-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai-secrets.ts
198 lines (168 loc) · 5.96 KB
/
ai-secrets.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// 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 AISecretsAPI from './ai-secrets';
import * as Shared from './shared';
import { AISecretsListObjects } from './shared';
import { type ListObjectsParams } from '../pagination';
export class AISecrets extends APIResource {
/**
* Create a new ai_secret. If there is an existing ai_secret with the same name as
* the one specified in the request, will return the existing ai_secret unmodified
*/
create(body: AISecretCreateParams, options?: Core.RequestOptions): Core.APIPromise<Shared.AISecret> {
return this._client.post('/v1/ai_secret', { body, ...options });
}
/**
* Get an ai_secret object by its id
*/
retrieve(aiSecretId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.AISecret> {
return this._client.get(`/v1/ai_secret/${aiSecretId}`, options);
}
/**
* Partially update an ai_secret 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(
aiSecretId: string,
body?: AISecretUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.AISecret>;
update(aiSecretId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.AISecret>;
update(
aiSecretId: string,
body: AISecretUpdateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<Shared.AISecret> {
if (isRequestOptions(body)) {
return this.update(aiSecretId, {}, body);
}
return this._client.patch(`/v1/ai_secret/${aiSecretId}`, { body, ...options });
}
/**
* List out all ai_secrets. The ai_secrets are sorted by creation date, with the
* most recently-created ai_secrets coming first
*/
list(
query?: AISecretListParams,
options?: Core.RequestOptions,
): Core.PagePromise<AISecretsListObjects, Shared.AISecret>;
list(options?: Core.RequestOptions): Core.PagePromise<AISecretsListObjects, Shared.AISecret>;
list(
query: AISecretListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<AISecretsListObjects, Shared.AISecret> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/v1/ai_secret', AISecretsListObjects, { query, ...options });
}
/**
* Delete an ai_secret object by its id
*/
delete(aiSecretId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.AISecret> {
return this._client.delete(`/v1/ai_secret/${aiSecretId}`, options);
}
/**
* Delete a single ai_secret
*/
findAndDelete(
body: AISecretFindAndDeleteParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.AISecret> {
return this._client.delete('/v1/ai_secret', { body, ...options });
}
/**
* Create or replace ai_secret. If there is an existing ai_secret with the same
* name as the one specified in the request, will replace the existing ai_secret
* with the provided fields
*/
replace(body: AISecretReplaceParams, options?: Core.RequestOptions): Core.APIPromise<Shared.AISecret> {
return this._client.put('/v1/ai_secret', { body, ...options });
}
}
export interface AISecretCreateParams {
/**
* Name of the AI secret
*/
name: string;
metadata?: Record<string, unknown> | null;
/**
* For nearly all users, this parameter should be unnecessary. But in the rare case
* that your API key belongs to multiple organizations, you may specify the name of
* the organization the AI Secret belongs in.
*/
org_name?: string | null;
/**
* Secret value. If omitted in a PUT request, the existing secret value will be
* left intact, not replaced with null.
*/
secret?: string | null;
type?: string | null;
}
export interface AISecretUpdateParams {
metadata?: Record<string, unknown> | null;
/**
* Name of the AI secret
*/
name?: string | null;
secret?: string | null;
type?: string | null;
}
export interface AISecretListParams extends ListObjectsParams {
/**
* Name of the ai_secret to search for
*/
ai_secret_name?: string;
ai_secret_type?: string | Array<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>;
/**
* Filter search results to within a particular organization
*/
org_name?: string;
}
export interface AISecretFindAndDeleteParams {
/**
* Name of the AI secret
*/
name: string;
/**
* For nearly all users, this parameter should be unnecessary. But in the rare case
* that your API key belongs to multiple organizations, you may specify the name of
* the organization the AI Secret belongs in.
*/
org_name?: string | null;
}
export interface AISecretReplaceParams {
/**
* Name of the AI secret
*/
name: string;
metadata?: Record<string, unknown> | null;
/**
* For nearly all users, this parameter should be unnecessary. But in the rare case
* that your API key belongs to multiple organizations, you may specify the name of
* the organization the AI Secret belongs in.
*/
org_name?: string | null;
/**
* Secret value. If omitted in a PUT request, the existing secret value will be
* left intact, not replaced with null.
*/
secret?: string | null;
type?: string | null;
}
export namespace AISecrets {
export import AISecretCreateParams = AISecretsAPI.AISecretCreateParams;
export import AISecretUpdateParams = AISecretsAPI.AISecretUpdateParams;
export import AISecretListParams = AISecretsAPI.AISecretListParams;
export import AISecretFindAndDeleteParams = AISecretsAPI.AISecretFindAndDeleteParams;
export import AISecretReplaceParams = AISecretsAPI.AISecretReplaceParams;
}
export { AISecretsListObjects };