@odata2ts/odata-service
Version:
Main runtime dependency of odata2ts for generated odata client services
45 lines • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityTypeServiceV4 = void 0;
const tslib_1 = require("tslib");
const odata_query_objects_1 = require("@odata2ts/odata-query-objects");
const ServiceStateHelperV4_js_1 = require("./ServiceStateHelperV4.js");
class EntityTypeServiceV4 {
constructor(client, basePath, name, qModel, options) {
this.__base = new ServiceStateHelperV4_js_1.ServiceStateHelperV4(client, basePath, name, qModel, options);
}
getPath() {
return this.__base.path;
}
patch(model, requestConfig, patchOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { client, qModel, basePath, path, getDefaultHeaders, qResponseType } = this.__base;
const { dontUseCastPathSegment, useTypeCi } = this.__base.evaluateSubtypeOptions(patchOptions);
const result = yield client.patch(dontUseCastPathSegment ? basePath : path, qModel.convertToOData(useTypeCi ? this.__base.addTypeControlInfo(model) : model), requestConfig, getDefaultHeaders());
return (0, odata_query_objects_1.convertV4ModelResponse)(result, qResponseType);
});
}
update(model, requestConfig, updateOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { client, qModel, basePath, path, getDefaultHeaders, qResponseType } = this.__base;
const { dontUseCastPathSegment, useTypeCi } = this.__base.evaluateSubtypeOptions(updateOptions);
const result = yield client.put(dontUseCastPathSegment ? basePath : path, qModel.convertToOData(useTypeCi ? this.__base.addTypeControlInfo(model) : model), requestConfig, getDefaultHeaders());
return (0, odata_query_objects_1.convertV4ModelResponse)(result, qResponseType);
});
}
delete(requestConfig) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { client, path } = this.__base;
return client.delete(path, requestConfig);
});
}
query(queryFn, requestConfig) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { client, applyQueryBuilder, getDefaultHeaders, qResponseType } = this.__base;
const response = yield client.get(applyQueryBuilder(queryFn), requestConfig, getDefaultHeaders());
return (0, odata_query_objects_1.convertV4ModelResponse)(response, qResponseType);
});
}
}
exports.EntityTypeServiceV4 = EntityTypeServiceV4;
//# sourceMappingURL=EntityTypeServiceV4.js.map