@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
65 lines (64 loc) • 3.62 kB
TypeScript
import { CountRequestBuilder } from './count-request-builder';
import { GetRequestBuilderBase } from './get-request-builder-base';
import type { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
import type { EntityBase } from '../entity-base';
import type { Selectable } from '../selectable';
import type { OrderableAndOrderableInput } from '../order';
import type { ODataGetAllRequestConfig } from '../request';
import type { EntityDeserializer } from '../entity-deserializer';
import type { ResponseDataAccessor } from '../response-data-accessor';
import type { DeSerializers } from '../de-serializers';
import type { EntityApi } from '../entity-api';
/**
* Base class for the get all request builders {@link @sap-cloud-sdk/odata-v2!GetAllRequestBuilder | GetAllRequestBuilderV2} and {@link @sap-cloud-sdk/odata-v4!GetAllRequestBuilder | GetAllRequestBuilderV4}.
* @typeParam EntityT - Type of the entity to be requested
*/
export declare abstract class GetAllRequestBuilderBase<EntityT extends EntityBase, DeSerializersT extends DeSerializers> extends GetRequestBuilderBase<EntityT, DeSerializersT, ODataGetAllRequestConfig<EntityT, DeSerializersT>> {
readonly entityDeserializer: EntityDeserializer;
readonly dataAccessor: ResponseDataAccessor;
/**
* Creates an instance of GetAllRequestBuilder.
* @param entityApi - Entity API for building and executing the request.
* @param getAllRequestConfig - Request config of the get all request.
* @param entityDeserializer - Entity deserializer.
* @param dataAccessor - Object access functions for get requests.
*/
constructor(entityApi: EntityApi<EntityT, DeSerializersT>, getAllRequestConfig: ODataGetAllRequestConfig<EntityT, DeSerializersT>, entityDeserializer: EntityDeserializer, dataAccessor: ResponseDataAccessor);
/**
* 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;
/**
* Add order-by statements to the request.
* @param orderBy - OrderBy statements to order the response by.
* @returns The request builder itself, to facilitate method chaining.
*/
orderBy(orderBy: OrderableAndOrderableInput<EntityT, DeSerializersT, EntityApi<EntityBase, DeSerializersT>>[]): this;
orderBy(...orderBy: OrderableAndOrderableInput<EntityT, DeSerializersT, EntityApi<EntityBase, DeSerializersT>>[]): this;
/**
* Limit number of returned entities.
* @param top - Maximum number of entities to return in the response. Can be less, if less entities match the request.
* @returns The request builder itself, to facilitate method chaining.
*/
top(top: number): this;
/**
* Skip number of entities.
* @param skip - Number of matching entities to skip. Useful for paging.
* @returns The request builder itself, to facilitate method chaining.
*/
skip(skip: number): this;
/**
* Count the number of entities.
* @returns A count request builder for execution.
*/
count(): CountRequestBuilder<EntityT, DeSerializersT>;
/**
* Execute request.
* @param destination - Destination or DestinationFetchOptions to execute the request against.
* @returns A promise resolving to the requested entities.
*/
execute(destination: HttpDestinationOrFetchOptions): Promise<EntityT[]>;
}