sandbox0 0.1.13 → 0.2.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.
@@ -41,6 +41,36 @@ export interface ApiV1SandboxesIdFilesStatGetRequest {
41
41
  export interface ApiV1SandboxesIdFilesWatchGetRequest {
42
42
  id: string;
43
43
  }
44
+ export interface ApiV1SandboxvolumesIdFilesDeleteRequest {
45
+ id: string;
46
+ path: string;
47
+ }
48
+ export interface ApiV1SandboxvolumesIdFilesGetRequest {
49
+ id: string;
50
+ path: string;
51
+ }
52
+ export interface ApiV1SandboxvolumesIdFilesListGetRequest {
53
+ id: string;
54
+ path: string;
55
+ }
56
+ export interface ApiV1SandboxvolumesIdFilesMovePostRequest {
57
+ id: string;
58
+ moveFileRequest: MoveFileRequest;
59
+ }
60
+ export interface ApiV1SandboxvolumesIdFilesPostRequest {
61
+ id: string;
62
+ path: string;
63
+ mkdir?: boolean;
64
+ recursive?: boolean;
65
+ body?: Blob;
66
+ }
67
+ export interface ApiV1SandboxvolumesIdFilesStatGetRequest {
68
+ id: string;
69
+ path: string;
70
+ }
71
+ export interface ApiV1SandboxvolumesIdFilesWatchGetRequest {
72
+ id: string;
73
+ }
44
74
  /**
45
75
  *
46
76
  */
@@ -111,5 +141,71 @@ export declare class FilesApi extends runtime.BaseAPI {
111
141
  * File watch WebSocket
112
142
  */
113
143
  apiV1SandboxesIdFilesWatchGet(requestParameters: ApiV1SandboxesIdFilesWatchGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
144
+ /**
145
+ * Delete volume file or directory
146
+ */
147
+ apiV1SandboxvolumesIdFilesDeleteRaw(requestParameters: ApiV1SandboxvolumesIdFilesDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessDeletedResponse>>;
148
+ /**
149
+ * Delete volume file or directory
150
+ */
151
+ apiV1SandboxvolumesIdFilesDelete(requestParameters: ApiV1SandboxvolumesIdFilesDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessDeletedResponse>;
152
+ /**
153
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root When `Accept` or `Content-Type` is `application/json`, returns a base64 JSON payload.
154
+ * Read volume file content
155
+ */
156
+ apiV1SandboxvolumesIdFilesGetRaw(requestParameters: ApiV1SandboxvolumesIdFilesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>>;
157
+ /**
158
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root When `Accept` or `Content-Type` is `application/json`, returns a base64 JSON payload.
159
+ * Read volume file content
160
+ */
161
+ apiV1SandboxvolumesIdFilesGet(requestParameters: ApiV1SandboxvolumesIdFilesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
162
+ /**
163
+ * Use query params: - path=/tmp: target directory path relative to the volume root
164
+ * List volume directory entries
165
+ */
166
+ apiV1SandboxvolumesIdFilesListGetRaw(requestParameters: ApiV1SandboxvolumesIdFilesListGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessFileListResponse>>;
167
+ /**
168
+ * Use query params: - path=/tmp: target directory path relative to the volume root
169
+ * List volume directory entries
170
+ */
171
+ apiV1SandboxvolumesIdFilesListGet(requestParameters: ApiV1SandboxvolumesIdFilesListGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessFileListResponse>;
172
+ /**
173
+ * Move a volume file or directory
174
+ */
175
+ apiV1SandboxvolumesIdFilesMovePostRaw(requestParameters: ApiV1SandboxvolumesIdFilesMovePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessMovedResponse>>;
176
+ /**
177
+ * Move a volume file or directory
178
+ */
179
+ apiV1SandboxvolumesIdFilesMovePost(requestParameters: ApiV1SandboxvolumesIdFilesMovePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMovedResponse>;
180
+ /**
181
+ * Use `path` query param and `mkdir=true` to create directories, otherwise writes file content.
182
+ * Write volume file or create directory
183
+ */
184
+ apiV1SandboxvolumesIdFilesPostRaw(requestParameters: ApiV1SandboxvolumesIdFilesPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessWrittenResponse>>;
185
+ /**
186
+ * Use `path` query param and `mkdir=true` to create directories, otherwise writes file content.
187
+ * Write volume file or create directory
188
+ */
189
+ apiV1SandboxvolumesIdFilesPost(requestParameters: ApiV1SandboxvolumesIdFilesPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessWrittenResponse>;
190
+ /**
191
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root
192
+ * Stat a volume file
193
+ */
194
+ apiV1SandboxvolumesIdFilesStatGetRaw(requestParameters: ApiV1SandboxvolumesIdFilesStatGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessFileStatResponse>>;
195
+ /**
196
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root
197
+ * Stat a volume file
198
+ */
199
+ apiV1SandboxvolumesIdFilesStatGet(requestParameters: ApiV1SandboxvolumesIdFilesStatGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessFileStatResponse>;
200
+ /**
201
+ * Upgrades to WebSocket for volume file watch events. Client messages: - { \"action\": \"subscribe\", \"path\": \"/tmp\", \"recursive\": false } - { \"action\": \"unsubscribe\", \"watch_id\": \"watch-id\" } Server messages: - { \"type\": \"subscribed\", \"watch_id\": \"watch-id\", \"path\": \"/tmp\" } - { \"type\": \"event\", \"watch_id\": \"watch-id\", \"event\": \"write\", \"path\": \"/tmp/a.txt\" } - { \"type\": \"unsubscribed\", \"watch_id\": \"watch-id\" } - { \"type\": \"error\", \"error\": \"message\" }
202
+ * Volume file watch WebSocket
203
+ */
204
+ apiV1SandboxvolumesIdFilesWatchGetRaw(requestParameters: ApiV1SandboxvolumesIdFilesWatchGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
205
+ /**
206
+ * Upgrades to WebSocket for volume file watch events. Client messages: - { \"action\": \"subscribe\", \"path\": \"/tmp\", \"recursive\": false } - { \"action\": \"unsubscribe\", \"watch_id\": \"watch-id\" } Server messages: - { \"type\": \"subscribed\", \"watch_id\": \"watch-id\", \"path\": \"/tmp\" } - { \"type\": \"event\", \"watch_id\": \"watch-id\", \"event\": \"write\", \"path\": \"/tmp/a.txt\" } - { \"type\": \"unsubscribed\", \"watch_id\": \"watch-id\" } - { \"type\": \"error\", \"error\": \"message\" }
207
+ * Volume file watch WebSocket
208
+ */
209
+ apiV1SandboxvolumesIdFilesWatchGet(requestParameters: ApiV1SandboxvolumesIdFilesWatchGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
114
210
  }
115
211
  //# sourceMappingURL=FilesApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilesApi.d.ts","sourceRoot":"","sources":["../../../../src/apispec/src/apis/FilesApi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAEV,eAAe,EAEf,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAoBzB,MAAM,WAAW,kCAAkC;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCAAmC;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oCAAoC;IACjD,EAAE,EAAE,MAAM,CAAC;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,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAKlM;;;OAGG;IACG,qCAAqC,CAAC,iBAAiB,EAAE,yCAAyC,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAkCzM;;;OAGG;IACG,kCAAkC,CAAC,iBAAiB,EAAE,yCAAyC,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAIpL"}
@@ -300,4 +300,287 @@ export class FilesApi extends runtime.BaseAPI {
300
300
  async apiV1SandboxesIdFilesWatchGet(requestParameters, initOverrides) {
301
301
  await this.apiV1SandboxesIdFilesWatchGetRaw(requestParameters, initOverrides);
302
302
  }
303
+ /**
304
+ * Delete volume file or directory
305
+ */
306
+ async apiV1SandboxvolumesIdFilesDeleteRaw(requestParameters, initOverrides) {
307
+ if (requestParameters['id'] == null) {
308
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesDelete().');
309
+ }
310
+ if (requestParameters['path'] == null) {
311
+ throw new runtime.RequiredError('path', 'Required parameter "path" was null or undefined when calling apiV1SandboxvolumesIdFilesDelete().');
312
+ }
313
+ const queryParameters = {};
314
+ if (requestParameters['path'] != null) {
315
+ queryParameters['path'] = requestParameters['path'];
316
+ }
317
+ const headerParameters = {};
318
+ if (this.configuration && this.configuration.accessToken) {
319
+ const token = this.configuration.accessToken;
320
+ const tokenString = await token("bearerAuth", []);
321
+ if (tokenString) {
322
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
323
+ }
324
+ }
325
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files`;
326
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
327
+ const response = await this.request({
328
+ path: urlPath,
329
+ method: 'DELETE',
330
+ headers: headerParameters,
331
+ query: queryParameters,
332
+ }, initOverrides);
333
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuccessDeletedResponseFromJSON(jsonValue));
334
+ }
335
+ /**
336
+ * Delete volume file or directory
337
+ */
338
+ async apiV1SandboxvolumesIdFilesDelete(requestParameters, initOverrides) {
339
+ const response = await this.apiV1SandboxvolumesIdFilesDeleteRaw(requestParameters, initOverrides);
340
+ return await response.value();
341
+ }
342
+ /**
343
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root When `Accept` or `Content-Type` is `application/json`, returns a base64 JSON payload.
344
+ * Read volume file content
345
+ */
346
+ async apiV1SandboxvolumesIdFilesGetRaw(requestParameters, initOverrides) {
347
+ if (requestParameters['id'] == null) {
348
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesGet().');
349
+ }
350
+ if (requestParameters['path'] == null) {
351
+ throw new runtime.RequiredError('path', 'Required parameter "path" was null or undefined when calling apiV1SandboxvolumesIdFilesGet().');
352
+ }
353
+ const queryParameters = {};
354
+ if (requestParameters['path'] != null) {
355
+ queryParameters['path'] = requestParameters['path'];
356
+ }
357
+ const headerParameters = {};
358
+ if (this.configuration && this.configuration.accessToken) {
359
+ const token = this.configuration.accessToken;
360
+ const tokenString = await token("bearerAuth", []);
361
+ if (tokenString) {
362
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
363
+ }
364
+ }
365
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files`;
366
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
367
+ const response = await this.request({
368
+ path: urlPath,
369
+ method: 'GET',
370
+ headers: headerParameters,
371
+ query: queryParameters,
372
+ }, initOverrides);
373
+ return new runtime.BlobApiResponse(response);
374
+ }
375
+ /**
376
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root When `Accept` or `Content-Type` is `application/json`, returns a base64 JSON payload.
377
+ * Read volume file content
378
+ */
379
+ async apiV1SandboxvolumesIdFilesGet(requestParameters, initOverrides) {
380
+ const response = await this.apiV1SandboxvolumesIdFilesGetRaw(requestParameters, initOverrides);
381
+ return await response.value();
382
+ }
383
+ /**
384
+ * Use query params: - path=/tmp: target directory path relative to the volume root
385
+ * List volume directory entries
386
+ */
387
+ async apiV1SandboxvolumesIdFilesListGetRaw(requestParameters, initOverrides) {
388
+ if (requestParameters['id'] == null) {
389
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesListGet().');
390
+ }
391
+ if (requestParameters['path'] == null) {
392
+ throw new runtime.RequiredError('path', 'Required parameter "path" was null or undefined when calling apiV1SandboxvolumesIdFilesListGet().');
393
+ }
394
+ const queryParameters = {};
395
+ if (requestParameters['path'] != null) {
396
+ queryParameters['path'] = requestParameters['path'];
397
+ }
398
+ const headerParameters = {};
399
+ if (this.configuration && this.configuration.accessToken) {
400
+ const token = this.configuration.accessToken;
401
+ const tokenString = await token("bearerAuth", []);
402
+ if (tokenString) {
403
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
404
+ }
405
+ }
406
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files/list`;
407
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
408
+ const response = await this.request({
409
+ path: urlPath,
410
+ method: 'GET',
411
+ headers: headerParameters,
412
+ query: queryParameters,
413
+ }, initOverrides);
414
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuccessFileListResponseFromJSON(jsonValue));
415
+ }
416
+ /**
417
+ * Use query params: - path=/tmp: target directory path relative to the volume root
418
+ * List volume directory entries
419
+ */
420
+ async apiV1SandboxvolumesIdFilesListGet(requestParameters, initOverrides) {
421
+ const response = await this.apiV1SandboxvolumesIdFilesListGetRaw(requestParameters, initOverrides);
422
+ return await response.value();
423
+ }
424
+ /**
425
+ * Move a volume file or directory
426
+ */
427
+ async apiV1SandboxvolumesIdFilesMovePostRaw(requestParameters, initOverrides) {
428
+ if (requestParameters['id'] == null) {
429
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesMovePost().');
430
+ }
431
+ if (requestParameters['moveFileRequest'] == null) {
432
+ throw new runtime.RequiredError('moveFileRequest', 'Required parameter "moveFileRequest" was null or undefined when calling apiV1SandboxvolumesIdFilesMovePost().');
433
+ }
434
+ const queryParameters = {};
435
+ const headerParameters = {};
436
+ headerParameters['Content-Type'] = 'application/json';
437
+ if (this.configuration && this.configuration.accessToken) {
438
+ const token = this.configuration.accessToken;
439
+ const tokenString = await token("bearerAuth", []);
440
+ if (tokenString) {
441
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
442
+ }
443
+ }
444
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files/move`;
445
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
446
+ const response = await this.request({
447
+ path: urlPath,
448
+ method: 'POST',
449
+ headers: headerParameters,
450
+ query: queryParameters,
451
+ body: MoveFileRequestToJSON(requestParameters['moveFileRequest']),
452
+ }, initOverrides);
453
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuccessMovedResponseFromJSON(jsonValue));
454
+ }
455
+ /**
456
+ * Move a volume file or directory
457
+ */
458
+ async apiV1SandboxvolumesIdFilesMovePost(requestParameters, initOverrides) {
459
+ const response = await this.apiV1SandboxvolumesIdFilesMovePostRaw(requestParameters, initOverrides);
460
+ return await response.value();
461
+ }
462
+ /**
463
+ * Use `path` query param and `mkdir=true` to create directories, otherwise writes file content.
464
+ * Write volume file or create directory
465
+ */
466
+ async apiV1SandboxvolumesIdFilesPostRaw(requestParameters, initOverrides) {
467
+ if (requestParameters['id'] == null) {
468
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesPost().');
469
+ }
470
+ if (requestParameters['path'] == null) {
471
+ throw new runtime.RequiredError('path', 'Required parameter "path" was null or undefined when calling apiV1SandboxvolumesIdFilesPost().');
472
+ }
473
+ const queryParameters = {};
474
+ if (requestParameters['path'] != null) {
475
+ queryParameters['path'] = requestParameters['path'];
476
+ }
477
+ if (requestParameters['mkdir'] != null) {
478
+ queryParameters['mkdir'] = requestParameters['mkdir'];
479
+ }
480
+ if (requestParameters['recursive'] != null) {
481
+ queryParameters['recursive'] = requestParameters['recursive'];
482
+ }
483
+ const headerParameters = {};
484
+ headerParameters['Content-Type'] = 'application/octet-stream';
485
+ if (this.configuration && this.configuration.accessToken) {
486
+ const token = this.configuration.accessToken;
487
+ const tokenString = await token("bearerAuth", []);
488
+ if (tokenString) {
489
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
490
+ }
491
+ }
492
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files`;
493
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
494
+ const response = await this.request({
495
+ path: urlPath,
496
+ method: 'POST',
497
+ headers: headerParameters,
498
+ query: queryParameters,
499
+ body: requestParameters['body'],
500
+ }, initOverrides);
501
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuccessWrittenResponseFromJSON(jsonValue));
502
+ }
503
+ /**
504
+ * Use `path` query param and `mkdir=true` to create directories, otherwise writes file content.
505
+ * Write volume file or create directory
506
+ */
507
+ async apiV1SandboxvolumesIdFilesPost(requestParameters, initOverrides) {
508
+ const response = await this.apiV1SandboxvolumesIdFilesPostRaw(requestParameters, initOverrides);
509
+ return await response.value();
510
+ }
511
+ /**
512
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root
513
+ * Stat a volume file
514
+ */
515
+ async apiV1SandboxvolumesIdFilesStatGetRaw(requestParameters, initOverrides) {
516
+ if (requestParameters['id'] == null) {
517
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesStatGet().');
518
+ }
519
+ if (requestParameters['path'] == null) {
520
+ throw new runtime.RequiredError('path', 'Required parameter "path" was null or undefined when calling apiV1SandboxvolumesIdFilesStatGet().');
521
+ }
522
+ const queryParameters = {};
523
+ if (requestParameters['path'] != null) {
524
+ queryParameters['path'] = requestParameters['path'];
525
+ }
526
+ const headerParameters = {};
527
+ if (this.configuration && this.configuration.accessToken) {
528
+ const token = this.configuration.accessToken;
529
+ const tokenString = await token("bearerAuth", []);
530
+ if (tokenString) {
531
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
532
+ }
533
+ }
534
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files/stat`;
535
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
536
+ const response = await this.request({
537
+ path: urlPath,
538
+ method: 'GET',
539
+ headers: headerParameters,
540
+ query: queryParameters,
541
+ }, initOverrides);
542
+ return new runtime.JSONApiResponse(response, (jsonValue) => SuccessFileStatResponseFromJSON(jsonValue));
543
+ }
544
+ /**
545
+ * Use query params: - path=/tmp/a.txt: target file path relative to the volume root
546
+ * Stat a volume file
547
+ */
548
+ async apiV1SandboxvolumesIdFilesStatGet(requestParameters, initOverrides) {
549
+ const response = await this.apiV1SandboxvolumesIdFilesStatGetRaw(requestParameters, initOverrides);
550
+ return await response.value();
551
+ }
552
+ /**
553
+ * Upgrades to WebSocket for volume file watch events. Client messages: - { \"action\": \"subscribe\", \"path\": \"/tmp\", \"recursive\": false } - { \"action\": \"unsubscribe\", \"watch_id\": \"watch-id\" } Server messages: - { \"type\": \"subscribed\", \"watch_id\": \"watch-id\", \"path\": \"/tmp\" } - { \"type\": \"event\", \"watch_id\": \"watch-id\", \"event\": \"write\", \"path\": \"/tmp/a.txt\" } - { \"type\": \"unsubscribed\", \"watch_id\": \"watch-id\" } - { \"type\": \"error\", \"error\": \"message\" }
554
+ * Volume file watch WebSocket
555
+ */
556
+ async apiV1SandboxvolumesIdFilesWatchGetRaw(requestParameters, initOverrides) {
557
+ if (requestParameters['id'] == null) {
558
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling apiV1SandboxvolumesIdFilesWatchGet().');
559
+ }
560
+ const queryParameters = {};
561
+ const headerParameters = {};
562
+ if (this.configuration && this.configuration.accessToken) {
563
+ const token = this.configuration.accessToken;
564
+ const tokenString = await token("bearerAuth", []);
565
+ if (tokenString) {
566
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
567
+ }
568
+ }
569
+ let urlPath = `/api/v1/sandboxvolumes/{id}/files/watch`;
570
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
571
+ const response = await this.request({
572
+ path: urlPath,
573
+ method: 'GET',
574
+ headers: headerParameters,
575
+ query: queryParameters,
576
+ }, initOverrides);
577
+ return new runtime.VoidApiResponse(response);
578
+ }
579
+ /**
580
+ * Upgrades to WebSocket for volume file watch events. Client messages: - { \"action\": \"subscribe\", \"path\": \"/tmp\", \"recursive\": false } - { \"action\": \"unsubscribe\", \"watch_id\": \"watch-id\" } Server messages: - { \"type\": \"subscribed\", \"watch_id\": \"watch-id\", \"path\": \"/tmp\" } - { \"type\": \"event\", \"watch_id\": \"watch-id\", \"event\": \"write\", \"path\": \"/tmp/a.txt\" } - { \"type\": \"unsubscribed\", \"watch_id\": \"watch-id\" } - { \"type\": \"error\", \"error\": \"message\" }
581
+ * Volume file watch WebSocket
582
+ */
583
+ async apiV1SandboxvolumesIdFilesWatchGet(requestParameters, initOverrides) {
584
+ await this.apiV1SandboxvolumesIdFilesWatchGetRaw(requestParameters, initOverrides);
585
+ }
303
586
  }
@@ -1,6 +1,7 @@
1
- import type { CreateSandboxVolumeRequest, ForkVolumeRequest, CreateSnapshotRequest, SandboxVolume, Snapshot, SuccessDeletedResponse, SuccessRestoreResponse } from "../apispec/src/models/index.js";
1
+ import type { CreateSandboxVolumeRequest, FileInfo, ForkVolumeRequest, CreateSnapshotRequest, SandboxVolume, Snapshot, SuccessCreatedResponse, SuccessDeletedResponse, SuccessRestoreResponse, SuccessMovedResponse, SuccessWrittenResponse } from "../apispec/src/models/index.js";
2
2
  import type { Client } from "../client.js";
3
3
  import { VolumeSession } from "../sessions.js";
4
+ import { FileWatchStream } from "../sandbox.js";
4
5
  export declare class Volumes {
5
6
  private readonly client;
6
7
  constructor(client: Client);
@@ -17,5 +18,13 @@ export declare class Volumes {
17
18
  getSnapshot(volumeId: string, snapshotId: string): Promise<Snapshot>;
18
19
  deleteSnapshot(volumeId: string, snapshotId: string): Promise<SuccessDeletedResponse>;
19
20
  restoreSnapshot(volumeId: string, snapshotId: string): Promise<SuccessRestoreResponse>;
21
+ readFile(volumeId: string, path: string): Promise<Uint8Array>;
22
+ statFile(volumeId: string, path: string): Promise<FileInfo>;
23
+ listFiles(volumeId: string, path: string): Promise<FileInfo[]>;
24
+ writeFile(volumeId: string, path: string, data: Uint8Array | string): Promise<SuccessWrittenResponse>;
25
+ mkdir(volumeId: string, path: string, recursive?: boolean): Promise<SuccessCreatedResponse>;
26
+ deleteFile(volumeId: string, path: string): Promise<SuccessDeletedResponse>;
27
+ moveFile(volumeId: string, source: string, destination: string): Promise<SuccessMovedResponse>;
28
+ watchFiles(volumeId: string, path: string, recursive?: boolean): Promise<FileWatchStream>;
20
29
  }
21
30
  //# sourceMappingURL=volumes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"volumes.d.ts","sourceRoot":"","sources":["../../src/resources/volumes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,MAAM,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,aAAa,CAAC;IASnE,IAAI,CAAC,OAAO,EAAE,0BAA0B,GAAG,O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AAO,CAAC,QAAQ,CAAC;IAU3D,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAW9D,SAAS,CACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,GAAG,MAAM,GACxB,OAAO,CAAC,sBAAsB,CAAC;IAY5B,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,UAAQ,GAChB,OAAO,CAAC,sBAAsB,CAAC;IAa5B,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAU3E,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,CAAC;IAU1B,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,UAAQ,GAChB,OAAO,CAAC,eAAe,CAAC;CAqC5B"}
@@ -1,6 +1,10 @@
1
+ import { models } from "../apispec_compat.js";
2
+ import { APIError } from "../errors.js";
1
3
  import { ensureData, ensureModel } from "../response.js";
2
4
  import { wrapApiCall } from "../errors.js";
3
5
  import { VolumeSession } from "../sessions.js";
6
+ import { FileWatchStream } from "../sandbox.js";
7
+ import { WebSocketClient } from "../ws_client.js";
4
8
  export class Volumes {
5
9
  client;
6
10
  constructor(client) {
@@ -74,4 +78,136 @@ export class Volumes {
74
78
  }));
75
79
  return ensureModel(response, "restore snapshot returned empty response");
76
80
  }
81
+ async readFile(volumeId, path) {
82
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesGetRaw({
83
+ id: volumeId,
84
+ path,
85
+ }));
86
+ const contentType = response.raw.headers.get("content-type")?.toLowerCase() ?? "";
87
+ if (contentType.includes("application/json")) {
88
+ const payload = (await response.raw.json());
89
+ const data = ensureData(payload, "read volume file returned empty response");
90
+ const content = data.content ?? "";
91
+ const encoding = data.encoding;
92
+ if (encoding && encoding !== models.FileContentResponseEncodingEnum.Base64) {
93
+ throw new APIError({
94
+ statusCode: response.raw.status,
95
+ code: "unsupported_encoding",
96
+ message: `unsupported file encoding: ${encoding}`,
97
+ });
98
+ }
99
+ return Buffer.from(content, "base64");
100
+ }
101
+ const blob = await response.value();
102
+ const buffer = await blob.arrayBuffer();
103
+ return new Uint8Array(buffer);
104
+ }
105
+ async statFile(volumeId, path) {
106
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesStatGet({
107
+ id: volumeId,
108
+ path,
109
+ }));
110
+ return ensureData(response, "stat volume file returned empty response");
111
+ }
112
+ async listFiles(volumeId, path) {
113
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesListGet({
114
+ id: volumeId,
115
+ path,
116
+ }));
117
+ const data = ensureData(response, "list volume files returned empty response");
118
+ return data.entries ?? [];
119
+ }
120
+ async writeFile(volumeId, path, data) {
121
+ const payload = typeof data === "string" ? Buffer.from(data) : data;
122
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesPost({
123
+ id: volumeId,
124
+ path,
125
+ body: new Blob([payload]),
126
+ }));
127
+ return ensureModel(response, "write volume file returned empty response");
128
+ }
129
+ async mkdir(volumeId, path, recursive = false) {
130
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesPost({
131
+ id: volumeId,
132
+ path,
133
+ mkdir: true,
134
+ recursive: recursive || undefined,
135
+ body: new Blob([]),
136
+ }));
137
+ return ensureModel(response, "mkdir volume path returned empty response");
138
+ }
139
+ async deleteFile(volumeId, path) {
140
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesDelete({
141
+ id: volumeId,
142
+ path,
143
+ }));
144
+ return ensureModel(response, "delete volume file returned empty response");
145
+ }
146
+ async moveFile(volumeId, source, destination) {
147
+ const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesMovePost({
148
+ id: volumeId,
149
+ moveFileRequest: { source, destination },
150
+ }));
151
+ return ensureModel(response, "move volume file returned empty response");
152
+ }
153
+ async watchFiles(volumeId, path, recursive = false) {
154
+ const wsUrl = this.client.websocketUrl(`/api/v1/sandboxvolumes/${volumeId}/files/watch`);
155
+ const headers = await this.client.wsHeaders();
156
+ const socket = new WebSocketClient(wsUrl, { headers });
157
+ await socket.waitForOpen();
158
+ socket.send(JSON.stringify({ action: "subscribe", path, recursive: !!recursive }));
159
+ const firstRaw = await socket.waitForMessage();
160
+ const first = firstRaw ? parseWsMessage(firstRaw) : null;
161
+ if (!first) {
162
+ socket.close();
163
+ throw new APIError({
164
+ statusCode: 0,
165
+ code: "watch_failed",
166
+ message: "watch subscribe failed: empty response",
167
+ });
168
+ }
169
+ if (first.type === "error") {
170
+ socket.close();
171
+ throw new APIError({
172
+ statusCode: 0,
173
+ code: "watch_failed",
174
+ message: `watch subscribe failed: ${first.error ?? ""}`,
175
+ });
176
+ }
177
+ if (first.type !== "subscribed" || !first.watch_id) {
178
+ socket.close();
179
+ throw new APIError({
180
+ statusCode: 0,
181
+ code: "watch_failed",
182
+ message: `unexpected watch response: ${first.type ?? ""}`,
183
+ });
184
+ }
185
+ const stream = new FileWatchStream(socket);
186
+ stream.watchId = String(first.watch_id);
187
+ return stream;
188
+ }
189
+ }
190
+ function parseWsMessage(data) {
191
+ try {
192
+ let text;
193
+ if (typeof data === "string") {
194
+ text = data;
195
+ }
196
+ else if (Buffer.isBuffer(data)) {
197
+ text = data.toString("utf-8");
198
+ }
199
+ else if (Array.isArray(data)) {
200
+ text = Buffer.concat(data).toString("utf-8");
201
+ }
202
+ else if (data instanceof ArrayBuffer) {
203
+ text = Buffer.from(data).toString("utf-8");
204
+ }
205
+ else {
206
+ text = Buffer.from(data).toString("utf-8");
207
+ }
208
+ return JSON.parse(text);
209
+ }
210
+ catch {
211
+ return null;
212
+ }
77
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandbox0",
3
- "version": "0.1.13",
3
+ "version": "0.2.0",
4
4
  "description": "Sandbox0 JavaScript/TypeScript SDK",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Sandbox0 Team",