@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
90 lines • 3.81 kB
TypeScript
import { Destination } from '../../connectivity';
import { HttpResponse } from '../../http-client';
import { ODataRequestConfig } from './odata-request-config';
/**
* OData request configuration for an entity type.
* @typeparam EntityT - Type of the entity to setup a request for
*/
export declare class ODataRequest<RequestConfigT extends ODataRequestConfig> {
config: RequestConfigT;
private _destination?;
/**
* Creates an instance of ODataRequest.
* @param config - Configuration of the request.
* @param _destination - Destination to setup the request against.
*/
constructor(config: RequestConfigT, _destination?: Destination | undefined);
set destination(dest: Destination | undefined);
get destination(): Destination | undefined;
/**
* Constructs an absolute URL for the given request.
* @returns The absolute URL for the request.
*/
url(): string;
/**
* Constructs a URL relative to the destination.
* @param includeServicePath - Whether or not to include the service path in the URL.
* @param includeQueryParameters - Whether or not to include the query parameters in the URL.
* @returns The relative URL for the request.
*/
relativeUrl(includeServicePath?: boolean, includeQueryParameters?: boolean): string;
/**
* Specifies whether the destination needs a specific authentication or not.
* @returns A boolean value that specifies whether the destination needs authentication or not
*/
needsAuthentication(): boolean;
/**
* Returns the service URL for a given OData request.
* @returns The URL of the service the given entity belongs to
*/
serviceUrl(): string;
/**
* Returns the service URL relative to the url of the destination for a given OData request.
* @returns The relative URL of the service the given entity belongs to.
*/
relativeServiceUrl(): string;
/**
* Returns the URL to a specific OData .resource, i.e. the entity collection.
* @returns The URL of the resource
*/
resourceUrl(): string;
/**
* Returns the relative URL to a specific OData resource.
* @param includeServicePath - Whether or not to include the service path in the URL.
* @returns The relative URL of the resource.
*/
relativeResourceUrl(includeServicePath?: boolean): string;
/**
* Get query parameters as string. Leads with `?` if there are parameters to return.
* @returns Query parameter string
*/
query(): string;
/**
* Create object containing all headers, including custom headers for the given request.
* @returns Key-value pairs where the key is the name of a header property and the value is the respective value
*/
headers(): Promise<Record<string, any>>;
/**
* Get all custom headers.
* @returns Key-value pairs where the key is the name of a header property and the value is the respective value
*/
customHeaders(): Record<string, any>;
/**
* Get all default headers. If custom headers are set, those take precedence.
* @returns Key-value pairs where the key is the name of a header property and the value is the respective value
*/
defaultHeaders(): Record<string, any>;
/**
* Get the eTag related headers, e. g. `if-match`.
* @returns Key-value pairs where the key is the name of a header property and the value is the respective value
*/
eTagHeaders(): Record<string, any>;
/**
* Execute the given request and return the according promise.
* @returns Promise resolving to the requested data
*/
execute(): Promise<HttpResponse>;
private getAdditionalHeadersForKeys;
private queryParameters;
}
//# sourceMappingURL=odata-request.d.ts.map