Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GetByKeyRequestBuilder<EntityT>

Create OData request to get a single entity based on its key properties. A GetByKeyRequestBuilder allows to restrict the response to a selection of fields, where no selection is equal to selecting all fields.

Type parameters

  • EntityT: Entity

    Type of the entity to be requested

Hierarchy

Implements

  • EntityIdentifiable<EntityT>

Index

Constructors

constructor

  • Creates an instance of GetByKeyRequestBuilder.

    Parameters

    • entityConstructor: Constructable<EntityT>

      Constructor of the entity to create the request for

    • keys: MapType<FieldType>

      Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value

    Returns GetByKeyRequestBuilder

Properties

entityConstructor

entityConstructor: Constructable<EntityT>

Constructor of the entity to create the request for

Protected requestConfig

requestConfig: ODataGetByKeyRequestConfig<EntityT>

Request configuration to initialize with

Methods

build

execute

  • Execute request.

    Parameters

    Returns Promise<EntityT>

    A promise resolving to the requested entity

Protected extractEtagFromHeader

  • extractEtagFromHeader(response: AxiosResponse): string | undefined
  • Parameters

    • response: AxiosResponse

    Returns string | undefined

select

  • select(...selects: Array<Selectable<EntityT>>): this
  • Restrict the response to the given selection of properties in the request.

    Parameters

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

      Fields to select in the request

    Returns this

    The request builder 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