@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.
- package/.openapi-generator/FILES +8 -0
- package/README.md +2 -2
- package/dist/apis/BoatApi.d.ts +76 -0
- package/dist/apis/BoatApi.js +199 -0
- package/dist/boat-helpers.d.ts +23 -0
- package/dist/boat-helpers.js +97 -0
- package/dist/esm/apis/BoatApi.d.ts +76 -0
- package/dist/esm/apis/BoatApi.js +199 -0
- package/dist/esm/boat-helpers.d.ts +23 -0
- package/dist/esm/boat-helpers.js +95 -0
- package/dist/esm/models/CredentialAccount.d.ts +50 -0
- package/dist/esm/models/CredentialAccount.js +53 -0
- package/dist/esm/models/CredentialAccountsResponse.d.ts +64 -0
- package/dist/esm/models/CredentialAccountsResponse.js +65 -0
- package/dist/esm/models/CredentialProfile.d.ts +9 -0
- package/dist/esm/models/CredentialProfile.js +2 -0
- package/dist/esm/models/DeletionOperation.d.ts +1 -3
- package/dist/esm/models/DeletionOperation.js +0 -2
- package/dist/esm/models/LimitsFields.d.ts +7 -0
- package/dist/esm/models/LimitsFields.js +3 -0
- package/dist/esm/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
- package/dist/esm/models/LimitsFieldsMachineTypesInner.js +60 -0
- package/dist/esm/models/LimitsResponse.d.ts +7 -0
- package/dist/esm/models/LimitsResponse.js +3 -0
- package/dist/esm/models/Sandbox.d.ts +15 -2
- package/dist/esm/models/Sandbox.js +5 -0
- package/dist/esm/models/SandboxHydration.d.ts +50 -0
- package/dist/esm/models/SandboxHydration.js +55 -0
- package/dist/esm/models/SetCredentialKeyRequest.d.ts +6 -0
- package/dist/esm/models/SetCredentialKeyRequest.js +2 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/models/CredentialAccount.d.ts +50 -0
- package/dist/models/CredentialAccount.js +60 -0
- package/dist/models/CredentialAccountsResponse.d.ts +64 -0
- package/dist/models/CredentialAccountsResponse.js +72 -0
- package/dist/models/CredentialProfile.d.ts +9 -0
- package/dist/models/CredentialProfile.js +2 -0
- package/dist/models/DeletionOperation.d.ts +1 -3
- package/dist/models/DeletionOperation.js +0 -2
- package/dist/models/LimitsFields.d.ts +7 -0
- package/dist/models/LimitsFields.js +3 -0
- package/dist/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
- package/dist/models/LimitsFieldsMachineTypesInner.js +68 -0
- package/dist/models/LimitsResponse.d.ts +7 -0
- package/dist/models/LimitsResponse.js +3 -0
- package/dist/models/Sandbox.d.ts +15 -2
- package/dist/models/Sandbox.js +5 -0
- package/dist/models/SandboxHydration.d.ts +50 -0
- package/dist/models/SandboxHydration.js +62 -0
- package/dist/models/SetCredentialKeyRequest.d.ts +6 -0
- package/dist/models/SetCredentialKeyRequest.js +2 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/docs/BoatApi.md +325 -0
- package/docs/CredentialAccount.md +39 -0
- package/docs/CredentialAccountsResponse.md +42 -0
- package/docs/CredentialProfile.md +2 -0
- package/docs/LimitsFields.md +2 -0
- package/docs/LimitsFieldsMachineTypesInner.md +36 -0
- package/docs/LimitsResponse.md +2 -0
- package/docs/Sandbox.md +4 -0
- package/docs/SandboxHydration.md +39 -0
- package/docs/SetCredentialKeyRequest.md +2 -0
- package/package.json +2 -2
- package/src/apis/BoatApi.ts +307 -0
- package/src/boat-helpers.ts +109 -0
- package/src/models/CredentialAccount.ts +92 -0
- package/src/models/CredentialAccountsResponse.ts +128 -0
- package/src/models/CredentialProfile.ts +15 -0
- package/src/models/DeletionOperation.ts +1 -3
- package/src/models/LimitsFields.ts +15 -0
- package/src/models/LimitsFieldsMachineTypesInner.ts +97 -0
- package/src/models/LimitsResponse.ts +15 -0
- package/src/models/Sandbox.ts +25 -2
- package/src/models/SandboxHydration.ts +93 -0
- package/src/models/SetCredentialKeyRequest.ts +8 -0
- package/src/models/index.ts +4 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# LimitsFieldsMachineTypesInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`type` | string
|
|
10
|
+
`available` | boolean
|
|
11
|
+
`reason` | string
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { LimitsFieldsMachineTypesInner } from '@boatdev/sdk'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"type": null,
|
|
21
|
+
"available": null,
|
|
22
|
+
"reason": null,
|
|
23
|
+
} satisfies LimitsFieldsMachineTypesInner
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as LimitsFieldsMachineTypesInner
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
package/docs/LimitsResponse.md
CHANGED
|
@@ -49,6 +49,7 @@ Name | Type
|
|
|
49
49
|
`last24hUsageSeconds` | number
|
|
50
50
|
`trialComputeCapSeconds` | number
|
|
51
51
|
`trialLine` | string
|
|
52
|
+
`machineTypes` | [Array<LimitsFieldsMachineTypesInner>](LimitsFieldsMachineTypesInner.md)
|
|
52
53
|
`giftLimit` | [LimitsFieldsGiftLimit](LimitsFieldsGiftLimit.md)
|
|
53
54
|
`billingStatus` | string
|
|
54
55
|
`subscriptionStatus` | string
|
|
@@ -110,6 +111,7 @@ const example = {
|
|
|
110
111
|
"last24hUsageSeconds": null,
|
|
111
112
|
"trialComputeCapSeconds": null,
|
|
112
113
|
"trialLine": null,
|
|
114
|
+
"machineTypes": null,
|
|
113
115
|
"giftLimit": null,
|
|
114
116
|
"billingStatus": null,
|
|
115
117
|
"subscriptionStatus": null,
|
package/docs/Sandbox.md
CHANGED
|
@@ -15,6 +15,7 @@ Name | Type
|
|
|
15
15
|
`degradedSince` | Date
|
|
16
16
|
`hydrated` | boolean
|
|
17
17
|
`hydratedAt` | Date
|
|
18
|
+
`hydration` | [SandboxHydration](SandboxHydration.md)
|
|
18
19
|
`type` | string
|
|
19
20
|
`vcpu` | number
|
|
20
21
|
`memoryGB` | number
|
|
@@ -26,6 +27,7 @@ Name | Type
|
|
|
26
27
|
`createdAt` | Date
|
|
27
28
|
`updatedAt` | Date
|
|
28
29
|
`archiveAfter` | Date
|
|
30
|
+
`ttlSeconds` | number
|
|
29
31
|
`desktopAvailable` | boolean
|
|
30
32
|
`desktopUrl` | string
|
|
31
33
|
`snapshots` | boolean
|
|
@@ -64,6 +66,7 @@ const example = {
|
|
|
64
66
|
"degradedSince": null,
|
|
65
67
|
"hydrated": null,
|
|
66
68
|
"hydratedAt": null,
|
|
69
|
+
"hydration": null,
|
|
67
70
|
"type": null,
|
|
68
71
|
"vcpu": null,
|
|
69
72
|
"memoryGB": null,
|
|
@@ -75,6 +78,7 @@ const example = {
|
|
|
75
78
|
"createdAt": null,
|
|
76
79
|
"updatedAt": null,
|
|
77
80
|
"archiveAfter": null,
|
|
81
|
+
"ttlSeconds": null,
|
|
78
82
|
"desktopAvailable": null,
|
|
79
83
|
"desktopUrl": null,
|
|
80
84
|
"snapshots": null,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SandboxHydration
|
|
3
|
+
|
|
4
|
+
Restore progress while `hydrated` is false, on GET /sandboxes/{id} only. Null in lists, after hydration, or when the sandbox does not answer within 1.5 s.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`phase` | string
|
|
11
|
+
`entriesDone` | number
|
|
12
|
+
`entriesTotal` | number
|
|
13
|
+
`percent` | number
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { SandboxHydration } from '@boatdev/sdk'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"phase": null,
|
|
23
|
+
"entriesDone": null,
|
|
24
|
+
"entriesTotal": null,
|
|
25
|
+
"percent": null,
|
|
26
|
+
} satisfies SandboxHydration
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as SandboxHydration
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
Name | Type
|
|
8
8
|
------------ | -------------
|
|
9
9
|
`value` | string
|
|
10
|
+
`keepCurrent` | boolean
|
|
10
11
|
|
|
11
12
|
## Example
|
|
12
13
|
|
|
@@ -16,6 +17,7 @@ import type { SetCredentialKeyRequest } from '@boatdev/sdk'
|
|
|
16
17
|
// TODO: Update the object below with actual values
|
|
17
18
|
const example = {
|
|
18
19
|
"value": null,
|
|
20
|
+
"keepCurrent": null,
|
|
19
21
|
} satisfies SetCredentialKeyRequest
|
|
20
22
|
|
|
21
23
|
console.log(example)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boatdev/sdk",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"description": "OpenAPI client for @boatdev/sdk",
|
|
5
5
|
"author": "OpenAPI-Generator",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "7.0.2"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://docs.boat.dev/sdks"
|
|
18
|
+
"homepage": "https://docs.boat.dev/sdks/overview"
|
|
19
19
|
}
|
package/src/apis/BoatApi.ts
CHANGED
|
@@ -138,6 +138,11 @@ import {
|
|
|
138
138
|
CreateScopedApiKeyRequestFromJSON,
|
|
139
139
|
CreateScopedApiKeyRequestToJSON,
|
|
140
140
|
} from '../models/CreateScopedApiKeyRequest';
|
|
141
|
+
import {
|
|
142
|
+
type CredentialAccountsResponse,
|
|
143
|
+
CredentialAccountsResponseFromJSON,
|
|
144
|
+
CredentialAccountsResponseToJSON,
|
|
145
|
+
} from '../models/CredentialAccountsResponse';
|
|
141
146
|
import {
|
|
142
147
|
type CredentialId,
|
|
143
148
|
CredentialIdFromJSON,
|
|
@@ -554,6 +559,12 @@ import {
|
|
|
554
559
|
WebhookUpdateRequestToJSON,
|
|
555
560
|
} from '../models/WebhookUpdateRequest';
|
|
556
561
|
|
|
562
|
+
export interface AddCredentialAccountRequest {
|
|
563
|
+
profile: string;
|
|
564
|
+
credential: CredentialId;
|
|
565
|
+
setCredentialKeyRequest: SetCredentialKeyRequest;
|
|
566
|
+
}
|
|
567
|
+
|
|
557
568
|
export interface AddEnvironmentRepoOperationRequest {
|
|
558
569
|
environmentId: string;
|
|
559
570
|
addEnvironmentRepoRequest: AddEnvironmentRepoRequest;
|
|
@@ -648,6 +659,12 @@ export interface CreateWebhookRequest {
|
|
|
648
659
|
webhookCreateRequest: WebhookCreateRequest;
|
|
649
660
|
}
|
|
650
661
|
|
|
662
|
+
export interface DeleteCredentialAccountRequest {
|
|
663
|
+
profile: string;
|
|
664
|
+
credential: CredentialId;
|
|
665
|
+
account: string;
|
|
666
|
+
}
|
|
667
|
+
|
|
651
668
|
export interface DeleteCredentialProfileRequest {
|
|
652
669
|
profile: string;
|
|
653
670
|
}
|
|
@@ -810,6 +827,11 @@ export interface LimitsRequest {
|
|
|
810
827
|
teamId?: string;
|
|
811
828
|
}
|
|
812
829
|
|
|
830
|
+
export interface ListCredentialAccountsRequest {
|
|
831
|
+
profile: string;
|
|
832
|
+
credential: CredentialId;
|
|
833
|
+
}
|
|
834
|
+
|
|
813
835
|
export interface ListSandboxSnapshotsRequest {
|
|
814
836
|
sandboxId: string;
|
|
815
837
|
limit?: number;
|
|
@@ -962,6 +984,12 @@ export interface StopCommandRequest {
|
|
|
962
984
|
processId: number;
|
|
963
985
|
}
|
|
964
986
|
|
|
987
|
+
export interface SwitchCredentialAccountRequest {
|
|
988
|
+
profile: string;
|
|
989
|
+
credential: CredentialId;
|
|
990
|
+
account: string;
|
|
991
|
+
}
|
|
992
|
+
|
|
965
993
|
export interface UpdateRequest {
|
|
966
994
|
sandboxId: string;
|
|
967
995
|
updateSandboxRequest: UpdateSandboxRequest;
|
|
@@ -1019,6 +1047,80 @@ export interface WriteFileRequest {
|
|
|
1019
1047
|
*/
|
|
1020
1048
|
export class BoatApi extends runtime.BaseAPI {
|
|
1021
1049
|
|
|
1050
|
+
/**
|
|
1051
|
+
* Creates request options for addCredentialAccount without sending the request
|
|
1052
|
+
*/
|
|
1053
|
+
async addCredentialAccountRequestOpts(input: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>): Promise<runtime.RequestOpts> {
|
|
1054
|
+
const requestParameters = runtime.unflattenBody<AddCredentialAccountRequest>(input, 'setCredentialKeyRequest', ['profile', 'credential'], []);
|
|
1055
|
+
if (requestParameters['profile'] == null) {
|
|
1056
|
+
throw new runtime.RequiredError(
|
|
1057
|
+
'profile',
|
|
1058
|
+
'Required parameter "profile" was null or undefined when calling addCredentialAccount().'
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (requestParameters['credential'] == null) {
|
|
1063
|
+
throw new runtime.RequiredError(
|
|
1064
|
+
'credential',
|
|
1065
|
+
'Required parameter "credential" was null or undefined when calling addCredentialAccount().'
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (requestParameters['setCredentialKeyRequest'] == null) {
|
|
1070
|
+
throw new runtime.RequiredError(
|
|
1071
|
+
'setCredentialKeyRequest',
|
|
1072
|
+
'Required parameter "setCredentialKeyRequest" was null or undefined when calling addCredentialAccount().'
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
const queryParameters: any = {};
|
|
1077
|
+
|
|
1078
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1079
|
+
|
|
1080
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1081
|
+
|
|
1082
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1083
|
+
const token = this.configuration.accessToken;
|
|
1084
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
1085
|
+
|
|
1086
|
+
if (tokenString) {
|
|
1087
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
|
|
1092
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
1093
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
1094
|
+
|
|
1095
|
+
return {
|
|
1096
|
+
path: urlPath,
|
|
1097
|
+
method: 'POST',
|
|
1098
|
+
headers: headerParameters,
|
|
1099
|
+
query: queryParameters,
|
|
1100
|
+
body: SetCredentialKeyRequestToJSON(requestParameters['setCredentialKeyRequest']),
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* 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`.
|
|
1106
|
+
* Add another API key to a credential
|
|
1107
|
+
*/
|
|
1108
|
+
async addCredentialAccountRaw(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>> {
|
|
1109
|
+
const requestOptions = await this.addCredentialAccountRequestOpts(requestParameters);
|
|
1110
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1111
|
+
|
|
1112
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* 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`.
|
|
1117
|
+
* Add another API key to a credential
|
|
1118
|
+
*/
|
|
1119
|
+
async addCredentialAccount(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse> {
|
|
1120
|
+
const response = await this.addCredentialAccountRaw(requestParameters, initOverrides);
|
|
1121
|
+
return await response.value();
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1022
1124
|
/**
|
|
1023
1125
|
* Creates request options for addEnvironmentRepo without sending the request
|
|
1024
1126
|
*/
|
|
@@ -2160,6 +2262,77 @@ export class BoatApi extends runtime.BaseAPI {
|
|
|
2160
2262
|
return await response.value();
|
|
2161
2263
|
}
|
|
2162
2264
|
|
|
2265
|
+
/**
|
|
2266
|
+
* Creates request options for deleteCredentialAccount without sending the request
|
|
2267
|
+
*/
|
|
2268
|
+
async deleteCredentialAccountRequestOpts(requestParameters: DeleteCredentialAccountRequest): Promise<runtime.RequestOpts> {
|
|
2269
|
+
if (requestParameters['profile'] == null) {
|
|
2270
|
+
throw new runtime.RequiredError(
|
|
2271
|
+
'profile',
|
|
2272
|
+
'Required parameter "profile" was null or undefined when calling deleteCredentialAccount().'
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
if (requestParameters['credential'] == null) {
|
|
2277
|
+
throw new runtime.RequiredError(
|
|
2278
|
+
'credential',
|
|
2279
|
+
'Required parameter "credential" was null or undefined when calling deleteCredentialAccount().'
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
if (requestParameters['account'] == null) {
|
|
2284
|
+
throw new runtime.RequiredError(
|
|
2285
|
+
'account',
|
|
2286
|
+
'Required parameter "account" was null or undefined when calling deleteCredentialAccount().'
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
const queryParameters: any = {};
|
|
2291
|
+
|
|
2292
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
2293
|
+
|
|
2294
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2295
|
+
const token = this.configuration.accessToken;
|
|
2296
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
2297
|
+
|
|
2298
|
+
if (tokenString) {
|
|
2299
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}`;
|
|
2304
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
2305
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
2306
|
+
urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
|
|
2307
|
+
|
|
2308
|
+
return {
|
|
2309
|
+
path: urlPath,
|
|
2310
|
+
method: 'DELETE',
|
|
2311
|
+
headers: headerParameters,
|
|
2312
|
+
query: queryParameters,
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/**
|
|
2317
|
+
* 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`.
|
|
2318
|
+
* Forget an account of a credential
|
|
2319
|
+
*/
|
|
2320
|
+
async deleteCredentialAccountRaw(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>> {
|
|
2321
|
+
const requestOptions = await this.deleteCredentialAccountRequestOpts(requestParameters);
|
|
2322
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
2323
|
+
|
|
2324
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* 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`.
|
|
2329
|
+
* Forget an account of a credential
|
|
2330
|
+
*/
|
|
2331
|
+
async deleteCredentialAccount(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse> {
|
|
2332
|
+
const response = await this.deleteCredentialAccountRaw(requestParameters, initOverrides);
|
|
2333
|
+
return await response.value();
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2163
2336
|
/**
|
|
2164
2337
|
* Creates request options for deleteCredentialProfile without sending the request
|
|
2165
2338
|
*/
|
|
@@ -4236,6 +4409,69 @@ export class BoatApi extends runtime.BaseAPI {
|
|
|
4236
4409
|
return await response.value();
|
|
4237
4410
|
}
|
|
4238
4411
|
|
|
4412
|
+
/**
|
|
4413
|
+
* Creates request options for listCredentialAccounts without sending the request
|
|
4414
|
+
*/
|
|
4415
|
+
async listCredentialAccountsRequestOpts(requestParameters: ListCredentialAccountsRequest): Promise<runtime.RequestOpts> {
|
|
4416
|
+
if (requestParameters['profile'] == null) {
|
|
4417
|
+
throw new runtime.RequiredError(
|
|
4418
|
+
'profile',
|
|
4419
|
+
'Required parameter "profile" was null or undefined when calling listCredentialAccounts().'
|
|
4420
|
+
);
|
|
4421
|
+
}
|
|
4422
|
+
|
|
4423
|
+
if (requestParameters['credential'] == null) {
|
|
4424
|
+
throw new runtime.RequiredError(
|
|
4425
|
+
'credential',
|
|
4426
|
+
'Required parameter "credential" was null or undefined when calling listCredentialAccounts().'
|
|
4427
|
+
);
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4430
|
+
const queryParameters: any = {};
|
|
4431
|
+
|
|
4432
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
4433
|
+
|
|
4434
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
4435
|
+
const token = this.configuration.accessToken;
|
|
4436
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
4437
|
+
|
|
4438
|
+
if (tokenString) {
|
|
4439
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
|
|
4444
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
4445
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
4446
|
+
|
|
4447
|
+
return {
|
|
4448
|
+
path: urlPath,
|
|
4449
|
+
method: 'GET',
|
|
4450
|
+
headers: headerParameters,
|
|
4451
|
+
query: queryParameters,
|
|
4452
|
+
};
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4455
|
+
/**
|
|
4456
|
+
* 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`.
|
|
4457
|
+
* List the accounts of a credential
|
|
4458
|
+
*/
|
|
4459
|
+
async listCredentialAccountsRaw(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>> {
|
|
4460
|
+
const requestOptions = await this.listCredentialAccountsRequestOpts(requestParameters);
|
|
4461
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
4462
|
+
|
|
4463
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
/**
|
|
4467
|
+
* 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`.
|
|
4468
|
+
* List the accounts of a credential
|
|
4469
|
+
*/
|
|
4470
|
+
async listCredentialAccounts(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse> {
|
|
4471
|
+
const response = await this.listCredentialAccountsRaw(requestParameters, initOverrides);
|
|
4472
|
+
return await response.value();
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4239
4475
|
/**
|
|
4240
4476
|
* Creates request options for listCredentialProfiles without sending the request
|
|
4241
4477
|
*/
|
|
@@ -6342,6 +6578,77 @@ export class BoatApi extends runtime.BaseAPI {
|
|
|
6342
6578
|
return await response.value();
|
|
6343
6579
|
}
|
|
6344
6580
|
|
|
6581
|
+
/**
|
|
6582
|
+
* Creates request options for switchCredentialAccount without sending the request
|
|
6583
|
+
*/
|
|
6584
|
+
async switchCredentialAccountRequestOpts(requestParameters: SwitchCredentialAccountRequest): Promise<runtime.RequestOpts> {
|
|
6585
|
+
if (requestParameters['profile'] == null) {
|
|
6586
|
+
throw new runtime.RequiredError(
|
|
6587
|
+
'profile',
|
|
6588
|
+
'Required parameter "profile" was null or undefined when calling switchCredentialAccount().'
|
|
6589
|
+
);
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
if (requestParameters['credential'] == null) {
|
|
6593
|
+
throw new runtime.RequiredError(
|
|
6594
|
+
'credential',
|
|
6595
|
+
'Required parameter "credential" was null or undefined when calling switchCredentialAccount().'
|
|
6596
|
+
);
|
|
6597
|
+
}
|
|
6598
|
+
|
|
6599
|
+
if (requestParameters['account'] == null) {
|
|
6600
|
+
throw new runtime.RequiredError(
|
|
6601
|
+
'account',
|
|
6602
|
+
'Required parameter "account" was null or undefined when calling switchCredentialAccount().'
|
|
6603
|
+
);
|
|
6604
|
+
}
|
|
6605
|
+
|
|
6606
|
+
const queryParameters: any = {};
|
|
6607
|
+
|
|
6608
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
6609
|
+
|
|
6610
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
6611
|
+
const token = this.configuration.accessToken;
|
|
6612
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
6613
|
+
|
|
6614
|
+
if (tokenString) {
|
|
6615
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
6616
|
+
}
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6619
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}/active`;
|
|
6620
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
6621
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
6622
|
+
urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
|
|
6623
|
+
|
|
6624
|
+
return {
|
|
6625
|
+
path: urlPath,
|
|
6626
|
+
method: 'PUT',
|
|
6627
|
+
headers: headerParameters,
|
|
6628
|
+
query: queryParameters,
|
|
6629
|
+
};
|
|
6630
|
+
}
|
|
6631
|
+
|
|
6632
|
+
/**
|
|
6633
|
+
* 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`.
|
|
6634
|
+
* Switch a credential to another account
|
|
6635
|
+
*/
|
|
6636
|
+
async switchCredentialAccountRaw(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>> {
|
|
6637
|
+
const requestOptions = await this.switchCredentialAccountRequestOpts(requestParameters);
|
|
6638
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
6639
|
+
|
|
6640
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CredentialAccountsResponseFromJSON(jsonValue));
|
|
6641
|
+
}
|
|
6642
|
+
|
|
6643
|
+
/**
|
|
6644
|
+
* 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`.
|
|
6645
|
+
* Switch a credential to another account
|
|
6646
|
+
*/
|
|
6647
|
+
async switchCredentialAccount(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse> {
|
|
6648
|
+
const response = await this.switchCredentialAccountRaw(requestParameters, initOverrides);
|
|
6649
|
+
return await response.value();
|
|
6650
|
+
}
|
|
6651
|
+
|
|
6345
6652
|
/**
|
|
6346
6653
|
* Creates request options for update without sending the request
|
|
6347
6654
|
*/
|
package/src/boat-helpers.ts
CHANGED
|
@@ -281,3 +281,112 @@ export async function* streamCommand(
|
|
|
281
281
|
await delay(1_000);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
+
|
|
285
|
+
// The server sends a heartbeat every 15 s, so 60 s of silence is a dead connection.
|
|
286
|
+
const ATTACH_IDLE_MS = 60_000;
|
|
287
|
+
// After the first connection, a failed reconnect is tried again for this long.
|
|
288
|
+
const ATTACH_RETRY_MS = 60_000;
|
|
289
|
+
|
|
290
|
+
export type FollowCommandOptions = {
|
|
291
|
+
signal?: AbortSignal;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
function isNetworkError(e: unknown, signal?: AbortSignal): boolean {
|
|
295
|
+
if (signal?.aborted || e instanceof SyntaxError) return false;
|
|
296
|
+
return !(e as { response?: Response })?.response;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Yield a detached command's output from its start until it ends: `stdout`/`stderr`
|
|
301
|
+
* chunks (`frame.data`), then exactly one `exit` (`exitCode`, ...) or `error`
|
|
302
|
+
* (`message`). The server ends each connection after 10 minutes; this reconnects
|
|
303
|
+
* from the same offsets, with no gap and no repeat. A network cut is reconnected
|
|
304
|
+
* the same way for up to 60 s.
|
|
305
|
+
*/
|
|
306
|
+
export async function* followCommand(
|
|
307
|
+
api: BoatApi,
|
|
308
|
+
sandboxId: string,
|
|
309
|
+
processId: number,
|
|
310
|
+
options?: FollowCommandOptions,
|
|
311
|
+
): AsyncGenerator<CommandFrame> {
|
|
312
|
+
const offsets = { stdout: 0, stderr: 0 };
|
|
313
|
+
let connected = false;
|
|
314
|
+
// Set at the first failure after a good connection; any good connection clears it.
|
|
315
|
+
let failingSince: number | undefined;
|
|
316
|
+
for (;;) {
|
|
317
|
+
if (options?.signal?.aborted) throw options.signal.reason ?? new Error('followCommand aborted');
|
|
318
|
+
// One controller per connection: the caller's signal, or 60 s with no line.
|
|
319
|
+
const connection = new AbortController();
|
|
320
|
+
const abort = () => connection.abort();
|
|
321
|
+
options?.signal?.addEventListener('abort', abort);
|
|
322
|
+
let idle: ReturnType<typeof setTimeout> | undefined;
|
|
323
|
+
const touch = () => {
|
|
324
|
+
clearTimeout(idle);
|
|
325
|
+
idle = setTimeout(abort, ATTACH_IDLE_MS);
|
|
326
|
+
};
|
|
327
|
+
try {
|
|
328
|
+
touch();
|
|
329
|
+
const response = await api.attachCommandRaw(
|
|
330
|
+
{ sandboxId, processId, stdoutOffset: offsets.stdout, stderrOffset: offsets.stderr },
|
|
331
|
+
{ signal: connection.signal },
|
|
332
|
+
);
|
|
333
|
+
connected = true;
|
|
334
|
+
failingSince = undefined;
|
|
335
|
+
for await (const frame of ndjsonFrames(response.raw)) {
|
|
336
|
+
touch();
|
|
337
|
+
if (frame.type === 'stdout' || frame.type === 'stderr') {
|
|
338
|
+
offsets[frame.type] = (frame.nextOffset as number | undefined) ?? offsets[frame.type];
|
|
339
|
+
yield frame;
|
|
340
|
+
} else if (frame.type === 'exit' || frame.type === 'error') {
|
|
341
|
+
yield frame;
|
|
342
|
+
return;
|
|
343
|
+
} else {
|
|
344
|
+
// attached, heartbeat, reconnect: ours to handle, never the caller's.
|
|
345
|
+
offsets.stdout = (frame.stdoutOffset as number | undefined) ?? offsets.stdout;
|
|
346
|
+
offsets.stderr = (frame.stderrOffset as number | undefined) ?? offsets.stderr;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
} catch (e) {
|
|
350
|
+
failingSince ??= Date.now();
|
|
351
|
+
if (!isNetworkError(e, options?.signal) || !connected || Date.now() - failingSince >= ATTACH_RETRY_MS) throw e;
|
|
352
|
+
await delay(1_000);
|
|
353
|
+
} finally {
|
|
354
|
+
clearTimeout(idle);
|
|
355
|
+
options?.signal?.removeEventListener('abort', abort);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export type RunCommandOptions = FollowCommandOptions & {
|
|
361
|
+
cwd?: string;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Run a command with no time limit and yield its output until it ends.
|
|
366
|
+
*
|
|
367
|
+
* The command runs detached, so it has no 600 s cap and survives a dropped
|
|
368
|
+
* connection. Frames: `{ type: 'started', processId }`, then the frames of
|
|
369
|
+
* `followCommand`. Stopping early leaves the command running: call
|
|
370
|
+
* `stopCommand({ sandboxId, processId })` to stop it.
|
|
371
|
+
*/
|
|
372
|
+
export async function* runCommand(
|
|
373
|
+
api: BoatApi,
|
|
374
|
+
sandboxId: string,
|
|
375
|
+
command: string,
|
|
376
|
+
options?: RunCommandOptions,
|
|
377
|
+
): AsyncGenerator<CommandFrame> {
|
|
378
|
+
const deadline = Date.now() + STREAM_RETRY_MS;
|
|
379
|
+
let processId: number;
|
|
380
|
+
for (;;) {
|
|
381
|
+
try {
|
|
382
|
+
const started = await api.command({ sandboxId, commandRequest: { command, cwd: options?.cwd, detached: true } });
|
|
383
|
+
processId = (started as { processId: number }).processId;
|
|
384
|
+
break;
|
|
385
|
+
} catch (e) {
|
|
386
|
+
if (Date.now() + 1_000 >= deadline || !(await isRetryable(e))) throw e;
|
|
387
|
+
}
|
|
388
|
+
await delay(1_000);
|
|
389
|
+
}
|
|
390
|
+
yield { type: 'started', processId } as CommandFrame;
|
|
391
|
+
yield* followCommand(api, sandboxId, processId, options);
|
|
392
|
+
}
|