openai 6.47.0 → 6.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/azure.d.mts.map +1 -1
- package/azure.d.ts.map +1 -1
- package/azure.js +5 -1
- package/azure.js.map +1 -1
- package/azure.mjs +5 -1
- package/azure.mjs.map +1 -1
- package/helpers/standard-schema.d.mts +104 -0
- package/helpers/standard-schema.d.mts.map +1 -0
- package/helpers/standard-schema.d.ts +104 -0
- package/helpers/standard-schema.d.ts.map +1 -0
- package/helpers/standard-schema.js +320 -0
- package/helpers/standard-schema.js.map +1 -0
- package/helpers/standard-schema.mjs +314 -0
- package/helpers/standard-schema.mjs.map +1 -0
- package/helpers/zod.d.mts +26 -3
- package/helpers/zod.d.mts.map +1 -1
- package/helpers/zod.d.ts +26 -3
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js +97 -7
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs +96 -7
- package/helpers/zod.mjs.map +1 -1
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +7 -3
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +7 -3
- package/internal/headers.mjs.map +1 -1
- package/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/lib/AbstractChatCompletionRunner.js +43 -1
- package/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/lib/AbstractChatCompletionRunner.mjs +43 -1
- package/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/lib/ChatCompletionStream.d.mts +2 -1
- package/lib/ChatCompletionStream.d.mts.map +1 -1
- package/lib/ChatCompletionStream.d.ts +2 -1
- package/lib/ChatCompletionStream.d.ts.map +1 -1
- package/lib/ChatCompletionStream.js +53 -14
- package/lib/ChatCompletionStream.js.map +1 -1
- package/lib/ChatCompletionStream.mjs +53 -14
- package/lib/ChatCompletionStream.mjs.map +1 -1
- package/lib/ResponsesParser.d.mts.map +1 -1
- package/lib/ResponsesParser.d.ts.map +1 -1
- package/lib/ResponsesParser.js +3 -5
- package/lib/ResponsesParser.js.map +1 -1
- package/lib/ResponsesParser.mjs +3 -5
- package/lib/ResponsesParser.mjs.map +1 -1
- package/lib/jsonschema.d.mts +3 -0
- package/lib/jsonschema.d.mts.map +1 -1
- package/lib/jsonschema.d.ts +3 -0
- package/lib/jsonschema.d.ts.map +1 -1
- package/lib/transform.d.mts +25 -1
- package/lib/transform.d.mts.map +1 -1
- package/lib/transform.d.ts +25 -1
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +1521 -82
- package/lib/transform.js.map +1 -1
- package/lib/transform.mjs +1515 -82
- package/lib/transform.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/admin/organization/audit-logs.d.mts +2 -2
- package/resources/admin/organization/audit-logs.d.mts.map +1 -1
- package/resources/admin/organization/audit-logs.d.ts +2 -2
- package/resources/admin/organization/audit-logs.d.ts.map +1 -1
- package/resources/admin/organization/index.d.mts +1 -0
- package/resources/admin/organization/index.d.mts.map +1 -1
- package/resources/admin/organization/index.d.ts +1 -0
- package/resources/admin/organization/index.d.ts.map +1 -1
- package/resources/admin/organization/index.js +3 -1
- package/resources/admin/organization/index.js.map +1 -1
- package/resources/admin/organization/index.mjs +1 -0
- package/resources/admin/organization/index.mjs.map +1 -1
- package/resources/admin/organization/organization.d.mts +4 -0
- package/resources/admin/organization/organization.d.mts.map +1 -1
- package/resources/admin/organization/organization.d.ts +4 -0
- package/resources/admin/organization/organization.d.ts.map +1 -1
- package/resources/admin/organization/organization.js +4 -0
- package/resources/admin/organization/organization.js.map +1 -1
- package/resources/admin/organization/organization.mjs +4 -0
- package/resources/admin/organization/organization.mjs.map +1 -1
- package/resources/admin/organization/projects/index.d.mts +2 -1
- package/resources/admin/organization/projects/index.d.mts.map +1 -1
- package/resources/admin/organization/projects/index.d.ts +2 -1
- package/resources/admin/organization/projects/index.d.ts.map +1 -1
- package/resources/admin/organization/projects/index.js +7 -5
- package/resources/admin/organization/projects/index.js.map +1 -1
- package/resources/admin/organization/projects/index.mjs +2 -1
- package/resources/admin/organization/projects/index.mjs.map +1 -1
- package/resources/admin/organization/projects/projects.d.mts +6 -2
- package/resources/admin/organization/projects/projects.d.mts.map +1 -1
- package/resources/admin/organization/projects/projects.d.ts +6 -2
- package/resources/admin/organization/projects/projects.d.ts.map +1 -1
- package/resources/admin/organization/projects/projects.js +6 -2
- package/resources/admin/organization/projects/projects.js.map +1 -1
- package/resources/admin/organization/projects/projects.mjs +6 -2
- package/resources/admin/organization/projects/projects.mjs.map +1 -1
- package/resources/admin/organization/projects/service-accounts/api-keys.d.mts +58 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.d.ts +58 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.js.map +1 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
- package/resources/admin/organization/projects/service-accounts/api-keys.mjs.map +1 -0
- package/resources/admin/organization/projects/service-accounts/index.d.mts +3 -0
- package/resources/admin/organization/projects/service-accounts/index.d.mts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/index.d.ts +3 -0
- package/resources/admin/organization/projects/service-accounts/index.d.ts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/index.js +9 -0
- package/resources/admin/organization/projects/service-accounts/index.js.map +1 -0
- package/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
- package/resources/admin/organization/projects/service-accounts/index.mjs.map +1 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.d.mts +177 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.d.mts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.d.ts +177 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.d.ts.map +1 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.js.map +1 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
- package/resources/admin/organization/projects/service-accounts/service-accounts.mjs.map +1 -0
- package/resources/admin/organization/projects/service-accounts.d.mts +1 -167
- package/resources/admin/organization/projects/service-accounts.d.mts.map +1 -1
- package/resources/admin/organization/projects/service-accounts.d.ts +1 -167
- package/resources/admin/organization/projects/service-accounts.d.ts.map +1 -1
- package/resources/admin/organization/projects/service-accounts.js +2 -97
- package/resources/admin/organization/projects/service-accounts.js.map +1 -1
- package/resources/admin/organization/projects/service-accounts.mjs +1 -95
- package/resources/admin/organization/projects/service-accounts.mjs.map +1 -1
- package/resources/admin/organization/projects/spend-limit.d.mts +115 -0
- package/resources/admin/organization/projects/spend-limit.d.mts.map +1 -0
- package/resources/admin/organization/projects/spend-limit.d.ts +115 -0
- package/resources/admin/organization/projects/spend-limit.d.ts.map +1 -0
- package/resources/admin/organization/projects/spend-limit.js +67 -0
- package/resources/admin/organization/projects/spend-limit.js.map +1 -0
- package/resources/admin/organization/projects/spend-limit.mjs +63 -0
- package/resources/admin/organization/projects/spend-limit.mjs.map +1 -0
- package/resources/admin/organization/spend-limit.d.mts +108 -0
- package/resources/admin/organization/spend-limit.d.mts.map +1 -0
- package/resources/admin/organization/spend-limit.d.ts +108 -0
- package/resources/admin/organization/spend-limit.d.ts.map +1 -0
- package/resources/admin/organization/spend-limit.js +59 -0
- package/resources/admin/organization/spend-limit.js.map +1 -0
- package/resources/admin/organization/spend-limit.mjs +55 -0
- package/resources/admin/organization/spend-limit.mjs.map +1 -0
- package/resources/admin/organization/usage.d.mts +517 -88
- package/resources/admin/organization/usage.d.mts.map +1 -1
- package/resources/admin/organization/usage.d.ts +517 -88
- package/resources/admin/organization/usage.d.ts.map +1 -1
- package/resources/beta/responses/input-tokens.d.mts +6 -2
- package/resources/beta/responses/input-tokens.d.mts.map +1 -1
- package/resources/beta/responses/input-tokens.d.ts +6 -2
- package/resources/beta/responses/input-tokens.d.ts.map +1 -1
- package/resources/beta/responses/responses.d.mts +25 -15
- package/resources/beta/responses/responses.d.mts.map +1 -1
- package/resources/beta/responses/responses.d.ts +25 -15
- package/resources/beta/responses/responses.d.ts.map +1 -1
- package/resources/beta/responses/responses.js.map +1 -1
- package/resources/beta/responses/responses.mjs.map +1 -1
- package/resources/chat/completions/completions.d.mts +4 -3
- package/resources/chat/completions/completions.d.mts.map +1 -1
- package/resources/chat/completions/completions.d.ts +4 -3
- package/resources/chat/completions/completions.d.ts.map +1 -1
- package/resources/chat/completions/completions.js.map +1 -1
- package/resources/chat/completions/completions.mjs.map +1 -1
- package/resources/responses/input-tokens.d.mts +2 -1
- package/resources/responses/input-tokens.d.mts.map +1 -1
- package/resources/responses/input-tokens.d.ts +2 -1
- package/resources/responses/input-tokens.d.ts.map +1 -1
- package/resources/responses/responses.d.mts +9 -8
- package/resources/responses/responses.d.mts.map +1 -1
- package/resources/responses/responses.d.ts +9 -8
- package/resources/responses/responses.d.ts.map +1 -1
- package/resources/responses/responses.js.map +1 -1
- package/resources/responses/responses.mjs.map +1 -1
- package/resources/shared.d.mts +4 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +4 -1
- package/resources/shared.d.ts.map +1 -1
- package/src/azure.ts +5 -1
- package/src/helpers/standard-schema.ts +570 -0
- package/src/helpers/zod.ts +158 -29
- package/src/internal/headers.ts +7 -3
- package/src/lib/AbstractChatCompletionRunner.ts +43 -1
- package/src/lib/ChatCompletionStream.ts +56 -8
- package/src/lib/ResponsesParser.ts +7 -5
- package/src/lib/jsonschema.ts +3 -0
- package/src/lib/transform.ts +1930 -103
- package/src/resources/admin/organization/audit-logs.ts +169 -1
- package/src/resources/admin/organization/index.ts +6 -0
- package/src/resources/admin/organization/organization.ts +16 -0
- package/src/resources/admin/organization/projects/index.ts +7 -1
- package/src/resources/admin/organization/projects/projects.ts +29 -13
- package/src/resources/admin/organization/projects/service-accounts/api-keys.ts +80 -0
- package/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
- package/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +284 -0
- package/src/resources/admin/organization/projects/service-accounts.ts +1 -264
- package/src/resources/admin/organization/projects/spend-limit.ts +156 -0
- package/src/resources/admin/organization/spend-limit.ts +144 -0
- package/src/resources/admin/organization/usage.ts +616 -88
- package/src/resources/beta/responses/input-tokens.ts +6 -2
- package/src/resources/beta/responses/responses.ts +25 -14
- package/src/resources/chat/completions/completions.ts +4 -3
- package/src/resources/responses/input-tokens.ts +2 -1
- package/src/resources/responses/responses.ts +9 -7
- package/src/resources/shared.ts +4 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../../core/resource';
|
|
4
|
+
import * as APIKeysAPI from './api-keys';
|
|
5
|
+
import { APIKeyCreateParams, APIKeyCreateResponse, APIKeys } from './api-keys';
|
|
6
|
+
import { APIPromise } from '../../../../../core/api-promise';
|
|
7
|
+
import {
|
|
8
|
+
ConversationCursorPage,
|
|
9
|
+
type ConversationCursorPageParams,
|
|
10
|
+
PagePromise,
|
|
11
|
+
} from '../../../../../core/pagination';
|
|
12
|
+
import { RequestOptions } from '../../../../../internal/request-options';
|
|
13
|
+
import { path } from '../../../../../internal/utils/path';
|
|
14
|
+
|
|
15
|
+
export class ServiceAccounts extends APIResource {
|
|
16
|
+
apiKeys: APIKeysAPI.APIKeys = new APIKeysAPI.APIKeys(this._client);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new service account in the project. By default, this also returns an
|
|
20
|
+
* unredacted API key for the service account.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const serviceAccount =
|
|
25
|
+
* await client.admin.organization.projects.serviceAccounts.create(
|
|
26
|
+
* 'project_id',
|
|
27
|
+
* { name: 'name' },
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
create(
|
|
32
|
+
projectID: string,
|
|
33
|
+
body: ServiceAccountCreateParams,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<ServiceAccountCreateResponse> {
|
|
36
|
+
return this._client.post(path`/organization/projects/${projectID}/service_accounts`, {
|
|
37
|
+
body,
|
|
38
|
+
...options,
|
|
39
|
+
__security: { adminAPIKeyAuth: true },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves a service account in the project.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const projectServiceAccount =
|
|
49
|
+
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
50
|
+
* 'service_account_id',
|
|
51
|
+
* { project_id: 'project_id' },
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
retrieve(
|
|
56
|
+
serviceAccountID: string,
|
|
57
|
+
params: ServiceAccountRetrieveParams,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): APIPromise<ProjectServiceAccount> {
|
|
60
|
+
const { project_id } = params;
|
|
61
|
+
return this._client.get(path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
62
|
+
...options,
|
|
63
|
+
__security: { adminAPIKeyAuth: true },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Updates a service account in the project.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const projectServiceAccount =
|
|
73
|
+
* await client.admin.organization.projects.serviceAccounts.update(
|
|
74
|
+
* 'service_account_id',
|
|
75
|
+
* { project_id: 'project_id' },
|
|
76
|
+
* );
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
update(
|
|
80
|
+
serviceAccountID: string,
|
|
81
|
+
params: ServiceAccountUpdateParams,
|
|
82
|
+
options?: RequestOptions,
|
|
83
|
+
): APIPromise<ProjectServiceAccount> {
|
|
84
|
+
const { project_id, ...body } = params;
|
|
85
|
+
return this._client.post(
|
|
86
|
+
path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`,
|
|
87
|
+
{ body, ...options, __security: { adminAPIKeyAuth: true } },
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns a list of service accounts in the project.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* // Automatically fetches more pages as needed.
|
|
97
|
+
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
98
|
+
* 'project_id',
|
|
99
|
+
* )) {
|
|
100
|
+
* // ...
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
list(
|
|
105
|
+
projectID: string,
|
|
106
|
+
query: ServiceAccountListParams | null | undefined = {},
|
|
107
|
+
options?: RequestOptions,
|
|
108
|
+
): PagePromise<ProjectServiceAccountsPage, ProjectServiceAccount> {
|
|
109
|
+
return this._client.getAPIList(
|
|
110
|
+
path`/organization/projects/${projectID}/service_accounts`,
|
|
111
|
+
ConversationCursorPage<ProjectServiceAccount>,
|
|
112
|
+
{ query, ...options, __security: { adminAPIKeyAuth: true } },
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Deletes a service account from the project.
|
|
118
|
+
*
|
|
119
|
+
* Returns confirmation of service account deletion, or an error if the project is
|
|
120
|
+
* archived (archived projects have no service accounts).
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const serviceAccount =
|
|
125
|
+
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
126
|
+
* 'service_account_id',
|
|
127
|
+
* { project_id: 'project_id' },
|
|
128
|
+
* );
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
delete(
|
|
132
|
+
serviceAccountID: string,
|
|
133
|
+
params: ServiceAccountDeleteParams,
|
|
134
|
+
options?: RequestOptions,
|
|
135
|
+
): APIPromise<ServiceAccountDeleteResponse> {
|
|
136
|
+
const { project_id } = params;
|
|
137
|
+
return this._client.delete(
|
|
138
|
+
path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`,
|
|
139
|
+
{ ...options, __security: { adminAPIKeyAuth: true } },
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type ProjectServiceAccountsPage = ConversationCursorPage<ProjectServiceAccount>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Represents an individual service account in a project.
|
|
148
|
+
*/
|
|
149
|
+
export interface ProjectServiceAccount {
|
|
150
|
+
/**
|
|
151
|
+
* The identifier, which can be referenced in API endpoints
|
|
152
|
+
*/
|
|
153
|
+
id: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The Unix timestamp (in seconds) of when the service account was created
|
|
157
|
+
*/
|
|
158
|
+
created_at: number;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The name of the service account
|
|
162
|
+
*/
|
|
163
|
+
name: string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The object type, which is always `organization.project.service_account`
|
|
167
|
+
*/
|
|
168
|
+
object: 'organization.project.service_account';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `owner`, `member`, or `none`
|
|
172
|
+
*/
|
|
173
|
+
role: 'owner' | 'member' | 'none';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface ServiceAccountCreateResponse {
|
|
177
|
+
id: string;
|
|
178
|
+
|
|
179
|
+
api_key: ServiceAccountCreateResponse.APIKey | null;
|
|
180
|
+
|
|
181
|
+
created_at: number;
|
|
182
|
+
|
|
183
|
+
name: string;
|
|
184
|
+
|
|
185
|
+
object: 'organization.project.service_account';
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Service accounts created with default project membership have role `member`.
|
|
189
|
+
* Accounts created with `create_service_account_only` have role `none`.
|
|
190
|
+
*/
|
|
191
|
+
role: 'member' | 'none';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export namespace ServiceAccountCreateResponse {
|
|
195
|
+
export interface APIKey {
|
|
196
|
+
id: string;
|
|
197
|
+
|
|
198
|
+
created_at: number;
|
|
199
|
+
|
|
200
|
+
name: string;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The object type, which is always `organization.project.service_account.api_key`
|
|
204
|
+
*/
|
|
205
|
+
object: 'organization.project.service_account.api_key';
|
|
206
|
+
|
|
207
|
+
value: string;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ServiceAccountDeleteResponse {
|
|
212
|
+
id: string;
|
|
213
|
+
|
|
214
|
+
deleted: boolean;
|
|
215
|
+
|
|
216
|
+
object: 'organization.project.service_account.deleted';
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface ServiceAccountCreateParams {
|
|
220
|
+
/**
|
|
221
|
+
* The name of the service account being created.
|
|
222
|
+
*/
|
|
223
|
+
name: string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Create the service account without default roles or an API key.
|
|
227
|
+
*/
|
|
228
|
+
create_service_account_only?: boolean | null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface ServiceAccountRetrieveParams {
|
|
232
|
+
/**
|
|
233
|
+
* The ID of the project.
|
|
234
|
+
*/
|
|
235
|
+
project_id: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface ServiceAccountUpdateParams {
|
|
239
|
+
/**
|
|
240
|
+
* Path param: The ID of the project.
|
|
241
|
+
*/
|
|
242
|
+
project_id: string;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Body param: The updated service account name.
|
|
246
|
+
*/
|
|
247
|
+
name?: string;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Body param: The updated service account role.
|
|
251
|
+
*/
|
|
252
|
+
role?: 'member' | 'owner';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface ServiceAccountListParams extends ConversationCursorPageParams {}
|
|
256
|
+
|
|
257
|
+
export interface ServiceAccountDeleteParams {
|
|
258
|
+
/**
|
|
259
|
+
* The ID of the project.
|
|
260
|
+
*/
|
|
261
|
+
project_id: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
ServiceAccounts.APIKeys = APIKeys;
|
|
265
|
+
|
|
266
|
+
export declare namespace ServiceAccounts {
|
|
267
|
+
export {
|
|
268
|
+
type ProjectServiceAccount as ProjectServiceAccount,
|
|
269
|
+
type ServiceAccountCreateResponse as ServiceAccountCreateResponse,
|
|
270
|
+
type ServiceAccountDeleteResponse as ServiceAccountDeleteResponse,
|
|
271
|
+
type ProjectServiceAccountsPage as ProjectServiceAccountsPage,
|
|
272
|
+
type ServiceAccountCreateParams as ServiceAccountCreateParams,
|
|
273
|
+
type ServiceAccountRetrieveParams as ServiceAccountRetrieveParams,
|
|
274
|
+
type ServiceAccountUpdateParams as ServiceAccountUpdateParams,
|
|
275
|
+
type ServiceAccountListParams as ServiceAccountListParams,
|
|
276
|
+
type ServiceAccountDeleteParams as ServiceAccountDeleteParams,
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
APIKeys as APIKeys,
|
|
281
|
+
type APIKeyCreateResponse as APIKeyCreateResponse,
|
|
282
|
+
type APIKeyCreateParams as APIKeyCreateParams,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
@@ -1,266 +1,3 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { APIPromise } from '../../../../core/api-promise';
|
|
5
|
-
import {
|
|
6
|
-
ConversationCursorPage,
|
|
7
|
-
type ConversationCursorPageParams,
|
|
8
|
-
PagePromise,
|
|
9
|
-
} from '../../../../core/pagination';
|
|
10
|
-
import { RequestOptions } from '../../../../internal/request-options';
|
|
11
|
-
import { path } from '../../../../internal/utils/path';
|
|
12
|
-
|
|
13
|
-
export class ServiceAccounts extends APIResource {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new service account in the project. This also returns an unredacted
|
|
16
|
-
* API key for the service account.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const serviceAccount =
|
|
21
|
-
* await client.admin.organization.projects.serviceAccounts.create(
|
|
22
|
-
* 'project_id',
|
|
23
|
-
* { name: 'name' },
|
|
24
|
-
* );
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
create(
|
|
28
|
-
projectID: string,
|
|
29
|
-
body: ServiceAccountCreateParams,
|
|
30
|
-
options?: RequestOptions,
|
|
31
|
-
): APIPromise<ServiceAccountCreateResponse> {
|
|
32
|
-
return this._client.post(path`/organization/projects/${projectID}/service_accounts`, {
|
|
33
|
-
body,
|
|
34
|
-
...options,
|
|
35
|
-
__security: { adminAPIKeyAuth: true },
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Retrieves a service account in the project.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* const projectServiceAccount =
|
|
45
|
-
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
46
|
-
* 'service_account_id',
|
|
47
|
-
* { project_id: 'project_id' },
|
|
48
|
-
* );
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
retrieve(
|
|
52
|
-
serviceAccountID: string,
|
|
53
|
-
params: ServiceAccountRetrieveParams,
|
|
54
|
-
options?: RequestOptions,
|
|
55
|
-
): APIPromise<ProjectServiceAccount> {
|
|
56
|
-
const { project_id } = params;
|
|
57
|
-
return this._client.get(path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
58
|
-
...options,
|
|
59
|
-
__security: { adminAPIKeyAuth: true },
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Updates a service account in the project.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* const projectServiceAccount =
|
|
69
|
-
* await client.admin.organization.projects.serviceAccounts.update(
|
|
70
|
-
* 'service_account_id',
|
|
71
|
-
* { project_id: 'project_id' },
|
|
72
|
-
* );
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
update(
|
|
76
|
-
serviceAccountID: string,
|
|
77
|
-
params: ServiceAccountUpdateParams,
|
|
78
|
-
options?: RequestOptions,
|
|
79
|
-
): APIPromise<ProjectServiceAccount> {
|
|
80
|
-
const { project_id, ...body } = params;
|
|
81
|
-
return this._client.post(
|
|
82
|
-
path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`,
|
|
83
|
-
{ body, ...options, __security: { adminAPIKeyAuth: true } },
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Returns a list of service accounts in the project.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```ts
|
|
92
|
-
* // Automatically fetches more pages as needed.
|
|
93
|
-
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
94
|
-
* 'project_id',
|
|
95
|
-
* )) {
|
|
96
|
-
* // ...
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
list(
|
|
101
|
-
projectID: string,
|
|
102
|
-
query: ServiceAccountListParams | null | undefined = {},
|
|
103
|
-
options?: RequestOptions,
|
|
104
|
-
): PagePromise<ProjectServiceAccountsPage, ProjectServiceAccount> {
|
|
105
|
-
return this._client.getAPIList(
|
|
106
|
-
path`/organization/projects/${projectID}/service_accounts`,
|
|
107
|
-
ConversationCursorPage<ProjectServiceAccount>,
|
|
108
|
-
{ query, ...options, __security: { adminAPIKeyAuth: true } },
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Deletes a service account from the project.
|
|
114
|
-
*
|
|
115
|
-
* Returns confirmation of service account deletion, or an error if the project is
|
|
116
|
-
* archived (archived projects have no service accounts).
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* const serviceAccount =
|
|
121
|
-
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
122
|
-
* 'service_account_id',
|
|
123
|
-
* { project_id: 'project_id' },
|
|
124
|
-
* );
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
delete(
|
|
128
|
-
serviceAccountID: string,
|
|
129
|
-
params: ServiceAccountDeleteParams,
|
|
130
|
-
options?: RequestOptions,
|
|
131
|
-
): APIPromise<ServiceAccountDeleteResponse> {
|
|
132
|
-
const { project_id } = params;
|
|
133
|
-
return this._client.delete(
|
|
134
|
-
path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`,
|
|
135
|
-
{ ...options, __security: { adminAPIKeyAuth: true } },
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export type ProjectServiceAccountsPage = ConversationCursorPage<ProjectServiceAccount>;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Represents an individual service account in a project.
|
|
144
|
-
*/
|
|
145
|
-
export interface ProjectServiceAccount {
|
|
146
|
-
/**
|
|
147
|
-
* The identifier, which can be referenced in API endpoints
|
|
148
|
-
*/
|
|
149
|
-
id: string;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* The Unix timestamp (in seconds) of when the service account was created
|
|
153
|
-
*/
|
|
154
|
-
created_at: number;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* The name of the service account
|
|
158
|
-
*/
|
|
159
|
-
name: string;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* The object type, which is always `organization.project.service_account`
|
|
163
|
-
*/
|
|
164
|
-
object: 'organization.project.service_account';
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* `owner` or `member`
|
|
168
|
-
*/
|
|
169
|
-
role: 'owner' | 'member';
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface ServiceAccountCreateResponse {
|
|
173
|
-
id: string;
|
|
174
|
-
|
|
175
|
-
api_key: ServiceAccountCreateResponse.APIKey | null;
|
|
176
|
-
|
|
177
|
-
created_at: number;
|
|
178
|
-
|
|
179
|
-
name: string;
|
|
180
|
-
|
|
181
|
-
object: 'organization.project.service_account';
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Service accounts can only have one role of type `member`
|
|
185
|
-
*/
|
|
186
|
-
role: 'member';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export namespace ServiceAccountCreateResponse {
|
|
190
|
-
export interface APIKey {
|
|
191
|
-
id: string;
|
|
192
|
-
|
|
193
|
-
created_at: number;
|
|
194
|
-
|
|
195
|
-
name: string;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* The object type, which is always `organization.project.service_account.api_key`
|
|
199
|
-
*/
|
|
200
|
-
object: 'organization.project.service_account.api_key';
|
|
201
|
-
|
|
202
|
-
value: string;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export interface ServiceAccountDeleteResponse {
|
|
207
|
-
id: string;
|
|
208
|
-
|
|
209
|
-
deleted: boolean;
|
|
210
|
-
|
|
211
|
-
object: 'organization.project.service_account.deleted';
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface ServiceAccountCreateParams {
|
|
215
|
-
/**
|
|
216
|
-
* The name of the service account being created.
|
|
217
|
-
*/
|
|
218
|
-
name: string;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface ServiceAccountRetrieveParams {
|
|
222
|
-
/**
|
|
223
|
-
* The ID of the project.
|
|
224
|
-
*/
|
|
225
|
-
project_id: string;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export interface ServiceAccountUpdateParams {
|
|
229
|
-
/**
|
|
230
|
-
* Path param: The ID of the project.
|
|
231
|
-
*/
|
|
232
|
-
project_id: string;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Body param: The updated service account name.
|
|
236
|
-
*/
|
|
237
|
-
name?: string;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Body param: The updated service account role.
|
|
241
|
-
*/
|
|
242
|
-
role?: 'member' | 'owner';
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export interface ServiceAccountListParams extends ConversationCursorPageParams {}
|
|
246
|
-
|
|
247
|
-
export interface ServiceAccountDeleteParams {
|
|
248
|
-
/**
|
|
249
|
-
* The ID of the project.
|
|
250
|
-
*/
|
|
251
|
-
project_id: string;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export declare namespace ServiceAccounts {
|
|
255
|
-
export {
|
|
256
|
-
type ProjectServiceAccount as ProjectServiceAccount,
|
|
257
|
-
type ServiceAccountCreateResponse as ServiceAccountCreateResponse,
|
|
258
|
-
type ServiceAccountDeleteResponse as ServiceAccountDeleteResponse,
|
|
259
|
-
type ProjectServiceAccountsPage as ProjectServiceAccountsPage,
|
|
260
|
-
type ServiceAccountCreateParams as ServiceAccountCreateParams,
|
|
261
|
-
type ServiceAccountRetrieveParams as ServiceAccountRetrieveParams,
|
|
262
|
-
type ServiceAccountUpdateParams as ServiceAccountUpdateParams,
|
|
263
|
-
type ServiceAccountListParams as ServiceAccountListParams,
|
|
264
|
-
type ServiceAccountDeleteParams as ServiceAccountDeleteParams,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
3
|
+
export * from './service-accounts/index';
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../../../internal/request-options';
|
|
6
|
+
import { path } from '../../../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class SpendLimit extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Get a project's hard spend limit.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const projectSpendLimit =
|
|
15
|
+
* await client.admin.organization.projects.spendLimit.retrieve(
|
|
16
|
+
* 'proj_123',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
retrieve(projectID: string, options?: RequestOptions): APIPromise<ProjectSpendLimit> {
|
|
21
|
+
return this._client.get(path`/organization/projects/${projectID}/spend_limit`, {
|
|
22
|
+
...options,
|
|
23
|
+
__security: { adminAPIKeyAuth: true },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create or replace a project's hard spend limit.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const projectSpendLimit =
|
|
33
|
+
* await client.admin.organization.projects.spendLimit.update(
|
|
34
|
+
* 'proj_123',
|
|
35
|
+
* {
|
|
36
|
+
* currency: 'USD',
|
|
37
|
+
* interval: 'month',
|
|
38
|
+
* threshold_amount: 1,
|
|
39
|
+
* },
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
update(
|
|
44
|
+
projectID: string,
|
|
45
|
+
body: SpendLimitUpdateParams,
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): APIPromise<ProjectSpendLimit> {
|
|
48
|
+
return this._client.post(path`/organization/projects/${projectID}/spend_limit`, {
|
|
49
|
+
body,
|
|
50
|
+
...options,
|
|
51
|
+
__security: { adminAPIKeyAuth: true },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Delete a project's hard spend limit.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const projectSpendLimitDeleted =
|
|
61
|
+
* await client.admin.organization.projects.spendLimit.delete(
|
|
62
|
+
* 'proj_123',
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
delete(projectID: string, options?: RequestOptions): APIPromise<ProjectSpendLimitDeleted> {
|
|
67
|
+
return this._client.delete(path`/organization/projects/${projectID}/spend_limit`, {
|
|
68
|
+
...options,
|
|
69
|
+
__security: { adminAPIKeyAuth: true },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Represents a hard spend limit configured at the project level.
|
|
76
|
+
*/
|
|
77
|
+
export interface ProjectSpendLimit {
|
|
78
|
+
/**
|
|
79
|
+
* The currency for the threshold amount. Currently, only `USD` is supported.
|
|
80
|
+
*/
|
|
81
|
+
currency: (string & {}) | 'USD';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The current enforcement state of the hard spend limit.
|
|
85
|
+
*/
|
|
86
|
+
enforcement: ProjectSpendLimit.Enforcement;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The time interval for evaluating spend against the threshold. Currently, only
|
|
90
|
+
* `month` is supported.
|
|
91
|
+
*/
|
|
92
|
+
interval: (string & {}) | 'month';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The object type, which is always `project.spend_limit`.
|
|
96
|
+
*/
|
|
97
|
+
object: 'project.spend_limit';
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The hard spend limit amount, in cents.
|
|
101
|
+
*/
|
|
102
|
+
threshold_amount: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export namespace ProjectSpendLimit {
|
|
106
|
+
/**
|
|
107
|
+
* The current enforcement state of the hard spend limit.
|
|
108
|
+
*/
|
|
109
|
+
export interface Enforcement {
|
|
110
|
+
/**
|
|
111
|
+
* Whether the hard spend limit is currently enforcing.
|
|
112
|
+
*/
|
|
113
|
+
status: (string & {}) | 'inactive' | 'enforcing';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Confirmation payload returned after deleting a project hard spend limit.
|
|
119
|
+
*/
|
|
120
|
+
export interface ProjectSpendLimitDeleted {
|
|
121
|
+
/**
|
|
122
|
+
* Whether the hard spend limit was deleted.
|
|
123
|
+
*/
|
|
124
|
+
deleted: boolean;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The object type, which is always `project.spend_limit.deleted`.
|
|
128
|
+
*/
|
|
129
|
+
object: 'project.spend_limit.deleted';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface SpendLimitUpdateParams {
|
|
133
|
+
/**
|
|
134
|
+
* The currency for the threshold amount. Currently, only `USD` is supported.
|
|
135
|
+
*/
|
|
136
|
+
currency: 'USD';
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The time interval for evaluating spend against the threshold. Currently, only
|
|
140
|
+
* `month` is supported.
|
|
141
|
+
*/
|
|
142
|
+
interval: 'month';
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The hard spend limit amount, in cents.
|
|
146
|
+
*/
|
|
147
|
+
threshold_amount: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare namespace SpendLimit {
|
|
151
|
+
export {
|
|
152
|
+
type ProjectSpendLimit as ProjectSpendLimit,
|
|
153
|
+
type ProjectSpendLimitDeleted as ProjectSpendLimitDeleted,
|
|
154
|
+
type SpendLimitUpdateParams as SpendLimitUpdateParams,
|
|
155
|
+
};
|
|
156
|
+
}
|