import { ODataRequestConfig , ODataUri } from '@sap-cloud-sdk/odata-common/internal' ; import { DeSerializers } from '../de-serializers' ; import { ActionImportParameters , ActionImportParameter } from './action-import-parameter' ; internal export class ODataActionImportRequestConfig < DeSerializersT extends DeSerializers , ParametersT > extends ODataRequestConfig { param defaultServicePath param actionImportName param parameters param oDataUri constructor ( defaultServicePath , readonly actionImportName , public parameters , protected oDataUri ) { super ( 'post' , defaultServicePath ) ; this . payload = this . buildHttpPayload ( parameters ) ; } resourcePath ( ) { return this . actionImportName ; } queryParameters ( ) { return { ... this . prependDollarToQueryParameters ( { format : 'json' } ) } ; } private buildHttpPayload ( parameters ) { const payload = Object . keys ( parameters ) . reduce ( ( all , key ) => { const payloadElement = parameters [ key ] ; if ( typeof payloadElement . value !== 'undefined' ) { all [ payloadElement . originalName ] = payloadElement . value ; } return all ; } , { } ) ; return payload ; } }