@3dverse/api 0.9.0 → 0.10.1

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/dist/index.mjs CHANGED
@@ -2,13 +2,201 @@
2
2
  import axiosRetry, { isNetworkError, isIdempotentRequestError } from "axios-retry";
3
3
 
4
4
  // _prebuild/wrapper.ts
5
- import axios from "axios";
5
+ import axios, {
6
+ AxiosHeaders
7
+ } from "axios";
8
+ var ServiceErrorResponse = class extends Error {
9
+ errorCode;
10
+ httpCode;
11
+ serviceError;
12
+ constructor(errorCode, httpCode, message, serviceError) {
13
+ super(message);
14
+ Object.defineProperty(this, "message", {
15
+ value: message,
16
+ enumerable: true,
17
+ writable: true,
18
+ configurable: true
19
+ });
20
+ this.errorCode = errorCode;
21
+ this.httpCode = httpCode;
22
+ this.serviceError = serviceError;
23
+ }
24
+ };
25
+ function optionalBody(body) {
26
+ return Object.values(body).some((value) => value !== void 0) ? body : void 0;
27
+ }
28
+ function multipartBody(fields, files) {
29
+ const form = new FormData();
30
+ for (const [name, value] of Object.entries(fields)) {
31
+ if (value !== void 0) {
32
+ form.append(name, typeof value === "string" ? value : JSON.stringify(value));
33
+ }
34
+ }
35
+ for (const [name, value] of Object.entries(files)) {
36
+ for (const file of value === void 0 ? [] : Array.isArray(value) ? value : [value]) {
37
+ form.append(name, file);
38
+ }
39
+ }
40
+ return form;
41
+ }
42
+ function plainHeaders(headers) {
43
+ return headers instanceof AxiosHeaders ? headers.toJSON() : { ...headers };
44
+ }
6
45
  var axiosInstance = axios.create({
7
- baseURL: "https://api.3dverse.com/app/v1"
46
+ baseURL: "https://api.3dverse.com/app/v1",
47
+ paramsSerializer: { indexes: null }
8
48
  });
9
49
  function setBaseURL(baseURL) {
10
50
  axiosInstance.defaults.baseURL = baseURL;
11
51
  }
52
+ var AssetSourceFileNotFound = class extends ServiceErrorResponse {
53
+ static ERROR_CODE = 1018;
54
+ constructor(serviceError) {
55
+ super(1018, 404, "The asset was imported from no source file", serviceError);
56
+ Object.assign(this, serviceError);
57
+ }
58
+ };
59
+ var InsufficientPermissions = class extends ServiceErrorResponse {
60
+ static ERROR_CODE = 1002;
61
+ constructor(serviceError) {
62
+ super(1002, 403, "Insufficient permissions", serviceError);
63
+ Object.assign(this, serviceError);
64
+ }
65
+ };
66
+ var InvalidAuthorization = class extends ServiceErrorResponse {
67
+ static ERROR_CODE = 1003;
68
+ constructor(serviceError) {
69
+ super(1003, 403, "This operation is not allowed with this kind of token", serviceError);
70
+ Object.assign(this, serviceError);
71
+ }
72
+ };
73
+ var InsufficientSecurityScope = class extends ServiceErrorResponse {
74
+ static ERROR_CODE = 1004;
75
+ constructor(serviceError) {
76
+ super(1004, 403, "This operation is not permitted with the scope of this token", serviceError);
77
+ Object.assign(this, serviceError);
78
+ }
79
+ };
80
+ var Unauthorized = class extends ServiceErrorResponse {
81
+ static ERROR_CODE = 1005;
82
+ constructor(serviceError) {
83
+ super(1005, 401, "Invalid or expired token", serviceError);
84
+ Object.assign(this, serviceError);
85
+ }
86
+ };
87
+ var EnvironmentMismatch = class extends ServiceErrorResponse {
88
+ static ERROR_CODE = 1006;
89
+ constructor(serviceError) {
90
+ super(1006, 403, "User is not part of the current environment", serviceError);
91
+ Object.assign(this, serviceError);
92
+ }
93
+ };
94
+ var MissingAuthorizationHeader = class extends ServiceErrorResponse {
95
+ static ERROR_CODE = 1011;
96
+ constructor(serviceError) {
97
+ super(1011, 401, "Missing api key or user token", serviceError);
98
+ Object.assign(this, serviceError);
99
+ }
100
+ };
101
+ var InvalidApiKey = class extends ServiceErrorResponse {
102
+ static ERROR_CODE = 1012;
103
+ constructor(serviceError) {
104
+ super(1012, 401, "Invalid api key", serviceError);
105
+ Object.assign(this, serviceError);
106
+ }
107
+ };
108
+ var InvalidGuestToken = class extends ServiceErrorResponse {
109
+ static ERROR_CODE = 1016;
110
+ constructor(serviceError) {
111
+ super(1016, 403, "You are not allowed to use this guest token for this session", serviceError);
112
+ Object.assign(this, serviceError);
113
+ }
114
+ };
115
+ var InvalidTokenTtl = class extends ServiceErrorResponse {
116
+ static ERROR_CODE = 1017;
117
+ constructor(serviceError) {
118
+ super(1017, 400, "The time to live of a user token is a duration from 1 minute to 14 days", serviceError);
119
+ Object.assign(this, serviceError);
120
+ }
121
+ };
122
+ var UploadedPayloadTooLarge = class extends ServiceErrorResponse {
123
+ static ERROR_CODE = 1007;
124
+ constructor(serviceError) {
125
+ super(1007, 413, "Upload payload size exceeds the maximum allowed", serviceError);
126
+ Object.assign(this, serviceError);
127
+ }
128
+ };
129
+ var NoFileUploaded = class extends ServiceErrorResponse {
130
+ static ERROR_CODE = 1008;
131
+ constructor(serviceError) {
132
+ super(1008, 422, "No file uploaded", serviceError);
133
+ Object.assign(this, serviceError);
134
+ }
135
+ };
136
+ var UploadAborted = class extends ServiceErrorResponse {
137
+ static ERROR_CODE = 1009;
138
+ constructor(serviceError) {
139
+ super(1009, 422, "Upload aborted", serviceError);
140
+ Object.assign(this, serviceError);
141
+ }
142
+ };
143
+ var UploadTaskNotFound = class extends ServiceErrorResponse {
144
+ static ERROR_CODE = 1010;
145
+ constructor(serviceError) {
146
+ super(1010, 404, "Upload task not found", serviceError);
147
+ Object.assign(this, serviceError);
148
+ }
149
+ };
150
+ var InvalidMaterial = class extends ServiceErrorResponse {
151
+ static ERROR_CODE = 1013;
152
+ constructor(serviceError) {
153
+ super(1013, 400, "Some of the asset ids are not materials", serviceError);
154
+ Object.assign(this, serviceError);
155
+ }
156
+ };
157
+ var InvalidRequest = class extends ServiceErrorResponse {
158
+ static ERROR_CODE = 1014;
159
+ constructor(serviceError) {
160
+ super(1014, 400, "Invalid request", serviceError);
161
+ Object.assign(this, serviceError);
162
+ }
163
+ };
164
+ var ConversionTaskNotFound = class extends ServiceErrorResponse {
165
+ static ERROR_CODE = 1015;
166
+ constructor(serviceError) {
167
+ super(1015, 404, "Conversion task not found", serviceError);
168
+ Object.assign(this, serviceError);
169
+ }
170
+ };
171
+ var declaredErrors = {
172
+ 1018: AssetSourceFileNotFound,
173
+ 1002: InsufficientPermissions,
174
+ 1003: InvalidAuthorization,
175
+ 1004: InsufficientSecurityScope,
176
+ 1005: Unauthorized,
177
+ 1006: EnvironmentMismatch,
178
+ 1011: MissingAuthorizationHeader,
179
+ 1012: InvalidApiKey,
180
+ 1016: InvalidGuestToken,
181
+ 1017: InvalidTokenTtl,
182
+ 1007: UploadedPayloadTooLarge,
183
+ 1008: NoFileUploaded,
184
+ 1009: UploadAborted,
185
+ 1010: UploadTaskNotFound,
186
+ 1013: InvalidMaterial,
187
+ 1014: InvalidRequest,
188
+ 1015: ConversionTaskNotFound
189
+ };
190
+ function errorOf(error) {
191
+ if (Object.values(declaredErrors).some((declared2) => error instanceof declared2)) {
192
+ return error;
193
+ }
194
+ const failure = error;
195
+ const serviceError = failure?.serviceError ?? failure?.response?.data?.error;
196
+ const errorCode = serviceError?.errorCode;
197
+ const declared = typeof errorCode === "number" ? declaredErrors[errorCode] : void 0;
198
+ return declared ? new declared(serviceError) : void 0;
199
+ }
12
200
  function listUsers({
13
201
  offset = 0,
14
202
  limit = 10
@@ -47,7 +235,7 @@ function getUser({
47
235
  }, headers) {
48
236
  return axiosInstance({
49
237
  method: "get",
50
- url: "/users/" + user_id,
238
+ url: "/users/" + encodeURIComponent(user_id),
51
239
  headers
52
240
  });
53
241
  }
@@ -57,7 +245,7 @@ function updateUser({
57
245
  }, headers) {
58
246
  return axiosInstance({
59
247
  method: "patch",
60
- url: "/users/" + user_id,
248
+ url: "/users/" + encodeURIComponent(user_id),
61
249
  data: {
62
250
  username
63
251
  },
@@ -69,7 +257,7 @@ function deleteUser({
69
257
  }, headers) {
70
258
  return axiosInstance({
71
259
  method: "delete",
72
- url: "/users/" + user_id,
260
+ url: "/users/" + encodeURIComponent(user_id),
73
261
  headers
74
262
  });
75
263
  }
@@ -80,7 +268,7 @@ function generateUserToken({
80
268
  }, headers) {
81
269
  return axiosInstance({
82
270
  method: "post",
83
- url: "/users/" + user_id + "/tokens",
271
+ url: "/users/" + encodeURIComponent(user_id) + "/tokens",
84
272
  data: {
85
273
  scope,
86
274
  ttl
@@ -93,7 +281,7 @@ function getUserGroups({
93
281
  }, headers) {
94
282
  return axiosInstance({
95
283
  method: "get",
96
- url: "/users/" + user_id + "/groups",
284
+ url: "/users/" + encodeURIComponent(user_id) + "/groups",
97
285
  headers
98
286
  });
99
287
  }
@@ -104,7 +292,7 @@ function getUserUploadTasks({
104
292
  }, headers) {
105
293
  return axiosInstance({
106
294
  method: "get",
107
- url: "/users/" + user_id + "/upload-tasks",
295
+ url: "/users/" + encodeURIComponent(user_id) + "/upload-tasks",
108
296
  params: {
109
297
  offset,
110
298
  limit
@@ -133,7 +321,7 @@ function getGroup({
133
321
  }, headers) {
134
322
  return axiosInstance({
135
323
  method: "get",
136
- url: "/groups/" + group_id,
324
+ url: "/groups/" + encodeURIComponent(group_id),
137
325
  headers
138
326
  });
139
327
  }
@@ -144,7 +332,7 @@ function updateGroupDescription({
144
332
  }, headers) {
145
333
  return axiosInstance({
146
334
  method: "patch",
147
- url: "/groups/" + group_id,
335
+ url: "/groups/" + encodeURIComponent(group_id),
148
336
  data: {
149
337
  name,
150
338
  description
@@ -157,7 +345,7 @@ function deleteGroup({
157
345
  }, headers) {
158
346
  return axiosInstance({
159
347
  method: "delete",
160
- url: "/groups/" + group_id,
348
+ url: "/groups/" + encodeURIComponent(group_id),
161
349
  headers
162
350
  });
163
351
  }
@@ -170,7 +358,7 @@ function grantMemberAccessToGroup({
170
358
  }, headers) {
171
359
  return axiosInstance({
172
360
  method: "put",
173
- url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id,
361
+ url: "/groups/" + encodeURIComponent(group_id) + "/members/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
174
362
  data: {
175
363
  group_access,
176
364
  folder_access
@@ -185,7 +373,7 @@ function revokeMemberAccessToGroup({
185
373
  }, headers) {
186
374
  return axiosInstance({
187
375
  method: "delete",
188
- url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id,
376
+ url: "/groups/" + encodeURIComponent(group_id) + "/members/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
189
377
  headers
190
378
  });
191
379
  }
@@ -222,7 +410,7 @@ function getFolderInfo({
222
410
  }, headers) {
223
411
  return axiosInstance({
224
412
  method: "get",
225
- url: "/folders/" + folder_id,
413
+ url: "/folders/" + encodeURIComponent(folder_id),
226
414
  headers
227
415
  });
228
416
  }
@@ -232,7 +420,7 @@ function moveFolders({
232
420
  }, headers) {
233
421
  return axiosInstance({
234
422
  method: "put",
235
- url: "/folders/" + folder_id,
423
+ url: "/folders/" + encodeURIComponent(folder_id),
236
424
  data: folder_ids,
237
425
  headers
238
426
  });
@@ -243,7 +431,7 @@ function updateFolder({
243
431
  }, headers) {
244
432
  return axiosInstance({
245
433
  method: "patch",
246
- url: "/folders/" + folder_id,
434
+ url: "/folders/" + encodeURIComponent(folder_id),
247
435
  data: {
248
436
  name
249
437
  },
@@ -255,7 +443,7 @@ function deleteFolder({
255
443
  }, headers) {
256
444
  return axiosInstance({
257
445
  method: "delete",
258
- url: "/folders/" + folder_id,
446
+ url: "/folders/" + encodeURIComponent(folder_id),
259
447
  headers
260
448
  });
261
449
  }
@@ -264,7 +452,7 @@ function listFolderAccesses({
264
452
  }, headers) {
265
453
  return axiosInstance({
266
454
  method: "get",
267
- url: "/folders/" + folder_id + "/access",
455
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access",
268
456
  headers
269
457
  });
270
458
  }
@@ -276,7 +464,7 @@ function grantMemberAccessToFolder({
276
464
  }, headers) {
277
465
  return axiosInstance({
278
466
  method: "put",
279
- url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id,
467
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
280
468
  data: {
281
469
  access
282
470
  },
@@ -290,7 +478,7 @@ function revokeMemberAccessToFolder({
290
478
  }, headers) {
291
479
  return axiosInstance({
292
480
  method: "delete",
293
- url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id,
481
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
294
482
  headers
295
483
  });
296
484
  }
@@ -301,7 +489,7 @@ function createSubfolder({
301
489
  }, headers) {
302
490
  return axiosInstance({
303
491
  method: "post",
304
- url: "/folders/" + folder_id + "/folders",
492
+ url: "/folders/" + encodeURIComponent(folder_id) + "/folders",
305
493
  data: {
306
494
  name,
307
495
  subfolders
@@ -314,22 +502,36 @@ function listFolderSubFolders({
314
502
  }, headers) {
315
503
  return axiosInstance({
316
504
  method: "get",
317
- url: "/folders/" + folder_id + "/folders",
505
+ url: "/folders/" + encodeURIComponent(folder_id) + "/folders",
318
506
  headers
319
507
  });
320
508
  }
321
509
  function uploadSourceFiles({
322
510
  folder_id,
323
- body
511
+ files,
512
+ task_name,
513
+ conversion_pipeline = "auto-detect",
514
+ source_files,
515
+ options
324
516
  }, onUploadProgress, headers) {
325
517
  return axiosInstance({
326
518
  method: "post",
327
- url: "/folders/" + folder_id + "/source-files",
328
- data: body,
519
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
520
+ data: multipartBody(
521
+ {
522
+ task_name,
523
+ conversion_pipeline,
524
+ source_files,
525
+ options
526
+ },
527
+ {
528
+ files
529
+ }
530
+ ),
329
531
  onUploadProgress,
330
532
  headers: {
331
533
  "Content-Type": "multipart/form-data",
332
- ...headers?.toJSON()
534
+ ...plainHeaders(headers)
333
535
  }
334
536
  });
335
537
  }
@@ -341,7 +543,7 @@ function getSourceFilesInFolder({
341
543
  }, headers) {
342
544
  return axiosInstance({
343
545
  method: "get",
344
- url: "/folders/" + folder_id + "/source-files",
546
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
345
547
  params: {
346
548
  offset,
347
549
  limit,
@@ -359,7 +561,7 @@ function moveSourceFiles({
359
561
  }, headers) {
360
562
  return axiosInstance({
361
563
  method: "put",
362
- url: "/folders/" + folder_id + "/source-files",
564
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
363
565
  data: source_file_ids,
364
566
  headers
365
567
  });
@@ -371,7 +573,7 @@ function getUploadTasksInFolder({
371
573
  }, headers) {
372
574
  return axiosInstance({
373
575
  method: "get",
374
- url: "/folders/" + folder_id + "/upload-tasks",
576
+ url: "/folders/" + encodeURIComponent(folder_id) + "/upload-tasks",
375
577
  params: {
376
578
  offset,
377
579
  limit
@@ -388,7 +590,7 @@ function getFolderAssets({
388
590
  }, headers) {
389
591
  return axiosInstance({
390
592
  method: "get",
391
- url: "/folders/" + folder_id + "/assets",
593
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
392
594
  params: {
393
595
  offset,
394
596
  limit,
@@ -397,9 +599,7 @@ function getFolderAssets({
397
599
  },
398
600
  headers
399
601
  }).then((response) => {
400
- response.headers["x-assets-count"] = JSON.parse(
401
- response.headers["x-assets-count"]
402
- );
602
+ response.headers["x-assets-count"] = JSON.parse(response.headers["x-assets-count"]);
403
603
  return response;
404
604
  });
405
605
  }
@@ -409,7 +609,7 @@ function createAsset({
409
609
  }, headers) {
410
610
  return axiosInstance({
411
611
  method: "post",
412
- url: "/folders/" + folder_id + "/assets",
612
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
413
613
  data: asset_creation_options,
414
614
  headers
415
615
  });
@@ -420,21 +620,21 @@ function moveAssets({
420
620
  }, headers) {
421
621
  return axiosInstance({
422
622
  method: "put",
423
- url: "/folders/" + folder_id + "/assets",
623
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
424
624
  data: asset_ids,
425
625
  headers
426
626
  });
427
627
  }
428
628
  function createMaterial({
429
629
  folder_id,
430
- dataJson,
431
- isDoubleSided,
630
+ dataJson = {},
631
+ isDoubleSided = false,
432
632
  name,
433
- shaderRef
633
+ shaderRef = "00000000-0000-0000-0000-000000000000"
434
634
  }, headers) {
435
635
  return axiosInstance({
436
636
  method: "post",
437
- url: "/folders/" + folder_id + "/assets/materials",
637
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets/materials",
438
638
  data: {
439
639
  dataJson,
440
640
  isDoubleSided,
@@ -446,12 +646,19 @@ function createMaterial({
446
646
  }
447
647
  function createCubemap({
448
648
  folder_id,
449
- faces,
649
+ faces = [
650
+ "00000000-0000-0000-0000-000000000000",
651
+ "00000000-0000-0000-0000-000000000000",
652
+ "00000000-0000-0000-0000-000000000000",
653
+ "00000000-0000-0000-0000-000000000000",
654
+ "00000000-0000-0000-0000-000000000000",
655
+ "00000000-0000-0000-0000-000000000000"
656
+ ],
450
657
  name
451
658
  }, headers) {
452
659
  return axiosInstance({
453
660
  method: "post",
454
- url: "/folders/" + folder_id + "/assets/cubemaps",
661
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets/cubemaps",
455
662
  data: {
456
663
  faces,
457
664
  name
@@ -464,7 +671,83 @@ function getSessionsInFolder({
464
671
  }, headers) {
465
672
  return axiosInstance({
466
673
  method: "get",
467
- url: "/folders/" + folder_id + "/sessions",
674
+ url: "/folders/" + encodeURIComponent(folder_id) + "/sessions",
675
+ headers
676
+ });
677
+ }
678
+ function createDuplicationRequest({
679
+ assets,
680
+ options
681
+ }, headers) {
682
+ return axiosInstance({
683
+ method: "post",
684
+ url: "/duplication-requests",
685
+ data: {
686
+ assets,
687
+ options
688
+ },
689
+ headers
690
+ });
691
+ }
692
+ function listDuplicationRequests({
693
+ offset = 0,
694
+ limit = 10,
695
+ states,
696
+ mine = false
697
+ }, headers) {
698
+ return axiosInstance({
699
+ method: "get",
700
+ url: "/duplication-requests",
701
+ params: {
702
+ offset,
703
+ limit,
704
+ states,
705
+ mine
706
+ },
707
+ headers
708
+ });
709
+ }
710
+ function getDuplicationRequest({
711
+ duplication_request_id
712
+ }, headers) {
713
+ return axiosInstance({
714
+ method: "get",
715
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
716
+ headers
717
+ });
718
+ }
719
+ function updateDuplicationRequest({
720
+ duplication_request_id,
721
+ assets,
722
+ folders_by_type,
723
+ dependencies_folders
724
+ }, headers) {
725
+ return axiosInstance({
726
+ method: "patch",
727
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
728
+ data: {
729
+ assets,
730
+ folders_by_type,
731
+ dependencies_folders
732
+ },
733
+ headers
734
+ });
735
+ }
736
+ function discardDuplicationRequest({
737
+ duplication_request_id
738
+ }, headers) {
739
+ return axiosInstance({
740
+ method: "delete",
741
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
742
+ headers
743
+ });
744
+ }
745
+ function confirmDuplicationRequest({
746
+ duplication_request_id
747
+ }, headers) {
748
+ return axiosInstance({
749
+ method: "post",
750
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id) + "/confirm",
468
751
  headers
469
752
  });
470
753
  }
@@ -508,22 +791,12 @@ function getSupportedSourceFileFormats(headers) {
508
791
  headers
509
792
  });
510
793
  }
511
- function downloadSourceFile({
512
- source_file_id
513
- }, headers, responseType) {
514
- return axiosInstance({
515
- method: "get",
516
- url: "/source-files/" + source_file_id,
517
- headers,
518
- responseType: responseType || "arraybuffer"
519
- });
520
- }
521
794
  function getSourceFileDetails({
522
795
  source_file_id
523
796
  }, headers) {
524
797
  return axiosInstance({
525
798
  method: "get",
526
- url: "/source-files/" + source_file_id + "/details",
799
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
527
800
  headers
528
801
  });
529
802
  }
@@ -533,7 +806,7 @@ function updateSourceFileDetails({
533
806
  }, headers) {
534
807
  return axiosInstance({
535
808
  method: "patch",
536
- url: "/source-files/" + source_file_id + "/details",
809
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
537
810
  data: {
538
811
  name
539
812
  },
@@ -545,7 +818,7 @@ function getSourceFileAssets({
545
818
  }, headers) {
546
819
  return axiosInstance({
547
820
  method: "get",
548
- url: "/source-files/" + source_file_id + "/assets",
821
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/assets",
549
822
  headers
550
823
  });
551
824
  }
@@ -568,7 +841,7 @@ function getUploadTask({
568
841
  }, headers) {
569
842
  return axiosInstance({
570
843
  method: "get",
571
- url: "/upload-tasks/" + upload_task_id,
844
+ url: "/upload-tasks/" + encodeURIComponent(upload_task_id),
572
845
  headers
573
846
  });
574
847
  }
@@ -578,7 +851,7 @@ function getConversionTaskMetadata({
578
851
  }, headers, responseType) {
579
852
  return axiosInstance({
580
853
  method: "get",
581
- url: "/conversion_tasks/" + conversion_task_id + "/metadata/" + filename,
854
+ url: "/conversion_tasks/" + encodeURIComponent(conversion_task_id) + "/metadata/" + encodeURIComponent(filename),
582
855
  headers,
583
856
  responseType: responseType || "arraybuffer"
584
857
  });
@@ -608,7 +881,7 @@ function getPipeline({
608
881
  }, headers) {
609
882
  return axiosInstance({
610
883
  method: "get",
611
- url: "/pipelines/" + pipeline_id,
884
+ url: "/pipelines/" + encodeURIComponent(pipeline_id),
612
885
  headers
613
886
  });
614
887
  }
@@ -644,7 +917,7 @@ function deleteAsset({
644
917
  }, headers) {
645
918
  return axiosInstance({
646
919
  method: "delete",
647
- url: "/assets/" + asset_container + "/" + asset_id,
920
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id),
648
921
  headers
649
922
  });
650
923
  }
@@ -654,7 +927,7 @@ function getAssetSourceFile({
654
927
  }, headers) {
655
928
  return axiosInstance({
656
929
  method: "get",
657
- url: "/assets/" + asset_container + "/" + asset_id + "/source-file",
930
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/source-file",
658
931
  headers
659
932
  });
660
933
  }
@@ -664,7 +937,7 @@ function getAssetDetails({
664
937
  }, headers) {
665
938
  return axiosInstance({
666
939
  method: "get",
667
- url: "/assets/" + asset_container + "/" + asset_id + "/details",
940
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/details",
668
941
  headers
669
942
  });
670
943
  }
@@ -674,7 +947,7 @@ function getAssetFolder({
674
947
  }, headers) {
675
948
  return axiosInstance({
676
949
  method: "get",
677
- url: "/assets/" + asset_container + "/" + asset_id + "/folder",
950
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/folder",
678
951
  headers
679
952
  });
680
953
  }
@@ -689,7 +962,7 @@ function getAssetDependencies({
689
962
  }, headers) {
690
963
  return axiosInstance({
691
964
  method: "get",
692
- url: "/assets/" + asset_container + "/" + asset_id + "/dependencies",
965
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/dependencies",
693
966
  params: {
694
967
  offset,
695
968
  limit,
@@ -709,7 +982,7 @@ function getAssetReferences({
709
982
  }, headers) {
710
983
  return axiosInstance({
711
984
  method: "get",
712
- url: "/assets/" + asset_container + "/" + asset_id + "/references",
985
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/references",
713
986
  params: {
714
987
  offset,
715
988
  limit,
@@ -724,7 +997,7 @@ function getAssetDescription({
724
997
  }, headers) {
725
998
  return axiosInstance({
726
999
  method: "get",
727
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
1000
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
728
1001
  headers
729
1002
  });
730
1003
  }
@@ -735,7 +1008,7 @@ function updateAssetDescription({
735
1008
  }, headers) {
736
1009
  return axiosInstance({
737
1010
  method: "put",
738
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
1011
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
739
1012
  data: asset_description,
740
1013
  headers
741
1014
  });
@@ -747,7 +1020,7 @@ function renameAsset({
747
1020
  }, headers) {
748
1021
  return axiosInstance({
749
1022
  method: "patch",
750
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
1023
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
751
1024
  data: {
752
1025
  name
753
1026
  },
@@ -761,7 +1034,7 @@ function getAssetPayload({
761
1034
  }, headers, responseType) {
762
1035
  return axiosInstance({
763
1036
  method: "get",
764
- url: "/assets/" + asset_container_with_payload + "/" + asset_id + "/payload",
1037
+ url: "/assets/" + encodeURIComponent(asset_container_with_payload) + "/" + encodeURIComponent(asset_id) + "/payload",
765
1038
  params: {
766
1039
  sub_resource
767
1040
  },
@@ -775,7 +1048,7 @@ function getAssetGraph({
775
1048
  }, headers) {
776
1049
  return axiosInstance({
777
1050
  method: "get",
778
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1051
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
779
1052
  headers
780
1053
  });
781
1054
  }
@@ -786,7 +1059,7 @@ function updateAssetGraph({
786
1059
  }, headers) {
787
1060
  return axiosInstance({
788
1061
  method: "put",
789
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1062
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
790
1063
  data: asset_graph,
791
1064
  headers
792
1065
  });
@@ -797,7 +1070,7 @@ function getAssetHistory({
797
1070
  }, headers) {
798
1071
  return axiosInstance({
799
1072
  method: "get",
800
- url: "/assets/" + asset_container + "/" + asset_id + "/history",
1073
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/history",
801
1074
  headers
802
1075
  });
803
1076
  }
@@ -807,7 +1080,7 @@ function getAssetMeta({
807
1080
  }, headers) {
808
1081
  return axiosInstance({
809
1082
  method: "get",
810
- url: "/assets/" + asset_container + "/" + asset_id + "/meta",
1083
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/meta",
811
1084
  headers
812
1085
  });
813
1086
  }
@@ -817,7 +1090,7 @@ function getAssetCode({
817
1090
  }, headers) {
818
1091
  return axiosInstance({
819
1092
  method: "get",
820
- url: "/assets/" + asset_container_with_code + "/" + asset_id + "/code",
1093
+ url: "/assets/" + encodeURIComponent(asset_container_with_code) + "/" + encodeURIComponent(asset_id) + "/code",
821
1094
  headers,
822
1095
  responseType: "text"
823
1096
  });
@@ -830,7 +1103,7 @@ function getAssetThumbnail({
830
1103
  }, headers, responseType) {
831
1104
  return axiosInstance({
832
1105
  method: "get",
833
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1106
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
834
1107
  params: {
835
1108
  size,
836
1109
  default_url
@@ -846,32 +1119,22 @@ function setAssetThumbnail({
846
1119
  }, contentType, headers) {
847
1120
  return axiosInstance({
848
1121
  method: "put",
849
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1122
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
850
1123
  data: body,
851
1124
  maxRedirects: 0,
852
1125
  headers: {
853
1126
  "Content-Type": contentType,
854
- ...headers?.toJSON()
1127
+ ...plainHeaders(headers)
855
1128
  }
856
1129
  });
857
1130
  }
858
- function getAssetCustomTypes({
859
- asset_container_with_custom_types,
860
- asset_id
861
- }, headers) {
862
- return axiosInstance({
863
- method: "get",
864
- url: "/assets/" + asset_container_with_custom_types + "/" + asset_id + "/custom-types",
865
- headers
866
- });
867
- }
868
1131
  function packageAsset({
869
1132
  asset_container,
870
1133
  asset_id
871
1134
  }, headers, responseType) {
872
1135
  return axiosInstance({
873
1136
  method: "get",
874
- url: "/assets/" + asset_container + "/" + asset_id + "/package",
1137
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/package",
875
1138
  headers,
876
1139
  responseType: responseType || "arraybuffer"
877
1140
  });
@@ -882,16 +1145,15 @@ function exportAsset({
882
1145
  format,
883
1146
  scale = 1,
884
1147
  sub_mesh_index
885
- }, headers, responseType) {
1148
+ }, headers) {
886
1149
  return axiosInstance({
887
1150
  method: "get",
888
- url: "/assets/" + asset_container_exportable + "/" + asset_id + "/exports/" + format,
1151
+ url: "/assets/" + encodeURIComponent(asset_container_exportable) + "/" + encodeURIComponent(asset_id) + "/exports/" + encodeURIComponent(format),
889
1152
  params: {
890
1153
  scale,
891
1154
  sub_mesh_index
892
1155
  },
893
- headers,
894
- responseType: responseType || "arraybuffer"
1156
+ headers
895
1157
  });
896
1158
  }
897
1159
  function getSceneSessions({
@@ -899,7 +1161,7 @@ function getSceneSessions({
899
1161
  }, headers) {
900
1162
  return axiosInstance({
901
1163
  method: "get",
902
- url: "/assets/scenes/" + scene_id + "/sessions",
1164
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/sessions",
903
1165
  headers
904
1166
  });
905
1167
  }
@@ -908,18 +1170,116 @@ function getSceneAABB({
908
1170
  }, headers) {
909
1171
  return axiosInstance({
910
1172
  method: "get",
911
- url: "/assets/scenes/" + scene_id + "/aabb",
1173
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/aabb",
912
1174
  headers
913
1175
  });
914
1176
  }
915
1177
  function createEntity({
916
1178
  scene_id,
917
- entity_components
1179
+ animation_controller,
1180
+ animation_sequence_controller,
1181
+ bone,
1182
+ box_geometry,
1183
+ camera,
1184
+ capsule_geometry,
1185
+ character_controller,
1186
+ collision_geometry_ref,
1187
+ constraint,
1188
+ constraint_actuator,
1189
+ culling_geometry,
1190
+ custom_lens,
1191
+ cylinder_geometry,
1192
+ debug_name,
1193
+ decal_projector,
1194
+ environment,
1195
+ joint,
1196
+ label,
1197
+ lineage,
1198
+ local_aabb,
1199
+ local_transform,
1200
+ material,
1201
+ material_ref,
1202
+ measure,
1203
+ mesh_ref,
1204
+ morph_targets,
1205
+ orthographic_lens,
1206
+ overrider,
1207
+ perspective_lens,
1208
+ physics_material,
1209
+ plane_geometry,
1210
+ point_cloud_ref,
1211
+ point_light,
1212
+ reflection_probe,
1213
+ rigid_body,
1214
+ scene_ref,
1215
+ script_element,
1216
+ script_map,
1217
+ shadow_caster,
1218
+ skeleton_ref,
1219
+ sound_ref,
1220
+ sphere_geometry,
1221
+ spline,
1222
+ spot_light,
1223
+ tags,
1224
+ vehicle_controller,
1225
+ volume_filter,
1226
+ volume_material_ref,
1227
+ volume_ref
918
1228
  }, headers) {
919
1229
  return axiosInstance({
920
1230
  method: "post",
921
- url: "/assets/scenes/" + scene_id + "/entities",
922
- data: entity_components,
1231
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities",
1232
+ data: {
1233
+ animation_controller,
1234
+ animation_sequence_controller,
1235
+ bone,
1236
+ box_geometry,
1237
+ camera,
1238
+ capsule_geometry,
1239
+ character_controller,
1240
+ collision_geometry_ref,
1241
+ constraint,
1242
+ constraint_actuator,
1243
+ culling_geometry,
1244
+ custom_lens,
1245
+ cylinder_geometry,
1246
+ debug_name,
1247
+ decal_projector,
1248
+ environment,
1249
+ joint,
1250
+ label,
1251
+ lineage,
1252
+ local_aabb,
1253
+ local_transform,
1254
+ material,
1255
+ material_ref,
1256
+ measure,
1257
+ mesh_ref,
1258
+ morph_targets,
1259
+ orthographic_lens,
1260
+ overrider,
1261
+ perspective_lens,
1262
+ physics_material,
1263
+ plane_geometry,
1264
+ point_cloud_ref,
1265
+ point_light,
1266
+ reflection_probe,
1267
+ rigid_body,
1268
+ scene_ref,
1269
+ script_element,
1270
+ script_map,
1271
+ shadow_caster,
1272
+ skeleton_ref,
1273
+ sound_ref,
1274
+ sphere_geometry,
1275
+ spline,
1276
+ spot_light,
1277
+ tags,
1278
+ vehicle_controller,
1279
+ volume_filter,
1280
+ volume_material_ref,
1281
+ volume_ref
1282
+ },
923
1283
  headers
924
1284
  });
925
1285
  }
@@ -930,7 +1290,7 @@ function getEntity({
930
1290
  }, headers) {
931
1291
  return axiosInstance({
932
1292
  method: "get",
933
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1293
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
934
1294
  params: {
935
1295
  compute_global_transform
936
1296
  },
@@ -940,12 +1300,110 @@ function getEntity({
940
1300
  function updateEntity({
941
1301
  scene_id,
942
1302
  entity_id,
943
- entity_components
1303
+ animation_controller,
1304
+ animation_sequence_controller,
1305
+ bone,
1306
+ box_geometry,
1307
+ camera,
1308
+ capsule_geometry,
1309
+ character_controller,
1310
+ collision_geometry_ref,
1311
+ constraint,
1312
+ constraint_actuator,
1313
+ culling_geometry,
1314
+ custom_lens,
1315
+ cylinder_geometry,
1316
+ debug_name,
1317
+ decal_projector,
1318
+ environment,
1319
+ joint,
1320
+ label,
1321
+ lineage,
1322
+ local_aabb,
1323
+ local_transform,
1324
+ material,
1325
+ material_ref,
1326
+ measure,
1327
+ mesh_ref,
1328
+ morph_targets,
1329
+ orthographic_lens,
1330
+ overrider,
1331
+ perspective_lens,
1332
+ physics_material,
1333
+ plane_geometry,
1334
+ point_cloud_ref,
1335
+ point_light,
1336
+ reflection_probe,
1337
+ rigid_body,
1338
+ scene_ref,
1339
+ script_element,
1340
+ script_map,
1341
+ shadow_caster,
1342
+ skeleton_ref,
1343
+ sound_ref,
1344
+ sphere_geometry,
1345
+ spline,
1346
+ spot_light,
1347
+ tags,
1348
+ vehicle_controller,
1349
+ volume_filter,
1350
+ volume_material_ref,
1351
+ volume_ref
944
1352
  }, headers) {
945
1353
  return axiosInstance({
946
1354
  method: "patch",
947
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
948
- data: entity_components,
1355
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
1356
+ data: {
1357
+ animation_controller,
1358
+ animation_sequence_controller,
1359
+ bone,
1360
+ box_geometry,
1361
+ camera,
1362
+ capsule_geometry,
1363
+ character_controller,
1364
+ collision_geometry_ref,
1365
+ constraint,
1366
+ constraint_actuator,
1367
+ culling_geometry,
1368
+ custom_lens,
1369
+ cylinder_geometry,
1370
+ debug_name,
1371
+ decal_projector,
1372
+ environment,
1373
+ joint,
1374
+ label,
1375
+ lineage,
1376
+ local_aabb,
1377
+ local_transform,
1378
+ material,
1379
+ material_ref,
1380
+ measure,
1381
+ mesh_ref,
1382
+ morph_targets,
1383
+ orthographic_lens,
1384
+ overrider,
1385
+ perspective_lens,
1386
+ physics_material,
1387
+ plane_geometry,
1388
+ point_cloud_ref,
1389
+ point_light,
1390
+ reflection_probe,
1391
+ rigid_body,
1392
+ scene_ref,
1393
+ script_element,
1394
+ script_map,
1395
+ shadow_caster,
1396
+ skeleton_ref,
1397
+ sound_ref,
1398
+ sphere_geometry,
1399
+ spline,
1400
+ spot_light,
1401
+ tags,
1402
+ vehicle_controller,
1403
+ volume_filter,
1404
+ volume_material_ref,
1405
+ volume_ref
1406
+ },
949
1407
  headers
950
1408
  });
951
1409
  }
@@ -955,7 +1413,7 @@ function deleteEntity({
955
1413
  }, headers) {
956
1414
  return axiosInstance({
957
1415
  method: "delete",
958
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1416
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
959
1417
  headers
960
1418
  });
961
1419
  }
@@ -964,7 +1422,7 @@ function getSceneSettings({
964
1422
  }, headers) {
965
1423
  return axiosInstance({
966
1424
  method: "get",
967
- url: "/assets/scenes/" + scene_id + "/settings",
1425
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
968
1426
  headers
969
1427
  });
970
1428
  }
@@ -974,7 +1432,7 @@ function updateSceneSettings({
974
1432
  }, headers) {
975
1433
  return axiosInstance({
976
1434
  method: "patch",
977
- url: "/assets/scenes/" + scene_id + "/settings",
1435
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
978
1436
  data: body,
979
1437
  headers
980
1438
  });
@@ -1014,7 +1472,7 @@ function getSession({
1014
1472
  }, headers) {
1015
1473
  return axiosInstance({
1016
1474
  method: "get",
1017
- url: "/sessions/" + session_id,
1475
+ url: "/sessions/" + encodeURIComponent(session_id),
1018
1476
  headers
1019
1477
  });
1020
1478
  }
@@ -1023,7 +1481,7 @@ function killSession({
1023
1481
  }, headers) {
1024
1482
  return axiosInstance({
1025
1483
  method: "delete",
1026
- url: "/sessions/" + session_id,
1484
+ url: "/sessions/" + encodeURIComponent(session_id),
1027
1485
  headers
1028
1486
  });
1029
1487
  }
@@ -1033,10 +1491,10 @@ function joinSession({
1033
1491
  }, headers) {
1034
1492
  return axiosInstance({
1035
1493
  method: "post",
1036
- url: "/sessions/" + session_id + "/clients",
1037
- data: {
1494
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients",
1495
+ data: optionalBody({
1038
1496
  is_headless
1039
- },
1497
+ }),
1040
1498
  headers
1041
1499
  });
1042
1500
  }
@@ -1046,7 +1504,7 @@ function getClient({
1046
1504
  }, headers) {
1047
1505
  return axiosInstance({
1048
1506
  method: "get",
1049
- url: "/sessions/" + session_id + "/clients/" + client_id,
1507
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1050
1508
  headers
1051
1509
  });
1052
1510
  }
@@ -1056,7 +1514,7 @@ function kickClientFromSession({
1056
1514
  }, headers) {
1057
1515
  return axiosInstance({
1058
1516
  method: "delete",
1059
- url: "/sessions/" + session_id + "/clients/" + client_id,
1517
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1060
1518
  headers
1061
1519
  });
1062
1520
  }
@@ -1072,7 +1530,7 @@ function generateGuestToken({
1072
1530
  }, headers) {
1073
1531
  return axiosInstance({
1074
1532
  method: "post",
1075
- url: "/sessions/" + session_id + "/guests",
1533
+ url: "/sessions/" + encodeURIComponent(session_id) + "/guests",
1076
1534
  headers
1077
1535
  });
1078
1536
  }
@@ -1158,10 +1616,30 @@ function shouldRetryRequest(error) {
1158
1616
  installInterceptors();
1159
1617
  export {
1160
1618
  ApiError,
1619
+ AssetSourceFileNotFound,
1620
+ ConversionTaskNotFound,
1621
+ EnvironmentMismatch,
1622
+ InsufficientPermissions,
1623
+ InsufficientSecurityScope,
1624
+ InvalidApiKey,
1625
+ InvalidAuthorization,
1626
+ InvalidGuestToken,
1627
+ InvalidMaterial,
1628
+ InvalidRequest,
1629
+ InvalidTokenTtl,
1630
+ MissingAuthorizationHeader,
1631
+ NoFileUploaded,
1632
+ ServiceErrorResponse,
1633
+ Unauthorized,
1161
1634
  UnexpectedServiceError,
1635
+ UploadAborted,
1636
+ UploadTaskNotFound,
1637
+ UploadedPayloadTooLarge,
1162
1638
  axiosInstance,
1639
+ confirmDuplicationRequest,
1163
1640
  createAsset,
1164
1641
  createCubemap,
1642
+ createDuplicationRequest,
1165
1643
  createEntity,
1166
1644
  createFolder,
1167
1645
  createGroup,
@@ -1175,12 +1653,12 @@ export {
1175
1653
  deleteGroup,
1176
1654
  deleteSourceFiles,
1177
1655
  deleteUser,
1178
- downloadSourceFile,
1656
+ discardDuplicationRequest,
1657
+ errorOf,
1179
1658
  exportAsset,
1180
1659
  generateGuestToken,
1181
1660
  generateUserToken,
1182
1661
  getAssetCode,
1183
- getAssetCustomTypes,
1184
1662
  getAssetDependencies,
1185
1663
  getAssetDescription,
1186
1664
  getAssetDetails,
@@ -1195,6 +1673,7 @@ export {
1195
1673
  getClient,
1196
1674
  getConversionTaskMetadata,
1197
1675
  getCurrentUser,
1676
+ getDuplicationRequest,
1198
1677
  getEntity,
1199
1678
  getFolderAssets,
1200
1679
  getFolderInfo,
@@ -1223,6 +1702,7 @@ export {
1223
1702
  kickClientFromSession,
1224
1703
  killSession,
1225
1704
  listAssets,
1705
+ listDuplicationRequests,
1226
1706
  listFolderAccesses,
1227
1707
  listFolderSubFolders,
1228
1708
  listFolders,
@@ -1243,6 +1723,7 @@ export {
1243
1723
  setUserToken,
1244
1724
  updateAssetDescription,
1245
1725
  updateAssetGraph,
1726
+ updateDuplicationRequest,
1246
1727
  updateEntity,
1247
1728
  updateFolder,
1248
1729
  updateGroupDescription,