@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
53 lines (52 loc) • 2.86 kB
TypeScript
import { ODataGetByKeyRequestConfig } from '../request';
import { GetRequestBuilderBase } from './get-request-builder-base';
import type { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
import type { EntityBase } from '../entity-base';
import type { EntityDeserializer } from '../entity-deserializer';
import type { ResponseDataAccessor } from '../response-data-accessor';
import type { Selectable } from '../selectable';
import type { ODataUri } from '../uri-conversion';
import type { DeSerializers } from '../de-serializers';
import type { EntityApi } from '../entity-api';
import type { BatchReference, WithBatchReference } from '../request';
/**
* Abstract class to create a get by key request containing the shared functionality for OData v2 and v4.
* @typeParam EntityT - Type of the entity to be requested
*/
export declare abstract class GetByKeyRequestBuilderBase<EntityT extends EntityBase, DeSerializersT extends DeSerializers> extends GetRequestBuilderBase<EntityT, DeSerializersT, ODataGetByKeyRequestConfig<EntityT, DeSerializersT>> implements WithBatchReference {
readonly entityDeserializer: EntityDeserializer;
readonly dataAccessor: ResponseDataAccessor;
private _batchReference;
/**
* Creates an instance of GetByKeyRequestBuilder.
* @param entityApi - Entity API for building and executing the request.
* @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.
* @param oDataUri - URI conversion functions.
* @param entityDeserializer - Entity deserializer.
* @param dataAccessor - Object access functions for get requests.
*/
constructor(entityApi: EntityApi<EntityT, DeSerializersT>, keys: Record<string, any>, oDataUri: ODataUri<DeSerializersT>, entityDeserializer: EntityDeserializer, dataAccessor: ResponseDataAccessor);
/**
* Gets identifier for the batch request.
* @returns Batch request identifier.
*/
getBatchReference(): BatchReference;
/**
* Sets user-defined identifier for the batch reference.
* @param id - User-defined batch request identifier.
*/
setBatchId(id: string): void;
/**
* Restrict the response to the given selection of properties in the request.
* @param selects - Fields to select in the request.
* @returns The request builder itself, to facilitate method chaining.
*/
select(...selects: Selectable<EntityT, DeSerializersT>[]): this;
select(selects: Selectable<EntityT, DeSerializersT>[]): this;
/**
* Execute request.
* @param destination - Destination or DestinationFetchOptions to execute the request against.
* @returns A promise resolving to the requested entity.
*/
execute(destination: HttpDestinationOrFetchOptions): Promise<EntityT>;
}