Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CreateRequestBuilder<EntityT>

Create OData request to create an entity.

Type parameters

  • EntityT: Entity

    Type of the entity to be created

Hierarchy

Implements

  • EntityIdentifiable<EntityT>

Index

Constructors

constructor

  • new CreateRequestBuilder(entityConstructor: Constructable<EntityT>, entity: EntityT): CreateRequestBuilder
  • Creates an instance of CreateRequestBuilder.

    Parameters

    • entityConstructor: Constructable<EntityT>

      Constructor type of the entity to be created

    • entity: EntityT

      Entity to be created

    Returns CreateRequestBuilder

Properties

entity

entity: EntityT

Entity to be created

entityConstructor

entityConstructor: Constructable<EntityT>

Constructor type of the entity to be created

requestConfig

requestConfig: ODataCreateRequestConfig<EntityT>

Request configuration to initialize with

Methods

asChildOf

  • asChildOf<ParentEntityT>(parentEntity: ParentEntityT, linkField: Link<ParentEntityT, EntityT>): this
  • Specifies the parent of the entity to create.

    Type parameters

    Parameters

    • parentEntity: ParentEntityT

      Parent of the entity to create

    • linkField: Link<ParentEntityT, EntityT>

      Static representation of the navigation property that navigates from the parent entity to the child entity

    Returns this

    The entity itself, to facilitate method chaining

build

execute

  • Execute query.

    Parameters

    Returns Promise<EntityT>

    A promise resolving to the created entity

prepare

  • prepare(): this
  • Builds the payload of the query.

    Returns this

    the builder itself

relativeUrl

  • relativeUrl(): string
  • Create the relative url based on configuration of the given builder.

    Returns string

    The relative url for the request

url

  • Create the url based on configuration of the given builder.

    Parameters

    Returns Promise<string>

    Promise resolving to the url for the request

withCustomHeaders

  • withCustomHeaders(headers: MapType<string>): this
  • Add custom headers to the request.

    Parameters

    • headers: MapType<string>

      Key-value pairs denoting additional custom headers

    Returns this

    The request builder itself, to facilitate method chaining

withCustomServicePath

  • withCustomServicePath(servicePath: string): this
  • Replace the default service path with the given custom path. In case of the S/4HANA apis the servicePath defaults to '/sap/opu/odata/sap/' and can be overwritten here.

    Parameters

    • servicePath: string

      Path to override the default with

    Returns this

    The request builder itself, to facilitate method chaining