UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

95 lines 4.96 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnterpriseConfigurationsManager = exports.GetEnterpriseConfigurationByIdV2025R0Headers = exports.GetEnterpriseConfigurationByIdV2025R0Optionals = void 0; const enterpriseConfigurationV2025R0_1 = require("../schemas/v2025R0/enterpriseConfigurationV2025R0"); const network_1 = require("../networking/network"); const fetchOptions_1 = require("../networking/fetchOptions"); const utils_1 = require("../internal/utils"); const utils_2 = require("../internal/utils"); class GetEnterpriseConfigurationByIdV2025R0Optionals { constructor(fields) { this.headers = new GetEnterpriseConfigurationByIdV2025R0Headers({}); this.cancellationToken = void 0; if (fields.headers !== undefined) { this.headers = fields.headers; } if (fields.cancellationToken !== undefined) { this.cancellationToken = fields.cancellationToken; } } } exports.GetEnterpriseConfigurationByIdV2025R0Optionals = GetEnterpriseConfigurationByIdV2025R0Optionals; class GetEnterpriseConfigurationByIdV2025R0Headers { constructor(fields) { /** * Version header. */ this.boxVersion = '2025.0'; /** * Extra headers that will be included in the HTTP request. */ this.extraHeaders = {}; if (fields.boxVersion !== undefined) { this.boxVersion = fields.boxVersion; } if (fields.extraHeaders !== undefined) { this.extraHeaders = fields.extraHeaders; } } } exports.GetEnterpriseConfigurationByIdV2025R0Headers = GetEnterpriseConfigurationByIdV2025R0Headers; class EnterpriseConfigurationsManager { constructor(fields) { this.networkSession = new network_1.NetworkSession({}); if (fields.auth !== undefined) { this.auth = fields.auth; } if (fields.networkSession !== undefined) { this.networkSession = fields.networkSession; } } /** * Retrieves the configuration for an enterprise. * @param {string} enterpriseId The ID of the enterprise. Example: "3442311" * @param {GetEnterpriseConfigurationByIdV2025R0QueryParams} queryParams Query parameters of getEnterpriseConfigurationByIdV2025R0 method * @param {GetEnterpriseConfigurationByIdV2025R0OptionalsInput} optionalsInput * @returns {Promise<EnterpriseConfigurationV2025R0>} */ getEnterpriseConfigurationByIdV2025R0(enterpriseId_1, queryParams_1) { return __awaiter(this, arguments, void 0, function* (enterpriseId, queryParams, optionalsInput = {}) { const optionals = new GetEnterpriseConfigurationByIdV2025R0Optionals({ headers: optionalsInput.headers, cancellationToken: optionalsInput.cancellationToken, }); const headers = optionals.headers; const cancellationToken = optionals.cancellationToken; const queryParamsMap = (0, utils_1.prepareParams)({ ['categories']: queryParams.categories ? queryParams.categories.map(utils_2.toString).join(',') : undefined, }); const headersMap = (0, utils_1.prepareParams)(Object.assign({ ['box-version']: (0, utils_2.toString)(headers.boxVersion) }, headers.extraHeaders)); const response = yield this.networkSession.networkClient.fetch(new fetchOptions_1.FetchOptions({ url: ''.concat(this.networkSession.baseUrls.baseUrl, '/2.0/enterprise_configurations/', (0, utils_2.toString)(enterpriseId)), method: 'GET', params: queryParamsMap, headers: headersMap, responseFormat: 'json', auth: this.auth, networkSession: this.networkSession, cancellationToken: cancellationToken, })); return Object.assign(Object.assign({}, (0, enterpriseConfigurationV2025R0_1.deserializeEnterpriseConfigurationV2025R0)(response.data)), { rawData: response.data }); }); } } exports.EnterpriseConfigurationsManager = EnterpriseConfigurationsManager; //# sourceMappingURL=enterpriseConfigurations.js.map