@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
35 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ODataBatchRequestConfig = void 0;
const uuid_1 = require("uuid");
const odata_request_config_1 = require("./odata-request-config");
/**
* OData batch request configuration for an entity type.
*/
class ODataBatchRequestConfig extends odata_request_config_1.ODataRequestConfig {
/**
* Creates an instance of ODataBatchRequestConfig.
* @param defaultBasePath - The default OData service path.
* @param boundary - Request boundary for separation of subrequests. Defaults to an autogenerated value.
*/
constructor(defaultBasePath, boundary = `batch_${(0, uuid_1.v4)()}`) {
super('post', defaultBasePath, {
'content-type': `multipart/mixed; boundary=${boundary}`,
accept: 'multipart/mixed'
});
this.defaultBasePath = defaultBasePath;
this.boundary = boundary;
this.subRequestPathType = 'relativeToService';
}
withSubRequestPathType(subRequestPathType) {
this.subRequestPathType = subRequestPathType;
}
resourcePath() {
return '$batch';
}
queryParameters() {
return {};
}
}
exports.ODataBatchRequestConfig = ODataBatchRequestConfig;
//# sourceMappingURL=odata-batch-request-config.js.map