UNPKG

@datadog/datadog-api-client

Version:
592 lines (591 loc) 26.8 kB
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi"; import { Configuration } from "../../datadog-api-client-common/configuration"; import { RequestContext, ResponseContext } from "../../datadog-api-client-common/http/http"; import { AllocationExposureScheduleResponse } from "../models/AllocationExposureScheduleResponse"; import { AllocationResponse } from "../models/AllocationResponse"; import { CreateAllocationsRequest } from "../models/CreateAllocationsRequest"; import { CreateEnvironmentRequest } from "../models/CreateEnvironmentRequest"; import { CreateFeatureFlagRequest } from "../models/CreateFeatureFlagRequest"; import { CreateVariant } from "../models/CreateVariant"; import { EnvironmentResponse } from "../models/EnvironmentResponse"; import { FeatureFlagResponse } from "../models/FeatureFlagResponse"; import { ListAllocationsResponse } from "../models/ListAllocationsResponse"; import { ListEnvironmentsResponse } from "../models/ListEnvironmentsResponse"; import { ListFeatureFlagsResponse } from "../models/ListFeatureFlagsResponse"; import { OverwriteAllocationsRequest } from "../models/OverwriteAllocationsRequest"; import { UpdateEnvironmentRequest } from "../models/UpdateEnvironmentRequest"; import { UpdateFeatureFlagRequest } from "../models/UpdateFeatureFlagRequest"; import { UpdateVariantRequest } from "../models/UpdateVariantRequest"; import { Variant } from "../models/Variant"; export declare class FeatureFlagsApiRequestFactory extends BaseAPIRequestFactory { archiveFeatureFlag(featureFlagId: string, _options?: Configuration): Promise<RequestContext>; createAllocationsForFeatureFlagInEnvironment(featureFlagId: string, environmentId: string, body: CreateAllocationsRequest, _options?: Configuration): Promise<RequestContext>; createFeatureFlag(body: CreateFeatureFlagRequest, _options?: Configuration): Promise<RequestContext>; createFeatureFlagsEnvironment(body: CreateEnvironmentRequest, _options?: Configuration): Promise<RequestContext>; createVariantForFeatureFlag(featureFlagId: string, body: CreateVariant, _options?: Configuration): Promise<RequestContext>; deleteFeatureFlagsEnvironment(environmentId: string, _options?: Configuration): Promise<RequestContext>; deleteVariantFromFeatureFlag(featureFlagId: string, variantId: string, _options?: Configuration): Promise<RequestContext>; disableFeatureFlagEnvironment(featureFlagId: string, environmentId: string, _options?: Configuration): Promise<RequestContext>; enableFeatureFlagEnvironment(featureFlagId: string, environmentId: string, _options?: Configuration): Promise<RequestContext>; getFeatureFlag(featureFlagId: string, _options?: Configuration): Promise<RequestContext>; getFeatureFlagsEnvironment(environmentId: string, _options?: Configuration): Promise<RequestContext>; listFeatureFlags(key?: string, isArchived?: boolean, limit?: number, offset?: number, _options?: Configuration): Promise<RequestContext>; listFeatureFlagsEnvironments(name?: string, key?: string, limit?: number, offset?: number, _options?: Configuration): Promise<RequestContext>; pauseExposureSchedule(exposureScheduleId: string, _options?: Configuration): Promise<RequestContext>; resumeExposureSchedule(exposureScheduleId: string, _options?: Configuration): Promise<RequestContext>; startExposureSchedule(exposureScheduleId: string, _options?: Configuration): Promise<RequestContext>; stopExposureSchedule(exposureScheduleId: string, _options?: Configuration): Promise<RequestContext>; unarchiveFeatureFlag(featureFlagId: string, _options?: Configuration): Promise<RequestContext>; updateAllocationsForFeatureFlagInEnvironment(featureFlagId: string, environmentId: string, body: OverwriteAllocationsRequest, _options?: Configuration): Promise<RequestContext>; updateFeatureFlag(featureFlagId: string, body: UpdateFeatureFlagRequest, _options?: Configuration): Promise<RequestContext>; updateFeatureFlagsEnvironment(environmentId: string, body: UpdateEnvironmentRequest, _options?: Configuration): Promise<RequestContext>; updateVariantForFeatureFlag(featureFlagId: string, variantId: string, body: UpdateVariantRequest, _options?: Configuration): Promise<RequestContext>; } export declare 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: ResponseContext): Promise<FeatureFlagResponse>; /** * 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: ResponseContext): Promise<AllocationResponse>; /** * 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: ResponseContext): Promise<FeatureFlagResponse>; /** * 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: ResponseContext): Promise<EnvironmentResponse>; /** * 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: ResponseContext): Promise<Variant>; /** * 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: ResponseContext): Promise<void>; /** * 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 deleteVariantFromFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ deleteVariantFromFeatureFlag(response: ResponseContext): Promise<void>; /** * 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 disableFeatureFlagEnvironment * @throws ApiException if the response code was not in [200, 299] */ disableFeatureFlagEnvironment(response: ResponseContext): Promise<void>; /** * 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 enableFeatureFlagEnvironment * @throws ApiException if the response code was not in [200, 299] */ enableFeatureFlagEnvironment(response: ResponseContext): Promise<void>; /** * 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 getFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ getFeatureFlag(response: ResponseContext): Promise<FeatureFlagResponse>; /** * 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 getFeatureFlagsEnvironment * @throws ApiException if the response code was not in [200, 299] */ getFeatureFlagsEnvironment(response: ResponseContext): Promise<EnvironmentResponse>; /** * 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 listFeatureFlags * @throws ApiException if the response code was not in [200, 299] */ listFeatureFlags(response: ResponseContext): Promise<ListFeatureFlagsResponse>; /** * 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 listFeatureFlagsEnvironments * @throws ApiException if the response code was not in [200, 299] */ listFeatureFlagsEnvironments(response: ResponseContext): Promise<ListEnvironmentsResponse>; /** * 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 pauseExposureSchedule * @throws ApiException if the response code was not in [200, 299] */ pauseExposureSchedule(response: ResponseContext): Promise<AllocationExposureScheduleResponse>; /** * 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 resumeExposureSchedule * @throws ApiException if the response code was not in [200, 299] */ resumeExposureSchedule(response: ResponseContext): Promise<AllocationExposureScheduleResponse>; /** * 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 startExposureSchedule * @throws ApiException if the response code was not in [200, 299] */ startExposureSchedule(response: ResponseContext): Promise<AllocationExposureScheduleResponse>; /** * 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 stopExposureSchedule * @throws ApiException if the response code was not in [200, 299] */ stopExposureSchedule(response: ResponseContext): Promise<AllocationExposureScheduleResponse>; /** * 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 unarchiveFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ unarchiveFeatureFlag(response: ResponseContext): Promise<FeatureFlagResponse>; /** * 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 updateAllocationsForFeatureFlagInEnvironment * @throws ApiException if the response code was not in [200, 299] */ updateAllocationsForFeatureFlagInEnvironment(response: ResponseContext): Promise<ListAllocationsResponse>; /** * 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 updateFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ updateFeatureFlag(response: ResponseContext): Promise<FeatureFlagResponse>; /** * 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 updateFeatureFlagsEnvironment * @throws ApiException if the response code was not in [200, 299] */ updateFeatureFlagsEnvironment(response: ResponseContext): Promise<EnvironmentResponse>; /** * 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 updateVariantForFeatureFlag * @throws ApiException if the response code was not in [200, 299] */ updateVariantForFeatureFlag(response: ResponseContext): Promise<Variant>; } export interface FeatureFlagsApiArchiveFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; } export interface FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the environment. * @type string */ environmentId: string; /** * @type CreateAllocationsRequest */ body: CreateAllocationsRequest; } export interface FeatureFlagsApiCreateFeatureFlagRequest { /** * @type CreateFeatureFlagRequest */ body: CreateFeatureFlagRequest; } export interface FeatureFlagsApiCreateFeatureFlagsEnvironmentRequest { /** * @type CreateEnvironmentRequest */ body: CreateEnvironmentRequest; } export interface FeatureFlagsApiCreateVariantForFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * @type CreateVariant */ body: CreateVariant; } export interface FeatureFlagsApiDeleteFeatureFlagsEnvironmentRequest { /** * The ID of the environment. * @type string */ environmentId: string; } export interface FeatureFlagsApiDeleteVariantFromFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the variant. * @type string */ variantId: string; } export interface FeatureFlagsApiDisableFeatureFlagEnvironmentRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the environment. * @type string */ environmentId: string; } export interface FeatureFlagsApiEnableFeatureFlagEnvironmentRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the environment. * @type string */ environmentId: string; } export interface FeatureFlagsApiGetFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; } export interface FeatureFlagsApiGetFeatureFlagsEnvironmentRequest { /** * The ID of the environment. * @type string */ environmentId: string; } export interface FeatureFlagsApiListFeatureFlagsRequest { /** * Filter feature flags by key (partial matching). * @type string */ key?: string; /** * Filter by archived status. * @type boolean */ isArchived?: boolean; /** * Maximum number of results to return. * @type number */ limit?: number; /** * Number of results to skip. * @type number */ offset?: number; } export interface FeatureFlagsApiListFeatureFlagsEnvironmentsRequest { /** * Filter environments by name (partial matching). * @type string */ name?: string; /** * Filter environments by key (partial matching). * @type string */ key?: string; /** * Maximum number of results to return. * @type number */ limit?: number; /** * Number of results to skip. * @type number */ offset?: number; } export interface FeatureFlagsApiPauseExposureScheduleRequest { /** * The ID of the exposure schedule. * @type string */ exposureScheduleId: string; } export interface FeatureFlagsApiResumeExposureScheduleRequest { /** * The ID of the exposure schedule. * @type string */ exposureScheduleId: string; } export interface FeatureFlagsApiStartExposureScheduleRequest { /** * The ID of the exposure schedule. * @type string */ exposureScheduleId: string; } export interface FeatureFlagsApiStopExposureScheduleRequest { /** * The ID of the exposure schedule. * @type string */ exposureScheduleId: string; } export interface FeatureFlagsApiUnarchiveFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; } export interface FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the environment. * @type string */ environmentId: string; /** * @type OverwriteAllocationsRequest */ body: OverwriteAllocationsRequest; } export interface FeatureFlagsApiUpdateFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * @type UpdateFeatureFlagRequest */ body: UpdateFeatureFlagRequest; } export interface FeatureFlagsApiUpdateFeatureFlagsEnvironmentRequest { /** * The ID of the environment. * @type string */ environmentId: string; /** * @type UpdateEnvironmentRequest */ body: UpdateEnvironmentRequest; } export interface FeatureFlagsApiUpdateVariantForFeatureFlagRequest { /** * The ID of the feature flag. * @type string */ featureFlagId: string; /** * The ID of the variant. * @type string */ variantId: string; /** * @type UpdateVariantRequest */ body: UpdateVariantRequest; } export declare class FeatureFlagsApi { private requestFactory; private responseProcessor; private configuration; constructor(configuration: Configuration, requestFactory?: FeatureFlagsApiRequestFactory, responseProcessor?: FeatureFlagsApiResponseProcessor); /** * Archives a feature flag. Archived flags are * hidden from the main list but remain accessible and can be unarchived. * @param param The request object */ archiveFeatureFlag(param: FeatureFlagsApiArchiveFeatureFlagRequest, options?: Configuration): Promise<FeatureFlagResponse>; /** * Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. * @param param The request object */ createAllocationsForFeatureFlagInEnvironment(param: FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest, options?: Configuration): Promise<AllocationResponse>; /** * Creates a new feature flag with variants. * @param param The request object */ createFeatureFlag(param: FeatureFlagsApiCreateFeatureFlagRequest, options?: Configuration): Promise<FeatureFlagResponse>; /** * Creates a new environment for organizing feature flags. * @param param The request object */ createFeatureFlagsEnvironment(param: FeatureFlagsApiCreateFeatureFlagsEnvironmentRequest, options?: Configuration): Promise<EnvironmentResponse>; /** * Adds a single new variant to an existing feature flag. This endpoint is * additive-only: it never modifies existing variants. A request whose `key` * already exists on the flag is rejected with `409 Conflict`; a `value` * whose type does not match the flag's `value_type` is rejected with `400`. * The server generates the variant UUID and returns it in the response body; * callers (for example, the flag-migration tool) need this UUID to reference * the new variant in subsequent allocation syncs. * @param param The request object */ createVariantForFeatureFlag(param: FeatureFlagsApiCreateVariantForFeatureFlagRequest, options?: Configuration): Promise<Variant>; /** * Deletes an environment. This operation cannot be undone. * @param param The request object */ deleteFeatureFlagsEnvironment(param: FeatureFlagsApiDeleteFeatureFlagsEnvironmentRequest, options?: Configuration): Promise<void>; /** * Deletes a variant from a feature flag. * * When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a `FlagSuggestion` with `201 Created` instead of deleting the variant immediately. If a pending suggestion already exists for this flag's variant property, the endpoint returns `409 Conflict`. * @param param The request object */ deleteVariantFromFeatureFlag(param: FeatureFlagsApiDeleteVariantFromFeatureFlagRequest, options?: Configuration): Promise<void>; /** * Disable a feature flag in a specific environment. * @param param The request object */ disableFeatureFlagEnvironment(param: FeatureFlagsApiDisableFeatureFlagEnvironmentRequest, options?: Configuration): Promise<void>; /** * Enable a feature flag in a specific environment. * @param param The request object */ enableFeatureFlagEnvironment(param: FeatureFlagsApiEnableFeatureFlagEnvironmentRequest, options?: Configuration): Promise<void>; /** * Returns the details of a specific feature flag * including variants and environment status. * @param param The request object */ getFeatureFlag(param: FeatureFlagsApiGetFeatureFlagRequest, options?: Configuration): Promise<FeatureFlagResponse>; /** * Returns the details of a specific environment. * @param param The request object */ getFeatureFlagsEnvironment(param: FeatureFlagsApiGetFeatureFlagsEnvironmentRequest, options?: Configuration): Promise<EnvironmentResponse>; /** * Returns a list of feature flags for the organization. * Supports filtering by key and archived status. * @param param The request object */ listFeatureFlags(param?: FeatureFlagsApiListFeatureFlagsRequest, options?: Configuration): Promise<ListFeatureFlagsResponse>; /** * Returns a list of environments for the organization. * Supports filtering by name and key. * @param param The request object */ listFeatureFlagsEnvironments(param?: FeatureFlagsApiListFeatureFlagsEnvironmentsRequest, options?: Configuration): Promise<ListEnvironmentsResponse>; /** * Pauses a progressive rollout while preserving rollout state. * @param param The request object */ pauseExposureSchedule(param: FeatureFlagsApiPauseExposureScheduleRequest, options?: Configuration): Promise<AllocationExposureScheduleResponse>; /** * Resumes progression for a previously paused progressive rollout. * @param param The request object */ resumeExposureSchedule(param: FeatureFlagsApiResumeExposureScheduleRequest, options?: Configuration): Promise<AllocationExposureScheduleResponse>; /** * Starts a progressive rollout and begins progression. * @param param The request object */ startExposureSchedule(param: FeatureFlagsApiStartExposureScheduleRequest, options?: Configuration): Promise<AllocationExposureScheduleResponse>; /** * Stops a progressive rollout and marks it as aborted. * @param param The request object */ stopExposureSchedule(param: FeatureFlagsApiStopExposureScheduleRequest, options?: Configuration): Promise<AllocationExposureScheduleResponse>; /** * Unarchives a previously archived feature flag, * making it visible in the main list again. * @param param The request object */ unarchiveFeatureFlag(param: FeatureFlagsApiUnarchiveFeatureFlagRequest, options?: Configuration): Promise<FeatureFlagResponse>; /** * Updates targeting rules (allocations) for a specific feature flag in a specific environment. * This operation replaces the existing allocation set with the request payload. * @param param The request object */ updateAllocationsForFeatureFlagInEnvironment(param: FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest, options?: Configuration): Promise<ListAllocationsResponse>; /** * Updates an existing feature flag's metadata such as * name and description. Does not modify targeting rules or allocations. * @param param The request object */ updateFeatureFlag(param: FeatureFlagsApiUpdateFeatureFlagRequest, options?: Configuration): Promise<FeatureFlagResponse>; /** * Updates an existing environment's metadata such as * name and description. * @param param The request object */ updateFeatureFlagsEnvironment(param: FeatureFlagsApiUpdateFeatureFlagsEnvironmentRequest, options?: Configuration): Promise<EnvironmentResponse>; /** * Updates the name and value of an existing variant on a feature flag. * * When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a `FlagSuggestion` with `201 Created` instead of applying the change immediately. Use the returned suggestion `id` to approve or reject the change. If a pending suggestion already exists for this flag's variant property, the endpoint returns `409 Conflict`. * @param param The request object */ updateVariantForFeatureFlag(param: FeatureFlagsApiUpdateVariantForFeatureFlagRequest, options?: Configuration): Promise<Variant>; }