@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
40 lines • 1.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ODataGetAllRequestConfig = void 0;
const odata_request_config_1 = require("./odata-request-config");
/**
* OData getAll request configuration for an entity type.
* @template EntityT - Type of the entity to setup a request for.
*/
class ODataGetAllRequestConfig extends odata_request_config_1.ODataRequestConfig {
/**
* Creates an instance of ODataGetAllRequestConfig.
* @param entityApi - Entity API for building and executing the request.
* @param oDataUri - URI conversion functions.
*/
constructor(entityApi, oDataUri) {
super('get', entityApi.entityConstructor._defaultBasePath);
this.entityApi = entityApi;
this.oDataUri = oDataUri;
}
resourcePath() {
return this.entityApi.entityConstructor._entityName;
}
queryParameters() {
const params = {
...this.oDataUri.getSelect(this.selects),
...this.oDataUri.getExpand(this.selects, this.expands, this.entityApi),
...this.oDataUri.getFilter(this.filter, this.entityApi),
...this.oDataUri.getOrderBy(this.orderBy)
};
if (typeof this.top !== 'undefined') {
params.top = this.top;
}
if (typeof this.skip !== 'undefined') {
params.skip = this.skip;
}
return this.prependDollarToQueryParameters(params);
}
}
exports.ODataGetAllRequestConfig = ODataGetAllRequestConfig;
//# sourceMappingURL=odata-get-all-request-config.js.map