UNPKG

3.18 kBTypeScriptView Raw
1import { DestinationOptions, Destination, DestinationNameAndJwt } from '../../connectivity/scp-cf';
2import { ODataCreateRequestConfig } from '../request';
3import { HttpResponse } from '../../http-client';
4import type { EntitySerializer } from '../entity-serializer';
5import type { ODataUri } from '../uri-conversion/odata-uri';
6import type { Constructable, Entity, EntityIdentifiable } from '../entity';
7import type { EntityDeserializer } from '../entity-deserializer';
8import type { ResponseDataAccessor } from '../response-data-accessor';
9import type { Link } from '../selectable';
10import { MethodRequestBuilder } from './request-builder-base';
11/**
12 * Abstract create request class holding the parts shared in OData v2 and v4.
13 * @typeparam EntityT - Type of the entity to be created
14 */
15export declare abstract class CreateRequestBuilder<EntityT extends Entity> extends MethodRequestBuilder<ODataCreateRequestConfig<EntityT>> implements EntityIdentifiable<EntityT> {
16 readonly _entityConstructor: Constructable<EntityT>;
17 readonly _entity: EntityT;
18 readonly odataUri: ODataUri;
19 readonly serializer: EntitySerializer;
20 readonly deserializer: EntityDeserializer;
21 readonly responseDataAccessor: ResponseDataAccessor;
22 /**
23 * Creates an instance of CreateRequestBuilder.
24 * @param _entityConstructor - Constructor type of the entity to be created
25 * @param _entity - Entity to be created
26 */
27 constructor(_entityConstructor: Constructable<EntityT>, _entity: EntityT, odataUri: ODataUri, serializer: EntitySerializer, deserializer: EntityDeserializer, responseDataAccessor: ResponseDataAccessor);
28 get entity(): EntityT;
29 /**
30 * @deprecated Since v1.29.0. This method should never be called, it has severe side effects. * Builds the payload of the query.
31 * @returns the builder itself
32 */
33 prepare(): this;
34 /**
35 * Specifies the parent of the entity to create.
36 * @param parentEntity - Parent of the entity to create
37 * @param linkField - Static representation of the navigation property that navigates from the parent entity to the child entity
38 * @returns The entity itself, to facilitate method chaining
39 */
40 asChildOf<ParentEntityT extends Entity>(parentEntity: ParentEntityT, linkField: Link<ParentEntityT, EntityT>): this;
41 /**
42 * Execute query.
43 * @param destination - Destination to execute the request against
44 * @param options - Options to employ when fetching destinations
45 * @returns A promise resolving to the created entity
46 */
47 execute(destination: Destination | DestinationNameAndJwt, options?: DestinationOptions): Promise<EntityT>;
48 /**
49 * Execute request and return an [[HttpResponse]].
50 * @param destination - Destination to execute the request against
51 * @param options - Options to employ when fetching destinations
52 * @returns A promise resolving to an [[HttpResponse]].
53 */
54 executeRaw(destination: Destination | DestinationNameAndJwt, options?: DestinationOptions): Promise<HttpResponse>;
55}
56export { CreateRequestBuilder as CreateRequestBuilderBase };
57//# sourceMappingURL=create-request-builder-base.d.ts.map
\No newline at end of file