@@ -5,6 +5,48 @@ import * as Core from '../../core';
55import { PageCursorURL , type PageCursorURLParams } from '../../pagination' ;
66
77export class EnvironmentVariables extends APIResource {
8+ /**
9+ * Create a new environment variable scoped to this project.
10+ *
11+ * @example
12+ * ```ts
13+ * const environmentVariable =
14+ * await client.vals.environmentVariables.create(
15+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
16+ * { key: 'key', value: 'value' },
17+ * );
18+ * ```
19+ */
20+ create (
21+ valId : string ,
22+ body : EnvironmentVariableCreateParams ,
23+ options ?: Core . RequestOptions ,
24+ ) : Core . APIPromise < EnvironmentVariableCreateResponse > {
25+ return this . _client . post ( `/v2/vals/${ valId } /environment_variables` , { body, ...options } ) ;
26+ }
27+
28+ /**
29+ * Update a environment variable scoped to this project.
30+ *
31+ * @example
32+ * ```ts
33+ * const environmentVariable =
34+ * await client.vals.environmentVariables.update(
35+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
36+ * 'key',
37+ * { value: 'value' },
38+ * );
39+ * ```
40+ */
41+ update (
42+ valId : string ,
43+ key : string ,
44+ body : EnvironmentVariableUpdateParams ,
45+ options ?: Core . RequestOptions ,
46+ ) : Core . APIPromise < EnvironmentVariableUpdateResponse > {
47+ return this . _client . put ( `/v2/vals/${ valId } /environment_variables/${ key } ` , { body, ...options } ) ;
48+ }
49+
850 /**
951 * List environment variables defined in this project. This only includes names,
1052 * not values.
@@ -31,10 +73,66 @@ export class EnvironmentVariables extends APIResource {
3173 { query, ...options } ,
3274 ) ;
3375 }
76+
77+ /**
78+ * Delete a environment variable scoped to this project.
79+ *
80+ * @example
81+ * ```ts
82+ * await client.vals.environmentVariables.delete(
83+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
84+ * 'key',
85+ * );
86+ * ```
87+ */
88+ delete ( valId : string , key : string , options ?: Core . RequestOptions ) : Core . APIPromise < void > {
89+ return this . _client . delete ( `/v2/vals/${ valId } /environment_variables/${ key } ` , {
90+ ...options ,
91+ headers : { Accept : '*/*' , ...options ?. headers } ,
92+ } ) ;
93+ }
3494}
3595
3696export class EnvironmentVariableListResponsesPageCursorURL extends PageCursorURL < EnvironmentVariableListResponse > { }
3797
98+ /**
99+ * An environment variable
100+ */
101+ export interface EnvironmentVariableCreateResponse {
102+ createdAt : string ;
103+
104+ /**
105+ * Optional description of the environment variable
106+ */
107+ description : string | null ;
108+
109+ /**
110+ * Name or key of the environment variable, accessible via Deno.env or process.env
111+ */
112+ key : string ;
113+
114+ updatedAt : string ;
115+ }
116+
117+ /**
118+ * An environment variable
119+ */
120+ export interface EnvironmentVariableUpdateResponse {
121+ createdAt : string ;
122+
123+ /**
124+ * Optional description of the environment variable
125+ */
126+ description : string | null ;
127+
128+ /**
129+ * Name or key of the environment variable, accessible via Deno.env or process.env
130+ */
131+ key : string ;
132+
133+ updatedAt : string ;
134+ }
135+
38136/**
39137 * An environment variable
40138 */
@@ -54,15 +152,48 @@ export interface EnvironmentVariableListResponse {
54152 updatedAt : string ;
55153}
56154
155+ export interface EnvironmentVariableCreateParams {
156+ /**
157+ * Name or key of the environment variable, accessible via Deno.env or process.env
158+ */
159+ key : string ;
160+
161+ /**
162+ * Value of the environment variable.
163+ */
164+ value : string ;
165+
166+ /**
167+ * Optional description of the environment variable
168+ */
169+ description ?: string ;
170+ }
171+
172+ export interface EnvironmentVariableUpdateParams {
173+ /**
174+ * Value of the environment variable.
175+ */
176+ value : string ;
177+
178+ /**
179+ * Optional description of the environment variable
180+ */
181+ description ?: string ;
182+ }
183+
57184export interface EnvironmentVariableListParams extends PageCursorURLParams { }
58185
59186EnvironmentVariables . EnvironmentVariableListResponsesPageCursorURL =
60187 EnvironmentVariableListResponsesPageCursorURL ;
61188
62189export declare namespace EnvironmentVariables {
63190 export {
191+ type EnvironmentVariableCreateResponse as EnvironmentVariableCreateResponse ,
192+ type EnvironmentVariableUpdateResponse as EnvironmentVariableUpdateResponse ,
64193 type EnvironmentVariableListResponse as EnvironmentVariableListResponse ,
65194 EnvironmentVariableListResponsesPageCursorURL as EnvironmentVariableListResponsesPageCursorURL ,
195+ type EnvironmentVariableCreateParams as EnvironmentVariableCreateParams ,
196+ type EnvironmentVariableUpdateParams as EnvironmentVariableUpdateParams ,
66197 type EnvironmentVariableListParams as EnvironmentVariableListParams ,
67198 } ;
68199}
0 commit comments