@boatdev/sdk 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/.openapi-generator/FILES +12 -0
  2. package/dist/apis/BoatApi.d.ts +102 -4
  3. package/dist/apis/BoatApi.js +233 -4
  4. package/dist/esm/apis/BoatApi.d.ts +102 -4
  5. package/dist/esm/apis/BoatApi.js +233 -4
  6. package/dist/esm/http2-fetch.d.ts +1 -0
  7. package/dist/esm/http2-fetch.js +203 -0
  8. package/dist/esm/models/CreateSandboxRequest.d.ts +4 -3
  9. package/dist/esm/models/CreateSandboxRequest.js +2 -1
  10. package/dist/esm/models/ForkRequest.d.ts +2 -1
  11. package/dist/esm/models/ForkRequest.js +2 -1
  12. package/dist/esm/models/NamedSnapshotShare.d.ts +76 -0
  13. package/dist/esm/models/NamedSnapshotShare.js +74 -0
  14. package/dist/esm/models/NamedSnapshotShareCreatedResponse.d.ts +64 -0
  15. package/dist/esm/models/NamedSnapshotShareCreatedResponse.js +66 -0
  16. package/dist/esm/models/NamedSnapshotShareListResponse.d.ts +58 -0
  17. package/dist/esm/models/NamedSnapshotShareListResponse.js +62 -0
  18. package/dist/esm/models/NamedSnapshotShareRevokedResponse.d.ts +58 -0
  19. package/dist/esm/models/NamedSnapshotShareRevokedResponse.js +62 -0
  20. package/dist/esm/models/Recover200Response.d.ts +57 -0
  21. package/dist/esm/models/Recover200Response.js +53 -0
  22. package/dist/esm/models/ResumeRequest.d.ts +2 -1
  23. package/dist/esm/models/ResumeRequest.js +2 -1
  24. package/dist/esm/models/Sandbox.d.ts +2 -1
  25. package/dist/esm/models/Sandbox.js +2 -1
  26. package/dist/esm/models/SandboxUsageResponse.d.ts +2 -1
  27. package/dist/esm/models/SandboxUsageResponse.js +2 -1
  28. package/dist/esm/models/StopOperation.d.ts +1 -1
  29. package/dist/esm/models/StopOperationResponse.d.ts +58 -0
  30. package/dist/esm/models/StopOperationResponse.js +62 -0
  31. package/dist/esm/models/StopRequest.d.ts +1 -1
  32. package/dist/esm/models/UpdateSandboxRequest.d.ts +1 -1
  33. package/dist/esm/models/index.d.ts +6 -0
  34. package/dist/esm/models/index.js +6 -0
  35. package/dist/esm/runtime.js +2 -1
  36. package/dist/http2-fetch.d.ts +1 -0
  37. package/dist/http2-fetch.js +239 -0
  38. package/dist/models/CreateSandboxRequest.d.ts +4 -3
  39. package/dist/models/CreateSandboxRequest.js +2 -1
  40. package/dist/models/ForkRequest.d.ts +2 -1
  41. package/dist/models/ForkRequest.js +2 -1
  42. package/dist/models/NamedSnapshotShare.d.ts +76 -0
  43. package/dist/models/NamedSnapshotShare.js +82 -0
  44. package/dist/models/NamedSnapshotShareCreatedResponse.d.ts +64 -0
  45. package/dist/models/NamedSnapshotShareCreatedResponse.js +74 -0
  46. package/dist/models/NamedSnapshotShareListResponse.d.ts +58 -0
  47. package/dist/models/NamedSnapshotShareListResponse.js +70 -0
  48. package/dist/models/NamedSnapshotShareRevokedResponse.d.ts +58 -0
  49. package/dist/models/NamedSnapshotShareRevokedResponse.js +70 -0
  50. package/dist/models/Recover200Response.d.ts +57 -0
  51. package/dist/models/Recover200Response.js +61 -0
  52. package/dist/models/ResumeRequest.d.ts +2 -1
  53. package/dist/models/ResumeRequest.js +2 -1
  54. package/dist/models/Sandbox.d.ts +2 -1
  55. package/dist/models/Sandbox.js +2 -1
  56. package/dist/models/SandboxUsageResponse.d.ts +2 -1
  57. package/dist/models/SandboxUsageResponse.js +2 -1
  58. package/dist/models/StopOperation.d.ts +1 -1
  59. package/dist/models/StopOperationResponse.d.ts +58 -0
  60. package/dist/models/StopOperationResponse.js +70 -0
  61. package/dist/models/StopRequest.d.ts +1 -1
  62. package/dist/models/UpdateSandboxRequest.d.ts +1 -1
  63. package/dist/models/index.d.ts +6 -0
  64. package/dist/models/index.js +6 -0
  65. package/dist/runtime.js +9 -8
  66. package/docs/BoatApi.md +385 -2
  67. package/docs/NamedSnapshotShare.md +45 -0
  68. package/docs/NamedSnapshotShareCreatedResponse.md +40 -0
  69. package/docs/NamedSnapshotShareListResponse.md +38 -0
  70. package/docs/NamedSnapshotShareRevokedResponse.md +38 -0
  71. package/docs/Recover200Response.md +38 -0
  72. package/docs/StopOperationResponse.md +38 -0
  73. package/package.json +1 -1
  74. package/src/apis/BoatApi.ts +348 -4
  75. package/src/http2-fetch.ts +179 -0
  76. package/src/models/CreateSandboxRequest.ts +5 -4
  77. package/src/models/ForkRequest.ts +3 -2
  78. package/src/models/NamedSnapshotShare.ts +131 -0
  79. package/src/models/NamedSnapshotShareCreatedResponse.ts +120 -0
  80. package/src/models/NamedSnapshotShareListResponse.ts +111 -0
  81. package/src/models/NamedSnapshotShareRevokedResponse.ts +111 -0
  82. package/src/models/Recover200Response.ts +99 -0
  83. package/src/models/ResumeRequest.ts +3 -2
  84. package/src/models/Sandbox.ts +3 -2
  85. package/src/models/SandboxUsageResponse.ts +3 -2
  86. package/src/models/StopOperation.ts +1 -1
  87. package/src/models/StopOperationResponse.ts +111 -0
  88. package/src/models/StopRequest.ts +1 -1
  89. package/src/models/UpdateSandboxRequest.ts +1 -1
  90. package/src/models/index.ts +6 -0
  91. package/src/runtime.ts +2 -1
@@ -0,0 +1,179 @@
1
+ // The SDK's default fetch. On Node it sends every request to an https origin over
2
+ // ONE shared HTTP/2 connection. Node's global fetch speaks HTTP/1.1 only, so N
3
+ // concurrent calls opened N TLS connections: a burst of 200 calls from a laptop
4
+ // made 200 handshakes (measured 2026-10-08), and 250 creates arrived at the API
5
+ // over 8-14 s. Elsewhere (browsers, Deno, Bun, an origin without HTTP/2), and for
6
+ // any body this does not handle, it is the global fetch.
7
+ // Pass `fetchApi` in the Configuration to use your own fetch instead.
8
+
9
+ type Session = {
10
+ closed: boolean;
11
+ destroyed: boolean;
12
+ request(headers: Record<string, string>, options?: { endStream?: boolean }): any;
13
+ on(event: string, cb: (...args: any[]) => void): void;
14
+ unref(): void;
15
+ ref(): void;
16
+ };
17
+
18
+ const sessions = new Map<string, Promise<Session | null>>();
19
+ const http1Only = new Set<string>();
20
+ const slots = new WeakMap<Session, { active: number; waiting: Array<() => void> }>();
21
+
22
+ // A server caps the streams open at once on a connection (boat.dev: 250; this uses
23
+ // at most 100). A stream past the cap is refused, so the excess waits here. Requests open
24
+ // or waiting keep the process alive; an idle shared connection does not.
25
+ async function streamSlot(s: Session, signal?: AbortSignal | null): Promise<() => void> {
26
+ let st = slots.get(s);
27
+ if (!st) { st = { active: 0, waiting: [] }; slots.set(s, st); }
28
+ const state = st;
29
+ const cap = Math.max(1, Math.min(Number((s as any).remoteSettings?.maxConcurrentStreams) || 100, 100));
30
+ // Already aborted: take no stream, never queue (an abort listener added now never fires).
31
+ if (signal?.aborted) return () => {};
32
+ if (state.active === 0 && state.waiting.length === 0) s.ref();
33
+ if (state.active >= cap) {
34
+ const turn = await new Promise<boolean>((wake) => {
35
+ const w = () => wake(true);
36
+ state.waiting.push(w);
37
+ // An aborted waiter leaves the queue without a stream; the caller rejects it.
38
+ signal?.addEventListener('abort', () => {
39
+ const i = state.waiting.indexOf(w);
40
+ if (i !== -1) { state.waiting.splice(i, 1); wake(false); }
41
+ }, { once: true });
42
+ });
43
+ if (!turn) return () => {};
44
+ }
45
+ state.active++;
46
+ let released = false;
47
+ return () => {
48
+ if (released) return;
49
+ released = true;
50
+ state.active--;
51
+ const next = state.waiting.shift();
52
+ if (next) next();
53
+ else if (state.active === 0) s.unref();
54
+ };
55
+ }
56
+ let nodeHttp2: Promise<any | null> | undefined;
57
+
58
+ function loadNode(): Promise<any | null> {
59
+ if (!nodeHttp2) {
60
+ const versions = (globalThis as any).process?.versions;
61
+ const isNode = !!versions?.node && !versions.bun && typeof (globalThis as any).Deno === 'undefined';
62
+ // A variable, not a literal: a browser bundler must not try to resolve it.
63
+ const h2 = 'node:http2';
64
+ nodeHttp2 = isNode
65
+ ? import(/* webpackIgnore: true */ /* @vite-ignore */ h2).catch(() => null)
66
+ : Promise.resolve(null);
67
+ }
68
+ return nodeHttp2;
69
+ }
70
+
71
+ function session(origin: string, http2: any): Promise<Session | null> {
72
+ const open = sessions.get(origin);
73
+ if (open) return open;
74
+ const pending = new Promise<Session | null>((resolve) => {
75
+ let s: any;
76
+ try {
77
+ s = http2.connect(origin);
78
+ } catch {
79
+ resolve(null);
80
+ return;
81
+ }
82
+ const drop = () => { if (sessions.get(origin) === pending) sessions.delete(origin); };
83
+ s.once('connect', () => {
84
+ // An origin that answered without h2 never gets here: the TLS layer fails the connect.
85
+ s.unref(); // an idle shared connection must not keep the process alive
86
+ resolve(s);
87
+ });
88
+ // `on`, not `once`: a session can emit more than one error, and an unhandled one kills the process.
89
+ s.on('error', () => { drop(); resolve(null); });
90
+ s.once('close', drop);
91
+ s.once('goaway', drop);
92
+ });
93
+ sessions.set(origin, pending);
94
+ return pending;
95
+ }
96
+
97
+ function sendableBody(body: unknown): string | Uint8Array | null | undefined {
98
+ if (body == null) return null;
99
+ if (typeof body === 'string') return body;
100
+ if (body instanceof Uint8Array) return body;
101
+ if (body instanceof ArrayBuffer) return new Uint8Array(body);
102
+ if (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams) return body.toString();
103
+ return undefined; // FormData, Blob, streams: the global fetch encodes these
104
+ }
105
+
106
+ const HOP_BY_HOP = new Set(['connection', 'host', 'keep-alive', 'proxy-connection', 'transfer-encoding', 'upgrade']);
107
+
108
+ async function http2Fetch(input: RequestInfo | URL, init: RequestInit = {}): Promise<Response> {
109
+ const url = new URL(typeof input === 'string' ? input : input instanceof URL ? input.href : input.url);
110
+ const body = sendableBody(init.body);
111
+ const node = await loadNode();
112
+ const isRequest = typeof input !== 'string' && !(input instanceof URL);
113
+ if (!node || isRequest || body === undefined || url.protocol !== 'https:' || http1Only.has(url.origin)) {
114
+ return fetch(input as any, init);
115
+ }
116
+ const s = await session(url.origin, node);
117
+ if (!s || s.closed || s.destroyed) {
118
+ if (!s) http1Only.add(url.origin);
119
+ return fetch(input as any, init);
120
+ }
121
+ const headers: Record<string, string> = { ':method': (init.method || 'GET').toUpperCase(), ':path': url.pathname + url.search };
122
+ new Headers(init.headers).forEach((value, key) => { if (!HOP_BY_HOP.has(key)) headers[key] = value; });
123
+ const signal = init.signal;
124
+ const aborted = () => signal!.reason ?? new DOMException('This operation was aborted', 'AbortError');
125
+ const release = await streamSlot(s, signal);
126
+ return new Promise<Response>((resolve, reject) => {
127
+ if (signal?.aborted) { release(); reject(aborted()); return; }
128
+ let req: any;
129
+ try {
130
+ req = s.request(headers, { endStream: body === null });
131
+ } catch (e) {
132
+ // The connection closed (GOAWAY) while this call waited for a stream.
133
+ release();
134
+ reject(e);
135
+ return;
136
+ }
137
+ const onAbort = () => { req.close(); reject(aborted()); };
138
+ signal?.addEventListener('abort', onAbort, { once: true });
139
+ req.once('close', () => { release(); signal?.removeEventListener('abort', onAbort); });
140
+ req.on('error', reject); // after the response this errors its body stream; a no-op here
141
+ req.once('response', (h: Record<string, string | string[]>) => {
142
+ const status = Number(h[':status']);
143
+ const out = new Headers();
144
+ for (const [k, v] of Object.entries(h)) {
145
+ if (k.startsWith(':') || v === undefined) continue;
146
+ for (const one of Array.isArray(v) ? v : [v]) out.append(k, String(one));
147
+ }
148
+ const empty = status === 204 || status === 205 || status === 304 || headers[':method'] === 'HEAD';
149
+ if (empty) req.resume();
150
+ // Fed from 'data' events, not Readable.toWeb: an HTTP/2 stream the server has
151
+ // already closed is destroyed with its unread data, and toWeb's backpressure
152
+ // turned that into "Premature close" on 25 of 250 calls (prod, 2026-10-08).
153
+ // A slow reader (streamCommand between frames) must not let a fast command
154
+ // fill memory: past 4 MiB unread the stream pauses until the reader pulls.
155
+ const bodyStream = empty ? null : new ReadableStream<Uint8Array>({
156
+ start(controller) {
157
+ req.on('data', (chunk: Uint8Array) => {
158
+ controller.enqueue(new Uint8Array(chunk));
159
+ if ((controller.desiredSize ?? 1) <= 0) req.pause();
160
+ });
161
+ req.once('end', () => controller.close());
162
+ req.once('error', (e: unknown) => controller.error(e));
163
+ req.once('close', () => {
164
+ if (!req.readableEnded) { try { controller.error(new Error(`HTTP/2 stream closed before its end (code ${req.rstCode})`)); } catch {} }
165
+ });
166
+ },
167
+ pull() { if (req.isPaused()) req.resume(); },
168
+ cancel() { req.close(); },
169
+ }, { highWaterMark: 4 * 1024 * 1024, size: (chunk) => chunk?.byteLength ?? 0 });
170
+ const response = new Response(bodyStream, { status, headers: out });
171
+ // Response.url is read-only; the generated client never reads it, but keep it right.
172
+ Object.defineProperty(response, 'url', { value: url.href });
173
+ resolve(response);
174
+ });
175
+ if (body !== null) req.end(body);
176
+ });
177
+ }
178
+
179
+ export const defaultFetch = http2Fetch as typeof fetch;
@@ -20,7 +20,7 @@ import { mapValues } from '../runtime';
20
20
  */
21
21
  export interface CreateSandboxRequest {
22
22
  /**
23
- * Machine size. `small` consumes machine time at half rate and `large` at twice the default rate (see the Billing guide). A fork inherits the source sandbox's type unless the fork request passes its own, and resume and fork can move a sandbox between sizes.
23
+ * Machine size. `small` consumes machine time at half rate and `large` at twice the default rate (see the Billing guide). `xlarge` needs the $100/month plan or higher; lower plans get a 403 `machine_class_plan_required` on create, resume and fork. A fork inherits the source sandbox's type unless the fork request passes its own, and resume and fork can move a sandbox between sizes.
24
24
  * @type {CreateSandboxRequestTypeEnum}
25
25
  * @memberof CreateSandboxRequest
26
26
  */
@@ -62,7 +62,7 @@ export interface CreateSandboxRequest {
62
62
  */
63
63
  failFast?: boolean;
64
64
  /**
65
- * Shell script that runs on the sandbox after it is ready. Ready means "ready to accept the user", not "setup done": the script starts in the background once provisioning completes and never blocks the sandbox becoming usable. It runs as the sandbox user via `bash`, with the sandbox's environment applied, and its output goes to a log file on the sandbox. Observe the outcome as `setupStatus` (pending/running/done/failed) and `setupError` on the sandbox. Rejected with a 400 `invalid_setup_script` error when it is not a string or exceeds 64KB.
65
+ * Shell script that runs on the sandbox after it is ready. Ready means "ready to accept the user", not "setup done": the script starts in the background once provisioning completes and never blocks the sandbox becoming usable. It runs as the sandbox user (`user`, not root; `sudo` needs no password) via `bash`, with the sandbox's environment applied, and its output goes to a log file on the sandbox. Observe the outcome as `setupStatus` (pending/running/done/failed) and `setupError` on the sandbox. Rejected with a 400 `invalid_setup_script` error when it is not a string or exceeds 64KB.
66
66
  * @type {string}
67
67
  * @memberof CreateSandboxRequest
68
68
  */
@@ -80,7 +80,7 @@ export interface CreateSandboxRequest {
80
80
  */
81
81
  teamId?: string;
82
82
  /**
83
- * Create the sandbox from a named snapshot (saved with `POST /named-snapshots`, or `boat snapshot <id> <name>` in the CLI). The sandbox starts from that exact frozen state. Omitting `type` inherits the type the snapshot was saved from; env and no-env inherit from the snapshot's source sandbox unless the request passes its own, with the same rules as forking.
83
+ * Create the sandbox from a named snapshot (saved with `POST /named-snapshots`, or `boat snapshot <id> <name>` in the CLI). The sandbox starts from that exact frozen state. Omitting `type` inherits the type the snapshot was saved from; env and no-env inherit from the snapshot's source sandbox unless the request passes its own, with the same rules as forking. Also accepts a share code (`bsh_...`) that another account made with `POST /named-snapshots/{name}/shares`. The new sandbox lives in and is billed to your account. It does not get the owner's per-sandbox env; your own environment applies normally. A wrong or revoked code returns `404 snapshot_not_found`.
84
84
  * @type {string}
85
85
  * @memberof CreateSandboxRequest
86
86
  */
@@ -94,7 +94,8 @@ export interface CreateSandboxRequest {
94
94
  export const CreateSandboxRequestTypeEnum = {
95
95
  Small: 'small',
96
96
  Default: 'default',
97
- Large: 'large'
97
+ Large: 'large',
98
+ Xlarge: 'xlarge'
98
99
  } as const;
99
100
  export type CreateSandboxRequestTypeEnum = typeof CreateSandboxRequestTypeEnum[keyof typeof CreateSandboxRequestTypeEnum];
100
101
 
@@ -44,7 +44,7 @@ export interface ForkRequest {
44
44
  */
45
45
  noEnv?: boolean;
46
46
  /**
47
- * Machine size for the fork. Omit to inherit the source sandbox's type. The source sandbox is never modified. Shrinking is rejected with `type_too_small` when the source's data would not fit the smaller disk.
47
+ * Machine size for the fork. Omit to inherit the source sandbox's type. `xlarge` needs the $100/month plan or higher (403 `machine_class_plan_required`). The source sandbox is never modified. Shrinking is rejected with `type_too_small` when the source's data would not fit the smaller disk.
48
48
  * @type {ForkRequestTypeEnum}
49
49
  * @memberof ForkRequest
50
50
  */
@@ -64,7 +64,8 @@ export interface ForkRequest {
64
64
  export const ForkRequestTypeEnum = {
65
65
  Small: 'small',
66
66
  Default: 'default',
67
- Large: 'large'
67
+ Large: 'large',
68
+ Xlarge: 'xlarge'
68
69
  } as const;
69
70
  export type ForkRequestTypeEnum = typeof ForkRequestTypeEnum[keyof typeof ForkRequestTypeEnum];
70
71
 
@@ -0,0 +1,131 @@
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
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * A share code for a named snapshot. Any Boat account that holds the code can create a sandbox from the snapshot. Boat stores only a hash of the code. The full code is in the create response only.
18
+ * @export
19
+ * @interface NamedSnapshotShare
20
+ */
21
+ export interface NamedSnapshotShare {
22
+ /**
23
+ * Share id, for example `shr_...`. Pass it to revoke the code.
24
+ * @type {string}
25
+ * @memberof NamedSnapshotShare
26
+ */
27
+ id: string;
28
+ /**
29
+ * The first characters of the code, for example `bsh_xxxxxxxx`. Use it to tell codes apart.
30
+ * @type {string}
31
+ * @memberof NamedSnapshotShare
32
+ */
33
+ codePrefix: string;
34
+ /**
35
+ *
36
+ * @type {NamedSnapshotShareStatusEnum}
37
+ * @memberof NamedSnapshotShare
38
+ */
39
+ status: NamedSnapshotShareStatusEnum;
40
+ /**
41
+ * Number of sandboxes created with this code.
42
+ * @type {number}
43
+ * @memberof NamedSnapshotShare
44
+ */
45
+ useCount: number;
46
+ /**
47
+ * When a sandbox was last created with this code. null if never.
48
+ * @type {Date}
49
+ * @memberof NamedSnapshotShare
50
+ */
51
+ lastUsedAt: Date | null;
52
+ /**
53
+ * When the code was revoked. null while active.
54
+ * @type {Date}
55
+ * @memberof NamedSnapshotShare
56
+ */
57
+ revokedAt: Date | null;
58
+ /**
59
+ *
60
+ * @type {Date}
61
+ * @memberof NamedSnapshotShare
62
+ */
63
+ createdAt: Date;
64
+ }
65
+
66
+
67
+ /**
68
+ * @export
69
+ */
70
+ export const NamedSnapshotShareStatusEnum = {
71
+ Active: 'active',
72
+ Revoked: 'revoked'
73
+ } as const;
74
+ export type NamedSnapshotShareStatusEnum = typeof NamedSnapshotShareStatusEnum[keyof typeof NamedSnapshotShareStatusEnum];
75
+
76
+
77
+ /**
78
+ * Check if a given object implements the NamedSnapshotShare interface.
79
+ */
80
+ export function instanceOfNamedSnapshotShare(value: object): value is NamedSnapshotShare {
81
+ if (!('id' in value) || value['id'] === undefined) return false;
82
+ if (!('codePrefix' in value) || value['codePrefix'] === undefined) return false;
83
+ if (!('status' in value) || value['status'] === undefined) return false;
84
+ if (!('useCount' in value) || value['useCount'] === undefined) return false;
85
+ if (!('lastUsedAt' in value) || value['lastUsedAt'] === undefined) return false;
86
+ if (!('revokedAt' in value) || value['revokedAt'] === undefined) return false;
87
+ if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
88
+ return true;
89
+ }
90
+
91
+ export function NamedSnapshotShareFromJSON(json: any): NamedSnapshotShare {
92
+ return NamedSnapshotShareFromJSONTyped(json, false);
93
+ }
94
+
95
+ export function NamedSnapshotShareFromJSONTyped(json: any, ignoreDiscriminator: boolean): NamedSnapshotShare {
96
+ if (json == null) {
97
+ return json;
98
+ }
99
+ return {
100
+
101
+ 'id': json['id'],
102
+ 'codePrefix': json['codePrefix'],
103
+ 'status': json['status'],
104
+ 'useCount': json['useCount'],
105
+ 'lastUsedAt': (json['lastUsedAt'] == null ? null : new Date(json['lastUsedAt'])),
106
+ 'revokedAt': (json['revokedAt'] == null ? null : new Date(json['revokedAt'])),
107
+ 'createdAt': (new Date(json['createdAt'])),
108
+ };
109
+ }
110
+
111
+ export function NamedSnapshotShareToJSON(json: any): NamedSnapshotShare {
112
+ return NamedSnapshotShareToJSONTyped(json, false);
113
+ }
114
+
115
+ export function NamedSnapshotShareToJSONTyped(value?: NamedSnapshotShare | null, ignoreDiscriminator: boolean = false): any {
116
+ if (value == null) {
117
+ return value;
118
+ }
119
+
120
+ return {
121
+
122
+ 'id': value['id'],
123
+ 'codePrefix': value['codePrefix'],
124
+ 'status': value['status'],
125
+ 'useCount': value['useCount'],
126
+ 'lastUsedAt': value['lastUsedAt'] == null ? value['lastUsedAt'] : value['lastUsedAt'].toISOString(),
127
+ 'revokedAt': value['revokedAt'] == null ? value['revokedAt'] : value['revokedAt'].toISOString(),
128
+ 'createdAt': value['createdAt'].toISOString(),
129
+ };
130
+ }
131
+
@@ -0,0 +1,120 @@
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
+ import { mapValues } from '../runtime';
16
+ import type { NamedSnapshotShare } from './NamedSnapshotShare';
17
+ import {
18
+ NamedSnapshotShareFromJSON,
19
+ NamedSnapshotShareFromJSONTyped,
20
+ NamedSnapshotShareToJSON,
21
+ NamedSnapshotShareToJSONTyped,
22
+ } from './NamedSnapshotShare';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface NamedSnapshotShareCreatedResponse
28
+ */
29
+ export interface NamedSnapshotShareCreatedResponse {
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof NamedSnapshotShareCreatedResponse
34
+ */
35
+ ok: boolean;
36
+ /**
37
+ *
38
+ * @type {NamedSnapshotShareCreatedResponseTypeEnum}
39
+ * @memberof NamedSnapshotShareCreatedResponse
40
+ */
41
+ type: NamedSnapshotShareCreatedResponseTypeEnum;
42
+ /**
43
+ * The named snapshot the code deploys.
44
+ * @type {string}
45
+ * @memberof NamedSnapshotShareCreatedResponse
46
+ */
47
+ name: string;
48
+ /**
49
+ * The share code, for example `bsh_...`. Boat shows it only in this response. Store it now; you cannot get it again.
50
+ * @type {string}
51
+ * @memberof NamedSnapshotShareCreatedResponse
52
+ */
53
+ shareCode: string;
54
+ /**
55
+ *
56
+ * @type {NamedSnapshotShare}
57
+ * @memberof NamedSnapshotShareCreatedResponse
58
+ */
59
+ share: NamedSnapshotShare;
60
+ }
61
+
62
+
63
+ /**
64
+ * @export
65
+ */
66
+ export const NamedSnapshotShareCreatedResponseTypeEnum = {
67
+ SnapshotShareCreated: 'snapshot.share.created'
68
+ } as const;
69
+ export type NamedSnapshotShareCreatedResponseTypeEnum = typeof NamedSnapshotShareCreatedResponseTypeEnum[keyof typeof NamedSnapshotShareCreatedResponseTypeEnum];
70
+
71
+
72
+ /**
73
+ * Check if a given object implements the NamedSnapshotShareCreatedResponse interface.
74
+ */
75
+ export function instanceOfNamedSnapshotShareCreatedResponse(value: object): value is NamedSnapshotShareCreatedResponse {
76
+ if (!('ok' in value) || value['ok'] === undefined) return false;
77
+ if (!('type' in value) || value['type'] === undefined) return false;
78
+ if (!('name' in value) || value['name'] === undefined) return false;
79
+ if (!('shareCode' in value) || value['shareCode'] === undefined) return false;
80
+ if (!('share' in value) || value['share'] === undefined) return false;
81
+ return true;
82
+ }
83
+
84
+ export function NamedSnapshotShareCreatedResponseFromJSON(json: any): NamedSnapshotShareCreatedResponse {
85
+ return NamedSnapshotShareCreatedResponseFromJSONTyped(json, false);
86
+ }
87
+
88
+ export function NamedSnapshotShareCreatedResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NamedSnapshotShareCreatedResponse {
89
+ if (json == null) {
90
+ return json;
91
+ }
92
+ return {
93
+
94
+ 'ok': json['ok'],
95
+ 'type': json['type'],
96
+ 'name': json['name'],
97
+ 'shareCode': json['shareCode'],
98
+ 'share': NamedSnapshotShareFromJSON(json['share']),
99
+ };
100
+ }
101
+
102
+ export function NamedSnapshotShareCreatedResponseToJSON(json: any): NamedSnapshotShareCreatedResponse {
103
+ return NamedSnapshotShareCreatedResponseToJSONTyped(json, false);
104
+ }
105
+
106
+ export function NamedSnapshotShareCreatedResponseToJSONTyped(value?: NamedSnapshotShareCreatedResponse | null, ignoreDiscriminator: boolean = false): any {
107
+ if (value == null) {
108
+ return value;
109
+ }
110
+
111
+ return {
112
+
113
+ 'ok': value['ok'],
114
+ 'type': value['type'],
115
+ 'name': value['name'],
116
+ 'shareCode': value['shareCode'],
117
+ 'share': NamedSnapshotShareToJSON(value['share']),
118
+ };
119
+ }
120
+
@@ -0,0 +1,111 @@
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
+ import { mapValues } from '../runtime';
16
+ import type { NamedSnapshotShare } from './NamedSnapshotShare';
17
+ import {
18
+ NamedSnapshotShareFromJSON,
19
+ NamedSnapshotShareFromJSONTyped,
20
+ NamedSnapshotShareToJSON,
21
+ NamedSnapshotShareToJSONTyped,
22
+ } from './NamedSnapshotShare';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface NamedSnapshotShareListResponse
28
+ */
29
+ export interface NamedSnapshotShareListResponse {
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof NamedSnapshotShareListResponse
34
+ */
35
+ ok: boolean;
36
+ /**
37
+ *
38
+ * @type {NamedSnapshotShareListResponseTypeEnum}
39
+ * @memberof NamedSnapshotShareListResponse
40
+ */
41
+ type: NamedSnapshotShareListResponseTypeEnum;
42
+ /**
43
+ *
44
+ * @type {string}
45
+ * @memberof NamedSnapshotShareListResponse
46
+ */
47
+ name: string;
48
+ /**
49
+ *
50
+ * @type {Array<NamedSnapshotShare>}
51
+ * @memberof NamedSnapshotShareListResponse
52
+ */
53
+ shares: Array<NamedSnapshotShare>;
54
+ }
55
+
56
+
57
+ /**
58
+ * @export
59
+ */
60
+ export const NamedSnapshotShareListResponseTypeEnum = {
61
+ SnapshotShareList: 'snapshot.share.list'
62
+ } as const;
63
+ export type NamedSnapshotShareListResponseTypeEnum = typeof NamedSnapshotShareListResponseTypeEnum[keyof typeof NamedSnapshotShareListResponseTypeEnum];
64
+
65
+
66
+ /**
67
+ * Check if a given object implements the NamedSnapshotShareListResponse interface.
68
+ */
69
+ export function instanceOfNamedSnapshotShareListResponse(value: object): value is NamedSnapshotShareListResponse {
70
+ if (!('ok' in value) || value['ok'] === undefined) return false;
71
+ if (!('type' in value) || value['type'] === undefined) return false;
72
+ if (!('name' in value) || value['name'] === undefined) return false;
73
+ if (!('shares' in value) || value['shares'] === undefined) return false;
74
+ return true;
75
+ }
76
+
77
+ export function NamedSnapshotShareListResponseFromJSON(json: any): NamedSnapshotShareListResponse {
78
+ return NamedSnapshotShareListResponseFromJSONTyped(json, false);
79
+ }
80
+
81
+ export function NamedSnapshotShareListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NamedSnapshotShareListResponse {
82
+ if (json == null) {
83
+ return json;
84
+ }
85
+ return {
86
+
87
+ 'ok': json['ok'],
88
+ 'type': json['type'],
89
+ 'name': json['name'],
90
+ 'shares': ((json['shares'] as Array<any>).map(NamedSnapshotShareFromJSON)),
91
+ };
92
+ }
93
+
94
+ export function NamedSnapshotShareListResponseToJSON(json: any): NamedSnapshotShareListResponse {
95
+ return NamedSnapshotShareListResponseToJSONTyped(json, false);
96
+ }
97
+
98
+ export function NamedSnapshotShareListResponseToJSONTyped(value?: NamedSnapshotShareListResponse | null, ignoreDiscriminator: boolean = false): any {
99
+ if (value == null) {
100
+ return value;
101
+ }
102
+
103
+ return {
104
+
105
+ 'ok': value['ok'],
106
+ 'type': value['type'],
107
+ 'name': value['name'],
108
+ 'shares': ((value['shares'] as Array<any>).map(NamedSnapshotShareToJSON)),
109
+ };
110
+ }
111
+