UNPKG

@datadog/datadog-api-client

Version:
878 lines (877 loc) 102 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.FeatureFlagsApi = exports.FeatureFlagsApiResponseProcessor = exports.FeatureFlagsApiRequestFactory = void 0; const baseapi_1 = require("../../datadog-api-client-common/baseapi"); const configuration_1 = require("../../datadog-api-client-common/configuration"); const http_1 = require("../../datadog-api-client-common/http/http"); const logger_1 = require("../../../logger"); const ObjectSerializer_1 = require("../models/ObjectSerializer"); const exception_1 = require("../../datadog-api-client-common/exception"); class FeatureFlagsApiRequestFactory extends baseapi_1.BaseAPIRequestFactory { archiveFeatureFlag(featureFlagId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "archiveFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/archive".replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.archiveFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } createAllocationsForFeatureFlagInEnvironment(featureFlagId, environmentId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "createAllocationsForFeatureFlagInEnvironment"); } // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "createAllocationsForFeatureFlagInEnvironment"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "createAllocationsForFeatureFlagInEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.createAllocationsForFeatureFlagInEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "CreateAllocationsRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } createFeatureFlag(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "createFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags"; // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.createFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "CreateFeatureFlagRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } createFeatureFlagsEnvironment(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "createFeatureFlagsEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/environments"; // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.createFeatureFlagsEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "CreateEnvironmentRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } createVariantForFeatureFlag(featureFlagId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "createVariantForFeatureFlag"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "createVariantForFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/variants".replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.createVariantForFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "CreateVariant", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } deleteFeatureFlagsEnvironment(environmentId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "deleteFeatureFlagsEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/environments/{environment_id}".replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "*/*"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } deleteVariantFromFeatureFlag(featureFlagId, variantId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "deleteVariantFromFeatureFlag"); } // verify required parameter 'variantId' is not null or undefined if (variantId === null || variantId === undefined) { throw new baseapi_1.RequiredError("variantId", "deleteVariantFromFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{variant_id}", encodeURIComponent(String(variantId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.deleteVariantFromFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "*/*"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } disableFeatureFlagEnvironment(featureFlagId, environmentId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "disableFeatureFlagEnvironment"); } // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "disableFeatureFlagEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/disable" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.disableFeatureFlagEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "*/*"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } enableFeatureFlagEnvironment(featureFlagId, environmentId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "enableFeatureFlagEnvironment"); } // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "enableFeatureFlagEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/enable" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.enableFeatureFlagEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "*/*"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } getFeatureFlag(featureFlagId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "getFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}".replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.getFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } getFeatureFlagsEnvironment(environmentId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "getFeatureFlagsEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/environments/{environment_id}".replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.getFeatureFlagsEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } listFeatureFlags(key, isArchived, limit, offset, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // Path Params const localVarPath = "/api/v2/feature-flags"; // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.listFeatureFlags") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Query Params if (key !== undefined) { requestContext.setQueryParam("key", ObjectSerializer_1.ObjectSerializer.serialize(key, "string", ""), ""); } if (isArchived !== undefined) { requestContext.setQueryParam("is_archived", ObjectSerializer_1.ObjectSerializer.serialize(isArchived, "boolean", ""), ""); } if (limit !== undefined) { requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", "int64"), ""); } if (offset !== undefined) { requestContext.setQueryParam("offset", ObjectSerializer_1.ObjectSerializer.serialize(offset, "number", "int64"), ""); } // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } listFeatureFlagsEnvironments(name, key, limit, offset, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // Path Params const localVarPath = "/api/v2/feature-flags/environments"; // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.listFeatureFlagsEnvironments") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Query Params if (name !== undefined) { requestContext.setQueryParam("name", ObjectSerializer_1.ObjectSerializer.serialize(name, "string", ""), ""); } if (key !== undefined) { requestContext.setQueryParam("key", ObjectSerializer_1.ObjectSerializer.serialize(key, "string", ""), ""); } if (limit !== undefined) { requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", "int64"), ""); } if (offset !== undefined) { requestContext.setQueryParam("offset", ObjectSerializer_1.ObjectSerializer.serialize(offset, "number", "int64"), ""); } // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } pauseExposureSchedule(exposureScheduleId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'exposureScheduleId' is not null or undefined if (exposureScheduleId === null || exposureScheduleId === undefined) { throw new baseapi_1.RequiredError("exposureScheduleId", "pauseExposureSchedule"); } // Path Params const localVarPath = "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause".replace("{exposure_schedule_id}", encodeURIComponent(String(exposureScheduleId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.pauseExposureSchedule") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } resumeExposureSchedule(exposureScheduleId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'exposureScheduleId' is not null or undefined if (exposureScheduleId === null || exposureScheduleId === undefined) { throw new baseapi_1.RequiredError("exposureScheduleId", "resumeExposureSchedule"); } // Path Params const localVarPath = "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume".replace("{exposure_schedule_id}", encodeURIComponent(String(exposureScheduleId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.resumeExposureSchedule") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } startExposureSchedule(exposureScheduleId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'exposureScheduleId' is not null or undefined if (exposureScheduleId === null || exposureScheduleId === undefined) { throw new baseapi_1.RequiredError("exposureScheduleId", "startExposureSchedule"); } // Path Params const localVarPath = "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start".replace("{exposure_schedule_id}", encodeURIComponent(String(exposureScheduleId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.startExposureSchedule") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } stopExposureSchedule(exposureScheduleId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'exposureScheduleId' is not null or undefined if (exposureScheduleId === null || exposureScheduleId === undefined) { throw new baseapi_1.RequiredError("exposureScheduleId", "stopExposureSchedule"); } // Path Params const localVarPath = "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop".replace("{exposure_schedule_id}", encodeURIComponent(String(exposureScheduleId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.stopExposureSchedule") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } unarchiveFeatureFlag(featureFlagId, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "unarchiveFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/unarchive".replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.unarchiveFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } updateAllocationsForFeatureFlagInEnvironment(featureFlagId, environmentId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "updateAllocationsForFeatureFlagInEnvironment"); } // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "updateAllocationsForFeatureFlagInEnvironment"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "updateAllocationsForFeatureFlagInEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.PUT); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "OverwriteAllocationsRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } updateFeatureFlag(featureFlagId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "updateFeatureFlag"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "updateFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}".replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.updateFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.PUT); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "UpdateFeatureFlagRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } updateFeatureFlagsEnvironment(environmentId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'environmentId' is not null or undefined if (environmentId === null || environmentId === undefined) { throw new baseapi_1.RequiredError("environmentId", "updateFeatureFlagsEnvironment"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "updateFeatureFlagsEnvironment"); } // Path Params const localVarPath = "/api/v2/feature-flags/environments/{environment_id}".replace("{environment_id}", encodeURIComponent(String(environmentId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.updateFeatureFlagsEnvironment") .makeRequestContext(localVarPath, http_1.HttpMethod.PUT); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "UpdateEnvironmentRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } updateVariantForFeatureFlag(featureFlagId, variantId, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; // verify required parameter 'featureFlagId' is not null or undefined if (featureFlagId === null || featureFlagId === undefined) { throw new baseapi_1.RequiredError("featureFlagId", "updateVariantForFeatureFlag"); } // verify required parameter 'variantId' is not null or undefined if (variantId === null || variantId === undefined) { throw new baseapi_1.RequiredError("variantId", "updateVariantForFeatureFlag"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "updateVariantForFeatureFlag"); } // Path Params const localVarPath = "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}" .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) .replace("{variant_id}", encodeURIComponent(String(variantId))); // Make Request Context const requestContext = _config .getServer("v2.FeatureFlagsApi.updateVariantForFeatureFlag") .makeRequestContext(localVarPath, http_1.HttpMethod.PUT); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Body Params const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json", ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "UpdateVariantRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", ]); return requestContext; }); } } exports.FeatureFlagsApiRequestFactory = FeatureFlagsApiRequestFactory; class FeatureFlagsApiResponseProcessor { /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to archiveFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ archiveFeatureFlag(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "FeatureFlagResponse"); return body; } if (response.httpStatusCode === 400 || response.httpStatusCode === 403 || response.httpStatusCode === 404 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`); throw new exception_1.ApiException(response.httpStatusCode, bodyText); } throw new exception_1.ApiException(response.httpStatusCode, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "FeatureFlagResponse", ""); return body; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createAllocationsForFeatureFlagInEnvironment * @throws ApiException if the response code was not in [200, 299] */ createAllocationsForFeatureFlagInEnvironment(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 201 || response.httpStatusCode === 202) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AllocationResponse"); return body; } if (response.httpStatusCode === 400 || response.httpStatusCode === 403 || response.httpStatusCode === 404 || response.httpStatusCode === 409 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`); throw new exception_1.ApiException(response.httpStatusCode, bodyText); } throw new exception_1.ApiException(response.httpStatusCode, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AllocationResponse", ""); return body; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ createFeatureFlag(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 201) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "FeatureFlagResponse"); return body; } if (response.httpStatusCode === 400 || response.httpStatusCode === 403 || response.httpStatusCode === 409 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`); throw new exception_1.ApiException(response.httpStatusCode, bodyText); } throw new exception_1.ApiException(response.httpStatusCode, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "FeatureFlagResponse", ""); return body; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createFeatureFlagsEnvironment * @throws ApiException if the response code was not in [200, 299] */ createFeatureFlagsEnvironment(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 201) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "EnvironmentResponse"); return body; } if (response.httpStatusCode === 400 || response.httpStatusCode === 403 || response.httpStatusCode === 409 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`); throw new exception_1.ApiException(response.httpStatusCode, bodyText); } throw new exception_1.ApiException(response.httpStatusCode, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "EnvironmentResponse", ""); return body; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createVariantForFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ createVariantForFeatureFlag(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 201) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Variant"); return body; } if (response.httpStatusCode === 400 || response.httpStatusCode === 403 || response.httpStatusCode === 404 || response.httpStatusCode === 409 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`); throw new exception_1.ApiException(response.httpStatusCode, bodyText); } throw new exception_1.ApiException(response.httpStatusCode, body); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Variant", ""); return body; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to deleteFeatureFlagsEnvironment * @throws ApiException if the response code was not in [200, 299] */ deleteFeatureFlagsEnvironment(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 204) { return; } if (response.httpStatusCode === 403 || response.httpStatusCode === 404 || response.httpStatusCode === 429) { const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType); let body; try { body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse"); } catch (error) { logger_1.logger.debug(`Got error deserializing error: ${error}`);