import { changeset as otherServiceChangeset , multipleSchemasService } from '@sap-cloud-sdk/test-services/v2/multiple-schemas-service' ; import { batch , changeset as testEntityChangeset , testService } from '@sap-cloud-sdk/test-services/v2/test-service' ; import { ReadResponse } from '@sap-cloud-sdk/odata-v2/internal' ; const { testEntityApi } = testService ( ) ; const { multiSchemaTestEntityApi } = multipleSchemasService ( ) ; const createTestEntity = testEntityApi . requestBuilder ( ) . create ( testEntityApi . entityBuilder ( ) . build ( ) ) ; const createTestEntityFromOtherService = multiSchemaTestEntityApi . requestBuilder ( ) . create ( multiSchemaTestEntityApi . entityBuilder ( ) . build ( ) ) ; const changeSetTestEntity = testEntityChangeset ( createTestEntity ) ; testEntityChangeset ( createTestEntity , createTestEntity ) ; testEntityChangeset ( [ createTestEntity , createTestEntity ] ) ; otherServiceChangeset ( createTestEntityFromOtherService ) ; batch ( changeSetTestEntity , changeSetTestEntity ) ; batch ( [ changeSetTestEntity , changeSetTestEntity ] ) ; const responseWithDefault = { } as ReadResponse ; async function test ( ) { const responses = await testService ( ) . batch ( testEntityApi . requestBuilder ( ) . getAll ( ) ) . execute ( { } as any ) ; const response = responses [ 0 ] ; if ( response . isSuccess ( ) ) { response ; } if ( response . isReadResponse ( ) ) { response ; const result = response . as ( testEntityApi ) ; } const custom = { 'Edm.Binary' : { deserialize : ( val ) : number => 1 , serialize : ( val ) : string => '1' , serializeToUri : ( ) => '' } } ; const responsesCustomDeserializer = await batch ( testService ( custom ) . testEntityApi . requestBuilder ( ) . getAll ( ) ) . execute ( { } as any ) ; const responseCustomDeserializer = responsesCustomDeserializer [ 0 ] ; if ( responseCustomDeserializer . isSuccess ( ) ) { responseCustomDeserializer ; } if ( responseCustomDeserializer . isReadResponse ( ) ) { responseCustomDeserializer ; const result = responseCustomDeserializer . as ( testService ( custom ) . testEntityApi ) ; } }