import { Destination , DestinationFetchOptions } from '@sap-cloud-sdk/connectivity' ; import { HttpResponse } from '@sap-cloud-sdk/http-client' ; import { EntityBase } from '../entity-base' ; import { ODataCountRequestConfig } from '../request' ; import { DeSerializers } from '../de-serializers' ; import { MethodRequestBuilder } from './request-builder-base' ; import type { GetAllRequestBuilderBase } from './get-all-request-builder-base' ; typeparam internal export class CountRequestBuilder < EntityT extends EntityBase , DeSerializersT extends DeSerializers > extends MethodRequestBuilder < ODataCountRequestConfig < EntityT , DeSerializersT > > { param getAllRequest constructor ( readonly getAllRequest ) { super ( new ODataCountRequestConfig ( getAllRequest ) ) ; } param destination returns async execute ( destination ) { return this . executeRaw ( destination ) . then ( response => { if ( typeof response . data !== 'number' ) { throw new Error ( 'Count request did not return a bare number.' ) ; } return response . data ; } ) ; } param destination returns async executeRaw ( destination ) { return this . build ( destination ) . then ( request => request . execute ( ) ) ; } }