@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
36 lines • 2.52 kB
TypeScript
import { MethodRequestBuilder } from '../request-builder-base';
import { ODataBatchRequestConfig } from '../../request/odata-batch-request-config';
import { Constructable, Entity } from '../../entity';
import { Destination, DestinationNameAndJwt, DestinationOptions, DestinationRetrievalOptions } from '../../../connectivity/scp-cf';
import { ODataRequest } from '../../request/odata-request';
import { HttpResponse } from '../../../http-client';
import { BatchChangeSet } from './batch-change-set';
import { BatchSubRequestPathType } from './batch-request-options';
/**
* Create a batch request to invoke multiple requests as a batch. The batch request builder accepts retrieve requests, i. e. [[GetAllRequestBuilder | getAll]] and [[GetByKeyRequestBuilder | getByKey]] requests and change sets, which in turn can contain [[CreateRequestBuilder | create]], [[UpdateRequestBuilder | update]] or [[DeleteRequestBuilder | delete]] requests.
* The retrieve and change sets will be executed in order, while the order within a change set can vary.
*/
export declare class BatchRequestBuilder extends MethodRequestBuilder<ODataBatchRequestConfig> {
readonly defaultServicePath: string;
readonly requests: (BatchChangeSet | MethodRequestBuilder)[];
readonly entityToConstructorMap: Record<string, Constructable<Entity>>;
/**
* Creates an instance of ODataBatchRequestBuilder.
* @param defaultServicePath - Service path
* @param requests - An array of retrieve requests or change sets
* @param entityToConstructorMap - A map that holds the entity type to constructor mapping
*/
constructor(defaultServicePath: string, requests: (BatchChangeSet | MethodRequestBuilder)[], entityToConstructorMap: Record<string, Constructable<Entity>>);
withSubRequestPathType(subRequestPathType: BatchSubRequestPathType): this;
build(): ODataRequest<ODataBatchRequestConfig>;
build(destination: Destination | DestinationNameAndJwt, options?: DestinationRetrievalOptions): Promise<ODataRequest<ODataBatchRequestConfig>>;
/**
* Execute request and return an [[HttpResponse]].
* @param destination - Destination to execute the request against
* @param options - Options to employ when fetching destinations
* @returns A promise resolving to an [[HttpResponse]].
*/
executeRaw(destination: Destination | DestinationNameAndJwt, options?: DestinationOptions): Promise<HttpResponse>;
private setPayload;
}
//# sourceMappingURL=batch-request-builder.d.ts.map