Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpdateRequestBuilder<EntityT>

Create OData query to update an entity.

Type parameters

  • EntityT: Entity

    Type of the entity to be updated

Hierarchy

Implements

  • EntityIdentifiable<EntityT>

Index

Constructors

constructor

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

    Parameters

    • entityConstructor: Constructable<EntityT>

      Constructor type of the entity to be updated

    • entity: EntityT

      Entity to be updated

    Returns UpdateRequestBuilder

Properties

entityConstructor

entityConstructor: Constructable<EntityT>

Constructor type of the entity to be updated

requestConfig

requestConfig: ODataUpdateRequestConfig<EntityT>

Request configuration to initialize with

Methods

build

execute

  • Executes the query.

    Parameters

    Returns Promise<EntityT>

    A promise resolving to the entity once it was updated

ignoreVersionIdentifier

  • ignoreVersionIdentifier(): this
  • Instructs the request to force an overwrite of the entity by sending an 'If-Match: *' header instead of sending the ETag version identifier.

    Returns this

    this The request itself to ease chaining while executing the request

ignoredFields

  • ignoredFields(...fields: Array<Selectable<EntityT>>): this
  • Specifies entity fields to ignore by the update request.

    Parameters

    • Rest ...fields: Array<Selectable<EntityT>>

      Enumeration of the fields to be ignored

    Returns this

    The entity itself, to facilitate method chaining

prepare

  • prepare(): this
  • Builds the payload and the entity keys 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

replaceWholeEntityWithPut

  • replaceWholeEntityWithPut(): this
  • Explicitly configure 'PUT' as the method of the update request. By default, only the properties that have changed compared to the last known remote state are sent using 'PATCH', while with 'PUT', the whole entity is sent.

    Returns this

    The entity itself, to facilitate method chaining

requiredFields

  • requiredFields(...fields: Array<Selectable<EntityT>>): this
  • Specifies required entity keys for the update request.

    Parameters

    • Rest ...fields: Array<Selectable<EntityT>>

      Enumeration of the fields to be required

    Returns this

    The entity itself, to facilitate method chaining

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

withCustomVersionIdentifier

  • withCustomVersionIdentifier(etag: string): this
  • Specifies a custom ETag version identifier of the entity to update.

    Parameters

    • etag: string

      Custom ETag version identifier to be sent in the header of the request

    Returns this

    this The request itself to ease chaining while executing the request