UNPKG

2.32 kBTypeScriptView Raw
1import { Destination, DestinationNameAndJwt, DestinationOptions } from '../../connectivity/scp-cf';
2import { Constructable, Entity } from '../entity';
3import { ODataGetByKeyRequestConfig } from '../request';
4import { ODataUri } from '../uri-conversion';
5import { FieldType, Selectable } from '../selectable';
6import { EntityDeserializer } from '../entity-deserializer';
7import { ResponseDataAccessor } from '../response-data-accessor';
8import { GetRequestBuilder } from './get-request-builder-base';
9/**
10 * Abstract class to create a get by key request containing the shared functionality for OData v2 and v4.
11 * @typeparam EntityT - Type of the entity to be requested
12 */
13export declare abstract class GetByKeyRequestBuilder<EntityT extends Entity> extends GetRequestBuilder<EntityT, ODataGetByKeyRequestConfig<EntityT>> {
14 readonly entityDeserializer: EntityDeserializer;
15 readonly dataAccessor: ResponseDataAccessor;
16 /**
17 * Creates an instance of GetByKeyRequestBuilder.
18 * @param entityConstructor - Constructor of the entity to create the request for
19 * @param keys - Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value
20 * @param oDataUri - Uri conversion methods
21 * @param entityDeserializer - Entity deserializer
22 */
23 constructor(entityConstructor: Constructable<EntityT>, keys: Record<string, FieldType>, oDataUri: ODataUri, entityDeserializer: EntityDeserializer, dataAccessor: ResponseDataAccessor);
24 /**
25 * Restrict the response to the given selection of properties in the request.
26 * @param selects - Fields to select in the request
27 * @returns The request builder itself, to facilitate method chaining
28 */
29 select(...selects: Selectable<EntityT>[]): this;
30 select(selects: Selectable<EntityT>[]): this;
31 /**
32 * Execute request.
33 * @param destination - Destination to execute the request against
34 * @param options - Options to employ when fetching destinations
35 * @returns A promise resolving to the requested entity
36 */
37 execute(destination: Destination | DestinationNameAndJwt, options?: DestinationOptions): Promise<EntityT>;
38}
39export { GetByKeyRequestBuilder as GetByKeyRequestBuilderBase };
40//# sourceMappingURL=get-by-key-request-builder.d.ts.map
\No newline at end of file