import { ErrorWithCause , variadicArgumentToArray } from '@sap-cloud-sdk/util' ; import { Destination , DestinationFetchOptions } from '@sap-cloud-sdk/connectivity' ; import { EntityApi , EntityBase } from '../entity-base' ; import { EntityDeserializer } from '../entity-deserializer' ; import { ResponseDataAccessor } from '../response-data-accessor' ; import { ODataGetByKeyRequestConfig } from '../request' ; import { Selectable } from '../selectable' ; import { ODataUri } from '../uri-conversion' ; import { DeSerializers } from '../de-serializers' ; import { GetRequestBuilderBase } from './get-request-builder-base' ; typeparam internal export abstract class GetByKeyRequestBuilderBase < EntityT extends EntityBase , DeSerializersT extends DeSerializers > extends GetRequestBuilderBase < EntityT , DeSerializersT , ODataGetByKeyRequestConfig < EntityT , DeSerializersT > > { param entityApi param keys param oDataUri param entityDeserializer param dataAccessor constructor ( entityApi , keys , oDataUri , readonly entityDeserializer , readonly dataAccessor ) { super ( entityApi , new ODataGetByKeyRequestConfig ( entityApi , oDataUri ) ) ; this . requestConfig . keys = keys ; } param selects returns select ( ... selects ) ; select ( selects ) ; select ( first , ... rest ) { this . requestConfig . selects = variadicArgumentToArray ( first , rest ) ; return this ; } param destination returns async execute ( destination ) { return this . executeRaw ( destination ) . then ( response => this . entityDeserializer . deserializeEntity ( this . dataAccessor . getSingleResult ( response . data ) , this . _entityApi , response . headers ) ) . catch ( error => { throw new ErrorWithCause ( 'OData get by key request failed!' , error ) ; } ) ; } }