@sap-cloud-sdk/odata-v4
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
32 lines • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteRequestBuilder = void 0;
const internal_1 = require("@sap-cloud-sdk/odata-common/internal");
const uri_conversion_1 = require("../uri-conversion");
/**
* Create OData query to delete an entity.
* @typeParam EntityT - Type of the entity to be deleted.
*/
class DeleteRequestBuilder extends internal_1.DeleteRequestBuilderBase {
/**
* Creates an instance of DeleteRequestBuilder. If the entity is passed, a version identifier will also be added.
* @param entityApi - Entity API for building and executing the request.
* @param keysOrEntity - Entity or key-value pairs of key properties for the given entity.
*/
constructor(entityApi, keysOrEntity) {
super(entityApi, (0, uri_conversion_1.createODataUri)(entityApi.deSerializers), keysOrEntity);
}
/**
* Add ETag version identifier in the delete request header.
* @param etag - The version identifier of the entity.
* @returns The builder itself, to facilitate method chaining.
*/
setVersionIdentifier(etag) {
if (etag) {
this.requestConfig.addCustomHeaders({ 'if-match': etag });
}
return this;
}
}
exports.DeleteRequestBuilder = DeleteRequestBuilder;
//# sourceMappingURL=delete-request-builder.js.map