@boatdev/sdk 1.9.6 → 1.9.8

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 (78) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +2 -2
  3. package/dist/apis/BoatApi.d.ts +76 -0
  4. package/dist/apis/BoatApi.js +199 -0
  5. package/dist/boat-helpers.d.ts +23 -0
  6. package/dist/boat-helpers.js +97 -0
  7. package/dist/esm/apis/BoatApi.d.ts +76 -0
  8. package/dist/esm/apis/BoatApi.js +199 -0
  9. package/dist/esm/boat-helpers.d.ts +23 -0
  10. package/dist/esm/boat-helpers.js +95 -0
  11. package/dist/esm/models/CredentialAccount.d.ts +50 -0
  12. package/dist/esm/models/CredentialAccount.js +53 -0
  13. package/dist/esm/models/CredentialAccountsResponse.d.ts +64 -0
  14. package/dist/esm/models/CredentialAccountsResponse.js +65 -0
  15. package/dist/esm/models/CredentialProfile.d.ts +9 -0
  16. package/dist/esm/models/CredentialProfile.js +2 -0
  17. package/dist/esm/models/DeletionOperation.d.ts +1 -3
  18. package/dist/esm/models/DeletionOperation.js +0 -2
  19. package/dist/esm/models/LimitsFields.d.ts +7 -0
  20. package/dist/esm/models/LimitsFields.js +3 -0
  21. package/dist/esm/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
  22. package/dist/esm/models/LimitsFieldsMachineTypesInner.js +60 -0
  23. package/dist/esm/models/LimitsResponse.d.ts +7 -0
  24. package/dist/esm/models/LimitsResponse.js +3 -0
  25. package/dist/esm/models/Sandbox.d.ts +15 -2
  26. package/dist/esm/models/Sandbox.js +5 -0
  27. package/dist/esm/models/SandboxHydration.d.ts +50 -0
  28. package/dist/esm/models/SandboxHydration.js +55 -0
  29. package/dist/esm/models/SetCredentialKeyRequest.d.ts +6 -0
  30. package/dist/esm/models/SetCredentialKeyRequest.js +2 -0
  31. package/dist/esm/models/index.d.ts +4 -0
  32. package/dist/esm/models/index.js +4 -0
  33. package/dist/models/CredentialAccount.d.ts +50 -0
  34. package/dist/models/CredentialAccount.js +60 -0
  35. package/dist/models/CredentialAccountsResponse.d.ts +64 -0
  36. package/dist/models/CredentialAccountsResponse.js +72 -0
  37. package/dist/models/CredentialProfile.d.ts +9 -0
  38. package/dist/models/CredentialProfile.js +2 -0
  39. package/dist/models/DeletionOperation.d.ts +1 -3
  40. package/dist/models/DeletionOperation.js +0 -2
  41. package/dist/models/LimitsFields.d.ts +7 -0
  42. package/dist/models/LimitsFields.js +3 -0
  43. package/dist/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
  44. package/dist/models/LimitsFieldsMachineTypesInner.js +68 -0
  45. package/dist/models/LimitsResponse.d.ts +7 -0
  46. package/dist/models/LimitsResponse.js +3 -0
  47. package/dist/models/Sandbox.d.ts +15 -2
  48. package/dist/models/Sandbox.js +5 -0
  49. package/dist/models/SandboxHydration.d.ts +50 -0
  50. package/dist/models/SandboxHydration.js +62 -0
  51. package/dist/models/SetCredentialKeyRequest.d.ts +6 -0
  52. package/dist/models/SetCredentialKeyRequest.js +2 -0
  53. package/dist/models/index.d.ts +4 -0
  54. package/dist/models/index.js +4 -0
  55. package/docs/BoatApi.md +325 -0
  56. package/docs/CredentialAccount.md +39 -0
  57. package/docs/CredentialAccountsResponse.md +42 -0
  58. package/docs/CredentialProfile.md +2 -0
  59. package/docs/LimitsFields.md +2 -0
  60. package/docs/LimitsFieldsMachineTypesInner.md +36 -0
  61. package/docs/LimitsResponse.md +2 -0
  62. package/docs/Sandbox.md +4 -0
  63. package/docs/SandboxHydration.md +39 -0
  64. package/docs/SetCredentialKeyRequest.md +2 -0
  65. package/package.json +2 -2
  66. package/src/apis/BoatApi.ts +307 -0
  67. package/src/boat-helpers.ts +109 -0
  68. package/src/models/CredentialAccount.ts +92 -0
  69. package/src/models/CredentialAccountsResponse.ts +128 -0
  70. package/src/models/CredentialProfile.ts +15 -0
  71. package/src/models/DeletionOperation.ts +1 -3
  72. package/src/models/LimitsFields.ts +15 -0
  73. package/src/models/LimitsFieldsMachineTypesInner.ts +97 -0
  74. package/src/models/LimitsResponse.ts +15 -0
  75. package/src/models/Sandbox.ts +25 -2
  76. package/src/models/SandboxHydration.ts +93 -0
  77. package/src/models/SetCredentialKeyRequest.ts +8 -0
  78. package/src/models/index.ts +4 -0
@@ -33,6 +33,7 @@ import { type CreateSandboxEnvironmentRequest } from '../models/CreateSandboxEnv
33
33
  import { type CreateSandboxRequest } from '../models/CreateSandboxRequest';
34
34
  import { type CreateSandboxResponse } from '../models/CreateSandboxResponse';
35
35
  import { type CreateScopedApiKeyRequest } from '../models/CreateScopedApiKeyRequest';
36
+ import { type CredentialAccountsResponse } from '../models/CredentialAccountsResponse';
36
37
  import { type CredentialId } from '../models/CredentialId';
37
38
  import { type CredentialProfileDeletedResponse } from '../models/CredentialProfileDeletedResponse';
38
39
  import { type CredentialProfileListResponse } from '../models/CredentialProfileListResponse';
@@ -114,6 +115,11 @@ import { type WebhookListResponse } from '../models/WebhookListResponse';
114
115
  import { type WebhookResponse } from '../models/WebhookResponse';
115
116
  import { type WebhookSecretResponse } from '../models/WebhookSecretResponse';
116
117
  import { type WebhookUpdateRequest } from '../models/WebhookUpdateRequest';
118
+ export interface AddCredentialAccountRequest {
119
+ profile: string;
120
+ credential: CredentialId;
121
+ setCredentialKeyRequest: SetCredentialKeyRequest;
122
+ }
117
123
  export interface AddEnvironmentRepoOperationRequest {
118
124
  environmentId: string;
119
125
  addEnvironmentRepoRequest: AddEnvironmentRepoRequest;
@@ -191,6 +197,11 @@ export interface CreateUploadUrlRequest {
191
197
  export interface CreateWebhookRequest {
192
198
  webhookCreateRequest: WebhookCreateRequest;
193
199
  }
200
+ export interface DeleteCredentialAccountRequest {
201
+ profile: string;
202
+ credential: CredentialId;
203
+ account: string;
204
+ }
194
205
  export interface DeleteCredentialProfileRequest {
195
206
  profile: string;
196
207
  }
@@ -321,6 +332,10 @@ export interface LimitsRequest {
321
332
  xBoatOrg?: string;
322
333
  teamId?: string;
323
334
  }
335
+ export interface ListCredentialAccountsRequest {
336
+ profile: string;
337
+ credential: CredentialId;
338
+ }
324
339
  export interface ListSandboxSnapshotsRequest {
325
340
  sandboxId: string;
326
341
  limit?: number;
@@ -444,6 +459,11 @@ export interface StopCommandRequest {
444
459
  sandboxId: string;
445
460
  processId: number;
446
461
  }
462
+ export interface SwitchCredentialAccountRequest {
463
+ profile: string;
464
+ credential: CredentialId;
465
+ account: string;
466
+ }
447
467
  export interface UpdateRequest {
448
468
  sandboxId: string;
449
469
  updateSandboxRequest: UpdateSandboxRequest;
@@ -490,6 +510,20 @@ export interface WriteFileRequest {
490
510
  *
491
511
  */
492
512
  export declare class BoatApi extends runtime.BaseAPI {
513
+ /**
514
+ * Creates request options for addCredentialAccount without sending the request
515
+ */
516
+ addCredentialAccountRequestOpts(input: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>): Promise<runtime.RequestOpts>;
517
+ /**
518
+ * Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
519
+ * Add another API key to a credential
520
+ */
521
+ addCredentialAccountRaw(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
522
+ /**
523
+ * Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
524
+ * Add another API key to a credential
525
+ */
526
+ addCredentialAccount(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
493
527
  /**
494
528
  * Creates request options for addEnvironmentRepo without sending the request
495
529
  */
@@ -742,6 +776,20 @@ export declare class BoatApi extends runtime.BaseAPI {
742
776
  * Create webhook
743
777
  */
744
778
  createWebhook(requestParameters: CreateWebhookRequest | runtime.FlatBody<CreateWebhookRequest, 'webhookCreateRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WebhookSecretResponse>;
779
+ /**
780
+ * Creates request options for deleteCredentialAccount without sending the request
781
+ */
782
+ deleteCredentialAccountRequestOpts(requestParameters: DeleteCredentialAccountRequest): Promise<runtime.RequestOpts>;
783
+ /**
784
+ * Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
785
+ * Forget an account of a credential
786
+ */
787
+ deleteCredentialAccountRaw(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
788
+ /**
789
+ * Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
790
+ * Forget an account of a credential
791
+ */
792
+ deleteCredentialAccount(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
745
793
  /**
746
794
  * Creates request options for deleteCredentialProfile without sending the request
747
795
  */
@@ -1228,6 +1276,20 @@ export declare class BoatApi extends runtime.BaseAPI {
1228
1276
  * Get Boat limits
1229
1277
  */
1230
1278
  limits(requestParameters?: LimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LimitsResponse>;
1279
+ /**
1280
+ * Creates request options for listCredentialAccounts without sending the request
1281
+ */
1282
+ listCredentialAccountsRequestOpts(requestParameters: ListCredentialAccountsRequest): Promise<runtime.RequestOpts>;
1283
+ /**
1284
+ * Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
1285
+ * List the accounts of a credential
1286
+ */
1287
+ listCredentialAccountsRaw(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
1288
+ /**
1289
+ * Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
1290
+ * List the accounts of a credential
1291
+ */
1292
+ listCredentialAccounts(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
1231
1293
  /**
1232
1294
  * Creates request options for listCredentialProfiles without sending the request
1233
1295
  */
@@ -1716,6 +1778,20 @@ export declare class BoatApi extends runtime.BaseAPI {
1716
1778
  * Stop a detached command
1717
1779
  */
1718
1780
  stopCommand(requestParameters: StopCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CommandStopResponse>;
1781
+ /**
1782
+ * Creates request options for switchCredentialAccount without sending the request
1783
+ */
1784
+ switchCredentialAccountRequestOpts(requestParameters: SwitchCredentialAccountRequest): Promise<runtime.RequestOpts>;
1785
+ /**
1786
+ * Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
1787
+ * Switch a credential to another account
1788
+ */
1789
+ switchCredentialAccountRaw(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
1790
+ /**
1791
+ * Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
1792
+ * Switch a credential to another account
1793
+ */
1794
+ switchCredentialAccount(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
1719
1795
  /**
1720
1796
  * Creates request options for update without sending the request
1721
1797
  */
@@ -35,6 +35,7 @@ import { CreateSandboxEnvironmentRequestToJSON, } from '../models/CreateSandboxE
35
35
  import { CreateSandboxRequestToJSON, } from '../models/CreateSandboxRequest';
36
36
  import { CreateSandboxResponseFromJSON, } from '../models/CreateSandboxResponse';
37
37
  import { CreateScopedApiKeyRequestToJSON, } from '../models/CreateScopedApiKeyRequest';
38
+ import { CredentialAccountsResponseFromJSON, } from '../models/CredentialAccountsResponse';
38
39
  import { CredentialProfileDeletedResponseFromJSON, } from '../models/CredentialProfileDeletedResponse';
39
40
  import { CredentialProfileListResponseFromJSON, } from '../models/CredentialProfileListResponse';
40
41
  import { CredentialProfileResponseFromJSON, } from '../models/CredentialProfileResponse';
@@ -119,6 +120,58 @@ import { WebhookUpdateRequestToJSON, } from '../models/WebhookUpdateRequest';
119
120
  *
120
121
  */
121
122
  export class BoatApi extends runtime.BaseAPI {
123
+ /**
124
+ * Creates request options for addCredentialAccount without sending the request
125
+ */
126
+ async addCredentialAccountRequestOpts(input) {
127
+ const requestParameters = runtime.unflattenBody(input, 'setCredentialKeyRequest', ['profile', 'credential'], []);
128
+ if (requestParameters['profile'] == null) {
129
+ throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling addCredentialAccount().');
130
+ }
131
+ if (requestParameters['credential'] == null) {
132
+ throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling addCredentialAccount().');
133
+ }
134
+ if (requestParameters['setCredentialKeyRequest'] == null) {
135
+ throw new runtime.RequiredError('setCredentialKeyRequest', 'Required parameter "setCredentialKeyRequest" was null or undefined when calling addCredentialAccount().');
136
+ }
137
+ const queryParameters = {};
138
+ const headerParameters = {};
139
+ headerParameters['Content-Type'] = 'application/json';
140
+ if (this.configuration && this.configuration.accessToken) {
141
+ const token = this.configuration.accessToken;
142
+ const tokenString = await token("BoatBearerAuth", []);
143
+ if (tokenString) {
144
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
145
+ }
146
+ }
147
+ let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
148
+ urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
149
+ urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
150
+ return {
151
+ path: urlPath,
152
+ method: 'POST',
153
+ headers: headerParameters,
154
+ query: queryParameters,
155
+ body: SetCredentialKeyRequestToJSON(requestParameters['setCredentialKeyRequest']),
156
+ };
157
+ }
158
+ /**
159
+ * Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
160
+ * Add another API key to a credential
161
+ */
162
+ async addCredentialAccountRaw(requestParameters, initOverrides) {
163
+ const requestOptions = await this.addCredentialAccountRequestOpts(requestParameters);
164
+ const response = await this.request(requestOptions, initOverrides);
165
+ return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
166
+ }
167
+ /**
168
+ * Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
169
+ * Add another API key to a credential
170
+ */
171
+ async addCredentialAccount(requestParameters, initOverrides) {
172
+ const response = await this.addCredentialAccountRaw(requestParameters, initOverrides);
173
+ return await response.value();
174
+ }
122
175
  /**
123
176
  * Creates request options for addEnvironmentRepo without sending the request
124
177
  */
@@ -974,6 +1027,56 @@ export class BoatApi extends runtime.BaseAPI {
974
1027
  const response = await this.createWebhookRaw(requestParameters, initOverrides);
975
1028
  return await response.value();
976
1029
  }
1030
+ /**
1031
+ * Creates request options for deleteCredentialAccount without sending the request
1032
+ */
1033
+ async deleteCredentialAccountRequestOpts(requestParameters) {
1034
+ if (requestParameters['profile'] == null) {
1035
+ throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling deleteCredentialAccount().');
1036
+ }
1037
+ if (requestParameters['credential'] == null) {
1038
+ throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling deleteCredentialAccount().');
1039
+ }
1040
+ if (requestParameters['account'] == null) {
1041
+ throw new runtime.RequiredError('account', 'Required parameter "account" was null or undefined when calling deleteCredentialAccount().');
1042
+ }
1043
+ const queryParameters = {};
1044
+ const headerParameters = {};
1045
+ if (this.configuration && this.configuration.accessToken) {
1046
+ const token = this.configuration.accessToken;
1047
+ const tokenString = await token("BoatBearerAuth", []);
1048
+ if (tokenString) {
1049
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1050
+ }
1051
+ }
1052
+ let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}`;
1053
+ urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
1054
+ urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
1055
+ urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
1056
+ return {
1057
+ path: urlPath,
1058
+ method: 'DELETE',
1059
+ headers: headerParameters,
1060
+ query: queryParameters,
1061
+ };
1062
+ }
1063
+ /**
1064
+ * Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
1065
+ * Forget an account of a credential
1066
+ */
1067
+ async deleteCredentialAccountRaw(requestParameters, initOverrides) {
1068
+ const requestOptions = await this.deleteCredentialAccountRequestOpts(requestParameters);
1069
+ const response = await this.request(requestOptions, initOverrides);
1070
+ return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
1071
+ }
1072
+ /**
1073
+ * Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
1074
+ * Forget an account of a credential
1075
+ */
1076
+ async deleteCredentialAccount(requestParameters, initOverrides) {
1077
+ const response = await this.deleteCredentialAccountRaw(requestParameters, initOverrides);
1078
+ return await response.value();
1079
+ }
977
1080
  /**
978
1081
  * Creates request options for deleteCredentialProfile without sending the request
979
1082
  */
@@ -2547,6 +2650,52 @@ export class BoatApi extends runtime.BaseAPI {
2547
2650
  const response = await this.limitsRaw(requestParameters, initOverrides);
2548
2651
  return await response.value();
2549
2652
  }
2653
+ /**
2654
+ * Creates request options for listCredentialAccounts without sending the request
2655
+ */
2656
+ async listCredentialAccountsRequestOpts(requestParameters) {
2657
+ if (requestParameters['profile'] == null) {
2658
+ throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling listCredentialAccounts().');
2659
+ }
2660
+ if (requestParameters['credential'] == null) {
2661
+ throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling listCredentialAccounts().');
2662
+ }
2663
+ const queryParameters = {};
2664
+ const headerParameters = {};
2665
+ if (this.configuration && this.configuration.accessToken) {
2666
+ const token = this.configuration.accessToken;
2667
+ const tokenString = await token("BoatBearerAuth", []);
2668
+ if (tokenString) {
2669
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2670
+ }
2671
+ }
2672
+ let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
2673
+ urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
2674
+ urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
2675
+ return {
2676
+ path: urlPath,
2677
+ method: 'GET',
2678
+ headers: headerParameters,
2679
+ query: queryParameters,
2680
+ };
2681
+ }
2682
+ /**
2683
+ * Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
2684
+ * List the accounts of a credential
2685
+ */
2686
+ async listCredentialAccountsRaw(requestParameters, initOverrides) {
2687
+ const requestOptions = await this.listCredentialAccountsRequestOpts(requestParameters);
2688
+ const response = await this.request(requestOptions, initOverrides);
2689
+ return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
2690
+ }
2691
+ /**
2692
+ * Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
2693
+ * List the accounts of a credential
2694
+ */
2695
+ async listCredentialAccounts(requestParameters, initOverrides) {
2696
+ const response = await this.listCredentialAccountsRaw(requestParameters, initOverrides);
2697
+ return await response.value();
2698
+ }
2550
2699
  /**
2551
2700
  * Creates request options for listCredentialProfiles without sending the request
2552
2701
  */
@@ -4137,6 +4286,56 @@ export class BoatApi extends runtime.BaseAPI {
4137
4286
  const response = await this.stopCommandRaw(requestParameters, initOverrides);
4138
4287
  return await response.value();
4139
4288
  }
4289
+ /**
4290
+ * Creates request options for switchCredentialAccount without sending the request
4291
+ */
4292
+ async switchCredentialAccountRequestOpts(requestParameters) {
4293
+ if (requestParameters['profile'] == null) {
4294
+ throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling switchCredentialAccount().');
4295
+ }
4296
+ if (requestParameters['credential'] == null) {
4297
+ throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling switchCredentialAccount().');
4298
+ }
4299
+ if (requestParameters['account'] == null) {
4300
+ throw new runtime.RequiredError('account', 'Required parameter "account" was null or undefined when calling switchCredentialAccount().');
4301
+ }
4302
+ const queryParameters = {};
4303
+ const headerParameters = {};
4304
+ if (this.configuration && this.configuration.accessToken) {
4305
+ const token = this.configuration.accessToken;
4306
+ const tokenString = await token("BoatBearerAuth", []);
4307
+ if (tokenString) {
4308
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
4309
+ }
4310
+ }
4311
+ let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}/active`;
4312
+ urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
4313
+ urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
4314
+ urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
4315
+ return {
4316
+ path: urlPath,
4317
+ method: 'PUT',
4318
+ headers: headerParameters,
4319
+ query: queryParameters,
4320
+ };
4321
+ }
4322
+ /**
4323
+ * Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
4324
+ * Switch a credential to another account
4325
+ */
4326
+ async switchCredentialAccountRaw(requestParameters, initOverrides) {
4327
+ const requestOptions = await this.switchCredentialAccountRequestOpts(requestParameters);
4328
+ const response = await this.request(requestOptions, initOverrides);
4329
+ return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
4330
+ }
4331
+ /**
4332
+ * Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
4333
+ * Switch a credential to another account
4334
+ */
4335
+ async switchCredentialAccount(requestParameters, initOverrides) {
4336
+ const response = await this.switchCredentialAccountRaw(requestParameters, initOverrides);
4337
+ return await response.value();
4338
+ }
4140
4339
  /**
4141
4340
  * Creates request options for update without sending the request
4142
4341
  */
@@ -76,3 +76,26 @@ export type StreamCommandOptions = {
76
76
  * sent to a starting sandbox for up to 60 s instead of refusing it.
77
77
  */
78
78
  export declare function streamCommand(api: BoatApi, sandboxId: string, command: string, options?: StreamCommandOptions): AsyncGenerator<CommandFrame>;
79
+ export type FollowCommandOptions = {
80
+ signal?: AbortSignal;
81
+ };
82
+ /**
83
+ * Yield a detached command's output from its start until it ends: `stdout`/`stderr`
84
+ * chunks (`frame.data`), then exactly one `exit` (`exitCode`, ...) or `error`
85
+ * (`message`). The server ends each connection after 10 minutes; this reconnects
86
+ * from the same offsets, with no gap and no repeat. A network cut is reconnected
87
+ * the same way for up to 60 s.
88
+ */
89
+ export declare function followCommand(api: BoatApi, sandboxId: string, processId: number, options?: FollowCommandOptions): AsyncGenerator<CommandFrame>;
90
+ export type RunCommandOptions = FollowCommandOptions & {
91
+ cwd?: string;
92
+ };
93
+ /**
94
+ * Run a command with no time limit and yield its output until it ends.
95
+ *
96
+ * The command runs detached, so it has no 600 s cap and survives a dropped
97
+ * connection. Frames: `{ type: 'started', processId }`, then the frames of
98
+ * `followCommand`. Stopping early leaves the command running: call
99
+ * `stopCommand({ sandboxId, processId })` to stop it.
100
+ */
101
+ export declare function runCommand(api: BoatApi, sandboxId: string, command: string, options?: RunCommandOptions): AsyncGenerator<CommandFrame>;
@@ -245,3 +245,98 @@ export async function* streamCommand(api, sandboxId, command, options) {
245
245
  await delay(1000);
246
246
  }
247
247
  }
248
+ // The server sends a heartbeat every 15 s, so 60 s of silence is a dead connection.
249
+ const ATTACH_IDLE_MS = 60000;
250
+ // After the first connection, a failed reconnect is tried again for this long.
251
+ const ATTACH_RETRY_MS = 60000;
252
+ function isNetworkError(e, signal) {
253
+ if ((signal === null || signal === void 0 ? void 0 : signal.aborted) || e instanceof SyntaxError)
254
+ return false;
255
+ return !(e === null || e === void 0 ? void 0 : e.response);
256
+ }
257
+ /**
258
+ * Yield a detached command's output from its start until it ends: `stdout`/`stderr`
259
+ * chunks (`frame.data`), then exactly one `exit` (`exitCode`, ...) or `error`
260
+ * (`message`). The server ends each connection after 10 minutes; this reconnects
261
+ * from the same offsets, with no gap and no repeat. A network cut is reconnected
262
+ * the same way for up to 60 s.
263
+ */
264
+ export async function* followCommand(api, sandboxId, processId, options) {
265
+ var _a, _b, _c;
266
+ var _d, _e, _f, _g;
267
+ const offsets = { stdout: 0, stderr: 0 };
268
+ let connected = false;
269
+ // Set at the first failure after a good connection; any good connection clears it.
270
+ let failingSince;
271
+ for (;;) {
272
+ if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted)
273
+ throw (_d = options.signal.reason) !== null && _d !== void 0 ? _d : new Error('followCommand aborted');
274
+ // One controller per connection: the caller's signal, or 60 s with no line.
275
+ const connection = new AbortController();
276
+ const abort = () => connection.abort();
277
+ (_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', abort);
278
+ let idle;
279
+ const touch = () => {
280
+ clearTimeout(idle);
281
+ idle = setTimeout(abort, ATTACH_IDLE_MS);
282
+ };
283
+ try {
284
+ touch();
285
+ const response = await api.attachCommandRaw({ sandboxId, processId, stdoutOffset: offsets.stdout, stderrOffset: offsets.stderr }, { signal: connection.signal });
286
+ connected = true;
287
+ failingSince = undefined;
288
+ for await (const frame of ndjsonFrames(response.raw)) {
289
+ touch();
290
+ if (frame.type === 'stdout' || frame.type === 'stderr') {
291
+ offsets[frame.type] = (_e = frame.nextOffset) !== null && _e !== void 0 ? _e : offsets[frame.type];
292
+ yield frame;
293
+ }
294
+ else if (frame.type === 'exit' || frame.type === 'error') {
295
+ yield frame;
296
+ return;
297
+ }
298
+ else {
299
+ // attached, heartbeat, reconnect: ours to handle, never the caller's.
300
+ offsets.stdout = (_f = frame.stdoutOffset) !== null && _f !== void 0 ? _f : offsets.stdout;
301
+ offsets.stderr = (_g = frame.stderrOffset) !== null && _g !== void 0 ? _g : offsets.stderr;
302
+ }
303
+ }
304
+ }
305
+ catch (e) {
306
+ failingSince !== null && failingSince !== void 0 ? failingSince : (failingSince = Date.now());
307
+ if (!isNetworkError(e, options === null || options === void 0 ? void 0 : options.signal) || !connected || Date.now() - failingSince >= ATTACH_RETRY_MS)
308
+ throw e;
309
+ await delay(1000);
310
+ }
311
+ finally {
312
+ clearTimeout(idle);
313
+ (_c = options === null || options === void 0 ? void 0 : options.signal) === null || _c === void 0 ? void 0 : _c.removeEventListener('abort', abort);
314
+ }
315
+ }
316
+ }
317
+ /**
318
+ * Run a command with no time limit and yield its output until it ends.
319
+ *
320
+ * The command runs detached, so it has no 600 s cap and survives a dropped
321
+ * connection. Frames: `{ type: 'started', processId }`, then the frames of
322
+ * `followCommand`. Stopping early leaves the command running: call
323
+ * `stopCommand({ sandboxId, processId })` to stop it.
324
+ */
325
+ export async function* runCommand(api, sandboxId, command, options) {
326
+ const deadline = Date.now() + STREAM_RETRY_MS;
327
+ let processId;
328
+ for (;;) {
329
+ try {
330
+ const started = await api.command({ sandboxId, commandRequest: { command, cwd: options === null || options === void 0 ? void 0 : options.cwd, detached: true } });
331
+ processId = started.processId;
332
+ break;
333
+ }
334
+ catch (e) {
335
+ if (Date.now() + 1000 >= deadline || !(await isRetryable(e)))
336
+ throw e;
337
+ }
338
+ await delay(1000);
339
+ }
340
+ yield { type: 'started', processId };
341
+ yield* followCommand(api, sandboxId, processId, options);
342
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Boat Public API v1
3
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * One account of a credential. Never a secret.
14
+ * @export
15
+ * @interface CredentialAccount
16
+ */
17
+ export interface CredentialAccount {
18
+ /**
19
+ * The account's id. It stays the same across switches.
20
+ * @type {string}
21
+ * @memberof CredentialAccount
22
+ */
23
+ id: string;
24
+ /**
25
+ * The account's email for a sign-in, or the key's last characters (…1234).
26
+ * @type {string}
27
+ * @memberof CredentialAccount
28
+ */
29
+ label: string;
30
+ /**
31
+ * True for the account every sandbox on the profile uses.
32
+ * @type {boolean}
33
+ * @memberof CredentialAccount
34
+ */
35
+ active: boolean;
36
+ /**
37
+ * When the account was set aside (accounts not in use).
38
+ * @type {Date}
39
+ * @memberof CredentialAccount
40
+ */
41
+ addedAt?: Date;
42
+ }
43
+ /**
44
+ * Check if a given object implements the CredentialAccount interface.
45
+ */
46
+ export declare function instanceOfCredentialAccount(value: object): value is CredentialAccount;
47
+ export declare function CredentialAccountFromJSON(json: any): CredentialAccount;
48
+ export declare function CredentialAccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): CredentialAccount;
49
+ export declare function CredentialAccountToJSON(json: any): CredentialAccount;
50
+ export declare function CredentialAccountToJSONTyped(value?: CredentialAccount | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,53 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Boat Public API v1
5
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the CredentialAccount interface.
16
+ */
17
+ export function instanceOfCredentialAccount(value) {
18
+ if (!('id' in value) || value['id'] === undefined)
19
+ return false;
20
+ if (!('label' in value) || value['label'] === undefined)
21
+ return false;
22
+ if (!('active' in value) || value['active'] === undefined)
23
+ return false;
24
+ return true;
25
+ }
26
+ export function CredentialAccountFromJSON(json) {
27
+ return CredentialAccountFromJSONTyped(json, false);
28
+ }
29
+ export function CredentialAccountFromJSONTyped(json, ignoreDiscriminator) {
30
+ if (json == null) {
31
+ return json;
32
+ }
33
+ return {
34
+ 'id': json['id'],
35
+ 'label': json['label'],
36
+ 'active': json['active'],
37
+ 'addedAt': json['addedAt'] == null ? undefined : (new Date(json['addedAt'])),
38
+ };
39
+ }
40
+ export function CredentialAccountToJSON(json) {
41
+ return CredentialAccountToJSONTyped(json, false);
42
+ }
43
+ export function CredentialAccountToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'id': value['id'],
49
+ 'label': value['label'],
50
+ 'active': value['active'],
51
+ 'addedAt': value['addedAt'] == null ? value['addedAt'] : value['addedAt'].toISOString(),
52
+ };
53
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Boat Public API v1
3
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { CredentialId } from './CredentialId';
13
+ import type { CredentialAccount } from './CredentialAccount';
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface CredentialAccountsResponse
18
+ */
19
+ export interface CredentialAccountsResponse {
20
+ /**
21
+ *
22
+ * @type {boolean}
23
+ * @memberof CredentialAccountsResponse
24
+ */
25
+ ok: boolean;
26
+ /**
27
+ * Stable success envelope discriminator added by v1.
28
+ * @type {string}
29
+ * @memberof CredentialAccountsResponse
30
+ */
31
+ type: string;
32
+ /**
33
+ *
34
+ * @type {boolean}
35
+ * @memberof CredentialAccountsResponse
36
+ */
37
+ success: boolean;
38
+ /**
39
+ *
40
+ * @type {string}
41
+ * @memberof CredentialAccountsResponse
42
+ */
43
+ profileId: string;
44
+ /**
45
+ *
46
+ * @type {CredentialId}
47
+ * @memberof CredentialAccountsResponse
48
+ */
49
+ credential: CredentialId;
50
+ /**
51
+ * In the order the accounts were added, so their numbers stay the same across switches. The one in use is marked `active`.
52
+ * @type {Array<CredentialAccount>}
53
+ * @memberof CredentialAccountsResponse
54
+ */
55
+ accounts: Array<CredentialAccount>;
56
+ }
57
+ /**
58
+ * Check if a given object implements the CredentialAccountsResponse interface.
59
+ */
60
+ export declare function instanceOfCredentialAccountsResponse(value: object): value is CredentialAccountsResponse;
61
+ export declare function CredentialAccountsResponseFromJSON(json: any): CredentialAccountsResponse;
62
+ export declare function CredentialAccountsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CredentialAccountsResponse;
63
+ export declare function CredentialAccountsResponseToJSON(json: any): CredentialAccountsResponse;
64
+ export declare function CredentialAccountsResponseToJSONTyped(value?: CredentialAccountsResponse | null, ignoreDiscriminator?: boolean): any;