import * as i0 from '@angular/core';
import { Injector, ModuleWithProviders } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpHeaders, HttpParams, HttpResponse, HttpClient } from '@angular/common/http';

/**
 * Using for model classes that it's not Resource but can hold Resources as property, for example is Embeddable entity.
 * A distinctive feature of such resources is that they do not have the <b>self</b> link while {@link Resource} has.
 * It's related with that Embeddable entity can't have an id property.
 *
 * Usage example:
 *
 * // Regular resource
 * class Product extends Resource {
 *   name: string;
 * }
 *
 * // EmbeddedResource that holds Product resource.
 * class CartItem extends EmbeddedResource {
 *   product: Product;
 * }
 */
declare class EmbeddedResource extends BaseResource {
}

/**
 * Resource link object.
 */
interface Link {
    /**
     * Link name.
     */
    [key: string]: LinkData;
}
interface LinkData {
    /**
     * Link url.
     */
    href: string;
    /**
     * {@code true} if <b>href</b> has template, {@code false} otherwise.
     */
    templated?: boolean;
}
/**
 * Interface that allows to identify that object is resource when it is has a links object.
 */
interface ResourceIdentifiable {
    /**
     * List of links related with the resource.
     */
    _links: Link;
}
/**
 * Http options that used by Angular HttpClient.
 */
interface HttpClientOptions {
    headers?: HttpHeaders | {
        [header: string]: string | string[];
    };
    observe?: 'body' | 'response';
    params?: HttpParams;
    reportProgress?: boolean;
    responseType?: 'json';
    withCredentials?: boolean;
}
/**
 * Extend {@link GetOption} with page param.
 */
interface PagedGetOption extends GetOption {
    pageParams?: PageParam;
}
/**
 * Contains options that can be applied to POST/PUT/PATCH/DELETE request.
 */
interface RequestOption {
    params?: RequestParam;
    headers?: HttpHeaders | {
        [header: string]: string | string[];
    };
    observe?: 'body' | 'response';
    reportProgress?: boolean;
    withCredentials?: boolean;
}
/**
 * Contains additional options that can be applied to the GET request.
 */
interface GetOption extends RequestOption {
    /**
     * Sorting options.
     */
    sort?: Sort;
    useCache?: boolean;
}
/**
 * Request params that will be applied to the result url as http request params.
 *
 * Should not contains params as: 'projection' and {@link PageParam} properties.
 * If want pass this params then use suitable properties from {@link GetOption} or {@link PagedGetOption},
 * otherwise exception will be thrown.
 */
interface RequestParam {
    [paramName: string]: Resource | string | number | boolean | Array<string> | Array<number>;
}
/**
 * Page content params.
 */
interface PageParam {
    /**
     * Number of page.
     */
    page?: number;
    /**
     * Page size.
     */
    size?: number;
}
/**
 * Page params with sort option.
 */
interface SortedPageParam {
    /**
     * Page content params.
     */
    pageParams?: PageParam;
    /**
     * Sorting options.
     */
    sort?: Sort;
}
type SortOrder = 'DESC' | 'ASC';
interface Sort {
    /**
     * Name of the property to sort.
     */
    [propertyToSort: string]: SortOrder;
}
/**
 * Page resource response from Spring application.
 */
interface PageData {
    page: {
        size: number;
        totalElements: number;
        totalPages: number;
        number: number;
    };
    _links?: {
        first: {
            href: string;
        };
        prev?: {
            href: string;
        };
        self: {
            href: string;
        };
        next?: {
            href: string;
        };
        last: {
            href: string;
        };
    };
}
declare enum Include {
    /**
     * Allows to include null values to request body
     */
    NULL_VALUES = "NULL_VALUES",
    /**
     * Not replace related resources with their self links, instead pass them as JSON objects.
     */
    REL_RESOURCES_AS_OBJECTS = "REL_RESOURCES_AS_OBJECTS"
}
/**
 * Include options that allow configure should include or not some specific values
 * (e.q. null values).
 */
interface ValuesOption {
    include: Include | Include[];
}
/**
 * Request body object.
 */
interface RequestBody<T> {
    /**
     * Any object that will be passed as request body.
     */
    body: T;
    /**
     * Use this param to influence on body values that you want include or not.
     */
    valuesOption?: ValuesOption;
}
/**
 * Supported http methods for custom query.
 */
declare enum HttpMethod {
    GET = "GET",
    POST = "POST",
    PUT = "PUT",
    PATCH = "PATCH"
}
type NonResourcePropertyType<T> = {
    [K in keyof T]: T[K] extends BaseResource ? never : K;
}[keyof T];
/**
 * Type that allowed represent resource relations as resource projection excluding {@link Resource},
 * {@link EmbeddedResource} props and methods from current type.
 */
type ProjectionRelType<T extends BaseResource> = Pick<T, Exclude<keyof T, keyof Resource | keyof EmbeddedResource> & NonResourcePropertyType<T>>;
/**
 * Additional cache modes.
 */
declare enum CacheMode {
    /**
     * Default mode.
     * When cache enable, then all HTTP GET methods will use cache. Except methods where explicitly passed {useCache : false}.
     */
    ALWAYS = "ALWAYS",
    /**
     * This is opposite option for ALWAYS mode.
     * When cache enable, that mode will NOT use cache by default on all HTTP GET methods.
     * Except methods where explicitly passed {useCache : true}.
     */
    ON_DEMAND = "ON_DEMAND"
}

/**
 * Abstract impl identifies resource interface.
 */
declare abstract class AbstractResource {
    /**
     * List of links related with the resource.
     */
    protected _links: Link;
    /**
     * Get relation link by relation name.
     *
     * @param relationName used to get the specific resource relation link
     * @throws error if no link is found by passed relation name
     */
    getRelationLink(relationName: string): LinkData;
    /**
     * Checks if relation link is present.
     *
     * @param relationName used to check for the specified relation name
     * @returns true if link is present, false otherwise
     */
    hasRelation(relationName: string): boolean;
}

/**
 * Collection of resources without pagination.
 *
 * If you want to have a pagination {@see PagedResourceCollection}.
 */
declare class ResourceCollection<T extends BaseResource> extends AbstractResource {
    resources: Array<T>;
    /**
     * Resource collection constructor.
     * If passed param then it used as a copy constructor.
     *
     * @param that (optional) another resource collection using to copy data from to current object
     */
    constructor(that?: ResourceCollection<T>);
}

/**
 * Collection of resources with pagination.
 */
declare class PagedResourceCollection<T extends BaseResource> extends ResourceCollection<T> {
    private readonly selfLink;
    private readonly nextLink;
    private readonly prevLink;
    private readonly firstLink;
    private readonly lastLink;
    readonly totalElements: number;
    readonly totalPages: number;
    readonly pageNumber: number;
    readonly pageSize: number;
    /**
     * Create a new paged resource collection from resource collection with the page data.
     *
     * @param resourceCollection collection that will be paged
     * @param pageData contains data about characteristics of the page.
     */
    constructor(resourceCollection: ResourceCollection<T>, pageData?: PageData);
    hasFirst(): boolean;
    hasLast(): boolean;
    hasNext(): boolean;
    hasPrev(): boolean;
    first(options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    last(options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    next(options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    prev(options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    page(pageNumber: number, options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    size(size: number, options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    sortElements(sortParam: Sort, options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
    /**
     * Perform query with custom page data.
     * That allows you change page size, current page or sort options.
     *
     * @param params contains data about new characteristics of the page.
     * @param options (optional) additional options that will be applied to the request
     * @throws error when required params are not valid or when passed inconsistent data
     */
    customPage(params: SortedPageParam, options?: {
        useCache: true;
    }): Observable<PagedResourceCollection<T>>;
}

/**
 * Common resource class.
 */
declare abstract class BaseResource extends AbstractResource {
    /**
     * Get single resource by the relation name.
     *
     * @param relationName used to get the specific relation link
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid or link not found by relation name
     */
    getRelation<T extends BaseResource>(relationName: string, options?: GetOption): Observable<T>;
    /**
     * Get collection of resources by the relation name.
     *
     * @param relationName used to get the specific relation link
     * @param options (optional) options that will be applied to the request
     * @throws error when required params are not valid or link not found by relation name
     */
    getRelatedCollection<T extends ResourceCollection<BaseResource>>(relationName: string, options?: GetOption): Observable<T>;
    /**
     * Get paged collection of resources by the relation name.
     *
     * @param relationName used to get the specific relation link
     * @param options (optional) additional options that should be applied to the request
     *        if options didn't contains {@link PageParam} then will be used default page params.
     * @throws error when required params are not valid or link not found by relation name
     */
    getRelatedPage<T extends PagedResourceCollection<BaseResource>>(relationName: string, options?: PagedGetOption): Observable<T>;
    /**
     *  Perform POST request to the relation with the body and url params.
     *
     * @param relationName used to get the specific relation link
     * @param requestBody that contains the body directly and optional body values option {@link ValuesOption}
     * @param options (optional) request options that will be applied to the request
     * @throws error when required params are not valid or link not found by relation name
     */
    postRelation(relationName: string, requestBody: RequestBody<any>, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * Perform PATCH request to relation with body and url params.
     *
     * @param relationName used to get the specific relation link
     * @param requestBody contains the body directly and body values option {@link ValuesOption}
     *        to clarify what specific values need to be included or not included in result request body
     * @param options (optional) request options that will be applied to the request
     * @throws error when required params are not valid or link not found by relation name
     */
    patchRelation(relationName: string, requestBody: RequestBody<any>, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * Perform PUT request to relation with body and url params.
     *
     * @param relationName used to get the specific relation link
     * @param requestBody contains the body directly and body values option {@link ValuesOption}
     *        to clarify what specific values need to be included or not included in result request body
     * @param options (optional) request options that will be applied to the request
     * @throws error when required params are not valid or link not found by relation name
     */
    putRelation(relationName: string, requestBody: RequestBody<any>, options?: RequestOption): Observable<HttpResponse<any> | any>;
}

/**
 * Resource class.
 * Should be extended by client model classes that represent entity objects.
 *
 * If you have an embedded entity then consider to use the {@link EmbeddedResource} class.
 */
declare class Resource extends BaseResource {
    /**
     * Resource should has self link.
     */
    protected _links: {
        self: LinkData;
        [key: string]: LinkData;
    };
    /**
     * Adding passed entities to the resource collection behind the relation name.
     * Used POST method with 'Content-Type': 'text/uri-list'.
     *
     * This method DOES NOT REPLACE existing resources in the collection instead it adds new ones.
     * To replace collection resource with passed entities use {@link bindRelation} method.
     *
     * @param relationName used to get the specific resource relation link to the resource collection
     * @param entities one or more entities that should be added to the resource collection
     * @throws error when required params are not valid or link not found by relation name
     */
    addCollectionRelation<T extends Resource>(relationName: string, entities: Array<T>): Observable<HttpResponse<any>>;
    /**
     * Bounding the passed entity or collection of entities to this resource by the relation name.
     * Used PUT method with 'Content-Type': 'text/uri-list'.
     *
     * This method also REPLACED existing resources in the collection by passed entities.
     * To add entities to collection resource use {@link addCollectionRelation} method.
     *
     * @param relationName with which will be associated passed entity to this resource
     * @param entities one or more entities that should be bind to this resource
     * @throws error when required params are not valid or link not found by relation name
     */
    bindRelation<T extends Resource>(relationName: string, entities: T | Array<T>): Observable<HttpResponse<any>>;
    /**
     * Unbinding single resource relation behind resource name.
     * Used DELETE method to relation resource link URL.
     *
     * This method DOES NOT WORK WITH COLLECTION RESOURCE relations.
     * To clear collection resource relation use {@link unbindCollectionRelation} method.
     * To delete one resource from resource collection use {@link deleteRelation} method.
     *
     * @param relationName resource relation name to unbind
     */
    unbindRelation<T extends Resource>(relationName: string): Observable<HttpResponse<any>>;
    /**
     * Unbind all resources from collection by the relation name.
     * Used PUT method with 'Content-Type': 'text/uri-list' and EMPTY body to clear relations.
     *
     * To delete one resource from collection use {@link deleteRelation} method.
     * To delete single resource relations use {@link unbindRelation} or {@link deleteRelation} methods.
     *
     * @param relationName used to get relation link to unbind
     * @throws error when required params are not valid or link not found by relation name
     */
    unbindCollectionRelation<T extends Resource>(relationName: string): Observable<HttpResponse<any>>;
    /**
     * Deleting resource relation.
     * For collection, means that only passed entity will be unbound from the collection.
     * For single resource, deleting relation the same as @{link unbindRelation} method.
     *
     * To delete all resource relations from collection use {@link unbindCollectionRelation} method.
     *
     * @param relationName used to get relation link to unbind
     * @param entity that should be unbind from this relation
     * @throws error when required params are not valid or link not found by relation name
     */
    deleteRelation<T extends Resource>(relationName: string, entity: T): Observable<HttpResponse<any>>;
    getSelfLinkHref(): string;
}

/**
 * Describe all client configuration params.
 */

/**
 * Used to specify additional {@link Resource} options.
 */
interface ResourceOption {
    /**
     * Name of the route that configured in {@link HateoasConfiguration#http} as {@link MultipleResourceRoutes}.
     * Be default used route with name 'defaultRoute'.
     *
     * See more about this option in <a href="https://github.com/lagoshny/ngx-hateoas-client/blob/master/README.md#options">documentation</a>.
     */
    routeName?: string;
}
/**
 * Resource route config that defined where from retrieve resources.
 * If you use this config, then a default route created with name 'defaultRoute' will be assigned to all resources.
 */
interface ResourceRoute {
    /**
     * Root server url.
     *
     * For default Spring application it looks like: http://localhost:8080.
     */
    rootUrl: string;
    /**
     * Proxy url on which to send requests.
     * If passed then it uses to change rootUrl to proxyUrl when get relation link.
     *
     * For default Spring application it looks like: http://localhost:8080/api/v1.
     */
    proxyUrl?: string;
}
/**
 * Defines several resource routes.
 */
interface MultipleResourceRoutes {
    /**
     * Each resource route is declared as {@link ResourceRoute} object with root and proxy url if need it.
     * Specified route name  is used in {@link ResourceOption#routeName} to retrieve resource by this route.
     *
     * If you want to declare only one route, you need to use default route name as 'defaultRoute' or use simple {@link ResourceRoute} config.
     */
    [routeName: string]: ResourceRoute;
}
interface HateoasConfiguration {
    /**
     * Http options.
     * {@link ResourceRoute} declare common resource route that created with default name 'defaultRoute'.
     * {@link MultipleResourceRoutes} declare several resource routes,
     * to define default route in this case, use default route name 'defaultRoute'.
     */
    http: ResourceRoute | MultipleResourceRoutes;
    /**
     * Logging option.
     */
    logs?: {
        /**
         * Should print verbose logs to the console.
         */
        verboseLogs?: boolean;
    };
    /**
     * Cache options.
     */
    cache?: {
        /**
         * When {@code true} then cache will be used, {@code false} otherwise.
         */
        enabled: boolean;
        /**
         * Allows to adjust cache more granular using {@link CacheMode} modes.
         */
        mode?: CacheMode;
        /**
         * Time in milliseconds after which cache need to be expired.
         */
        lifeTime?: number;
    };
    /**
     * Declared resource/embedded resource types that will be used to create resources from server response that contains resources.
     */
    useTypes?: {
        resources: Array<new (...args: any[]) => Resource>;
        embeddedResources?: Array<new (...args: any[]) => EmbeddedResource>;
    };
    /**
     * {@code true} when running in production environment, {@code false} otherwise.
     */
    isProduction?: boolean;
    /**
     * Specifying format for some type values.
     */
    typesFormat?: {
        /**
         * This date format will be used when parse {@link Resource} properties.
         * If the property will be match to some one of specified formats, then the property type will be as Date object.
         * Otherwise, raw type will be used as default.
         */
        date?: {
            /**
             * Date pattern.
             * The {@link https://date-fns.org} lib is used to parse date with patterns, use patterns supported by this lib.
             * See more about supported formats <a href='https://date-fns.org/v2.28.0/docs/parse'>here</a>.
             */
            patterns: Array<string>;
        };
    };
    /**
     * Let to change default page params that is size = 20, page = 0.
     */
    pagination?: {
        defaultPage: {
            size: number;
            page?: number;
        };
    };
    /**
     * Additional configuration to specify settings for HAL format.
     */
    halFormat?: {
        json?: {
            /**
             * {@code true} when empty object {} should be converted to {@code null} value
             * {@code false} when empty object {} should be used as is
             */
            convertEmptyObjectToNull: boolean;
        };
        collections?: {
            /**
             * If {@code true}, then for empty collections, not required to specify _embedded property.
             * When {@code false} (be default), you need to specify empty _embedded property for empty collections.
             *
             * By default, Spring Data REST includes empty _embedded property for empty collections,
             * but when using Spring HATEOAS you need to do it manually.
             *
             * Recommending use Spring Data REST approach and return empty _embedded property for empty collection
             * for more predictable determine resource type algorithm.
             */
            embeddedOptional: boolean;
        };
    };
}

/**
 * This service for configuration library.
 *
 * You should inject this service in your main AppModule and pass
 * configuration using {@link #configure()} method.
 */
declare class NgxHateoasClientConfigurationService {
    private injector;
    constructor(injector: Injector);
    private static isCommonRouteConfig;
    /**
     * Configure library with client params.
     *
     * @param config suitable client properties needed to properly library work
     */
    configure(config: HateoasConfiguration): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<NgxHateoasClientConfigurationService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<NgxHateoasClientConfigurationService>;
}

/**
 * Main resource operation class.
 * Extend this class to create resource service.
 */
declare class HateoasResourceOperation<T extends Resource> {
    private readonly resourceType;
    private hateoasResourceService;
    constructor(resourceType: new () => T);
    /**
     * {@link HateoasResourceService#getResource}.
     */
    getResource(id: number | string, options?: GetOption): Observable<T>;
    /**
     * {@link HateoasResourceService#getCollection}.
     */
    getCollection(options?: GetOption): Observable<ResourceCollection<T>>;
    /**
     * {@link HateoasResourceService#getPage}.
     */
    getPage(options?: PagedGetOption): Observable<PagedResourceCollection<T>>;
    /**
     * {@link HateoasResourceService#createResource}.
     */
    createResource(requestBody: RequestBody<T>, options?: RequestOption): Observable<any>;
    /**
     * {@link HateoasResourceService#updateResource}.
     */
    updateResource(entity: T, requestBody?: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * {@link HateoasResourceService#updateResourceById}.
     */
    updateResourceById(id: number | string, requestBody: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * {@link HateoasResourceService#patchResource}.
     */
    patchResource(entity: T, requestBody?: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * {@link HateoasResourceService#patchResourceById}.
     */
    patchResourceById(id: number | string, requestBody: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * {@link HateoasResourceService#deleteResource}.
     */
    deleteResource(entity: T, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * {@link HateoasResourceService#deleteResourceById}.
     */
    deleteResourceById(id: number | string, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * {@see ResourceCollectionHttpService#search}
     */
    searchCollection(query: string, options?: GetOption): Observable<ResourceCollection<T>>;
    /**
     * {@see PagedResourceCollection#search}
     */
    searchPage(query: string, options?: PagedGetOption): Observable<PagedResourceCollection<T>>;
    /**
     * {@see ResourceHttpService#search}
     */
    searchResource(query: string, options?: GetOption): Observable<T>;
    /**
     * {@see ResourceHttpService#customQuery}
     */
    customQuery<R>(method: HttpMethod, query: string, requestBody?: RequestBody<any>, options?: PagedGetOption): Observable<R>;
    /**
     * {@see ResourceHttpService#customSearchQuery}
     */
    customSearchQuery<R>(method: HttpMethod, searchQuery: string, requestBody?: RequestBody<any>, options?: PagedGetOption): Observable<R>;
}

/**
 * Contains all needed information about a resource.
 * It generates a string cache key to hold in a cache map from information about a resource.
 */
declare class CacheKey {
    readonly url: string;
    private readonly options;
    /**
     * String cache key value.
     */
    value: string;
    private constructor();
    /**
     * Create cache key from resource url and request params.
     *
     * @param url resource url
     * @param params request params
     */
    static of(url: string, params: {
        observe?: 'body' | 'response';
        params?: HttpParams;
    }): CacheKey;
}

declare class ResourceCacheService {
    private cacheMap;
    /**
     * Get cached resource value.
     *
     * @param key cache key
     * @return cached value or {@code null} when cached value is not exist or expired
     */
    getResource(key: CacheKey): ResourceIdentifiable;
    /**
     * Add resource value to the cache.
     * Before add new value, previous will be deleted if it was exist.
     *
     * @param key cache key
     * @param value cache value
     */
    putResource(key: CacheKey, value: ResourceIdentifiable): void;
    /**
     * Delete cached resource value by passed key.
     *
     * @param key cache key
     */
    evictResource(key: CacheKey): void;
    evictAll(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ResourceCacheService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ResourceCacheService>;
}

/**
 * Base class with common logics to perform HTTP requests.
 */
declare class HttpExecutor {
    protected httpClient: HttpClient;
    protected cacheService: ResourceCacheService;
    constructor(httpClient: HttpClient, cacheService: ResourceCacheService);
    private static logRequest;
    private static logResponse;
    /**
     * Perform GET request.
     *
     * @param url to perform request
     * @param options (optional) options that applied to the request
     * @param useCache value {@code true} if need to use cache, {@code false} otherwise
     * @throws error when required params are not valid
     */
    getHttp(url: string, options?: HttpClientOptions, useCache?: boolean): Observable<any>;
    /**
     * Perform POST request.
     *
     * @param url to perform request
     * @param body to send with request
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    postHttp(url: string, body: any | null, options?: HttpClientOptions): Observable<any>;
    /**
     * Perform PUT request.
     *
     * @param url to perform request
     * @param body to send with request
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    putHttp(url: string, body: any | null, options?: HttpClientOptions): Observable<any>;
    /**
     * Perform PATCH request.
     *
     * @param url to perform request
     * @param body to send with request
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    patchHttp(url: string, body: any | null, options?: HttpClientOptions): Observable<any>;
    /**
     * Perform DELETE request.
     *
     * @param url to perform request
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    deleteHttp(url: string, options?: HttpClientOptions): Observable<any>;
}

/**
 * Service to perform HTTP requests to get {@link Resource} type.
 */
declare class ResourceHttpService extends HttpExecutor {
    constructor(httpClient: HttpClient, cacheService: ResourceCacheService);
    /**
     * Perform GET request to retrieve resource.
     *
     * @param url to perform request
     * @param options request options
     * @throws error when required params are not valid or returned resource type is not resource
     */
    get<T extends BaseResource>(url: string, options?: GetOption): Observable<T>;
    /**
     * Perform POST request.
     *
     * @param url to perform request
     * @param body request body
     * @param options request options
     * @throws error when required params are not valid
     */
    post(url: string, body: any | null, options?: RequestOption): Observable<any>;
    /**
     * Perform PUT request.
     *
     * @param url to perform request
     * @param body request body
     * @param options request options
     * @throws error when required params are not valid
     */
    put(url: string, body: any | null, options?: RequestOption): Observable<any>;
    /**
     * Perform PATCH request.
     *
     * @param url to perform request
     * @param body request body
     * @param options request options
     * @throws error when required params are not valid
     */
    patch(url: string, body: any | null, options?: RequestOption): Observable<any>;
    /**
     * Perform DELETE request.
     *
     * @param url to perform request
     * @param options request options
     * @throws error when required params are not valid
     */
    delete(url: string, options?: RequestOption): Observable<any>;
    /**
     * Perform get resource request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param id resource id
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    getResource<T extends BaseResource>(resourceName: string, resourceOptions: ResourceOption, id: number | string, options?: GetOption): Observable<T>;
    /**
     * Perform POST resource request with url built by the resource name.
     *
     * @param resourceName to be post
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param body resource to create
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    postResource(resourceName: string, resourceOptions: ResourceOption, body: BaseResource, options?: RequestOption): Observable<any>;
    /**
     * Perform PATCH resource request with url built by the resource name and resource id.
     *
     * @param resourceName to be patched
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param id resource id
     * @param body contains data to patch resource properties
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    patchResource(resourceName: string, resourceOptions: ResourceOption, id: number | string, body: any, options?: RequestOption): Observable<any>;
    /**
     * Perform PUT resource request with url built by the resource name and resource id.
     *
     * @param resourceName to be put
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param id resource id
     * @param body contains data to replace resource properties
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    putResource(resourceName: string, resourceOptions: ResourceOption, id: number | string, body: any, options?: RequestOption): Observable<any>;
    /**
     * Perform DELETE resource request with url built by the resource name and resource id.
     *
     * @param resourceName to be deleted
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param id resource id
     * @param options (optional) additional options that will be applied to the request
     * @throws error when required params are not valid
     */
    deleteResource(resourceName: string, resourceOptions: ResourceOption, id: number | string, options?: RequestOption): Observable<any>;
    /**
     * Perform search single resource request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param searchQuery name of the search method
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    search<T extends BaseResource>(resourceName: string, resourceOptions: ResourceOption, searchQuery: string, options?: GetOption): Observable<T>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ResourceHttpService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ResourceHttpService>;
}

/**
 * Service to perform HTTP requests to get {@link PagedResourceCollection} type.
 */
declare class PagedResourceCollectionHttpService extends HttpExecutor {
    constructor(httpClient: HttpClient, cacheService: ResourceCacheService);
    /**
     * Perform GET request to retrieve paged collection of the resources.
     *
     * @param url to perform request
     * @param options request options
     * @throws error when required params are not valid or returned resource type is not paged collection of the resources
     */
    get<T extends PagedResourceCollection<BaseResource>>(url: string, options?: PagedGetOption): Observable<T>;
    /**
     * Perform get paged resource collection request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    getResourcePage<T extends PagedResourceCollection<BaseResource>>(resourceName: string, resourceOptions: ResourceOption, options?: PagedGetOption): Observable<T>;
    /**
     *  Perform search paged resource collection request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param searchQuery name of the search method
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    search<T extends PagedResourceCollection<BaseResource>>(resourceName: string, resourceOptions: ResourceOption, searchQuery: string, options?: PagedGetOption): Observable<T>;
    static ɵfac: i0.ɵɵFactoryDeclaration<PagedResourceCollectionHttpService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<PagedResourceCollectionHttpService>;
}

/**
 * Service to perform HTTP requests to get {@link ResourceCollection} type.
 */
declare class ResourceCollectionHttpService extends HttpExecutor {
    constructor(httpClient: HttpClient, cacheService: ResourceCacheService);
    /**
     * Perform GET request to retrieve collection of the resources.
     *
     * @param url to perform request
     * @param options request options
     * @throws error when required params are not valid or returned resource type is not collection of the resources
     */
    get<T extends ResourceCollection<BaseResource>>(url: string, options?: GetOption): Observable<T>;
    /**
     * Perform get resource collection request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    getResourceCollection<T extends ResourceCollection<BaseResource>>(resourceName: string, resourceOptions: ResourceOption, options?: GetOption): Observable<T>;
    /**
     *  Perform search resource collection request with url built by the resource name.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param searchQuery name of the search method
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    search<T extends ResourceCollection<BaseResource>>(resourceName: string, resourceOptions: ResourceOption, searchQuery: string, options?: GetOption): Observable<T>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ResourceCollectionHttpService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ResourceCollectionHttpService>;
}

/**
 * Service to perform HTTP requests to get any type of the {@link Resource}, {@link PagedResourceCollection}, {@link ResourceCollection}.
 */
declare class CommonResourceHttpService extends HttpExecutor {
    constructor(httpClient: HttpClient, cacheService: ResourceCacheService);
    /**
     * Perform custom HTTP request.
     *
     * Return type depends on result data it can be {@link Resource}, {@link ResourceCollection},
     * {@link PagedResourceCollection} or any data.
     *
     * @param resourceName used to build root url to the resource
     * @param resourceOptions additional resource options {@link ResourceOption}
     * @param method HTTP method that will be perform {@link HttpMethod}
     * @param query url path that applied to the result url at the end
     * @param body (optional) request body
     * @param options (optional) options that applied to the request
     * @throws error when required params are not valid
     */
    customQuery(resourceName: string, resourceOptions: ResourceOption, method: HttpMethod, query: string, body?: any, options?: PagedGetOption): Observable<any>;
    static ɵfac: i0.ɵɵFactoryDeclaration<CommonResourceHttpService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<CommonResourceHttpService>;
}

/**
 * Service to operate with {@link Resource}.
 *
 * Can be injected as standalone service to work with {@link Resource}.
 */
declare class HateoasResourceService {
    private commonHttpService;
    private resourceHttpService;
    private resourceCollectionHttpService;
    private pagedResourceCollectionHttpService;
    private cacheService;
    constructor(commonHttpService: CommonResourceHttpService, resourceHttpService: ResourceHttpService, resourceCollectionHttpService: ResourceCollectionHttpService, pagedResourceCollectionHttpService: PagedResourceCollectionHttpService, cacheService: ResourceCacheService);
    /**
     * Get resource by id.
     *
     * @param resourceType resource for which will perform request
     * @param id resource id
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid
     */
    getResource<T extends Resource>(resourceType: new () => T, id: number | string, options?: GetOption): Observable<T>;
    /**
     * Get collection of the resource by id.
     *
     * @param resourceType resource for which will perform request
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid
     */
    getCollection<T extends Resource>(resourceType: new () => T, options?: GetOption): Observable<ResourceCollection<T>>;
    /**
     * Get paged collection of the resource by id.
     *
     * @param resourceType resource for which will perform request
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid
     */
    getPage<T extends Resource>(resourceType: new () => T, options?: PagedGetOption): Observable<PagedResourceCollection<T>>;
    /**
     * Create resource.
     *
     * @param resourceType resource for which will perform request
     * @param requestBody that contains the body directly and optional body values option {@link ValuesOption}
     * @param options (optional) options that should be applied to the request {@link RequestOption}
     * @throws error when required params are not valid
     */
    createResource<T extends Resource>(resourceType: new () => T, requestBody: RequestBody<T>, options?: RequestOption): Observable<T | any>;
    /**
     * Updating all resource properties at the time to passed body properties. If some properties are not passed then will be used null value.
     * If you need update some part resource properties, use {@link HateoasResourceService#patchResource} method.
     *
     * @param entity to update
     * @param requestBody that contains the body directly and optional body values option {@link ValuesOption}
     * @param options (optional) options that should be applied to the request {@link RequestOption}
     * @throws error when required params are not valid
     */
    updateResource<T extends Resource>(entity: T, requestBody?: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * Update resource by id.
     * Updating all resource properties at the time to passed body properties. If some properties are not passed then will be used null value.
     * If you need update some part resource properties, use {@link HateoasResourceService#patchResource} method.
     *
     * @param resourceType resource for which will perform request
     * @param id resource id
     * @param requestBody that contains the body directly and optional body values option {@link ValuesOption}
     * @param options (optional) options that should be applied to the request {@link RequestOption}
     * @throws error when required params are not valid
     */
    updateResourceById<T extends Resource>(resourceType: new () => T, id: number | string, requestBody: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * Patch resource.
     * Allows fine-grained update resource properties, it means that only passed properties in body will be changed,
     * other properties stay as is.
     *
     * @param entity to patch
     * @param requestBody (optional) contains the body that will be patched resource and optional body values option {@link ValuesOption}
     *        if not passed then entity will be passed as body directly
     * @param options (optional) options that should be applied to the request {@link RequestOption}
     * @throws error when required params are not valid
     */
    patchResource<T extends Resource>(entity: T, requestBody?: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * Patch resource by id.
     * Allows fine-grained update resource properties, it means that only passed properties in body will be changed,
     * other properties stay as is.
     *
     * @param resourceType resource for which will perform request
     * @param id resource id
     * @param requestBody that contains the body directly and optional body values option {@link ValuesOption}
     * @param options (optional) options that should be applied to the request {@link RequestOption}
     * @throws error when required params are not valid
     */
    patchResourceById<T extends Resource>(resourceType: new () => T, id: number | string, requestBody: RequestBody<any>, options?: RequestOption): Observable<T | any>;
    /**
     * Delete resource.
     *
     * @param entity to delete
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid
     */
    deleteResource<T extends Resource>(entity: T, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * Delete resource by id.
     *
     * @param resourceType resource for which will perform request
     * @param id resource id
     * @param options (optional) options that should be applied to the request
     * @throws error when required params are not valid
     */
    deleteResourceById<T extends Resource>(resourceType: new () => T, id: number | string, options?: RequestOption): Observable<HttpResponse<any> | any>;
    /**
     * {@see ResourceCollectionHttpService#search}
     */
    searchCollection<T extends Resource>(resourceType: new () => T, searchQuery: string, options?: GetOption): Observable<ResourceCollection<T>>;
    /**
     * {@see PagedResourceCollection#search}
     */
    searchPage<T extends Resource>(resourceType: new () => T, searchQuery: string, options?: PagedGetOption): Observable<PagedResourceCollection<T>>;
    /**
     * {@see ResourceHttpService#search}
     */
    searchResource<T extends Resource>(resourceType: new () => T, searchQuery: string, options?: GetOption): Observable<T>;
    /**
     * {@see CommonResourceHttpService#customQuery}
     */
    customQuery<R>(resourceType: new () => Resource, method: HttpMethod, query: string, requestBody?: RequestBody<any>, options?: PagedGetOption): Observable<R>;
    /**
     * Differences between {@link HateoasResourceService#customQuery} and this method
     * that this one puts 'search' path to the result url automatically.
     *
     * {@see CommonResourceHttpService#customQuery}
     */
    customSearchQuery<R>(resourceType: new () => Resource, method: HttpMethod, searchQuery: string, requestBody?: RequestBody<any>, options?: PagedGetOption): Observable<R>;
    /**
     * Evict all resources cache.
     */
    evictResourcesCache(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<HateoasResourceService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<HateoasResourceService>;
}

/**
 * Decorator used to classes that extend {@link Resource} class to register 'resourceName' and 'resourceType'
 * information about this resource.
 *
 * @param resourceName resource name which will be used to build a resource URL.
 * @param options additional resource options. See more {@link ResourceOption}.
 */
declare function HateoasResource(resourceName: string, options?: ResourceOption): <T extends new (...args: any[]) => any>(constructor: T) => T;
/**
 * Decorator used to classes that extend {@link EmbeddedResource} class to register 'relationNames' and 'resourceType'
 * information about this resource.
 *
 * @param relationNames names of the properties that using to hold this embedded resource in resource objects.
 */
declare function HateoasEmbeddedResource(relationNames: Array<string>): <T extends new (...args: any[]) => any>(constructor: T) => void;
/**
 * Decorator used to create a projection representation of {@link Resource} heirs.
 *
 * @param resourceType type of resource that using for projection.
 * @param projectionName name of projection, will be used as projection request param.
 */
declare function HateoasProjection(resourceType: new () => Resource, projectionName: string): <T extends new (...args: any[]) => any>(constructor: T) => T;
/**
 * Decorator used to mark projection class properties that are resources and specifying class type used to create this relation.
 * This decorator used with class marked as {@link HateoasProjection}.
 *
 * @param relationType resource relation type that will be used to create resource with this type when parsed server response.
 */
declare function ProjectionRel(relationType: new () => BaseResource): (target: object, propertyKey: string) => void;

declare class NgxHateoasClientModule {
    static forRoot(): ModuleWithProviders<NgxHateoasClientModule>;
    constructor(config: NgxHateoasClientConfigurationService);
    static ɵfac: i0.ɵɵFactoryDeclaration<NgxHateoasClientModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<NgxHateoasClientModule, never, never, never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<NgxHateoasClientModule>;
}

export { CacheMode, EmbeddedResource, HateoasEmbeddedResource, HateoasProjection, HateoasResource, HateoasResourceOperation, HateoasResourceService, HttpMethod, Include, NgxHateoasClientConfigurationService, NgxHateoasClientModule, PagedResourceCollection, ProjectionRel, Resource, ResourceCollection };
export type { GetOption, PagedGetOption, ProjectionRelType, RequestOption, RequestParam, Sort, SortOrder };
