UNPKG

@sap-cloud-sdk/odata-v4

Version:

SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.

31 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetByKeyRequestBuilder = void 0; const util_1 = require("@sap-cloud-sdk/util"); const internal_1 = require("@sap-cloud-sdk/odata-common/internal"); const de_serializers_1 = require("../de-serializers"); const uri_conversion_1 = require("../uri-conversion"); const response_data_accessor_1 = require("./response-data-accessor"); /** * Create an OData request to get a single entity based on its key properties. * The properties available in the response can be restricted by creating a {@link GetByKeyRequestBuilder.select | selection}, where no selection is equal to selecting all fields of the entity. * Navigational properties need to be expanded explicitly by {@link GetAllRequestBuilder.expand}. * Where no selection is equal to selecting all fields. * @typeParam EntityT - Type of the entity to be requested. */ class GetByKeyRequestBuilder extends internal_1.GetByKeyRequestBuilderBase { /** * Creates an instance of GetByKeyRequestBuilder. * @param entityApi - Entity API for building and executing the request. * @param keys - Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value. */ constructor(entityApi, keys) { super(entityApi, keys, (0, uri_conversion_1.createODataUri)(entityApi.deSerializers), (0, de_serializers_1.entityDeserializer)(entityApi.deSerializers), response_data_accessor_1.responseDataAccessor); } expand(first, ...rest) { this.requestConfig.expands = (0, util_1.transformVariadicArgumentToArray)(first, rest); return this; } } exports.GetByKeyRequestBuilder = GetByKeyRequestBuilder; //# sourceMappingURL=get-by-key-request-builder.js.map