import { identity } from '@sap-cloud-sdk/util' ; import { Destination , DestinationFetchOptions } from '@sap-cloud-sdk/connectivity' ; import { HttpResponse } from '@sap-cloud-sdk/http-client' ; import { EntityIdentifiable , EntityApi , UpdateRequestBuilderBase , entitySerializer } from '@sap-cloud-sdk/odata-common/internal' ; import { Entity } from '../entity' ; import { extractODataEtag } from '../extract-odata-etag' ; import { DeSerializers } from '../de-serializers' ; import { createODataUri } from '../uri-conversion' ; export class UpdateRequestBuilder < EntityT extends Entity , DeSerializersT extends DeSerializers > extends UpdateRequestBuilderBase < EntityT , DeSerializersT > implements EntityIdentifiable < EntityT , DeSerializersT > { param entityApi param _entity constructor ( entityApi , readonly _entity ) { super ( entityApi , _entity , createODataUri ( entityApi . deSerializers ) , entitySerializer ( entityApi . deSerializers ) , extractODataEtag , identity ) ; } param destination param options returns async execute ( destination ) { if ( this . isEmptyObject ( this . requestConfig . payload ) ) { return this . _entity ; } const request = await this . build ( destination ) ; return super . executeRequest ( request ) ; } param destination returns async executeRaw ( destination ) { if ( this . isEmptyObject ( this . requestConfig . payload ) ) { throw new Error ( 'Cannot execute an update request with empty payload.' ) ; } const request = await this . build ( destination ) ; return super . executeRequestRaw ( request ) ; } }