UNPKG

3.81 kBTypeScriptView Raw
1import { Destination } from '../../connectivity';
2import { HttpResponse } from '../../http-client';
3import { ODataRequestConfig } from './odata-request-config';
4/**
5 * OData request configuration for an entity type.
6 * @typeparam EntityT - Type of the entity to setup a request for
7 */
8export declare class ODataRequest<RequestConfigT extends ODataRequestConfig> {
9 config: RequestConfigT;
10 private _destination?;
11 /**
12 * Creates an instance of ODataRequest.
13 * @param config - Configuration of the request.
14 * @param _destination - Destination to setup the request against.
15 */
16 constructor(config: RequestConfigT, _destination?: Destination | undefined);
17 set destination(dest: Destination | undefined);
18 get destination(): Destination | undefined;
19 /**
20 * Constructs an absolute URL for the given request.
21 * @returns The absolute URL for the request.
22 */
23 url(): string;
24 /**
25 * Constructs a URL relative to the destination.
26 * @param includeServicePath - Whether or not to include the service path in the URL.
27 * @param includeQueryParameters - Whether or not to include the query parameters in the URL.
28 * @returns The relative URL for the request.
29 */
30 relativeUrl(includeServicePath?: boolean, includeQueryParameters?: boolean): string;
31 /**
32 * Specifies whether the destination needs a specific authentication or not.
33 * @returns A boolean value that specifies whether the destination needs authentication or not
34 */
35 needsAuthentication(): boolean;
36 /**
37 * Returns the service URL for a given OData request.
38 * @returns The URL of the service the given entity belongs to
39 */
40 serviceUrl(): string;
41 /**
42 * Returns the service URL relative to the url of the destination for a given OData request.
43 * @returns The relative URL of the service the given entity belongs to.
44 */
45 relativeServiceUrl(): string;
46 /**
47 * Returns the URL to a specific OData .resource, i.e. the entity collection.
48 * @returns The URL of the resource
49 */
50 resourceUrl(): string;
51 /**
52 * Returns the relative URL to a specific OData resource.
53 * @param includeServicePath - Whether or not to include the service path in the URL.
54 * @returns The relative URL of the resource.
55 */
56 relativeResourceUrl(includeServicePath?: boolean): string;
57 /**
58 * Get query parameters as string. Leads with `?` if there are parameters to return.
59 * @returns Query parameter string
60 */
61 query(): string;
62 /**
63 * Create object containing all headers, including custom headers for the given request.
64 * @returns Key-value pairs where the key is the name of a header property and the value is the respective value
65 */
66 headers(): Promise<Record<string, any>>;
67 /**
68 * Get all custom headers.
69 * @returns Key-value pairs where the key is the name of a header property and the value is the respective value
70 */
71 customHeaders(): Record<string, any>;
72 /**
73 * Get all default headers. If custom headers are set, those take precedence.
74 * @returns Key-value pairs where the key is the name of a header property and the value is the respective value
75 */
76 defaultHeaders(): Record<string, any>;
77 /**
78 * Get the eTag related headers, e. g. `if-match`.
79 * @returns Key-value pairs where the key is the name of a header property and the value is the respective value
80 */
81 eTagHeaders(): Record<string, any>;
82 /**
83 * Execute the given request and return the according promise.
84 * @returns Promise resolving to the requested data
85 */
86 execute(): Promise<HttpResponse>;
87 private getAdditionalHeadersForKeys;
88 private queryParameters;
89}
90//# sourceMappingURL=odata-request.d.ts.map
\No newline at end of file