import { HttpResponseModel, ODataHttpClient, ODataHttpClientConfig, ODataHttpMethods } from "@odata2ts/http-client-api"; import { MainResponseConverter } from "@odata2ts/odata-query-objects"; import { MainRequestConverter, RequestConverter } from "./converter/RequestConverter"; import { ResponseConverter } from "./converter/ResponseConverter"; import { RequestInfo } from "./RequestInfo"; export interface RequestCmdOptions { /** * Set headers for the request. */ headers?: Record; /** * Sets the main request converter which converts from the user facing model * to the OData facing model. */ mainRequestConverter?: MainRequestConverter; /** * Sets the main response converter which converts from the OData facing model * to the user facing model. */ mainResponseConverter?: MainResponseConverter; } /** * Encapsulates an HTTP request to the OData server. Follows the Command Pattern. */ export declare abstract class RequestCmd { protected client: ClientType; protected method: ODataHttpMethods; protected data?: DataStructure | undefined; protected options: RequestCmdOptions; private readonly requestConverter; private readonly responseConverter; constructor(client: ClientType, method: ODataHttpMethods, data?: DataStructure | undefined, options?: RequestCmdOptions); /** * The unchanging URL of this command object. */ abstract getUrl(): string; /** * Get information about the request. * The data (if any) is presented with user facing typings. */ getInfo(): RequestInfo; /** * Get base information about the request. * All request converters get applied. * * With regard to data (if any), it gets converted from the user facing model * to the OData facing model, for which we don't have any typings, so we use any. * */ getInfoConverted(): RequestInfo; /** * Add a new request converter at the beginning of the converter chain. * This converter can then handle the user facing data structures. * * @param converter * @returns itself in builder fashion */ prependRequestConverter(converter: RequestConverter): this; /** * Add a new request converter at the end of the converter chain. * This converter can then handle the OData facing data structures. * Since we don't have any typings for this we use any. * * @param converter * @returns itself in builder fashion */ appendRequestConverter(converter: RequestConverter): this; /** * Add a response converter to the beginning of the converter chain. * This converter can then handle the data structures as they are returned from OData. * Since we don't have any typings for this we use any. * * @param converter * @returns itself in builder fashion */ prependResponseConverter(converter: ResponseConverter): this; /** * Add a response converter to the end of the converter chain. * This converter can then handle the data structures as they are returned for the user, * so with mapped property names and converted types. * * As the appended converter changes the final response structure, it is essential that * you follow the builder pattern to maintain the correct typings. * * @param converter * @returns itself in builder fashion */ appendResponseConverter(converter: ResponseConverter): RequestCmd; /** * Main method of this command object: Executes the request. * * @param requestConfig optional configuration */ execute(requestConfig?: ODataHttpClientConfig): Promise>; private convertResponse; }