@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
57 lines • 3.18 kB
TypeScript
import { DestinationOptions, Destination, DestinationNameAndJwt } from '../../connectivity/scp-cf';
import { ODataCreateRequestConfig } from '../request';
import { HttpResponse } from '../../http-client';
import type { EntitySerializer } from '../entity-serializer';
import type { ODataUri } from '../uri-conversion/odata-uri';
import type { Constructable, Entity, EntityIdentifiable } from '../entity';
import type { EntityDeserializer } from '../entity-deserializer';
import type { ResponseDataAccessor } from '../response-data-accessor';
import type { Link } from '../selectable';
import { MethodRequestBuilder } from './request-builder-base';
/**
* Abstract create request class holding the parts shared in OData v2 and v4.
* @typeparam EntityT - Type of the entity to be created
*/
export declare abstract class CreateRequestBuilder<EntityT extends Entity> extends MethodRequestBuilder<ODataCreateRequestConfig<EntityT>> implements EntityIdentifiable<EntityT> {
readonly _entityConstructor: Constructable<EntityT>;
readonly _entity: EntityT;
readonly odataUri: ODataUri;
readonly serializer: EntitySerializer;
readonly deserializer: EntityDeserializer;
readonly responseDataAccessor: ResponseDataAccessor;
/**
* Creates an instance of CreateRequestBuilder.
* @param _entityConstructor - Constructor type of the entity to be created
* @param _entity - Entity to be created
*/
constructor(_entityConstructor: Constructable<EntityT>, _entity: EntityT, odataUri: ODataUri, serializer: EntitySerializer, deserializer: EntityDeserializer, responseDataAccessor: ResponseDataAccessor);
get entity(): EntityT;
/**
* @deprecated Since v1.29.0. This method should never be called, it has severe side effects. * Builds the payload of the query.
* @returns the builder itself
*/
prepare(): this;
/**
* Specifies the parent of the entity to create.
* @param parentEntity - Parent of the entity to create
* @param linkField - Static representation of the navigation property that navigates from the parent entity to the child entity
* @returns The entity itself, to facilitate method chaining
*/
asChildOf<ParentEntityT extends Entity>(parentEntity: ParentEntityT, linkField: Link<ParentEntityT, EntityT>): this;
/**
* Execute query.
* @param destination - Destination to execute the request against
* @param options - Options to employ when fetching destinations
* @returns A promise resolving to the created entity
*/
execute(destination: Destination | DestinationNameAndJwt, options?: DestinationOptions): Promise<EntityT>;
/**
* 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>;
}
export { CreateRequestBuilder as CreateRequestBuilderBase };
//# sourceMappingURL=create-request-builder-base.d.ts.map