openai 6.47.0 → 6.48.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/internal/headers.d.mts.map +1 -1
  3. package/internal/headers.d.ts.map +1 -1
  4. package/internal/headers.js +7 -3
  5. package/internal/headers.js.map +1 -1
  6. package/internal/headers.mjs +7 -3
  7. package/internal/headers.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/admin/organization/audit-logs.d.mts +2 -2
  10. package/resources/admin/organization/audit-logs.d.mts.map +1 -1
  11. package/resources/admin/organization/audit-logs.d.ts +2 -2
  12. package/resources/admin/organization/audit-logs.d.ts.map +1 -1
  13. package/resources/admin/organization/projects/index.d.mts +1 -1
  14. package/resources/admin/organization/projects/index.d.mts.map +1 -1
  15. package/resources/admin/organization/projects/index.d.ts +1 -1
  16. package/resources/admin/organization/projects/index.d.ts.map +1 -1
  17. package/resources/admin/organization/projects/index.js +4 -4
  18. package/resources/admin/organization/projects/index.js.map +1 -1
  19. package/resources/admin/organization/projects/index.mjs +1 -1
  20. package/resources/admin/organization/projects/index.mjs.map +1 -1
  21. package/resources/admin/organization/projects/projects.d.mts +2 -2
  22. package/resources/admin/organization/projects/projects.d.mts.map +1 -1
  23. package/resources/admin/organization/projects/projects.d.ts +2 -2
  24. package/resources/admin/organization/projects/projects.d.ts.map +1 -1
  25. package/resources/admin/organization/projects/projects.js +2 -2
  26. package/resources/admin/organization/projects/projects.js.map +1 -1
  27. package/resources/admin/organization/projects/projects.mjs +2 -2
  28. package/resources/admin/organization/projects/projects.mjs.map +1 -1
  29. package/resources/admin/organization/projects/service-accounts/api-keys.d.mts +58 -0
  30. package/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -0
  31. package/resources/admin/organization/projects/service-accounts/api-keys.d.ts +58 -0
  32. package/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -0
  33. package/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
  34. package/resources/admin/organization/projects/service-accounts/api-keys.js.map +1 -0
  35. package/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
  36. package/resources/admin/organization/projects/service-accounts/api-keys.mjs.map +1 -0
  37. package/resources/admin/organization/projects/service-accounts/index.d.mts +3 -0
  38. package/resources/admin/organization/projects/service-accounts/index.d.mts.map +1 -0
  39. package/resources/admin/organization/projects/service-accounts/index.d.ts +3 -0
  40. package/resources/admin/organization/projects/service-accounts/index.d.ts.map +1 -0
  41. package/resources/admin/organization/projects/service-accounts/index.js +9 -0
  42. package/resources/admin/organization/projects/service-accounts/index.js.map +1 -0
  43. package/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
  44. package/resources/admin/organization/projects/service-accounts/index.mjs.map +1 -0
  45. package/resources/admin/organization/projects/service-accounts/service-accounts.d.mts +177 -0
  46. package/resources/admin/organization/projects/service-accounts/service-accounts.d.mts.map +1 -0
  47. package/resources/admin/organization/projects/service-accounts/service-accounts.d.ts +177 -0
  48. package/resources/admin/organization/projects/service-accounts/service-accounts.d.ts.map +1 -0
  49. package/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
  50. package/resources/admin/organization/projects/service-accounts/service-accounts.js.map +1 -0
  51. package/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
  52. package/resources/admin/organization/projects/service-accounts/service-accounts.mjs.map +1 -0
  53. package/resources/admin/organization/projects/service-accounts.d.mts +1 -167
  54. package/resources/admin/organization/projects/service-accounts.d.mts.map +1 -1
  55. package/resources/admin/organization/projects/service-accounts.d.ts +1 -167
  56. package/resources/admin/organization/projects/service-accounts.d.ts.map +1 -1
  57. package/resources/admin/organization/projects/service-accounts.js +2 -97
  58. package/resources/admin/organization/projects/service-accounts.js.map +1 -1
  59. package/resources/admin/organization/projects/service-accounts.mjs +1 -95
  60. package/resources/admin/organization/projects/service-accounts.mjs.map +1 -1
  61. package/resources/admin/organization/usage.d.mts +517 -88
  62. package/resources/admin/organization/usage.d.mts.map +1 -1
  63. package/resources/admin/organization/usage.d.ts +517 -88
  64. package/resources/admin/organization/usage.d.ts.map +1 -1
  65. package/resources/beta/responses/responses.d.mts +4 -4
  66. package/resources/beta/responses/responses.d.mts.map +1 -1
  67. package/resources/beta/responses/responses.d.ts +4 -4
  68. package/resources/beta/responses/responses.d.ts.map +1 -1
  69. package/src/internal/headers.ts +7 -3
  70. package/src/resources/admin/organization/audit-logs.ts +169 -1
  71. package/src/resources/admin/organization/projects/index.ts +1 -1
  72. package/src/resources/admin/organization/projects/projects.ts +13 -13
  73. package/src/resources/admin/organization/projects/service-accounts/api-keys.ts +80 -0
  74. package/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
  75. package/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +284 -0
  76. package/src/resources/admin/organization/projects/service-accounts.ts +1 -264
  77. package/src/resources/admin/organization/usage.ts +616 -88
  78. package/src/resources/beta/responses/responses.ts +4 -4
  79. package/src/version.ts +1 -1
  80. package/version.d.mts +1 -1
  81. package/version.d.ts +1 -1
  82. package/version.js +1 -1
  83. package/version.mjs +1 -1
@@ -113,7 +113,91 @@ export interface AuditLogListResponse {
113
113
  | 'service_account.deleted'
114
114
  | 'user.added'
115
115
  | 'user.updated'
116
- | 'user.deleted';
116
+ | 'user.deleted'
117
+ | 'tenant.metadata.updated'
118
+ | 'tenant.microsoft_entra_mapping.upserted'
119
+ | 'tenant.microsoft_entra_mapping.deleted'
120
+ | 'tenant.workload_identity.provider.created'
121
+ | 'tenant.workload_identity.provider.updated'
122
+ | 'tenant.workload_identity.provider.archived'
123
+ | 'tenant.workload_identity.mapping.created'
124
+ | 'tenant.workload_identity.mapping.updated'
125
+ | 'tenant.workload_identity.mapping.archived'
126
+ | 'tenant.workload_identity.binding.created'
127
+ | 'tenant.workload_identity.principal.provisioned'
128
+ | 'tenant.admin_api_key.created'
129
+ | 'tenant.admin_api_key.updated'
130
+ | 'tenant.admin_api_key.deleted'
131
+ | 'tenant.project_api_key.created'
132
+ | 'tenant.chatgpt_access_token.revoked'
133
+ | 'tenant.migration.completed'
134
+ | 'tenant.sso.migrated'
135
+ | 'tenant.domains.migrated'
136
+ | 'tenant.sso_connection.created'
137
+ | 'tenant.sso_connection.updated'
138
+ | 'tenant.sso_connection.deleted'
139
+ | 'tenant.sso_connection.setup.started'
140
+ | 'tenant.policy.created'
141
+ | 'tenant.policy.updated'
142
+ | 'tenant.policy.deleted'
143
+ | 'tenant.policy.attached'
144
+ | 'tenant.policy.detached'
145
+ | 'tenant.principal_authentication_policy.resolved'
146
+ | 'tenant.scim.setup.started'
147
+ | 'tenant.scim.deletion.requested'
148
+ | 'tenant.scim.directory.created'
149
+ | 'tenant.product_access_policy.updated'
150
+ | 'tenant.resource_share_grant.created'
151
+ | 'tenant.resource_share_grant.updated'
152
+ | 'tenant.resource_share_grant.accepted'
153
+ | 'tenant.resource_share_grant.declined'
154
+ | 'tenant.resource_share_grant.revoked'
155
+ | 'tenant.resource_share_grant.deleted'
156
+ | 'tenant.service_account.updated'
157
+ | 'tenant.service_account.deleted'
158
+ | 'tenant.service_account.token.revoked'
159
+ | 'tenant.billing.overage_limit.updated'
160
+ | 'tenant.billing.alerts.updated'
161
+ | 'tenant.billing.info.updated'
162
+ | 'tenant.usage_limit.workspace.updated'
163
+ | 'tenant.usage_limit.group.updated'
164
+ | 'tenant.usage_limit.user.updated'
165
+ | 'tenant.usage_limit.increase_request.updated'
166
+ | 'tenant.usage_limit.increase_request.resolved'
167
+ | 'tenant.group.created'
168
+ | 'tenant.group.updated'
169
+ | 'tenant.group.deleted'
170
+ | 'tenant.group.member.added'
171
+ | 'tenant.group.member.removed'
172
+ | 'tenant.migration_rollout.status.updated'
173
+ | 'tenant.migration_rollout.tier.updated'
174
+ | 'tenant.role.metadata.updated'
175
+ | 'tenant.custom_role.created'
176
+ | 'tenant.custom_role.updated'
177
+ | 'tenant.custom_role.deleted'
178
+ | 'tenant.role_assignment.created'
179
+ | 'tenant.role_assignment.deleted'
180
+ | 'tenant.resource_role_assignment.created'
181
+ | 'tenant.resource_role_assignment.deleted'
182
+ | 'tenant.resource_access.updated'
183
+ | 'tenant.resource_access.deleted'
184
+ | 'tenant.session_policy.created'
185
+ | 'tenant.session_policy.updated'
186
+ | 'tenant.session_policy.deleted'
187
+ | 'tenant.session_revocation.started'
188
+ | 'tenant.third_party_app_policy.updated'
189
+ | 'tenant.user.added'
190
+ | 'tenant.user.updated'
191
+ | 'tenant.user.removed'
192
+ | 'tenant.user.looked_up'
193
+ | 'tenant.user.invited'
194
+ | 'tenant.membership.revoked'
195
+ | 'tenant.api_organization_invite.upserted'
196
+ | 'tenant.api_organization_invite.deleted'
197
+ | 'tenant.chatgpt_workspace_invite.upserted'
198
+ | 'tenant.membership.accepted'
199
+ | 'tenant.membership.declined'
200
+ | 'tenant.workspace_invite_email_settings.updated';
117
201
 
118
202
  /**
119
203
  * The actor who performed the audit logged action.
@@ -1834,6 +1918,90 @@ export interface AuditLogListParams extends ConversationCursorPageParams {
1834
1918
  | 'user.added'
1835
1919
  | 'user.updated'
1836
1920
  | 'user.deleted'
1921
+ | 'tenant.metadata.updated'
1922
+ | 'tenant.microsoft_entra_mapping.upserted'
1923
+ | 'tenant.microsoft_entra_mapping.deleted'
1924
+ | 'tenant.workload_identity.provider.created'
1925
+ | 'tenant.workload_identity.provider.updated'
1926
+ | 'tenant.workload_identity.provider.archived'
1927
+ | 'tenant.workload_identity.mapping.created'
1928
+ | 'tenant.workload_identity.mapping.updated'
1929
+ | 'tenant.workload_identity.mapping.archived'
1930
+ | 'tenant.workload_identity.binding.created'
1931
+ | 'tenant.workload_identity.principal.provisioned'
1932
+ | 'tenant.admin_api_key.created'
1933
+ | 'tenant.admin_api_key.updated'
1934
+ | 'tenant.admin_api_key.deleted'
1935
+ | 'tenant.project_api_key.created'
1936
+ | 'tenant.chatgpt_access_token.revoked'
1937
+ | 'tenant.migration.completed'
1938
+ | 'tenant.sso.migrated'
1939
+ | 'tenant.domains.migrated'
1940
+ | 'tenant.sso_connection.created'
1941
+ | 'tenant.sso_connection.updated'
1942
+ | 'tenant.sso_connection.deleted'
1943
+ | 'tenant.sso_connection.setup.started'
1944
+ | 'tenant.policy.created'
1945
+ | 'tenant.policy.updated'
1946
+ | 'tenant.policy.deleted'
1947
+ | 'tenant.policy.attached'
1948
+ | 'tenant.policy.detached'
1949
+ | 'tenant.principal_authentication_policy.resolved'
1950
+ | 'tenant.scim.setup.started'
1951
+ | 'tenant.scim.deletion.requested'
1952
+ | 'tenant.scim.directory.created'
1953
+ | 'tenant.product_access_policy.updated'
1954
+ | 'tenant.resource_share_grant.created'
1955
+ | 'tenant.resource_share_grant.updated'
1956
+ | 'tenant.resource_share_grant.accepted'
1957
+ | 'tenant.resource_share_grant.declined'
1958
+ | 'tenant.resource_share_grant.revoked'
1959
+ | 'tenant.resource_share_grant.deleted'
1960
+ | 'tenant.service_account.updated'
1961
+ | 'tenant.service_account.deleted'
1962
+ | 'tenant.service_account.token.revoked'
1963
+ | 'tenant.billing.overage_limit.updated'
1964
+ | 'tenant.billing.alerts.updated'
1965
+ | 'tenant.billing.info.updated'
1966
+ | 'tenant.usage_limit.workspace.updated'
1967
+ | 'tenant.usage_limit.group.updated'
1968
+ | 'tenant.usage_limit.user.updated'
1969
+ | 'tenant.usage_limit.increase_request.updated'
1970
+ | 'tenant.usage_limit.increase_request.resolved'
1971
+ | 'tenant.group.created'
1972
+ | 'tenant.group.updated'
1973
+ | 'tenant.group.deleted'
1974
+ | 'tenant.group.member.added'
1975
+ | 'tenant.group.member.removed'
1976
+ | 'tenant.migration_rollout.status.updated'
1977
+ | 'tenant.migration_rollout.tier.updated'
1978
+ | 'tenant.role.metadata.updated'
1979
+ | 'tenant.custom_role.created'
1980
+ | 'tenant.custom_role.updated'
1981
+ | 'tenant.custom_role.deleted'
1982
+ | 'tenant.role_assignment.created'
1983
+ | 'tenant.role_assignment.deleted'
1984
+ | 'tenant.resource_role_assignment.created'
1985
+ | 'tenant.resource_role_assignment.deleted'
1986
+ | 'tenant.resource_access.updated'
1987
+ | 'tenant.resource_access.deleted'
1988
+ | 'tenant.session_policy.created'
1989
+ | 'tenant.session_policy.updated'
1990
+ | 'tenant.session_policy.deleted'
1991
+ | 'tenant.session_revocation.started'
1992
+ | 'tenant.third_party_app_policy.updated'
1993
+ | 'tenant.user.added'
1994
+ | 'tenant.user.updated'
1995
+ | 'tenant.user.removed'
1996
+ | 'tenant.user.looked_up'
1997
+ | 'tenant.user.invited'
1998
+ | 'tenant.membership.revoked'
1999
+ | 'tenant.api_organization_invite.upserted'
2000
+ | 'tenant.api_organization_invite.deleted'
2001
+ | 'tenant.chatgpt_workspace_invite.upserted'
2002
+ | 'tenant.membership.accepted'
2003
+ | 'tenant.membership.declined'
2004
+ | 'tenant.workspace_invite_email_settings.updated'
1837
2005
  >;
1838
2006
 
1839
2007
  /**
@@ -78,7 +78,7 @@ export {
78
78
  type ServiceAccountListParams,
79
79
  type ServiceAccountDeleteParams,
80
80
  type ProjectServiceAccountsPage,
81
- } from './service-accounts';
81
+ } from './service-accounts/index';
82
82
  export {
83
83
  SpendAlerts,
84
84
  type ProjectSpendAlert,
@@ -57,19 +57,6 @@ import {
57
57
  RoleUpdateParams,
58
58
  Roles,
59
59
  } from './roles';
60
- import * as ServiceAccountsAPI from './service-accounts';
61
- import {
62
- ProjectServiceAccount,
63
- ProjectServiceAccountsPage,
64
- ServiceAccountCreateParams,
65
- ServiceAccountCreateResponse,
66
- ServiceAccountDeleteParams,
67
- ServiceAccountDeleteResponse,
68
- ServiceAccountListParams,
69
- ServiceAccountRetrieveParams,
70
- ServiceAccountUpdateParams,
71
- ServiceAccounts,
72
- } from './service-accounts';
73
60
  import * as SpendAlertsAPI from './spend-alerts';
74
61
  import {
75
62
  ProjectSpendAlert,
@@ -93,6 +80,19 @@ import {
93
80
  ProjectGroup,
94
81
  ProjectGroupsPage,
95
82
  } from './groups/groups';
83
+ import * as ServiceAccountsAPI from './service-accounts/service-accounts';
84
+ import {
85
+ ProjectServiceAccount,
86
+ ProjectServiceAccountsPage,
87
+ ServiceAccountCreateParams,
88
+ ServiceAccountCreateResponse,
89
+ ServiceAccountDeleteParams,
90
+ ServiceAccountDeleteResponse,
91
+ ServiceAccountListParams,
92
+ ServiceAccountRetrieveParams,
93
+ ServiceAccountUpdateParams,
94
+ ServiceAccounts,
95
+ } from './service-accounts/service-accounts';
96
96
  import * as UsersAPI from './users/users';
97
97
  import {
98
98
  ProjectUser,
@@ -0,0 +1,80 @@
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 APIKeys extends APIResource {
9
+ /**
10
+ * Creates an API key for a service account in the project.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const apiKey =
15
+ * await client.admin.organization.projects.serviceAccounts.apiKeys.create(
16
+ * 'service_account_id',
17
+ * { project_id: 'project_id' },
18
+ * );
19
+ * ```
20
+ */
21
+ create(
22
+ serviceAccountID: string,
23
+ params: APIKeyCreateParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<APIKeyCreateResponse> {
26
+ const { project_id, ...body } = params;
27
+ return this._client.post(
28
+ path`/organization/projects/${project_id}/service_accounts/${serviceAccountID}/api_keys`,
29
+ { body, ...options, __security: { adminAPIKeyAuth: true } },
30
+ );
31
+ }
32
+ }
33
+
34
+ export interface APIKeyCreateResponse {
35
+ /**
36
+ * The identifier of the API key.
37
+ */
38
+ id: string;
39
+
40
+ /**
41
+ * The Unix timestamp (in seconds) when the API key was created.
42
+ */
43
+ created_at: number;
44
+
45
+ /**
46
+ * The name of the API key.
47
+ */
48
+ name: string;
49
+
50
+ /**
51
+ * The object type, which is always `organization.project.service_account.api_key`
52
+ */
53
+ object: 'organization.project.service_account.api_key';
54
+
55
+ /**
56
+ * The unredacted API key value.
57
+ */
58
+ value: string;
59
+ }
60
+
61
+ export interface APIKeyCreateParams {
62
+ /**
63
+ * Path param: The ID of the project.
64
+ */
65
+ project_id: string;
66
+
67
+ /**
68
+ * Body param: API key name.
69
+ */
70
+ name?: string;
71
+
72
+ /**
73
+ * Body param: API key scopes.
74
+ */
75
+ scopes?: Array<string>;
76
+ }
77
+
78
+ export declare namespace APIKeys {
79
+ export { type APIKeyCreateResponse as APIKeyCreateResponse, type APIKeyCreateParams as APIKeyCreateParams };
80
+ }
@@ -0,0 +1,15 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { APIKeys, type APIKeyCreateResponse, type APIKeyCreateParams } from './api-keys';
4
+ export {
5
+ ServiceAccounts,
6
+ type ProjectServiceAccount,
7
+ type ServiceAccountCreateResponse,
8
+ type ServiceAccountDeleteResponse,
9
+ type ServiceAccountCreateParams,
10
+ type ServiceAccountRetrieveParams,
11
+ type ServiceAccountUpdateParams,
12
+ type ServiceAccountListParams,
13
+ type ServiceAccountDeleteParams,
14
+ type ProjectServiceAccountsPage,
15
+ } from './service-accounts';
@@ -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
+ }