@athenaintel/sdk 4.3.2145 → 4.3.2146

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 (74) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/computer/client/Client.d.ts +56 -0
  3. package/dist/cjs/api/resources/computer/client/Client.js +249 -0
  4. package/dist/cjs/api/resources/computer/client/requests/GetSshAccessComputerRequest.d.ts +9 -0
  5. package/dist/cjs/api/resources/computer/client/requests/GetSshAccessComputerRequest.js +3 -0
  6. package/dist/cjs/api/resources/computer/client/requests/StartComputerComputerRequest.d.ts +9 -0
  7. package/dist/cjs/api/resources/computer/client/requests/StartComputerComputerRequest.js +3 -0
  8. package/dist/cjs/api/resources/computer/client/requests/StopComputerComputerRequest.d.ts +9 -0
  9. package/dist/cjs/api/resources/computer/client/requests/StopComputerComputerRequest.js +3 -0
  10. package/dist/cjs/api/resources/computer/client/requests/index.d.ts +3 -0
  11. package/dist/cjs/api/resources/index.d.ts +1 -0
  12. package/dist/cjs/api/resources/index.js +1 -0
  13. package/dist/cjs/api/resources/users/client/Client.d.ts +45 -1
  14. package/dist/cjs/api/resources/users/client/Client.js +218 -0
  15. package/dist/cjs/api/resources/users/client/index.d.ts +1 -1
  16. package/dist/cjs/api/resources/users/client/index.js +15 -0
  17. package/dist/cjs/api/resources/users/client/requests/AddSshKeyRequestIn.d.ts +13 -0
  18. package/dist/cjs/api/resources/users/client/requests/AddSshKeyRequestIn.js +3 -0
  19. package/dist/cjs/api/resources/users/client/requests/DeleteSshKeyUsersRequest.d.ts +9 -0
  20. package/dist/cjs/api/resources/users/client/requests/DeleteSshKeyUsersRequest.js +3 -0
  21. package/dist/cjs/api/resources/users/client/requests/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/users/client/requests/index.js +2 -0
  23. package/dist/cjs/api/types/ComputerLifecycleResponseOut.d.ts +11 -0
  24. package/dist/cjs/api/types/ComputerLifecycleResponseOut.js +3 -0
  25. package/dist/cjs/api/types/DeleteSshKeyResponseOut.d.ts +7 -0
  26. package/dist/cjs/api/types/DeleteSshKeyResponseOut.js +3 -0
  27. package/dist/cjs/api/types/SshAccessInfoOut.d.ts +13 -0
  28. package/dist/cjs/api/types/SshAccessInfoOut.js +3 -0
  29. package/dist/cjs/api/types/SshKeyListResponseOut.d.ts +8 -0
  30. package/dist/cjs/api/types/SshKeyListResponseOut.js +3 -0
  31. package/dist/cjs/api/types/SshKeyOut.d.ts +19 -0
  32. package/dist/cjs/api/types/SshKeyOut.js +3 -0
  33. package/dist/cjs/api/types/index.d.ts +5 -0
  34. package/dist/cjs/api/types/index.js +5 -0
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/BaseClient.mjs +2 -2
  38. package/dist/esm/api/resources/computer/client/Client.d.mts +56 -0
  39. package/dist/esm/api/resources/computer/client/Client.mjs +249 -0
  40. package/dist/esm/api/resources/computer/client/requests/GetSshAccessComputerRequest.d.mts +9 -0
  41. package/dist/esm/api/resources/computer/client/requests/GetSshAccessComputerRequest.mjs +2 -0
  42. package/dist/esm/api/resources/computer/client/requests/StartComputerComputerRequest.d.mts +9 -0
  43. package/dist/esm/api/resources/computer/client/requests/StartComputerComputerRequest.mjs +2 -0
  44. package/dist/esm/api/resources/computer/client/requests/StopComputerComputerRequest.d.mts +9 -0
  45. package/dist/esm/api/resources/computer/client/requests/StopComputerComputerRequest.mjs +2 -0
  46. package/dist/esm/api/resources/computer/client/requests/index.d.mts +3 -0
  47. package/dist/esm/api/resources/index.d.mts +1 -0
  48. package/dist/esm/api/resources/index.mjs +1 -0
  49. package/dist/esm/api/resources/users/client/Client.d.mts +45 -1
  50. package/dist/esm/api/resources/users/client/Client.mjs +218 -0
  51. package/dist/esm/api/resources/users/client/index.d.mts +1 -1
  52. package/dist/esm/api/resources/users/client/index.mjs +1 -1
  53. package/dist/esm/api/resources/users/client/requests/AddSshKeyRequestIn.d.mts +13 -0
  54. package/dist/esm/api/resources/users/client/requests/AddSshKeyRequestIn.mjs +2 -0
  55. package/dist/esm/api/resources/users/client/requests/DeleteSshKeyUsersRequest.d.mts +9 -0
  56. package/dist/esm/api/resources/users/client/requests/DeleteSshKeyUsersRequest.mjs +2 -0
  57. package/dist/esm/api/resources/users/client/requests/index.d.mts +2 -0
  58. package/dist/esm/api/resources/users/client/requests/index.mjs +1 -0
  59. package/dist/esm/api/types/ComputerLifecycleResponseOut.d.mts +11 -0
  60. package/dist/esm/api/types/ComputerLifecycleResponseOut.mjs +2 -0
  61. package/dist/esm/api/types/DeleteSshKeyResponseOut.d.mts +7 -0
  62. package/dist/esm/api/types/DeleteSshKeyResponseOut.mjs +2 -0
  63. package/dist/esm/api/types/SshAccessInfoOut.d.mts +13 -0
  64. package/dist/esm/api/types/SshAccessInfoOut.mjs +2 -0
  65. package/dist/esm/api/types/SshKeyListResponseOut.d.mts +8 -0
  66. package/dist/esm/api/types/SshKeyListResponseOut.mjs +2 -0
  67. package/dist/esm/api/types/SshKeyOut.d.mts +19 -0
  68. package/dist/esm/api/types/SshKeyOut.mjs +2 -0
  69. package/dist/esm/api/types/index.d.mts +5 -0
  70. package/dist/esm/api/types/index.mjs +5 -0
  71. package/dist/esm/version.d.mts +1 -1
  72. package/dist/esm/version.mjs +1 -1
  73. package/package.json +1 -1
  74. package/reference.md +381 -0
@@ -118,6 +118,85 @@ export class ComputerClient {
118
118
  }
119
119
  });
120
120
  }
121
+ /**
122
+ * Return the SSH gateway host, port, username, and ready-made command for connecting to a computer with a registered SSH public key (see `add_ssh_key`). The username is the computer's asset id; the gateway authorizes the connection against your current edit permission on the computer and starts it if it is stopped. Unlike `create_ssh_access`, this mints nothing and never wakes the computer. Returns 409 when the computer's provider does not support SSH.
123
+ *
124
+ * @param {AthenaIntelligence.GetSshAccessComputerRequest} request
125
+ * @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
126
+ *
127
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
128
+ * @throws {@link AthenaIntelligence.NotFoundError}
129
+ * @throws {@link AthenaIntelligence.ConflictError}
130
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
131
+ *
132
+ * @example
133
+ * await client.computer.getSshAccess({
134
+ * asset_id: "asset_id"
135
+ * })
136
+ */
137
+ getSshAccess(request, requestOptions) {
138
+ return core.HttpResponsePromise.fromPromise(this.__getSshAccess(request, requestOptions));
139
+ }
140
+ __getSshAccess(request, requestOptions) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
143
+ const { asset_id: assetId } = request;
144
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
145
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
146
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
147
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/computer/${core.url.encodePathParam(assetId)}/ssh-access`),
148
+ method: "GET",
149
+ headers: _headers,
150
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
151
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
152
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
153
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
154
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
155
+ logging: this._options.logging,
156
+ });
157
+ if (_response.ok) {
158
+ return { data: _response.body, rawResponse: _response.rawResponse };
159
+ }
160
+ if (_response.error.reason === "status-code") {
161
+ switch (_response.error.statusCode) {
162
+ case 401:
163
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
164
+ case 404:
165
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
166
+ case 409:
167
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
168
+ case 422:
169
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
170
+ default:
171
+ throw new errors.AthenaIntelligenceError({
172
+ statusCode: _response.error.statusCode,
173
+ body: _response.error.body,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ }
178
+ switch (_response.error.reason) {
179
+ case "non-json":
180
+ throw new errors.AthenaIntelligenceError({
181
+ statusCode: _response.error.statusCode,
182
+ body: _response.error.rawBody,
183
+ rawResponse: _response.rawResponse,
184
+ });
185
+ case "body-is-null":
186
+ throw new errors.AthenaIntelligenceError({
187
+ statusCode: _response.error.statusCode,
188
+ rawResponse: _response.rawResponse,
189
+ });
190
+ case "timeout":
191
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/computer/{asset_id}/ssh-access.");
192
+ case "unknown":
193
+ throw new errors.AthenaIntelligenceError({
194
+ message: _response.error.errorMessage,
195
+ rawResponse: _response.rawResponse,
196
+ });
197
+ }
198
+ });
199
+ }
121
200
  /**
122
201
  * Generate a time-limited SSH access token for a computer asset. Returns a full SSH command and token that can be used to connect to the computer's underlying VM and run commands. The computer must support SSH access and be in a running state.
123
202
  *
@@ -296,4 +375,174 @@ export class ComputerClient {
296
375
  }
297
376
  });
298
377
  }
378
+ /**
379
+ * Start a stopped computer's runtime and wait for it to come up — the same operation as the Start button in Athena. Idempotent for a running computer. Returns 409 when the computer's provider does not support lifecycle operations.
380
+ *
381
+ * @param {AthenaIntelligence.StartComputerComputerRequest} request
382
+ * @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
383
+ *
384
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
385
+ * @throws {@link AthenaIntelligence.NotFoundError}
386
+ * @throws {@link AthenaIntelligence.ConflictError}
387
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
388
+ * @throws {@link AthenaIntelligence.BadGatewayError}
389
+ *
390
+ * @example
391
+ * await client.computer.startComputer({
392
+ * asset_id: "asset_id"
393
+ * })
394
+ */
395
+ startComputer(request, requestOptions) {
396
+ return core.HttpResponsePromise.fromPromise(this.__startComputer(request, requestOptions));
397
+ }
398
+ __startComputer(request, requestOptions) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
401
+ const { asset_id: assetId } = request;
402
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
403
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
404
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
405
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/computer/${core.url.encodePathParam(assetId)}/start`),
406
+ method: "POST",
407
+ headers: _headers,
408
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
409
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
410
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
411
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
412
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
413
+ logging: this._options.logging,
414
+ });
415
+ if (_response.ok) {
416
+ return {
417
+ data: _response.body,
418
+ rawResponse: _response.rawResponse,
419
+ };
420
+ }
421
+ if (_response.error.reason === "status-code") {
422
+ switch (_response.error.statusCode) {
423
+ case 401:
424
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
425
+ case 404:
426
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
427
+ case 409:
428
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
429
+ case 422:
430
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
431
+ case 502:
432
+ throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
433
+ default:
434
+ throw new errors.AthenaIntelligenceError({
435
+ statusCode: _response.error.statusCode,
436
+ body: _response.error.body,
437
+ rawResponse: _response.rawResponse,
438
+ });
439
+ }
440
+ }
441
+ switch (_response.error.reason) {
442
+ case "non-json":
443
+ throw new errors.AthenaIntelligenceError({
444
+ statusCode: _response.error.statusCode,
445
+ body: _response.error.rawBody,
446
+ rawResponse: _response.rawResponse,
447
+ });
448
+ case "body-is-null":
449
+ throw new errors.AthenaIntelligenceError({
450
+ statusCode: _response.error.statusCode,
451
+ rawResponse: _response.rawResponse,
452
+ });
453
+ case "timeout":
454
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/computer/{asset_id}/start.");
455
+ case "unknown":
456
+ throw new errors.AthenaIntelligenceError({
457
+ message: _response.error.errorMessage,
458
+ rawResponse: _response.rawResponse,
459
+ });
460
+ }
461
+ });
462
+ }
463
+ /**
464
+ * Stop (suspend) a running computer's runtime — the same operation as the Stop button in Athena. The computer's files persist and it can be started again with `start_computer`. Returns 409 when the provider does not support lifecycle operations or when the stop was refused because the workspace could not be saved (the computer is left running; retry).
465
+ *
466
+ * @param {AthenaIntelligence.StopComputerComputerRequest} request
467
+ * @param {ComputerClient.RequestOptions} requestOptions - Request-specific configuration.
468
+ *
469
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
470
+ * @throws {@link AthenaIntelligence.NotFoundError}
471
+ * @throws {@link AthenaIntelligence.ConflictError}
472
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
473
+ * @throws {@link AthenaIntelligence.BadGatewayError}
474
+ *
475
+ * @example
476
+ * await client.computer.stopComputer({
477
+ * asset_id: "asset_id"
478
+ * })
479
+ */
480
+ stopComputer(request, requestOptions) {
481
+ return core.HttpResponsePromise.fromPromise(this.__stopComputer(request, requestOptions));
482
+ }
483
+ __stopComputer(request, requestOptions) {
484
+ return __awaiter(this, void 0, void 0, function* () {
485
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
486
+ const { asset_id: assetId } = request;
487
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
488
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
489
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
490
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/computer/${core.url.encodePathParam(assetId)}/stop`),
491
+ method: "POST",
492
+ headers: _headers,
493
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
494
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
495
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
496
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
497
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
498
+ logging: this._options.logging,
499
+ });
500
+ if (_response.ok) {
501
+ return {
502
+ data: _response.body,
503
+ rawResponse: _response.rawResponse,
504
+ };
505
+ }
506
+ if (_response.error.reason === "status-code") {
507
+ switch (_response.error.statusCode) {
508
+ case 401:
509
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
510
+ case 404:
511
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
512
+ case 409:
513
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
514
+ case 422:
515
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
516
+ case 502:
517
+ throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
518
+ default:
519
+ throw new errors.AthenaIntelligenceError({
520
+ statusCode: _response.error.statusCode,
521
+ body: _response.error.body,
522
+ rawResponse: _response.rawResponse,
523
+ });
524
+ }
525
+ }
526
+ switch (_response.error.reason) {
527
+ case "non-json":
528
+ throw new errors.AthenaIntelligenceError({
529
+ statusCode: _response.error.statusCode,
530
+ body: _response.error.rawBody,
531
+ rawResponse: _response.rawResponse,
532
+ });
533
+ case "body-is-null":
534
+ throw new errors.AthenaIntelligenceError({
535
+ statusCode: _response.error.statusCode,
536
+ rawResponse: _response.rawResponse,
537
+ });
538
+ case "timeout":
539
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/computer/{asset_id}/stop.");
540
+ case "unknown":
541
+ throw new errors.AthenaIntelligenceError({
542
+ message: _response.error.errorMessage,
543
+ rawResponse: _response.rawResponse,
544
+ });
545
+ }
546
+ });
547
+ }
299
548
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_id"
5
+ * }
6
+ */
7
+ export interface GetSshAccessComputerRequest {
8
+ asset_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_id"
5
+ * }
6
+ */
7
+ export interface StartComputerComputerRequest {
8
+ asset_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * asset_id: "asset_id"
5
+ * }
6
+ */
7
+ export interface StopComputerComputerRequest {
8
+ asset_id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,6 @@
1
1
  export type { CreateSshAccessRequestIn } from "./CreateSshAccessRequestIn.mjs";
2
2
  export type { DeployComputerRequestIn } from "./DeployComputerRequestIn.mjs";
3
+ export type { GetSshAccessComputerRequest } from "./GetSshAccessComputerRequest.mjs";
3
4
  export type { RevokeSshAccessRequestIn } from "./RevokeSshAccessRequestIn.mjs";
5
+ export type { StartComputerComputerRequest } from "./StartComputerComputerRequest.mjs";
6
+ export type { StopComputerComputerRequest } from "./StopComputerComputerRequest.mjs";
@@ -25,6 +25,7 @@ export * as threads from "./threads/index.mjs";
25
25
  export * from "./tools/client/requests/index.mjs";
26
26
  export * as tools from "./tools/index.mjs";
27
27
  export * from "./tools/types/index.mjs";
28
+ export * from "./users/client/requests/index.mjs";
28
29
  export * as users from "./users/index.mjs";
29
30
  export * from "./workspaces/client/requests/index.mjs";
30
31
  export * as workspaces from "./workspaces/index.mjs";
@@ -25,6 +25,7 @@ export * as threads from "./threads/index.mjs";
25
25
  export * from "./tools/client/requests/index.mjs";
26
26
  export * as tools from "./tools/index.mjs";
27
27
  export * from "./tools/types/index.mjs";
28
+ export * from "./users/client/requests/index.mjs";
28
29
  export * as users from "./users/index.mjs";
29
30
  export * from "./workspaces/client/requests/index.mjs";
30
31
  export * as workspaces from "./workspaces/index.mjs";
@@ -1,7 +1,7 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
3
  import * as core from "../../../../core/index.mjs";
4
- import type * as AthenaIntelligence from "../../../index.mjs";
4
+ import * as AthenaIntelligence from "../../../index.mjs";
5
5
  export declare namespace UsersClient {
6
6
  interface Options extends BaseClientOptions {
7
7
  }
@@ -31,4 +31,48 @@ export declare class UsersClient {
31
31
  */
32
32
  meSources(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.MeSourcesResponseOut>;
33
33
  private __meSources;
34
+ /**
35
+ * List the SSH public keys registered on the caller's Athena account. A registered key authenticates `ssh <computer_asset_id>@<gateway>` to every computer the caller can edit; keys are not tied to a workspace.
36
+ *
37
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
38
+ *
39
+ * @example
40
+ * await client.users.listSshKeys()
41
+ */
42
+ listSshKeys(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SshKeyListResponseOut>;
43
+ private __listSshKeys;
44
+ /**
45
+ * Register an SSH public key (the contents of an OpenSSH `.pub` file) on the caller's account. Returns 400 for a malformed or unsupported key, 409 when the key is already registered or the caller has reached the per-account limit.
46
+ *
47
+ * @param {AthenaIntelligence.AddSshKeyRequestIn} request
48
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
49
+ *
50
+ * @throws {@link AthenaIntelligence.BadRequestError}
51
+ * @throws {@link AthenaIntelligence.ConflictError}
52
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
53
+ *
54
+ * @example
55
+ * await client.users.addSshKey({
56
+ * label: "laptop",
57
+ * public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBZzuCu6wC9oVY2lVbVKdwpMElfCYiWTOIVQQBtq7HW9 me@laptop"
58
+ * })
59
+ */
60
+ addSshKey(request: AthenaIntelligence.AddSshKeyRequestIn, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SshKeyOut>;
61
+ private __addSshKey;
62
+ /**
63
+ * Delete an SSH public key from the caller's account. SSH sessions authenticated with the key are closed by the gateway within a minute. Returns 404 for a key the caller does not own.
64
+ *
65
+ * @param {AthenaIntelligence.DeleteSshKeyUsersRequest} request
66
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @throws {@link AthenaIntelligence.NotFoundError}
69
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
70
+ *
71
+ * @example
72
+ * await client.users.deleteSshKey({
73
+ * key_id: "key_id"
74
+ * })
75
+ */
76
+ deleteSshKey(request: AthenaIntelligence.DeleteSshKeyUsersRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.DeleteSshKeyResponseOut>;
77
+ private __deleteSshKey;
34
78
  }
@@ -13,6 +13,7 @@ import { mergeHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import * as environments from "../../../../environments.mjs";
15
15
  import * as errors from "../../../../errors/index.mjs";
16
+ import * as AthenaIntelligence from "../../../index.mjs";
16
17
  export class UsersClient {
17
18
  constructor(options = {}) {
18
19
  this._options = normalizeClientOptionsWithAuth(options);
@@ -138,4 +139,221 @@ export class UsersClient {
138
139
  }
139
140
  });
140
141
  }
142
+ /**
143
+ * List the SSH public keys registered on the caller's Athena account. A registered key authenticates `ssh <computer_asset_id>@<gateway>` to every computer the caller can edit; keys are not tied to a workspace.
144
+ *
145
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
146
+ *
147
+ * @example
148
+ * await client.users.listSshKeys()
149
+ */
150
+ listSshKeys(requestOptions) {
151
+ return core.HttpResponsePromise.fromPromise(this.__listSshKeys(requestOptions));
152
+ }
153
+ __listSshKeys(requestOptions) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
156
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
157
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
158
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
159
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/me/ssh-keys"),
160
+ method: "GET",
161
+ headers: _headers,
162
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
163
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
164
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
165
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
166
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
167
+ logging: this._options.logging,
168
+ });
169
+ if (_response.ok) {
170
+ return {
171
+ data: _response.body,
172
+ rawResponse: _response.rawResponse,
173
+ };
174
+ }
175
+ if (_response.error.reason === "status-code") {
176
+ throw new errors.AthenaIntelligenceError({
177
+ statusCode: _response.error.statusCode,
178
+ body: _response.error.body,
179
+ rawResponse: _response.rawResponse,
180
+ });
181
+ }
182
+ switch (_response.error.reason) {
183
+ case "non-json":
184
+ throw new errors.AthenaIntelligenceError({
185
+ statusCode: _response.error.statusCode,
186
+ body: _response.error.rawBody,
187
+ rawResponse: _response.rawResponse,
188
+ });
189
+ case "body-is-null":
190
+ throw new errors.AthenaIntelligenceError({
191
+ statusCode: _response.error.statusCode,
192
+ rawResponse: _response.rawResponse,
193
+ });
194
+ case "timeout":
195
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/me/ssh-keys.");
196
+ case "unknown":
197
+ throw new errors.AthenaIntelligenceError({
198
+ message: _response.error.errorMessage,
199
+ rawResponse: _response.rawResponse,
200
+ });
201
+ }
202
+ });
203
+ }
204
+ /**
205
+ * Register an SSH public key (the contents of an OpenSSH `.pub` file) on the caller's account. Returns 400 for a malformed or unsupported key, 409 when the key is already registered or the caller has reached the per-account limit.
206
+ *
207
+ * @param {AthenaIntelligence.AddSshKeyRequestIn} request
208
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
209
+ *
210
+ * @throws {@link AthenaIntelligence.BadRequestError}
211
+ * @throws {@link AthenaIntelligence.ConflictError}
212
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
213
+ *
214
+ * @example
215
+ * await client.users.addSshKey({
216
+ * label: "laptop",
217
+ * public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBZzuCu6wC9oVY2lVbVKdwpMElfCYiWTOIVQQBtq7HW9 me@laptop"
218
+ * })
219
+ */
220
+ addSshKey(request, requestOptions) {
221
+ return core.HttpResponsePromise.fromPromise(this.__addSshKey(request, requestOptions));
222
+ }
223
+ __addSshKey(request, requestOptions) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
226
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
227
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
228
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
229
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/me/ssh-keys"),
230
+ method: "POST",
231
+ headers: _headers,
232
+ contentType: "application/json",
233
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
234
+ requestType: "json",
235
+ body: request,
236
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
237
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
238
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
239
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
240
+ logging: this._options.logging,
241
+ });
242
+ if (_response.ok) {
243
+ return { data: _response.body, rawResponse: _response.rawResponse };
244
+ }
245
+ if (_response.error.reason === "status-code") {
246
+ switch (_response.error.statusCode) {
247
+ case 400:
248
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
249
+ case 409:
250
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
251
+ case 422:
252
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
253
+ default:
254
+ throw new errors.AthenaIntelligenceError({
255
+ statusCode: _response.error.statusCode,
256
+ body: _response.error.body,
257
+ rawResponse: _response.rawResponse,
258
+ });
259
+ }
260
+ }
261
+ switch (_response.error.reason) {
262
+ case "non-json":
263
+ throw new errors.AthenaIntelligenceError({
264
+ statusCode: _response.error.statusCode,
265
+ body: _response.error.rawBody,
266
+ rawResponse: _response.rawResponse,
267
+ });
268
+ case "body-is-null":
269
+ throw new errors.AthenaIntelligenceError({
270
+ statusCode: _response.error.statusCode,
271
+ rawResponse: _response.rawResponse,
272
+ });
273
+ case "timeout":
274
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/me/ssh-keys.");
275
+ case "unknown":
276
+ throw new errors.AthenaIntelligenceError({
277
+ message: _response.error.errorMessage,
278
+ rawResponse: _response.rawResponse,
279
+ });
280
+ }
281
+ });
282
+ }
283
+ /**
284
+ * Delete an SSH public key from the caller's account. SSH sessions authenticated with the key are closed by the gateway within a minute. Returns 404 for a key the caller does not own.
285
+ *
286
+ * @param {AthenaIntelligence.DeleteSshKeyUsersRequest} request
287
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
288
+ *
289
+ * @throws {@link AthenaIntelligence.NotFoundError}
290
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
291
+ *
292
+ * @example
293
+ * await client.users.deleteSshKey({
294
+ * key_id: "key_id"
295
+ * })
296
+ */
297
+ deleteSshKey(request, requestOptions) {
298
+ return core.HttpResponsePromise.fromPromise(this.__deleteSshKey(request, requestOptions));
299
+ }
300
+ __deleteSshKey(request, requestOptions) {
301
+ return __awaiter(this, void 0, void 0, function* () {
302
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
303
+ const { key_id: keyId } = request;
304
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
305
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
306
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
307
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/me/ssh-keys/${core.url.encodePathParam(keyId)}`),
308
+ method: "DELETE",
309
+ headers: _headers,
310
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
311
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
312
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
313
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
314
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
315
+ logging: this._options.logging,
316
+ });
317
+ if (_response.ok) {
318
+ return {
319
+ data: _response.body,
320
+ rawResponse: _response.rawResponse,
321
+ };
322
+ }
323
+ if (_response.error.reason === "status-code") {
324
+ switch (_response.error.statusCode) {
325
+ case 404:
326
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
327
+ case 422:
328
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
329
+ default:
330
+ throw new errors.AthenaIntelligenceError({
331
+ statusCode: _response.error.statusCode,
332
+ body: _response.error.body,
333
+ rawResponse: _response.rawResponse,
334
+ });
335
+ }
336
+ }
337
+ switch (_response.error.reason) {
338
+ case "non-json":
339
+ throw new errors.AthenaIntelligenceError({
340
+ statusCode: _response.error.statusCode,
341
+ body: _response.error.rawBody,
342
+ rawResponse: _response.rawResponse,
343
+ });
344
+ case "body-is-null":
345
+ throw new errors.AthenaIntelligenceError({
346
+ statusCode: _response.error.statusCode,
347
+ rawResponse: _response.rawResponse,
348
+ });
349
+ case "timeout":
350
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling DELETE /api/v0/me/ssh-keys/{key_id}.");
351
+ case "unknown":
352
+ throw new errors.AthenaIntelligenceError({
353
+ message: _response.error.errorMessage,
354
+ rawResponse: _response.rawResponse,
355
+ });
356
+ }
357
+ });
358
+ }
141
359
  }
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.mjs";
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * label: "laptop",
5
+ * public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBZzuCu6wC9oVY2lVbVKdwpMElfCYiWTOIVQQBtq7HW9 me@laptop"
6
+ * }
7
+ */
8
+ export interface AddSshKeyRequestIn {
9
+ /** Optional display label; defaults to the key's comment, then its type. */
10
+ label?: string | null;
11
+ /** The contents of an OpenSSH ``.pub`` file: ``<type> <base64> [comment]``. Accepted types: ssh-ed25519, ecdsa-sha2-nistp256/384/521, ssh-rsa (2048 bits or more), and the FIDO ``sk-`` variants. */
12
+ public_key: string;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};