import { HttpErrorResponse, HttpEvent, HttpHeaders, HttpParameterCodec, HttpRequest, HttpResponse } from '@angular/common/http'; import { DataMapper, HeadersData, HttpDataMapper } from '@softeq/data-mappers'; import { DataQuerySort } from './data-source'; export declare const HTTP_STATUS_NO_CONTENT = 204; export declare const HTTP_STATUS_ERROR_START = 400; export declare const HTTP_STATUS_ERROR_END = 600; export declare const HTTP_STATUS_CLIENT_ERROR_START = 400; export declare const HTTP_STATUS_CLIENT_ERROR_END = 500; export declare const HTTP_STATUS_SERVER_ERROR_START = 500; export declare const HTTP_STATUS_SERVER_ERROR_END = 600; export declare const HTTP_STATUS_BAD_REQUEST = 400; export declare const HTTP_STATUS_NOT_AUTHORIZED = 401; export declare const HTTP_STATUS_NOT_FOUND_ERROR = 404; export declare const HTTP_STATUS_PRECONDITION_FAILED_ERROR = 422; export declare const HTTP_STATUS_SERVER_UNAVAILABLE_ERROR = 503; export declare enum RequestMethod { Get = "GET", Post = "POST", Put = "PUT", Patch = "PATCH", Delete = "DELETE", Options = "OPTIONS", Head = "HEAD" } export declare function isResponseHttpEvent(event: HttpEvent | HttpResponse | HttpErrorResponse): event is HttpResponse; export declare function isErrorStatus(status: number): boolean; export declare function isClientErrorStatus(status: number): boolean; export declare function isServerErrorStatus(status: number): boolean; /** * Custom parameter encoder is necessary because Angular's default strategy is to allow '+' * and some other characters as parameter value. But '+' is treat as ' ' (space) character. * * Related issues: * https://github.com/angular/angular/issues/11058 * https://github.com/mean-expert-official/loopback-sdk-builder/issues/573 * https://github.com/angular/angular/issues/18261 */ export declare class NativeHttpParameterCodec implements HttpParameterCodec { encodeKey(k: string): string; encodeValue(v: string): string; decodeKey(k: string): string; decodeValue(v: string): string; } export declare class NativeHeadersData implements HeadersData { headers: HttpHeaders; constructor(headers: HttpHeaders); get(name: string): string | null; set(name: string, value: string | string[]): void; keys(): string[]; } /** * Creates {@link Request} object for the given set of parameters. * Body is serialized using provided request mapper: * * * for GET request body is merged into url using querystring library * * for request methods body is always passed via body of HTTP request. * * @param method target HTTP method * @param url relative endpoint URL * @param body request entity * @param requestMapper mapper for mapping request entity into body * @param responseMapper mapper for mapping response entity into body * @returns request object */ export declare function createGenericRequest(method: RequestMethod, url: string, body?: S, requestMapper?: HttpDataMapper, responseMapper?: HttpDataMapper): HttpRequest; export declare function mergeRequestWithMapper(request: HttpRequest, body?: S, requestMapper?: HttpDataMapper, responseMapper?: HttpDataMapper): HttpRequest; export declare function parseResponseWithMapper(response: HttpResponse, responseMapper?: HttpDataMapper): T; export declare function mergeUrl(...segments: string[]): string; export declare function serializeSortBy(sort: DataQuerySort | DataQuerySort[]): string; export declare function mergeSortByParameter(url: string, sort?: DataQuerySort | DataQuerySort[]): string; /** * The same method as {@link #wrapIntoHttpDataMapper}, but for response mapper * @param mapper */ export declare function wrapIntoHttpDataMapper(mapper: DataMapper): HttpDataMapper;