11// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22
33import { APIResource } from '../core/resource' ;
4+ import { APIPromise } from '../core/api-promise' ;
45import { EntriesCursor , type EntriesCursorParams , PagePromise } from '../core/pagination' ;
56import { RequestOptions } from '../internal/request-options' ;
7+ import { path } from '../internal/utils/path' ;
68
79export class Variables extends APIResource {
810 /**
9- * Returns a paginated list of variables for a given environment.
11+ * Returns a single variable by key with per-environment value overrides.
12+ *
13+ * @example
14+ * ```ts
15+ * const variable = await client.variables.retrieve('key');
16+ * ```
17+ */
18+ retrieve ( key : string , options ?: RequestOptions ) : APIPromise < Variable > {
19+ return this . _client . get ( path `/v1/variables/${ key } ` , options ) ;
20+ }
21+
22+ /**
23+ * Returns a list of variables. When an environment is specified, returns
24+ * per-environment variables. Otherwise, returns project-scoped variables with
25+ * per-environment overrides.
1026 *
1127 * @example
1228 * ```ts
@@ -50,14 +66,20 @@ export interface Variable {
5066 updated_at : string ;
5167
5268 /**
53- * The value of the variable.
69+ * The description of the variable.
70+ */
71+ description ?: string | null ;
72+
73+ /**
74+ * A map of environment slugs to their override values. Only present for
75+ * project-scoped responses.
5476 */
55- value : string ;
77+ environment_values ?: { [ key : string ] : string | null } ;
5678
5779 /**
58- * The description of the variable.
80+ * The default value of the variable. For secret variables, this is obfuscated .
5981 */
60- description ?: string | null ;
82+ value ?: string | null ;
6183}
6284
6385export interface VariableListParams extends EntriesCursorParams {
@@ -71,6 +93,11 @@ export interface VariableListParams extends EntriesCursorParams {
7193 * `"development"`.
7294 */
7395 branch ?: string ;
96+
97+ /**
98+ * Filter variables by type. Supports 'public' or 'secret'.
99+ */
100+ type ?: 'public' | 'secret' ;
74101}
75102
76103export declare namespace Variables {
0 commit comments