@anthropic-ai/sdk 0.125.0 → 0.126.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 (297) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +846 -840
  7. package/client.js.map +1 -1
  8. package/client.mjs +846 -834
  9. package/client.mjs.map +1 -1
  10. package/core/api-promise.js +71 -68
  11. package/core/api-promise.js.map +1 -1
  12. package/core/api-promise.mjs +71 -64
  13. package/core/api-promise.mjs.map +1 -1
  14. package/core/error.js +5 -2
  15. package/core/error.js.map +1 -1
  16. package/core/error.mjs +5 -2
  17. package/core/error.mjs.map +1 -1
  18. package/core/pagination.js +56 -50
  19. package/core/pagination.js.map +1 -1
  20. package/core/pagination.mjs +56 -41
  21. package/core/pagination.mjs.map +1 -1
  22. package/core/streaming.js +212 -209
  23. package/core/streaming.js.map +1 -1
  24. package/core/streaming.mjs +212 -209
  25. package/core/streaming.mjs.map +1 -1
  26. package/helpers/beta/mcp.js +14 -19
  27. package/helpers/beta/mcp.js.map +1 -1
  28. package/helpers/beta/mcp.mjs +14 -13
  29. package/helpers/beta/mcp.mjs.map +1 -1
  30. package/internal/constants.js +1 -1
  31. package/internal/constants.js.map +1 -1
  32. package/internal/decoders/jsonl.js +27 -24
  33. package/internal/decoders/jsonl.js.map +1 -1
  34. package/internal/decoders/jsonl.mjs +27 -24
  35. package/internal/decoders/jsonl.mjs.map +1 -1
  36. package/internal/decoders/line.js +52 -49
  37. package/internal/decoders/line.js.map +1 -1
  38. package/internal/decoders/line.mjs +52 -43
  39. package/internal/decoders/line.mjs.map +1 -1
  40. package/internal/file-store.js +256 -258
  41. package/internal/file-store.js.map +1 -1
  42. package/internal/file-store.mjs +256 -243
  43. package/internal/file-store.mjs.map +1 -1
  44. package/internal/node.browser.d.mts.map +1 -1
  45. package/internal/node.browser.d.ts.map +1 -1
  46. package/internal/node.browser.js.map +1 -1
  47. package/internal/node.browser.mjs +7 -7
  48. package/internal/node.browser.mjs.map +1 -1
  49. package/internal/shim-types.js +0 -6
  50. package/internal/shim-types.js.map +1 -1
  51. package/internal/shim-types.mjs +0 -6
  52. package/internal/shim-types.mjs.map +1 -1
  53. package/internal/shims.js +0 -6
  54. package/internal/shims.js.map +1 -1
  55. package/internal/shims.mjs +0 -6
  56. package/internal/shims.mjs.map +1 -1
  57. package/internal/stainless-helper-header.js +6 -6
  58. package/internal/stainless-helper-header.js.map +1 -1
  59. package/internal/utils/async-queue.js +66 -63
  60. package/internal/utils/async-queue.js.map +1 -1
  61. package/internal/utils/async-queue.mjs +66 -56
  62. package/internal/utils/async-queue.mjs.map +1 -1
  63. package/internal/utils/bytes.d.mts +1 -1
  64. package/internal/utils/bytes.d.mts.map +1 -1
  65. package/internal/utils/bytes.d.ts +1 -1
  66. package/internal/utils/bytes.d.ts.map +1 -1
  67. package/lib/BetaMessageStream.js +593 -590
  68. package/lib/BetaMessageStream.js.map +1 -1
  69. package/lib/BetaMessageStream.mjs +593 -590
  70. package/lib/BetaMessageStream.mjs.map +1 -1
  71. package/lib/MessageStream.js +544 -541
  72. package/lib/MessageStream.js.map +1 -1
  73. package/lib/MessageStream.mjs +544 -541
  74. package/lib/MessageStream.mjs.map +1 -1
  75. package/lib/environments/poller.js +180 -174
  76. package/lib/environments/poller.js.map +1 -1
  77. package/lib/environments/poller.mjs +180 -153
  78. package/lib/environments/poller.mjs.map +1 -1
  79. package/lib/environments/worker.js +375 -369
  80. package/lib/environments/worker.js.map +1 -1
  81. package/lib/environments/worker.mjs +374 -329
  82. package/lib/environments/worker.mjs.map +1 -1
  83. package/lib/tools/BetaToolRunner.js +316 -313
  84. package/lib/tools/BetaToolRunner.js.map +1 -1
  85. package/lib/tools/BetaToolRunner.mjs +315 -306
  86. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  87. package/lib/tools/SessionToolRunner.js +241 -235
  88. package/lib/tools/SessionToolRunner.js.map +1 -1
  89. package/lib/tools/SessionToolRunner.mjs +241 -192
  90. package/lib/tools/SessionToolRunner.mjs.map +1 -1
  91. package/lib/tools/ToolError.js +39 -36
  92. package/lib/tools/ToolError.js.map +1 -1
  93. package/lib/tools/ToolError.mjs +39 -13
  94. package/lib/tools/ToolError.mjs.map +1 -1
  95. package/package.json +3 -3
  96. package/resources/beta/agents/agents.js +135 -132
  97. package/resources/beta/agents/agents.js.map +1 -1
  98. package/resources/beta/agents/agents.mjs +135 -132
  99. package/resources/beta/agents/agents.mjs.map +1 -1
  100. package/resources/beta/beta.d.mts +5 -5
  101. package/resources/beta/beta.d.mts.map +1 -1
  102. package/resources/beta/beta.d.ts +5 -5
  103. package/resources/beta/beta.d.ts.map +1 -1
  104. package/resources/beta/beta.js +39 -36
  105. package/resources/beta/beta.js.map +1 -1
  106. package/resources/beta/beta.mjs +39 -36
  107. package/resources/beta/beta.mjs.map +1 -1
  108. package/resources/beta/dreams.d.mts +2 -28
  109. package/resources/beta/dreams.d.mts.map +1 -1
  110. package/resources/beta/dreams.d.ts +2 -28
  111. package/resources/beta/dreams.d.ts.map +1 -1
  112. package/resources/beta/environments/environments.js +157 -154
  113. package/resources/beta/environments/environments.js.map +1 -1
  114. package/resources/beta/environments/environments.mjs +157 -154
  115. package/resources/beta/environments/environments.mjs.map +1 -1
  116. package/resources/beta/environments/work.js +255 -252
  117. package/resources/beta/environments/work.js.map +1 -1
  118. package/resources/beta/environments/work.mjs +255 -252
  119. package/resources/beta/environments/work.mjs.map +1 -1
  120. package/resources/beta/index.d.mts +2 -2
  121. package/resources/beta/index.d.mts.map +1 -1
  122. package/resources/beta/index.d.ts +2 -2
  123. package/resources/beta/index.d.ts.map +1 -1
  124. package/resources/beta/index.js.map +1 -1
  125. package/resources/beta/index.mjs.map +1 -1
  126. package/resources/beta/memory-stores/memory-stores.js +150 -147
  127. package/resources/beta/memory-stores/memory-stores.js.map +1 -1
  128. package/resources/beta/memory-stores/memory-stores.mjs +150 -147
  129. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  130. package/resources/beta/messages/batches.d.mts +12 -1
  131. package/resources/beta/messages/batches.d.mts.map +1 -1
  132. package/resources/beta/messages/batches.d.ts +12 -1
  133. package/resources/beta/messages/batches.d.ts.map +1 -1
  134. package/resources/beta/messages/index.d.mts +1 -1
  135. package/resources/beta/messages/index.d.mts.map +1 -1
  136. package/resources/beta/messages/index.d.ts +1 -1
  137. package/resources/beta/messages/index.d.ts.map +1 -1
  138. package/resources/beta/messages/index.js.map +1 -1
  139. package/resources/beta/messages/index.mjs.map +1 -1
  140. package/resources/beta/messages/messages.d.mts +238 -100
  141. package/resources/beta/messages/messages.d.mts.map +1 -1
  142. package/resources/beta/messages/messages.d.ts +238 -100
  143. package/resources/beta/messages/messages.d.ts.map +1 -1
  144. package/resources/beta/messages/messages.js +113 -110
  145. package/resources/beta/messages/messages.js.map +1 -1
  146. package/resources/beta/messages/messages.mjs +113 -110
  147. package/resources/beta/messages/messages.mjs.map +1 -1
  148. package/resources/beta/models.d.mts +22 -1
  149. package/resources/beta/models.d.mts.map +1 -1
  150. package/resources/beta/models.d.ts +22 -1
  151. package/resources/beta/models.d.ts.map +1 -1
  152. package/resources/beta/organization/federation/federation.js +11 -8
  153. package/resources/beta/organization/federation/federation.js.map +1 -1
  154. package/resources/beta/organization/federation/federation.mjs +11 -8
  155. package/resources/beta/organization/federation/federation.mjs.map +1 -1
  156. package/resources/beta/organization/federation/rules/rules.js +187 -184
  157. package/resources/beta/organization/federation/rules/rules.js.map +1 -1
  158. package/resources/beta/organization/federation/rules/rules.mjs +187 -184
  159. package/resources/beta/organization/federation/rules/rules.mjs.map +1 -1
  160. package/resources/beta/organization/organization.js +38 -35
  161. package/resources/beta/organization/organization.js.map +1 -1
  162. package/resources/beta/organization/organization.mjs +38 -35
  163. package/resources/beta/organization/organization.mjs.map +1 -1
  164. package/resources/beta/organization/service-accounts/service-accounts.js +163 -160
  165. package/resources/beta/organization/service-accounts/service-accounts.js.map +1 -1
  166. package/resources/beta/organization/service-accounts/service-accounts.mjs +163 -160
  167. package/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -1
  168. package/resources/beta/organization/workspaces/workspaces.d.mts +3 -3
  169. package/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -1
  170. package/resources/beta/organization/workspaces/workspaces.d.ts +3 -3
  171. package/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -1
  172. package/resources/beta/organization/workspaces/workspaces.js +97 -94
  173. package/resources/beta/organization/workspaces/workspaces.js.map +1 -1
  174. package/resources/beta/organization/workspaces/workspaces.mjs +97 -94
  175. package/resources/beta/organization/workspaces/workspaces.mjs.map +1 -1
  176. package/resources/beta/sessions/events.d.mts +12 -21
  177. package/resources/beta/sessions/events.d.mts.map +1 -1
  178. package/resources/beta/sessions/events.d.ts +12 -21
  179. package/resources/beta/sessions/events.d.ts.map +1 -1
  180. package/resources/beta/sessions/events.js +118 -115
  181. package/resources/beta/sessions/events.js.map +1 -1
  182. package/resources/beta/sessions/events.mjs +118 -115
  183. package/resources/beta/sessions/events.mjs.map +1 -1
  184. package/resources/beta/sessions/resources.d.mts +0 -3
  185. package/resources/beta/sessions/resources.d.mts.map +1 -1
  186. package/resources/beta/sessions/resources.d.ts +0 -3
  187. package/resources/beta/sessions/resources.d.ts.map +1 -1
  188. package/resources/beta/sessions/sessions.d.mts +2 -2
  189. package/resources/beta/sessions/sessions.d.ts +2 -2
  190. package/resources/beta/sessions/sessions.js +161 -158
  191. package/resources/beta/sessions/sessions.js.map +1 -1
  192. package/resources/beta/sessions/sessions.mjs +161 -158
  193. package/resources/beta/sessions/sessions.mjs.map +1 -1
  194. package/resources/beta/sessions/threads/threads.js +86 -83
  195. package/resources/beta/sessions/threads/threads.js.map +1 -1
  196. package/resources/beta/sessions/threads/threads.mjs +86 -83
  197. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  198. package/resources/beta/skills/skills.js +104 -101
  199. package/resources/beta/skills/skills.js.map +1 -1
  200. package/resources/beta/skills/skills.mjs +104 -101
  201. package/resources/beta/skills/skills.mjs.map +1 -1
  202. package/resources/beta/tunnels/tunnels.js +188 -185
  203. package/resources/beta/tunnels/tunnels.js.map +1 -1
  204. package/resources/beta/tunnels/tunnels.mjs +188 -185
  205. package/resources/beta/tunnels/tunnels.mjs.map +1 -1
  206. package/resources/beta/user-profiles.d.mts +45 -0
  207. package/resources/beta/user-profiles.d.mts.map +1 -1
  208. package/resources/beta/user-profiles.d.ts +45 -0
  209. package/resources/beta/user-profiles.d.ts.map +1 -1
  210. package/resources/beta/user-profiles.js +25 -10
  211. package/resources/beta/user-profiles.js.map +1 -1
  212. package/resources/beta/user-profiles.mjs +25 -10
  213. package/resources/beta/user-profiles.mjs.map +1 -1
  214. package/resources/beta/vaults/credentials.d.mts +0 -14
  215. package/resources/beta/vaults/credentials.d.mts.map +1 -1
  216. package/resources/beta/vaults/credentials.d.ts +0 -14
  217. package/resources/beta/vaults/credentials.d.ts.map +1 -1
  218. package/resources/beta/vaults/vaults.js +156 -153
  219. package/resources/beta/vaults/vaults.js.map +1 -1
  220. package/resources/beta/vaults/vaults.mjs +156 -153
  221. package/resources/beta/vaults/vaults.mjs.map +1 -1
  222. package/resources/completions.d.mts +1 -1
  223. package/resources/completions.d.ts +1 -1
  224. package/resources/index.d.mts +1 -1
  225. package/resources/index.d.mts.map +1 -1
  226. package/resources/index.d.ts +1 -1
  227. package/resources/index.d.ts.map +1 -1
  228. package/resources/index.js.map +1 -1
  229. package/resources/index.mjs.map +1 -1
  230. package/resources/messages/index.d.mts +1 -1
  231. package/resources/messages/index.d.mts.map +1 -1
  232. package/resources/messages/index.d.ts +1 -1
  233. package/resources/messages/index.d.ts.map +1 -1
  234. package/resources/messages/index.js.map +1 -1
  235. package/resources/messages/index.mjs.map +1 -1
  236. package/resources/messages/messages.d.mts +100 -63
  237. package/resources/messages/messages.d.mts.map +1 -1
  238. package/resources/messages/messages.d.ts +100 -63
  239. package/resources/messages/messages.d.ts.map +1 -1
  240. package/resources/messages/messages.js +115 -112
  241. package/resources/messages/messages.js.map +1 -1
  242. package/resources/messages/messages.mjs +115 -112
  243. package/resources/messages/messages.mjs.map +1 -1
  244. package/resources/skills/skills.js +88 -85
  245. package/resources/skills/skills.js.map +1 -1
  246. package/resources/skills/skills.mjs +88 -85
  247. package/resources/skills/skills.mjs.map +1 -1
  248. package/resources/top-level.js +0 -1
  249. package/resources/top-level.js.map +1 -1
  250. package/resources/top-level.mjs +0 -1
  251. package/resources/top-level.mjs.map +1 -1
  252. package/src/client.ts +13 -1
  253. package/src/internal/node.browser.ts +7 -7
  254. package/src/internal/utils/bytes.ts +1 -1
  255. package/src/resources/beta/beta.ts +24 -1
  256. package/src/resources/beta/dreams.ts +2 -28
  257. package/src/resources/beta/index.ts +11 -0
  258. package/src/resources/beta/messages/batches.ts +13 -1
  259. package/src/resources/beta/messages/index.ts +10 -0
  260. package/src/resources/beta/messages/messages.ts +288 -99
  261. package/src/resources/beta/models.ts +25 -0
  262. package/src/resources/beta/organization/workspaces/workspaces.ts +3 -3
  263. package/src/resources/beta/sessions/events.ts +12 -21
  264. package/src/resources/beta/sessions/resources.ts +0 -3
  265. package/src/resources/beta/sessions/sessions.ts +2 -2
  266. package/src/resources/beta/user-profiles.ts +75 -10
  267. package/src/resources/beta/vaults/credentials.ts +0 -14
  268. package/src/resources/completions.ts +1 -1
  269. package/src/resources/index.ts +6 -0
  270. package/src/resources/messages/index.ts +6 -0
  271. package/src/resources/messages/messages.ts +128 -62
  272. package/src/tsconfig.json +13 -3
  273. package/src/version.ts +1 -1
  274. package/tools/agent-toolset/fs-util.js +0 -6
  275. package/tools/agent-toolset/fs-util.js.map +1 -1
  276. package/tools/agent-toolset/fs-util.mjs +0 -6
  277. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  278. package/tools/agent-toolset/memories.js +4 -4
  279. package/tools/agent-toolset/memories.js.map +1 -1
  280. package/tools/agent-toolset/memories.mjs +2 -2
  281. package/tools/agent-toolset/memories.mjs.map +1 -1
  282. package/tools/agent-toolset/node.browser.js +12 -12
  283. package/tools/agent-toolset/node.browser.js.map +1 -1
  284. package/tools/agent-toolset/node.js +142 -139
  285. package/tools/agent-toolset/node.js.map +1 -1
  286. package/tools/agent-toolset/node.mjs +132 -125
  287. package/tools/agent-toolset/node.mjs.map +1 -1
  288. package/tools/agent-toolset/skills.js +5 -5
  289. package/tools/agent-toolset/skills.js.map +1 -1
  290. package/tools/agent-toolset/sync-interval.js +3 -3
  291. package/tools/agent-toolset/sync-interval.js.map +1 -1
  292. package/tools/memory/node.browser.js +2 -2
  293. package/tools/memory/node.browser.js.map +1 -1
  294. package/version.d.mts +1 -1
  295. package/version.d.ts +1 -1
  296. package/version.js +1 -1
  297. package/version.mjs +1 -1
@@ -8,166 +8,169 @@ const workspaces_1 = require("./workspaces.js");
8
8
  const pagination_1 = require("../../../../core/pagination.js");
9
9
  const headers_1 = require("../../../../internal/headers.js");
10
10
  const path_1 = require("../../../../internal/utils/path.js");
11
- class ServiceAccounts extends resource_1.APIResource {
12
- constructor() {
13
- super(...arguments);
14
- this.workspaces = new WorkspacesAPI.Workspaces(this._client);
11
+ var ServiceAccounts = /* @__PURE__ */ (() => {
12
+ class ServiceAccounts extends resource_1.APIResource {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.workspaces = new WorkspacesAPI.Workspaces(this._client);
16
+ }
17
+ /**
18
+ * **Requires an OAuth access token with the `org:admin` scope**, from
19
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
20
+ * API keys are not accepted. See
21
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
22
+ *
23
+ * Create a service account.
24
+ *
25
+ * A service account is a named workload identity that federation rules target.
26
+ * `organization_role` is `developer` (default) or `admin`; a rule may only be
27
+ * created or retargeted to grant `org:admin` scope when the target's
28
+ * `organization_role` is `admin`. Creating an `admin`-role service account
29
+ * requires an interactive credential (a user OAuth token or a Console session) — a
30
+ * workload may only create `developer`-role service accounts.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const betaServiceAccount =
35
+ * await client.beta.organization.serviceAccounts.create({
36
+ * name: 'ci-deploy-bot',
37
+ * });
38
+ * ```
39
+ */
40
+ create(params, options) {
41
+ const { betas, ...body } = params;
42
+ return this._client.post('/v1/organizations/service_accounts?beta=true', {
43
+ body,
44
+ ...options,
45
+ headers: (0, headers_1.buildHeaders)([
46
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
47
+ options?.headers,
48
+ ]),
49
+ });
50
+ }
51
+ /**
52
+ * **Requires an OAuth access token with the `org:admin` scope**, from
53
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
54
+ * API keys are not accepted. See
55
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
56
+ *
57
+ * Retrieve a service account by its ID (`svac_...`).
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const betaServiceAccount =
62
+ * await client.beta.organization.serviceAccounts.retrieve(
63
+ * 'service_account_id',
64
+ * );
65
+ * ```
66
+ */
67
+ retrieve(serviceAccountID, params = {}, options) {
68
+ const { betas } = params ?? {};
69
+ return this._client.get((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
70
+ ...options,
71
+ headers: (0, headers_1.buildHeaders)([
72
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
73
+ options?.headers,
74
+ ]),
75
+ });
76
+ }
77
+ /**
78
+ * **Requires an OAuth access token with the `org:admin` scope**, from
79
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
80
+ * API keys are not accepted. See
81
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
82
+ *
83
+ * Update a service account.
84
+ *
85
+ * Only `description` and `organization_role` are mutable; `name` cannot be
86
+ * changed. Archived service accounts cannot be updated; this returns 400. Setting
87
+ * `organization_role` to `admin` (even when unchanged) requires an interactive
88
+ * credential (a user OAuth token or a Console session).
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const betaServiceAccount =
93
+ * await client.beta.organization.serviceAccounts.update(
94
+ * 'service_account_id',
95
+ * );
96
+ * ```
97
+ */
98
+ update(serviceAccountID, params, options) {
99
+ const { betas, ...body } = params;
100
+ return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
101
+ body,
102
+ ...options,
103
+ headers: (0, headers_1.buildHeaders)([
104
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
105
+ options?.headers,
106
+ ]),
107
+ });
108
+ }
109
+ /**
110
+ * **Requires an OAuth access token with the `org:admin` scope**, from
111
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
112
+ * API keys are not accepted. See
113
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
114
+ *
115
+ * List service accounts in the caller's organization.
116
+ *
117
+ * Results are ordered by creation time, newest first. Use `limit` and the
118
+ * `next_page` cursor to paginate; set `include_archived=true` to include archived
119
+ * service accounts.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * // Automatically fetches more pages as needed.
124
+ * for await (const betaServiceAccount of client.beta.organization.serviceAccounts.list()) {
125
+ * // ...
126
+ * }
127
+ * ```
128
+ */
129
+ list(params = {}, options) {
130
+ const { betas, ...query } = params ?? {};
131
+ return this._client.getAPIList('/v1/organizations/service_accounts?beta=true', (pagination_1.PageCursor), {
132
+ query,
133
+ ...options,
134
+ headers: (0, headers_1.buildHeaders)([
135
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
136
+ options?.headers,
137
+ ]),
138
+ });
139
+ }
140
+ /**
141
+ * **Requires an OAuth access token with the `org:admin` scope**, from
142
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
143
+ * API keys are not accepted. See
144
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
145
+ *
146
+ * Archive a service account.
147
+ *
148
+ * Idempotent; re-archiving returns the service account with its original
149
+ * `archived_at`. Rejected with 400 if any live (non-archived) federation rule
150
+ * still targets this service account, same as issuer archival; archive those rules
151
+ * first or change their target to another service account.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * const betaServiceAccount =
156
+ * await client.beta.organization.serviceAccounts.archive(
157
+ * 'service_account_id',
158
+ * );
159
+ * ```
160
+ */
161
+ archive(serviceAccountID, params = {}, options) {
162
+ const { betas } = params ?? {};
163
+ return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}/archive?beta=true`, {
164
+ ...options,
165
+ headers: (0, headers_1.buildHeaders)([
166
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
167
+ options?.headers,
168
+ ]),
169
+ });
170
+ }
15
171
  }
16
- /**
17
- * **Requires an OAuth access token with the `org:admin` scope**, from
18
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
19
- * API keys are not accepted. See
20
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
21
- *
22
- * Create a service account.
23
- *
24
- * A service account is a named workload identity that federation rules target.
25
- * `organization_role` is `developer` (default) or `admin`; a rule may only be
26
- * created or retargeted to grant `org:admin` scope when the target's
27
- * `organization_role` is `admin`. Creating an `admin`-role service account
28
- * requires an interactive credential (a user OAuth token or a Console session) — a
29
- * workload may only create `developer`-role service accounts.
30
- *
31
- * @example
32
- * ```ts
33
- * const betaServiceAccount =
34
- * await client.beta.organization.serviceAccounts.create({
35
- * name: 'ci-deploy-bot',
36
- * });
37
- * ```
38
- */
39
- create(params, options) {
40
- const { betas, ...body } = params;
41
- return this._client.post('/v1/organizations/service_accounts?beta=true', {
42
- body,
43
- ...options,
44
- headers: (0, headers_1.buildHeaders)([
45
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
46
- options?.headers,
47
- ]),
48
- });
49
- }
50
- /**
51
- * **Requires an OAuth access token with the `org:admin` scope**, from
52
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
53
- * API keys are not accepted. See
54
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
55
- *
56
- * Retrieve a service account by its ID (`svac_...`).
57
- *
58
- * @example
59
- * ```ts
60
- * const betaServiceAccount =
61
- * await client.beta.organization.serviceAccounts.retrieve(
62
- * 'service_account_id',
63
- * );
64
- * ```
65
- */
66
- retrieve(serviceAccountID, params = {}, options) {
67
- const { betas } = params ?? {};
68
- return this._client.get((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
69
- ...options,
70
- headers: (0, headers_1.buildHeaders)([
71
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
72
- options?.headers,
73
- ]),
74
- });
75
- }
76
- /**
77
- * **Requires an OAuth access token with the `org:admin` scope**, from
78
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
79
- * API keys are not accepted. See
80
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
81
- *
82
- * Update a service account.
83
- *
84
- * Only `description` and `organization_role` are mutable; `name` cannot be
85
- * changed. Archived service accounts cannot be updated; this returns 400. Setting
86
- * `organization_role` to `admin` (even when unchanged) requires an interactive
87
- * credential (a user OAuth token or a Console session).
88
- *
89
- * @example
90
- * ```ts
91
- * const betaServiceAccount =
92
- * await client.beta.organization.serviceAccounts.update(
93
- * 'service_account_id',
94
- * );
95
- * ```
96
- */
97
- update(serviceAccountID, params, options) {
98
- const { betas, ...body } = params;
99
- return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
100
- body,
101
- ...options,
102
- headers: (0, headers_1.buildHeaders)([
103
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
104
- options?.headers,
105
- ]),
106
- });
107
- }
108
- /**
109
- * **Requires an OAuth access token with the `org:admin` scope**, from
110
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
111
- * API keys are not accepted. See
112
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
113
- *
114
- * List service accounts in the caller's organization.
115
- *
116
- * Results are ordered by creation time, newest first. Use `limit` and the
117
- * `next_page` cursor to paginate; set `include_archived=true` to include archived
118
- * service accounts.
119
- *
120
- * @example
121
- * ```ts
122
- * // Automatically fetches more pages as needed.
123
- * for await (const betaServiceAccount of client.beta.organization.serviceAccounts.list()) {
124
- * // ...
125
- * }
126
- * ```
127
- */
128
- list(params = {}, options) {
129
- const { betas, ...query } = params ?? {};
130
- return this._client.getAPIList('/v1/organizations/service_accounts?beta=true', (pagination_1.PageCursor), {
131
- query,
132
- ...options,
133
- headers: (0, headers_1.buildHeaders)([
134
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
135
- options?.headers,
136
- ]),
137
- });
138
- }
139
- /**
140
- * **Requires an OAuth access token with the `org:admin` scope**, from
141
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
142
- * API keys are not accepted. See
143
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
144
- *
145
- * Archive a service account.
146
- *
147
- * Idempotent; re-archiving returns the service account with its original
148
- * `archived_at`. Rejected with 400 if any live (non-archived) federation rule
149
- * still targets this service account, same as issuer archival; archive those rules
150
- * first or change their target to another service account.
151
- *
152
- * @example
153
- * ```ts
154
- * const betaServiceAccount =
155
- * await client.beta.organization.serviceAccounts.archive(
156
- * 'service_account_id',
157
- * );
158
- * ```
159
- */
160
- archive(serviceAccountID, params = {}, options) {
161
- const { betas } = params ?? {};
162
- return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}/archive?beta=true`, {
163
- ...options,
164
- headers: (0, headers_1.buildHeaders)([
165
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
166
- options?.headers,
167
- ]),
168
- });
169
- }
170
- }
172
+ ServiceAccounts.Workspaces = workspaces_1.Workspaces;
173
+ return ServiceAccounts;
174
+ })();
171
175
  exports.ServiceAccounts = ServiceAccounts;
172
- ServiceAccounts.Workspaces = workspaces_1.Workspaces;
173
176
  //# sourceMappingURL=service-accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-accounts.js","sourceRoot":"","sources":["../../../../src/resources/beta/organization/service-accounts/service-accounts.ts"],"names":[],"mappings":";;;;AAAA,2DAAwD;AAExD,uEAA8C;AAC9C,gDAMsB;AAGtB,+DAA6F;AAC7F,6DAA4D;AAE5D,6DAAuD;AAEvD,MAAa,eAAgB,SAAQ,sBAAW;IAAhD;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAmLpF,CAAC;IAjLC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,MAAkC,EAAE,OAAwB;QACjE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE;YACvE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CACN,gBAAwB,EACxB,SAA0D,EAAE,EAC5D,OAAwB;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,sCAAsC,gBAAgB,YAAY,EAAE;YAC9F,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBAC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,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CACL,gBAAwB,EACxB,SAAyD,EAAE,EAC3D,OAAwB;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,sCAAsC,gBAAgB,oBAAoB,EAAE;YACvG,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AApLD,0CAoLC;AAwKD,eAAe,CAAC,UAAU,GAAG,uBAAU,CAAC"}
1
+ {"version":3,"file":"service-accounts.js","sourceRoot":"","sources":["../../../../src/resources/beta/organization/service-accounts/service-accounts.ts"],"names":[],"mappings":";;;;AAAA,2DAAwD;AAExD,uEAA8C;AAC9C,gDAMsB;AAGtB,+DAA6F;AAC7F,6DAA4D;AAE5D,6DAAuD;;IAEvD,MAAa,eAAgB,SAAQ,sBAAW;QAAhD;;YACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAmLpF,CAAC;QAjLC;;;;;;;;;;;;;;;;;;;;;;WAsBG;QACH,MAAM,CAAC,MAAkC,EAAE,OAAwB;YACjE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;YAClC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE;gBACvE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AC;QACL,CAAC;KACF;IAwKD,eAAe,CAAC,UAAU,GAAG,uBAAU,CAAC;;;AA5VxC,0CAoLC"}
@@ -4,165 +4,168 @@ import { Workspaces, } from "./workspaces.mjs";
4
4
  import { PageCursor } from "../../../../core/pagination.mjs";
5
5
  import { buildHeaders } from "../../../../internal/headers.mjs";
6
6
  import { path } from "../../../../internal/utils/path.mjs";
7
- export class ServiceAccounts extends APIResource {
8
- constructor() {
9
- super(...arguments);
10
- this.workspaces = new WorkspacesAPI.Workspaces(this._client);
7
+ export var ServiceAccounts = /* @__PURE__ */ (() => {
8
+ class ServiceAccounts extends APIResource {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.workspaces = new WorkspacesAPI.Workspaces(this._client);
12
+ }
13
+ /**
14
+ * **Requires an OAuth access token with the `org:admin` scope**, from
15
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
16
+ * API keys are not accepted. See
17
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
18
+ *
19
+ * Create a service account.
20
+ *
21
+ * A service account is a named workload identity that federation rules target.
22
+ * `organization_role` is `developer` (default) or `admin`; a rule may only be
23
+ * created or retargeted to grant `org:admin` scope when the target's
24
+ * `organization_role` is `admin`. Creating an `admin`-role service account
25
+ * requires an interactive credential (a user OAuth token or a Console session) — a
26
+ * workload may only create `developer`-role service accounts.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const betaServiceAccount =
31
+ * await client.beta.organization.serviceAccounts.create({
32
+ * name: 'ci-deploy-bot',
33
+ * });
34
+ * ```
35
+ */
36
+ create(params, options) {
37
+ const { betas, ...body } = params;
38
+ return this._client.post('/v1/organizations/service_accounts?beta=true', {
39
+ body,
40
+ ...options,
41
+ headers: buildHeaders([
42
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
43
+ options?.headers,
44
+ ]),
45
+ });
46
+ }
47
+ /**
48
+ * **Requires an OAuth access token with the `org:admin` scope**, from
49
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
50
+ * API keys are not accepted. See
51
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
52
+ *
53
+ * Retrieve a service account by its ID (`svac_...`).
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const betaServiceAccount =
58
+ * await client.beta.organization.serviceAccounts.retrieve(
59
+ * 'service_account_id',
60
+ * );
61
+ * ```
62
+ */
63
+ retrieve(serviceAccountID, params = {}, options) {
64
+ const { betas } = params ?? {};
65
+ return this._client.get(path `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
66
+ ...options,
67
+ headers: buildHeaders([
68
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
69
+ options?.headers,
70
+ ]),
71
+ });
72
+ }
73
+ /**
74
+ * **Requires an OAuth access token with the `org:admin` scope**, from
75
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
76
+ * API keys are not accepted. See
77
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
78
+ *
79
+ * Update a service account.
80
+ *
81
+ * Only `description` and `organization_role` are mutable; `name` cannot be
82
+ * changed. Archived service accounts cannot be updated; this returns 400. Setting
83
+ * `organization_role` to `admin` (even when unchanged) requires an interactive
84
+ * credential (a user OAuth token or a Console session).
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const betaServiceAccount =
89
+ * await client.beta.organization.serviceAccounts.update(
90
+ * 'service_account_id',
91
+ * );
92
+ * ```
93
+ */
94
+ update(serviceAccountID, params, options) {
95
+ const { betas, ...body } = params;
96
+ return this._client.post(path `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
97
+ body,
98
+ ...options,
99
+ headers: buildHeaders([
100
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
101
+ options?.headers,
102
+ ]),
103
+ });
104
+ }
105
+ /**
106
+ * **Requires an OAuth access token with the `org:admin` scope**, from
107
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
108
+ * API keys are not accepted. See
109
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
110
+ *
111
+ * List service accounts in the caller's organization.
112
+ *
113
+ * Results are ordered by creation time, newest first. Use `limit` and the
114
+ * `next_page` cursor to paginate; set `include_archived=true` to include archived
115
+ * service accounts.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * // Automatically fetches more pages as needed.
120
+ * for await (const betaServiceAccount of client.beta.organization.serviceAccounts.list()) {
121
+ * // ...
122
+ * }
123
+ * ```
124
+ */
125
+ list(params = {}, options) {
126
+ const { betas, ...query } = params ?? {};
127
+ return this._client.getAPIList('/v1/organizations/service_accounts?beta=true', (PageCursor), {
128
+ query,
129
+ ...options,
130
+ headers: buildHeaders([
131
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
132
+ options?.headers,
133
+ ]),
134
+ });
135
+ }
136
+ /**
137
+ * **Requires an OAuth access token with the `org:admin` scope**, from
138
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
139
+ * API keys are not accepted. See
140
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
141
+ *
142
+ * Archive a service account.
143
+ *
144
+ * Idempotent; re-archiving returns the service account with its original
145
+ * `archived_at`. Rejected with 400 if any live (non-archived) federation rule
146
+ * still targets this service account, same as issuer archival; archive those rules
147
+ * first or change their target to another service account.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const betaServiceAccount =
152
+ * await client.beta.organization.serviceAccounts.archive(
153
+ * 'service_account_id',
154
+ * );
155
+ * ```
156
+ */
157
+ archive(serviceAccountID, params = {}, options) {
158
+ const { betas } = params ?? {};
159
+ return this._client.post(path `/v1/organizations/service_accounts/${serviceAccountID}/archive?beta=true`, {
160
+ ...options,
161
+ headers: buildHeaders([
162
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
163
+ options?.headers,
164
+ ]),
165
+ });
166
+ }
11
167
  }
12
- /**
13
- * **Requires an OAuth access token with the `org:admin` scope**, from
14
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
15
- * API keys are not accepted. See
16
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
17
- *
18
- * Create a service account.
19
- *
20
- * A service account is a named workload identity that federation rules target.
21
- * `organization_role` is `developer` (default) or `admin`; a rule may only be
22
- * created or retargeted to grant `org:admin` scope when the target's
23
- * `organization_role` is `admin`. Creating an `admin`-role service account
24
- * requires an interactive credential (a user OAuth token or a Console session) — a
25
- * workload may only create `developer`-role service accounts.
26
- *
27
- * @example
28
- * ```ts
29
- * const betaServiceAccount =
30
- * await client.beta.organization.serviceAccounts.create({
31
- * name: 'ci-deploy-bot',
32
- * });
33
- * ```
34
- */
35
- create(params, options) {
36
- const { betas, ...body } = params;
37
- return this._client.post('/v1/organizations/service_accounts?beta=true', {
38
- body,
39
- ...options,
40
- headers: buildHeaders([
41
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
42
- options?.headers,
43
- ]),
44
- });
45
- }
46
- /**
47
- * **Requires an OAuth access token with the `org:admin` scope**, from
48
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
49
- * API keys are not accepted. See
50
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
51
- *
52
- * Retrieve a service account by its ID (`svac_...`).
53
- *
54
- * @example
55
- * ```ts
56
- * const betaServiceAccount =
57
- * await client.beta.organization.serviceAccounts.retrieve(
58
- * 'service_account_id',
59
- * );
60
- * ```
61
- */
62
- retrieve(serviceAccountID, params = {}, options) {
63
- const { betas } = params ?? {};
64
- return this._client.get(path `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
65
- ...options,
66
- headers: buildHeaders([
67
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
68
- options?.headers,
69
- ]),
70
- });
71
- }
72
- /**
73
- * **Requires an OAuth access token with the `org:admin` scope**, from
74
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
75
- * API keys are not accepted. See
76
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
77
- *
78
- * Update a service account.
79
- *
80
- * Only `description` and `organization_role` are mutable; `name` cannot be
81
- * changed. Archived service accounts cannot be updated; this returns 400. Setting
82
- * `organization_role` to `admin` (even when unchanged) requires an interactive
83
- * credential (a user OAuth token or a Console session).
84
- *
85
- * @example
86
- * ```ts
87
- * const betaServiceAccount =
88
- * await client.beta.organization.serviceAccounts.update(
89
- * 'service_account_id',
90
- * );
91
- * ```
92
- */
93
- update(serviceAccountID, params, options) {
94
- const { betas, ...body } = params;
95
- return this._client.post(path `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
96
- body,
97
- ...options,
98
- headers: buildHeaders([
99
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
100
- options?.headers,
101
- ]),
102
- });
103
- }
104
- /**
105
- * **Requires an OAuth access token with the `org:admin` scope**, from
106
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
107
- * API keys are not accepted. See
108
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
109
- *
110
- * List service accounts in the caller's organization.
111
- *
112
- * Results are ordered by creation time, newest first. Use `limit` and the
113
- * `next_page` cursor to paginate; set `include_archived=true` to include archived
114
- * service accounts.
115
- *
116
- * @example
117
- * ```ts
118
- * // Automatically fetches more pages as needed.
119
- * for await (const betaServiceAccount of client.beta.organization.serviceAccounts.list()) {
120
- * // ...
121
- * }
122
- * ```
123
- */
124
- list(params = {}, options) {
125
- const { betas, ...query } = params ?? {};
126
- return this._client.getAPIList('/v1/organizations/service_accounts?beta=true', (PageCursor), {
127
- query,
128
- ...options,
129
- headers: buildHeaders([
130
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
131
- options?.headers,
132
- ]),
133
- });
134
- }
135
- /**
136
- * **Requires an OAuth access token with the `org:admin` scope**, from
137
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
138
- * API keys are not accepted. See
139
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
140
- *
141
- * Archive a service account.
142
- *
143
- * Idempotent; re-archiving returns the service account with its original
144
- * `archived_at`. Rejected with 400 if any live (non-archived) federation rule
145
- * still targets this service account, same as issuer archival; archive those rules
146
- * first or change their target to another service account.
147
- *
148
- * @example
149
- * ```ts
150
- * const betaServiceAccount =
151
- * await client.beta.organization.serviceAccounts.archive(
152
- * 'service_account_id',
153
- * );
154
- * ```
155
- */
156
- archive(serviceAccountID, params = {}, options) {
157
- const { betas } = params ?? {};
158
- return this._client.post(path `/v1/organizations/service_accounts/${serviceAccountID}/archive?beta=true`, {
159
- ...options,
160
- headers: buildHeaders([
161
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
162
- options?.headers,
163
- ]),
164
- });
165
- }
166
- }
167
- ServiceAccounts.Workspaces = Workspaces;
168
+ ServiceAccounts.Workspaces = Workspaces;
169
+ return ServiceAccounts;
170
+ })();
168
171
  //# sourceMappingURL=service-accounts.mjs.map