/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { environmentVariablesCreate } from "../funcs/environmentVariablesCreate.js"; import { environmentVariablesDelete } from "../funcs/environmentVariablesDelete.js"; import { environmentVariablesList } from "../funcs/environmentVariablesList.js"; import { environmentVariablesRetrieve } from "../funcs/environmentVariablesRetrieve.js"; import { environmentVariablesUpdate } from "../funcs/environmentVariablesUpdate.js"; import { environmentVariablesUsage } from "../funcs/environmentVariablesUsage.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class EnvironmentVariables extends ClientSDK { /** * List all variables * * @remarks * Returns all environment variables for the current organization. Secret values are masked. */ async list( search?: string | undefined, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.EnvironmentVariablesControllerListEnvironmentVariablesResponse > { return unwrapAsync(environmentVariablesList( this, search, idempotencyKey, options, )); } /** * Create a variable * * @remarks * Creates a new environment variable. Keys must be uppercase with underscores only (e.g. BASE_URL). Secret variables are encrypted at rest and masked in API responses. */ async create( createEnvironmentVariableRequestDto: components.CreateEnvironmentVariableRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.EnvironmentVariablesControllerCreateEnvironmentVariableResponse > { return unwrapAsync(environmentVariablesCreate( this, createEnvironmentVariableRequestDto, idempotencyKey, options, )); } /** * Get environment variable * * @remarks * Returns a single environment variable by key. Secret values are masked. */ async retrieve( variableKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.EnvironmentVariablesControllerGetEnvironmentVariableResponse > { return unwrapAsync(environmentVariablesRetrieve( this, variableKey, idempotencyKey, options, )); } /** * Update a variable * * @remarks * Updates an existing environment variable. Providing `values` merges them into the existing per-environment values by `_environmentId`; envs not present in the request keep their stored value. Submitting the masked secret placeholder (the value returned by read endpoints for secret variables) as a real value is rejected. */ async update( updateEnvironmentVariableRequestDto: components.UpdateEnvironmentVariableRequestDto, variableKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.EnvironmentVariablesControllerUpdateEnvironmentVariableResponse > { return unwrapAsync(environmentVariablesUpdate( this, updateEnvironmentVariableRequestDto, variableKey, idempotencyKey, options, )); } /** * Delete environment variable * * @remarks * Deletes an environment variable by key. */ async delete( variableKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< | operations.EnvironmentVariablesControllerDeleteEnvironmentVariableResponse | undefined > { return unwrapAsync(environmentVariablesDelete( this, variableKey, idempotencyKey, options, )); } /** * Retrieve a variable usage * * @remarks * Returns the workflows that reference this environment variable via `{{env.KEY}}` in their step controls. **variableId** is required. */ async usage( variableKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.EnvironmentVariablesControllerGetEnvironmentVariableUsageResponse > { return unwrapAsync(environmentVariablesUsage( this, variableKey, idempotencyKey, options, )); } }