-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv-vars.ts
168 lines (144 loc) · 4.67 KB
/
env-vars.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
import * as EnvVarsAPI from './env-vars';
import * as Shared from './shared';
export class EnvVars extends APIResource {
/**
* Create a new env_var. If there is an existing env_var with the same name as the
* one specified in the request, will return the existing env_var unmodified
*/
create(body: EnvVarCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.EnvVar> {
return this._client.post('/v1/env_var', { body, ...options });
}
/**
* Get an env_var object by its id
*/
retrieve(envVarId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.EnvVar> {
return this._client.get(`/v1/env_var/${envVarId}`, options);
}
/**
* Partially update an env_var object. Specify the fields to update in the payload.
* Any object-type fields will be deep-merged with existing content. Currently we
* do not support removing fields or setting them to null.
*/
update(
envVarId: string,
body: EnvVarUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.EnvVar> {
return this._client.patch(`/v1/env_var/${envVarId}`, { body, ...options });
}
/**
* List out all env_vars. The env_vars are sorted by creation date, with the most
* recently-created env_vars coming first
*/
list(query?: EnvVarListParams, options?: Core.RequestOptions): Core.APIPromise<EnvVarListResponse>;
list(options?: Core.RequestOptions): Core.APIPromise<EnvVarListResponse>;
list(
query: EnvVarListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<EnvVarListResponse> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.get('/v1/env_var', { query, ...options });
}
/**
* Delete an env_var object by its id
*/
delete(envVarId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.EnvVar> {
return this._client.delete(`/v1/env_var/${envVarId}`, options);
}
/**
* Create or replace env_var. If there is an existing env_var with the same name as
* the one specified in the request, will replace the existing env_var with the
* provided fields
*/
replace(body: EnvVarReplaceParams, options?: Core.RequestOptions): Core.APIPromise<Shared.EnvVar> {
return this._client.put('/v1/env_var', { body, ...options });
}
}
export interface EnvVarListResponse {
/**
* A list of env_var objects
*/
objects: Array<Shared.EnvVar>;
}
export interface EnvVarCreateParams {
/**
* The name of the environment variable
*/
name: string;
/**
* The id of the object the environment variable is scoped for
*/
object_id: string;
/**
* The type of the object the environment variable is scoped for
*/
object_type: 'organization' | 'project' | 'function';
/**
* The value of the environment variable. Will be encrypted at rest.
*/
value?: string | null;
}
export interface EnvVarUpdateParams {
/**
* The name of the environment variable
*/
name: string;
/**
* The value of the environment variable. Will be encrypted at rest.
*/
value?: string | null;
}
export interface EnvVarListParams {
/**
* Name of the env_var to search for
*/
env_var_name?: string;
/**
* Filter search results to a particular set of object IDs. To specify a list of
* IDs, include the query param multiple times
*/
ids?: string | Array<string>;
/**
* Limit the number of objects to return
*/
limit?: number | null;
/**
* The id of the object the environment variable is scoped for
*/
object_id?: string;
/**
* The type of the object the environment variable is scoped for
*/
object_type?: 'organization' | 'project' | 'function';
}
export interface EnvVarReplaceParams {
/**
* The name of the environment variable
*/
name: string;
/**
* The id of the object the environment variable is scoped for
*/
object_id: string;
/**
* The type of the object the environment variable is scoped for
*/
object_type: 'organization' | 'project' | 'function';
/**
* The value of the environment variable. Will be encrypted at rest.
*/
value?: string | null;
}
export namespace EnvVars {
export import EnvVarListResponse = EnvVarsAPI.EnvVarListResponse;
export import EnvVarCreateParams = EnvVarsAPI.EnvVarCreateParams;
export import EnvVarUpdateParams = EnvVarsAPI.EnvVarUpdateParams;
export import EnvVarListParams = EnvVarsAPI.EnvVarListParams;
export import EnvVarReplaceParams = EnvVarsAPI.EnvVarReplaceParams;
}