@3dverse/api 0.8.22 → 0.10.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.
package/dist/index.mjs CHANGED
@@ -2,13 +2,185 @@
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 InsufficientPermissions = class extends ServiceErrorResponse {
53
+ static ERROR_CODE = 1002;
54
+ constructor(serviceError) {
55
+ super(1002, 403, "Insufficient permissions", serviceError);
56
+ Object.assign(this, serviceError);
57
+ }
58
+ };
59
+ var InvalidAuthorization = class extends ServiceErrorResponse {
60
+ static ERROR_CODE = 1003;
61
+ constructor(serviceError) {
62
+ super(1003, 403, "This operation is not allowed with this kind of token", serviceError);
63
+ Object.assign(this, serviceError);
64
+ }
65
+ };
66
+ var InsufficientSecurityScope = class extends ServiceErrorResponse {
67
+ static ERROR_CODE = 1004;
68
+ constructor(serviceError) {
69
+ super(1004, 403, "This operation is not permitted with the scope of this token", serviceError);
70
+ Object.assign(this, serviceError);
71
+ }
72
+ };
73
+ var Unauthorized = class extends ServiceErrorResponse {
74
+ static ERROR_CODE = 1005;
75
+ constructor(serviceError) {
76
+ super(1005, 401, "Invalid or expired token", serviceError);
77
+ Object.assign(this, serviceError);
78
+ }
79
+ };
80
+ var EnvironmentMismatch = class extends ServiceErrorResponse {
81
+ static ERROR_CODE = 1006;
82
+ constructor(serviceError) {
83
+ super(1006, 403, "User is not part of the current environment", serviceError);
84
+ Object.assign(this, serviceError);
85
+ }
86
+ };
87
+ var MissingAuthorizationHeader = class extends ServiceErrorResponse {
88
+ static ERROR_CODE = 1011;
89
+ constructor(serviceError) {
90
+ super(1011, 401, "Missing api key or user token", serviceError);
91
+ Object.assign(this, serviceError);
92
+ }
93
+ };
94
+ var InvalidApiKey = class extends ServiceErrorResponse {
95
+ static ERROR_CODE = 1012;
96
+ constructor(serviceError) {
97
+ super(1012, 401, "Invalid api key", serviceError);
98
+ Object.assign(this, serviceError);
99
+ }
100
+ };
101
+ var InvalidGuestToken = class extends ServiceErrorResponse {
102
+ static ERROR_CODE = 1016;
103
+ constructor(serviceError) {
104
+ super(1016, 403, "You are not allowed to use this guest token for this session", serviceError);
105
+ Object.assign(this, serviceError);
106
+ }
107
+ };
108
+ var UploadedPayloadTooLarge = class extends ServiceErrorResponse {
109
+ static ERROR_CODE = 1007;
110
+ constructor(serviceError) {
111
+ super(1007, 413, "Upload payload size exceeds the maximum allowed", serviceError);
112
+ Object.assign(this, serviceError);
113
+ }
114
+ };
115
+ var NoFileUploaded = class extends ServiceErrorResponse {
116
+ static ERROR_CODE = 1008;
117
+ constructor(serviceError) {
118
+ super(1008, 422, "No file uploaded", serviceError);
119
+ Object.assign(this, serviceError);
120
+ }
121
+ };
122
+ var UploadAborted = class extends ServiceErrorResponse {
123
+ static ERROR_CODE = 1009;
124
+ constructor(serviceError) {
125
+ super(1009, 422, "Upload aborted", serviceError);
126
+ Object.assign(this, serviceError);
127
+ }
128
+ };
129
+ var UploadTaskNotFound = class extends ServiceErrorResponse {
130
+ static ERROR_CODE = 1010;
131
+ constructor(serviceError) {
132
+ super(1010, 404, "Upload task not found", serviceError);
133
+ Object.assign(this, serviceError);
134
+ }
135
+ };
136
+ var InvalidMaterial = class extends ServiceErrorResponse {
137
+ static ERROR_CODE = 1013;
138
+ constructor(serviceError) {
139
+ super(1013, 400, "Some of the asset ids are not materials", serviceError);
140
+ Object.assign(this, serviceError);
141
+ }
142
+ };
143
+ var InvalidRequest = class extends ServiceErrorResponse {
144
+ static ERROR_CODE = 1014;
145
+ constructor(serviceError) {
146
+ super(1014, 400, "Invalid request", serviceError);
147
+ Object.assign(this, serviceError);
148
+ }
149
+ };
150
+ var ConversionTaskNotFound = class extends ServiceErrorResponse {
151
+ static ERROR_CODE = 1015;
152
+ constructor(serviceError) {
153
+ super(1015, 404, "Conversion task not found", serviceError);
154
+ Object.assign(this, serviceError);
155
+ }
156
+ };
157
+ var declaredErrors = {
158
+ 1002: InsufficientPermissions,
159
+ 1003: InvalidAuthorization,
160
+ 1004: InsufficientSecurityScope,
161
+ 1005: Unauthorized,
162
+ 1006: EnvironmentMismatch,
163
+ 1011: MissingAuthorizationHeader,
164
+ 1012: InvalidApiKey,
165
+ 1016: InvalidGuestToken,
166
+ 1007: UploadedPayloadTooLarge,
167
+ 1008: NoFileUploaded,
168
+ 1009: UploadAborted,
169
+ 1010: UploadTaskNotFound,
170
+ 1013: InvalidMaterial,
171
+ 1014: InvalidRequest,
172
+ 1015: ConversionTaskNotFound
173
+ };
174
+ function errorOf(error) {
175
+ if (Object.values(declaredErrors).some((declared2) => error instanceof declared2)) {
176
+ return error;
177
+ }
178
+ const failure = error;
179
+ const serviceError = failure?.serviceError ?? failure?.response?.data?.error;
180
+ const errorCode = serviceError?.errorCode;
181
+ const declared = typeof errorCode === "number" ? declaredErrors[errorCode] : void 0;
182
+ return declared ? new declared(serviceError) : void 0;
183
+ }
12
184
  function listUsers({
13
185
  offset = 0,
14
186
  limit = 10
@@ -47,7 +219,7 @@ function getUser({
47
219
  }, headers) {
48
220
  return axiosInstance({
49
221
  method: "get",
50
- url: "/users/" + user_id,
222
+ url: "/users/" + encodeURIComponent(user_id),
51
223
  headers
52
224
  });
53
225
  }
@@ -57,7 +229,7 @@ function updateUser({
57
229
  }, headers) {
58
230
  return axiosInstance({
59
231
  method: "patch",
60
- url: "/users/" + user_id,
232
+ url: "/users/" + encodeURIComponent(user_id),
61
233
  data: {
62
234
  username
63
235
  },
@@ -69,7 +241,7 @@ function deleteUser({
69
241
  }, headers) {
70
242
  return axiosInstance({
71
243
  method: "delete",
72
- url: "/users/" + user_id,
244
+ url: "/users/" + encodeURIComponent(user_id),
73
245
  headers
74
246
  });
75
247
  }
@@ -80,7 +252,7 @@ function generateUserToken({
80
252
  }, headers) {
81
253
  return axiosInstance({
82
254
  method: "post",
83
- url: "/users/" + user_id + "/tokens",
255
+ url: "/users/" + encodeURIComponent(user_id) + "/tokens",
84
256
  data: {
85
257
  scope,
86
258
  ttl
@@ -93,7 +265,7 @@ function getUserGroups({
93
265
  }, headers) {
94
266
  return axiosInstance({
95
267
  method: "get",
96
- url: "/users/" + user_id + "/groups",
268
+ url: "/users/" + encodeURIComponent(user_id) + "/groups",
97
269
  headers
98
270
  });
99
271
  }
@@ -104,7 +276,7 @@ function getUserUploadTasks({
104
276
  }, headers) {
105
277
  return axiosInstance({
106
278
  method: "get",
107
- url: "/users/" + user_id + "/upload-tasks",
279
+ url: "/users/" + encodeURIComponent(user_id) + "/upload-tasks",
108
280
  params: {
109
281
  offset,
110
282
  limit
@@ -133,7 +305,7 @@ function getGroup({
133
305
  }, headers) {
134
306
  return axiosInstance({
135
307
  method: "get",
136
- url: "/groups/" + group_id,
308
+ url: "/groups/" + encodeURIComponent(group_id),
137
309
  headers
138
310
  });
139
311
  }
@@ -144,7 +316,7 @@ function updateGroupDescription({
144
316
  }, headers) {
145
317
  return axiosInstance({
146
318
  method: "patch",
147
- url: "/groups/" + group_id,
319
+ url: "/groups/" + encodeURIComponent(group_id),
148
320
  data: {
149
321
  name,
150
322
  description
@@ -157,7 +329,7 @@ function deleteGroup({
157
329
  }, headers) {
158
330
  return axiosInstance({
159
331
  method: "delete",
160
- url: "/groups/" + group_id,
332
+ url: "/groups/" + encodeURIComponent(group_id),
161
333
  headers
162
334
  });
163
335
  }
@@ -170,7 +342,7 @@ function grantMemberAccessToGroup({
170
342
  }, headers) {
171
343
  return axiosInstance({
172
344
  method: "put",
173
- url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id,
345
+ url: "/groups/" + encodeURIComponent(group_id) + "/members/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
174
346
  data: {
175
347
  group_access,
176
348
  folder_access
@@ -185,7 +357,7 @@ function revokeMemberAccessToGroup({
185
357
  }, headers) {
186
358
  return axiosInstance({
187
359
  method: "delete",
188
- url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id,
360
+ url: "/groups/" + encodeURIComponent(group_id) + "/members/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
189
361
  headers
190
362
  });
191
363
  }
@@ -222,7 +394,7 @@ function getFolderInfo({
222
394
  }, headers) {
223
395
  return axiosInstance({
224
396
  method: "get",
225
- url: "/folders/" + folder_id,
397
+ url: "/folders/" + encodeURIComponent(folder_id),
226
398
  headers
227
399
  });
228
400
  }
@@ -232,7 +404,7 @@ function moveFolders({
232
404
  }, headers) {
233
405
  return axiosInstance({
234
406
  method: "put",
235
- url: "/folders/" + folder_id,
407
+ url: "/folders/" + encodeURIComponent(folder_id),
236
408
  data: folder_ids,
237
409
  headers
238
410
  });
@@ -243,7 +415,7 @@ function updateFolder({
243
415
  }, headers) {
244
416
  return axiosInstance({
245
417
  method: "patch",
246
- url: "/folders/" + folder_id,
418
+ url: "/folders/" + encodeURIComponent(folder_id),
247
419
  data: {
248
420
  name
249
421
  },
@@ -255,7 +427,7 @@ function deleteFolder({
255
427
  }, headers) {
256
428
  return axiosInstance({
257
429
  method: "delete",
258
- url: "/folders/" + folder_id,
430
+ url: "/folders/" + encodeURIComponent(folder_id),
259
431
  headers
260
432
  });
261
433
  }
@@ -264,7 +436,7 @@ function listFolderAccesses({
264
436
  }, headers) {
265
437
  return axiosInstance({
266
438
  method: "get",
267
- url: "/folders/" + folder_id + "/access",
439
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access",
268
440
  headers
269
441
  });
270
442
  }
@@ -276,7 +448,7 @@ function grantMemberAccessToFolder({
276
448
  }, headers) {
277
449
  return axiosInstance({
278
450
  method: "put",
279
- url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id,
451
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
280
452
  data: {
281
453
  access
282
454
  },
@@ -290,7 +462,7 @@ function revokeMemberAccessToFolder({
290
462
  }, headers) {
291
463
  return axiosInstance({
292
464
  method: "delete",
293
- url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id,
465
+ url: "/folders/" + encodeURIComponent(folder_id) + "/access/" + encodeURIComponent(member_type) + "/" + encodeURIComponent(member_id),
294
466
  headers
295
467
  });
296
468
  }
@@ -301,7 +473,7 @@ function createSubfolder({
301
473
  }, headers) {
302
474
  return axiosInstance({
303
475
  method: "post",
304
- url: "/folders/" + folder_id + "/folders",
476
+ url: "/folders/" + encodeURIComponent(folder_id) + "/folders",
305
477
  data: {
306
478
  name,
307
479
  subfolders
@@ -314,22 +486,36 @@ function listFolderSubFolders({
314
486
  }, headers) {
315
487
  return axiosInstance({
316
488
  method: "get",
317
- url: "/folders/" + folder_id + "/folders",
489
+ url: "/folders/" + encodeURIComponent(folder_id) + "/folders",
318
490
  headers
319
491
  });
320
492
  }
321
493
  function uploadSourceFiles({
322
494
  folder_id,
323
- body
495
+ files,
496
+ task_name,
497
+ conversion_pipeline = "auto-detect",
498
+ source_files,
499
+ options
324
500
  }, onUploadProgress, headers) {
325
501
  return axiosInstance({
326
502
  method: "post",
327
- url: "/folders/" + folder_id + "/source-files",
328
- data: body,
503
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
504
+ data: multipartBody(
505
+ {
506
+ task_name,
507
+ conversion_pipeline,
508
+ source_files,
509
+ options
510
+ },
511
+ {
512
+ files
513
+ }
514
+ ),
329
515
  onUploadProgress,
330
516
  headers: {
331
517
  "Content-Type": "multipart/form-data",
332
- ...headers?.toJSON()
518
+ ...plainHeaders(headers)
333
519
  }
334
520
  });
335
521
  }
@@ -341,7 +527,7 @@ function getSourceFilesInFolder({
341
527
  }, headers) {
342
528
  return axiosInstance({
343
529
  method: "get",
344
- url: "/folders/" + folder_id + "/source-files",
530
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
345
531
  params: {
346
532
  offset,
347
533
  limit,
@@ -359,7 +545,7 @@ function moveSourceFiles({
359
545
  }, headers) {
360
546
  return axiosInstance({
361
547
  method: "put",
362
- url: "/folders/" + folder_id + "/source-files",
548
+ url: "/folders/" + encodeURIComponent(folder_id) + "/source-files",
363
549
  data: source_file_ids,
364
550
  headers
365
551
  });
@@ -371,7 +557,7 @@ function getUploadTasksInFolder({
371
557
  }, headers) {
372
558
  return axiosInstance({
373
559
  method: "get",
374
- url: "/folders/" + folder_id + "/upload-tasks",
560
+ url: "/folders/" + encodeURIComponent(folder_id) + "/upload-tasks",
375
561
  params: {
376
562
  offset,
377
563
  limit
@@ -388,7 +574,7 @@ function getFolderAssets({
388
574
  }, headers) {
389
575
  return axiosInstance({
390
576
  method: "get",
391
- url: "/folders/" + folder_id + "/assets",
577
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
392
578
  params: {
393
579
  offset,
394
580
  limit,
@@ -397,9 +583,7 @@ function getFolderAssets({
397
583
  },
398
584
  headers
399
585
  }).then((response) => {
400
- response.headers["x-assets-count"] = JSON.parse(
401
- response.headers["x-assets-count"]
402
- );
586
+ response.headers["x-assets-count"] = JSON.parse(response.headers["x-assets-count"]);
403
587
  return response;
404
588
  });
405
589
  }
@@ -409,7 +593,7 @@ function createAsset({
409
593
  }, headers) {
410
594
  return axiosInstance({
411
595
  method: "post",
412
- url: "/folders/" + folder_id + "/assets",
596
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
413
597
  data: asset_creation_options,
414
598
  headers
415
599
  });
@@ -420,21 +604,21 @@ function moveAssets({
420
604
  }, headers) {
421
605
  return axiosInstance({
422
606
  method: "put",
423
- url: "/folders/" + folder_id + "/assets",
607
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets",
424
608
  data: asset_ids,
425
609
  headers
426
610
  });
427
611
  }
428
612
  function createMaterial({
429
613
  folder_id,
430
- dataJson,
431
- isDoubleSided,
614
+ dataJson = {},
615
+ isDoubleSided = false,
432
616
  name,
433
- shaderRef
617
+ shaderRef = "00000000-0000-0000-0000-000000000000"
434
618
  }, headers) {
435
619
  return axiosInstance({
436
620
  method: "post",
437
- url: "/folders/" + folder_id + "/assets/materials",
621
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets/materials",
438
622
  data: {
439
623
  dataJson,
440
624
  isDoubleSided,
@@ -446,12 +630,19 @@ function createMaterial({
446
630
  }
447
631
  function createCubemap({
448
632
  folder_id,
449
- faces,
633
+ faces = [
634
+ "00000000-0000-0000-0000-000000000000",
635
+ "00000000-0000-0000-0000-000000000000",
636
+ "00000000-0000-0000-0000-000000000000",
637
+ "00000000-0000-0000-0000-000000000000",
638
+ "00000000-0000-0000-0000-000000000000",
639
+ "00000000-0000-0000-0000-000000000000"
640
+ ],
450
641
  name
451
642
  }, headers) {
452
643
  return axiosInstance({
453
644
  method: "post",
454
- url: "/folders/" + folder_id + "/assets/cubemaps",
645
+ url: "/folders/" + encodeURIComponent(folder_id) + "/assets/cubemaps",
455
646
  data: {
456
647
  faces,
457
648
  name
@@ -459,32 +650,88 @@ function createCubemap({
459
650
  headers
460
651
  });
461
652
  }
462
- function importAssets({
463
- folder_id,
464
- overwrite = "never",
465
- body
466
- }, onUploadProgress, headers) {
653
+ function getSessionsInFolder({
654
+ folder_id
655
+ }, headers) {
467
656
  return axiosInstance({
468
- method: "put",
469
- url: "/folders/" + folder_id + "/packages",
657
+ method: "get",
658
+ url: "/folders/" + encodeURIComponent(folder_id) + "/sessions",
659
+ headers
660
+ });
661
+ }
662
+ function createDuplicationRequest({
663
+ assets,
664
+ options
665
+ }, headers) {
666
+ return axiosInstance({
667
+ method: "post",
668
+ url: "/duplication-requests",
669
+ data: {
670
+ assets,
671
+ options
672
+ },
673
+ headers
674
+ });
675
+ }
676
+ function listDuplicationRequests({
677
+ offset = 0,
678
+ limit = 10,
679
+ states,
680
+ mine = false
681
+ }, headers) {
682
+ return axiosInstance({
683
+ method: "get",
684
+ url: "/duplication-requests",
470
685
  params: {
471
- overwrite
686
+ offset,
687
+ limit,
688
+ states,
689
+ mine
472
690
  },
473
- data: body,
474
- maxRedirects: 0,
475
- onUploadProgress,
476
- headers: {
477
- "Content-Type": "application/zip",
478
- ...headers?.toJSON()
479
- }
691
+ headers
480
692
  });
481
693
  }
482
- function getSessionsInFolder({
483
- folder_id
694
+ function getDuplicationRequest({
695
+ duplication_request_id
484
696
  }, headers) {
485
697
  return axiosInstance({
486
698
  method: "get",
487
- url: "/folders/" + folder_id + "/sessions",
699
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
700
+ headers
701
+ });
702
+ }
703
+ function updateDuplicationRequest({
704
+ duplication_request_id,
705
+ assets,
706
+ folders_by_type,
707
+ dependencies_folders
708
+ }, headers) {
709
+ return axiosInstance({
710
+ method: "patch",
711
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
712
+ data: {
713
+ assets,
714
+ folders_by_type,
715
+ dependencies_folders
716
+ },
717
+ headers
718
+ });
719
+ }
720
+ function discardDuplicationRequest({
721
+ duplication_request_id
722
+ }, headers) {
723
+ return axiosInstance({
724
+ method: "delete",
725
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id),
726
+ headers
727
+ });
728
+ }
729
+ function confirmDuplicationRequest({
730
+ duplication_request_id
731
+ }, headers) {
732
+ return axiosInstance({
733
+ method: "post",
734
+ url: "/duplication-requests/" + encodeURIComponent(duplication_request_id) + "/confirm",
488
735
  headers
489
736
  });
490
737
  }
@@ -528,22 +775,12 @@ function getSupportedSourceFileFormats(headers) {
528
775
  headers
529
776
  });
530
777
  }
531
- function downloadSourceFile({
532
- source_file_id
533
- }, headers, responseType) {
534
- return axiosInstance({
535
- method: "get",
536
- url: "/source-files/" + source_file_id,
537
- headers,
538
- responseType: responseType || "arraybuffer"
539
- });
540
- }
541
778
  function getSourceFileDetails({
542
779
  source_file_id
543
780
  }, headers) {
544
781
  return axiosInstance({
545
782
  method: "get",
546
- url: "/source-files/" + source_file_id + "/details",
783
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
547
784
  headers
548
785
  });
549
786
  }
@@ -553,7 +790,7 @@ function updateSourceFileDetails({
553
790
  }, headers) {
554
791
  return axiosInstance({
555
792
  method: "patch",
556
- url: "/source-files/" + source_file_id + "/details",
793
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
557
794
  data: {
558
795
  name
559
796
  },
@@ -565,7 +802,7 @@ function getSourceFileAssets({
565
802
  }, headers) {
566
803
  return axiosInstance({
567
804
  method: "get",
568
- url: "/source-files/" + source_file_id + "/assets",
805
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/assets",
569
806
  headers
570
807
  });
571
808
  }
@@ -588,7 +825,7 @@ function getUploadTask({
588
825
  }, headers) {
589
826
  return axiosInstance({
590
827
  method: "get",
591
- url: "/upload-tasks/" + upload_task_id,
828
+ url: "/upload-tasks/" + encodeURIComponent(upload_task_id),
592
829
  headers
593
830
  });
594
831
  }
@@ -598,7 +835,7 @@ function getConversionTaskMetadata({
598
835
  }, headers, responseType) {
599
836
  return axiosInstance({
600
837
  method: "get",
601
- url: "/conversion_tasks/" + conversion_task_id + "/metadata/" + filename,
838
+ url: "/conversion_tasks/" + encodeURIComponent(conversion_task_id) + "/metadata/" + encodeURIComponent(filename),
602
839
  headers,
603
840
  responseType: responseType || "arraybuffer"
604
841
  });
@@ -628,7 +865,7 @@ function getPipeline({
628
865
  }, headers) {
629
866
  return axiosInstance({
630
867
  method: "get",
631
- url: "/pipelines/" + pipeline_id,
868
+ url: "/pipelines/" + encodeURIComponent(pipeline_id),
632
869
  headers
633
870
  });
634
871
  }
@@ -664,7 +901,7 @@ function deleteAsset({
664
901
  }, headers) {
665
902
  return axiosInstance({
666
903
  method: "delete",
667
- url: "/assets/" + asset_container + "/" + asset_id,
904
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id),
668
905
  headers
669
906
  });
670
907
  }
@@ -674,7 +911,7 @@ function getAssetSourceFile({
674
911
  }, headers) {
675
912
  return axiosInstance({
676
913
  method: "get",
677
- url: "/assets/" + asset_container + "/" + asset_id + "/source-file",
914
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/source-file",
678
915
  headers
679
916
  });
680
917
  }
@@ -684,7 +921,7 @@ function getAssetDetails({
684
921
  }, headers) {
685
922
  return axiosInstance({
686
923
  method: "get",
687
- url: "/assets/" + asset_container + "/" + asset_id + "/details",
924
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/details",
688
925
  headers
689
926
  });
690
927
  }
@@ -694,7 +931,7 @@ function getAssetFolder({
694
931
  }, headers) {
695
932
  return axiosInstance({
696
933
  method: "get",
697
- url: "/assets/" + asset_container + "/" + asset_id + "/folder",
934
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/folder",
698
935
  headers
699
936
  });
700
937
  }
@@ -709,7 +946,7 @@ function getAssetDependencies({
709
946
  }, headers) {
710
947
  return axiosInstance({
711
948
  method: "get",
712
- url: "/assets/" + asset_container + "/" + asset_id + "/dependencies",
949
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/dependencies",
713
950
  params: {
714
951
  offset,
715
952
  limit,
@@ -729,7 +966,7 @@ function getAssetReferences({
729
966
  }, headers) {
730
967
  return axiosInstance({
731
968
  method: "get",
732
- url: "/assets/" + asset_container + "/" + asset_id + "/references",
969
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/references",
733
970
  params: {
734
971
  offset,
735
972
  limit,
@@ -744,7 +981,7 @@ function getAssetDescription({
744
981
  }, headers) {
745
982
  return axiosInstance({
746
983
  method: "get",
747
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
984
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
748
985
  headers
749
986
  });
750
987
  }
@@ -755,7 +992,7 @@ function updateAssetDescription({
755
992
  }, headers) {
756
993
  return axiosInstance({
757
994
  method: "put",
758
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
995
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
759
996
  data: asset_description,
760
997
  headers
761
998
  });
@@ -767,7 +1004,7 @@ function renameAsset({
767
1004
  }, headers) {
768
1005
  return axiosInstance({
769
1006
  method: "patch",
770
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
1007
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
771
1008
  data: {
772
1009
  name
773
1010
  },
@@ -781,7 +1018,7 @@ function getAssetPayload({
781
1018
  }, headers, responseType) {
782
1019
  return axiosInstance({
783
1020
  method: "get",
784
- url: "/assets/" + asset_container_with_payload + "/" + asset_id + "/payload",
1021
+ url: "/assets/" + encodeURIComponent(asset_container_with_payload) + "/" + encodeURIComponent(asset_id) + "/payload",
785
1022
  params: {
786
1023
  sub_resource
787
1024
  },
@@ -795,7 +1032,7 @@ function getAssetGraph({
795
1032
  }, headers) {
796
1033
  return axiosInstance({
797
1034
  method: "get",
798
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1035
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
799
1036
  headers
800
1037
  });
801
1038
  }
@@ -806,7 +1043,7 @@ function updateAssetGraph({
806
1043
  }, headers) {
807
1044
  return axiosInstance({
808
1045
  method: "put",
809
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1046
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
810
1047
  data: asset_graph,
811
1048
  headers
812
1049
  });
@@ -817,7 +1054,7 @@ function getAssetHistory({
817
1054
  }, headers) {
818
1055
  return axiosInstance({
819
1056
  method: "get",
820
- url: "/assets/" + asset_container + "/" + asset_id + "/history",
1057
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/history",
821
1058
  headers
822
1059
  });
823
1060
  }
@@ -827,7 +1064,7 @@ function getAssetMeta({
827
1064
  }, headers) {
828
1065
  return axiosInstance({
829
1066
  method: "get",
830
- url: "/assets/" + asset_container + "/" + asset_id + "/meta",
1067
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/meta",
831
1068
  headers
832
1069
  });
833
1070
  }
@@ -837,7 +1074,7 @@ function getAssetCode({
837
1074
  }, headers) {
838
1075
  return axiosInstance({
839
1076
  method: "get",
840
- url: "/assets/" + asset_container_with_code + "/" + asset_id + "/code",
1077
+ url: "/assets/" + encodeURIComponent(asset_container_with_code) + "/" + encodeURIComponent(asset_id) + "/code",
841
1078
  headers,
842
1079
  responseType: "text"
843
1080
  });
@@ -850,7 +1087,7 @@ function getAssetThumbnail({
850
1087
  }, headers, responseType) {
851
1088
  return axiosInstance({
852
1089
  method: "get",
853
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1090
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
854
1091
  params: {
855
1092
  size,
856
1093
  default_url
@@ -866,32 +1103,22 @@ function setAssetThumbnail({
866
1103
  }, contentType, headers) {
867
1104
  return axiosInstance({
868
1105
  method: "put",
869
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1106
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
870
1107
  data: body,
871
1108
  maxRedirects: 0,
872
1109
  headers: {
873
1110
  "Content-Type": contentType,
874
- ...headers?.toJSON()
1111
+ ...plainHeaders(headers)
875
1112
  }
876
1113
  });
877
1114
  }
878
- function getAssetCustomTypes({
879
- asset_container_with_custom_types,
880
- asset_id
881
- }, headers) {
882
- return axiosInstance({
883
- method: "get",
884
- url: "/assets/" + asset_container_with_custom_types + "/" + asset_id + "/custom-types",
885
- headers
886
- });
887
- }
888
1115
  function packageAsset({
889
1116
  asset_container,
890
1117
  asset_id
891
1118
  }, headers, responseType) {
892
1119
  return axiosInstance({
893
1120
  method: "get",
894
- url: "/assets/" + asset_container + "/" + asset_id + "/package",
1121
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/package",
895
1122
  headers,
896
1123
  responseType: responseType || "arraybuffer"
897
1124
  });
@@ -905,7 +1132,7 @@ function exportAsset({
905
1132
  }, headers, responseType) {
906
1133
  return axiosInstance({
907
1134
  method: "get",
908
- url: "/assets/" + asset_container_exportable + "/" + asset_id + "/exports/" + format,
1135
+ url: "/assets/" + encodeURIComponent(asset_container_exportable) + "/" + encodeURIComponent(asset_id) + "/exports/" + encodeURIComponent(format),
909
1136
  params: {
910
1137
  scale,
911
1138
  sub_mesh_index
@@ -919,7 +1146,7 @@ function getSceneSessions({
919
1146
  }, headers) {
920
1147
  return axiosInstance({
921
1148
  method: "get",
922
- url: "/assets/scenes/" + scene_id + "/sessions",
1149
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/sessions",
923
1150
  headers
924
1151
  });
925
1152
  }
@@ -928,18 +1155,116 @@ function getSceneAABB({
928
1155
  }, headers) {
929
1156
  return axiosInstance({
930
1157
  method: "get",
931
- url: "/assets/scenes/" + scene_id + "/aabb",
1158
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/aabb",
932
1159
  headers
933
1160
  });
934
1161
  }
935
1162
  function createEntity({
936
1163
  scene_id,
937
- entity_components
1164
+ animation_controller,
1165
+ animation_sequence_controller,
1166
+ bone,
1167
+ box_geometry,
1168
+ camera,
1169
+ capsule_geometry,
1170
+ character_controller,
1171
+ collision_geometry_ref,
1172
+ constraint,
1173
+ constraint_actuator,
1174
+ culling_geometry,
1175
+ custom_lens,
1176
+ cylinder_geometry,
1177
+ debug_name,
1178
+ decal_projector,
1179
+ environment,
1180
+ joint,
1181
+ label,
1182
+ lineage,
1183
+ local_aabb,
1184
+ local_transform,
1185
+ material,
1186
+ material_ref,
1187
+ measure,
1188
+ mesh_ref,
1189
+ morph_targets,
1190
+ orthographic_lens,
1191
+ overrider,
1192
+ perspective_lens,
1193
+ physics_material,
1194
+ plane_geometry,
1195
+ point_cloud_ref,
1196
+ point_light,
1197
+ reflection_probe,
1198
+ rigid_body,
1199
+ scene_ref,
1200
+ script_element,
1201
+ script_map,
1202
+ shadow_caster,
1203
+ skeleton_ref,
1204
+ sound_ref,
1205
+ sphere_geometry,
1206
+ spline,
1207
+ spot_light,
1208
+ tags,
1209
+ vehicle_controller,
1210
+ volume_filter,
1211
+ volume_material_ref,
1212
+ volume_ref
938
1213
  }, headers) {
939
1214
  return axiosInstance({
940
1215
  method: "post",
941
- url: "/assets/scenes/" + scene_id + "/entities",
942
- data: entity_components,
1216
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities",
1217
+ data: {
1218
+ animation_controller,
1219
+ animation_sequence_controller,
1220
+ bone,
1221
+ box_geometry,
1222
+ camera,
1223
+ capsule_geometry,
1224
+ character_controller,
1225
+ collision_geometry_ref,
1226
+ constraint,
1227
+ constraint_actuator,
1228
+ culling_geometry,
1229
+ custom_lens,
1230
+ cylinder_geometry,
1231
+ debug_name,
1232
+ decal_projector,
1233
+ environment,
1234
+ joint,
1235
+ label,
1236
+ lineage,
1237
+ local_aabb,
1238
+ local_transform,
1239
+ material,
1240
+ material_ref,
1241
+ measure,
1242
+ mesh_ref,
1243
+ morph_targets,
1244
+ orthographic_lens,
1245
+ overrider,
1246
+ perspective_lens,
1247
+ physics_material,
1248
+ plane_geometry,
1249
+ point_cloud_ref,
1250
+ point_light,
1251
+ reflection_probe,
1252
+ rigid_body,
1253
+ scene_ref,
1254
+ script_element,
1255
+ script_map,
1256
+ shadow_caster,
1257
+ skeleton_ref,
1258
+ sound_ref,
1259
+ sphere_geometry,
1260
+ spline,
1261
+ spot_light,
1262
+ tags,
1263
+ vehicle_controller,
1264
+ volume_filter,
1265
+ volume_material_ref,
1266
+ volume_ref
1267
+ },
943
1268
  headers
944
1269
  });
945
1270
  }
@@ -950,7 +1275,7 @@ function getEntity({
950
1275
  }, headers) {
951
1276
  return axiosInstance({
952
1277
  method: "get",
953
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1278
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
954
1279
  params: {
955
1280
  compute_global_transform
956
1281
  },
@@ -960,12 +1285,110 @@ function getEntity({
960
1285
  function updateEntity({
961
1286
  scene_id,
962
1287
  entity_id,
963
- entity_components
1288
+ animation_controller,
1289
+ animation_sequence_controller,
1290
+ bone,
1291
+ box_geometry,
1292
+ camera,
1293
+ capsule_geometry,
1294
+ character_controller,
1295
+ collision_geometry_ref,
1296
+ constraint,
1297
+ constraint_actuator,
1298
+ culling_geometry,
1299
+ custom_lens,
1300
+ cylinder_geometry,
1301
+ debug_name,
1302
+ decal_projector,
1303
+ environment,
1304
+ joint,
1305
+ label,
1306
+ lineage,
1307
+ local_aabb,
1308
+ local_transform,
1309
+ material,
1310
+ material_ref,
1311
+ measure,
1312
+ mesh_ref,
1313
+ morph_targets,
1314
+ orthographic_lens,
1315
+ overrider,
1316
+ perspective_lens,
1317
+ physics_material,
1318
+ plane_geometry,
1319
+ point_cloud_ref,
1320
+ point_light,
1321
+ reflection_probe,
1322
+ rigid_body,
1323
+ scene_ref,
1324
+ script_element,
1325
+ script_map,
1326
+ shadow_caster,
1327
+ skeleton_ref,
1328
+ sound_ref,
1329
+ sphere_geometry,
1330
+ spline,
1331
+ spot_light,
1332
+ tags,
1333
+ vehicle_controller,
1334
+ volume_filter,
1335
+ volume_material_ref,
1336
+ volume_ref
964
1337
  }, headers) {
965
1338
  return axiosInstance({
966
1339
  method: "patch",
967
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
968
- data: entity_components,
1340
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
1341
+ data: {
1342
+ animation_controller,
1343
+ animation_sequence_controller,
1344
+ bone,
1345
+ box_geometry,
1346
+ camera,
1347
+ capsule_geometry,
1348
+ character_controller,
1349
+ collision_geometry_ref,
1350
+ constraint,
1351
+ constraint_actuator,
1352
+ culling_geometry,
1353
+ custom_lens,
1354
+ cylinder_geometry,
1355
+ debug_name,
1356
+ decal_projector,
1357
+ environment,
1358
+ joint,
1359
+ label,
1360
+ lineage,
1361
+ local_aabb,
1362
+ local_transform,
1363
+ material,
1364
+ material_ref,
1365
+ measure,
1366
+ mesh_ref,
1367
+ morph_targets,
1368
+ orthographic_lens,
1369
+ overrider,
1370
+ perspective_lens,
1371
+ physics_material,
1372
+ plane_geometry,
1373
+ point_cloud_ref,
1374
+ point_light,
1375
+ reflection_probe,
1376
+ rigid_body,
1377
+ scene_ref,
1378
+ script_element,
1379
+ script_map,
1380
+ shadow_caster,
1381
+ skeleton_ref,
1382
+ sound_ref,
1383
+ sphere_geometry,
1384
+ spline,
1385
+ spot_light,
1386
+ tags,
1387
+ vehicle_controller,
1388
+ volume_filter,
1389
+ volume_material_ref,
1390
+ volume_ref
1391
+ },
969
1392
  headers
970
1393
  });
971
1394
  }
@@ -975,7 +1398,7 @@ function deleteEntity({
975
1398
  }, headers) {
976
1399
  return axiosInstance({
977
1400
  method: "delete",
978
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1401
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
979
1402
  headers
980
1403
  });
981
1404
  }
@@ -984,7 +1407,7 @@ function getSceneSettings({
984
1407
  }, headers) {
985
1408
  return axiosInstance({
986
1409
  method: "get",
987
- url: "/assets/scenes/" + scene_id + "/settings",
1410
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
988
1411
  headers
989
1412
  });
990
1413
  }
@@ -994,7 +1417,7 @@ function updateSceneSettings({
994
1417
  }, headers) {
995
1418
  return axiosInstance({
996
1419
  method: "patch",
997
- url: "/assets/scenes/" + scene_id + "/settings",
1420
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
998
1421
  data: body,
999
1422
  headers
1000
1423
  });
@@ -1034,7 +1457,7 @@ function getSession({
1034
1457
  }, headers) {
1035
1458
  return axiosInstance({
1036
1459
  method: "get",
1037
- url: "/sessions/" + session_id,
1460
+ url: "/sessions/" + encodeURIComponent(session_id),
1038
1461
  headers
1039
1462
  });
1040
1463
  }
@@ -1043,7 +1466,7 @@ function killSession({
1043
1466
  }, headers) {
1044
1467
  return axiosInstance({
1045
1468
  method: "delete",
1046
- url: "/sessions/" + session_id,
1469
+ url: "/sessions/" + encodeURIComponent(session_id),
1047
1470
  headers
1048
1471
  });
1049
1472
  }
@@ -1053,10 +1476,10 @@ function joinSession({
1053
1476
  }, headers) {
1054
1477
  return axiosInstance({
1055
1478
  method: "post",
1056
- url: "/sessions/" + session_id + "/clients",
1057
- data: {
1479
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients",
1480
+ data: optionalBody({
1058
1481
  is_headless
1059
- },
1482
+ }),
1060
1483
  headers
1061
1484
  });
1062
1485
  }
@@ -1066,7 +1489,7 @@ function getClient({
1066
1489
  }, headers) {
1067
1490
  return axiosInstance({
1068
1491
  method: "get",
1069
- url: "/sessions/" + session_id + "/clients/" + client_id,
1492
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1070
1493
  headers
1071
1494
  });
1072
1495
  }
@@ -1076,7 +1499,7 @@ function kickClientFromSession({
1076
1499
  }, headers) {
1077
1500
  return axiosInstance({
1078
1501
  method: "delete",
1079
- url: "/sessions/" + session_id + "/clients/" + client_id,
1502
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1080
1503
  headers
1081
1504
  });
1082
1505
  }
@@ -1092,7 +1515,7 @@ function generateGuestToken({
1092
1515
  }, headers) {
1093
1516
  return axiosInstance({
1094
1517
  method: "post",
1095
- url: "/sessions/" + session_id + "/guests",
1518
+ url: "/sessions/" + encodeURIComponent(session_id) + "/guests",
1096
1519
  headers
1097
1520
  });
1098
1521
  }
@@ -1178,10 +1601,28 @@ function shouldRetryRequest(error) {
1178
1601
  installInterceptors();
1179
1602
  export {
1180
1603
  ApiError,
1604
+ ConversionTaskNotFound,
1605
+ EnvironmentMismatch,
1606
+ InsufficientPermissions,
1607
+ InsufficientSecurityScope,
1608
+ InvalidApiKey,
1609
+ InvalidAuthorization,
1610
+ InvalidGuestToken,
1611
+ InvalidMaterial,
1612
+ InvalidRequest,
1613
+ MissingAuthorizationHeader,
1614
+ NoFileUploaded,
1615
+ ServiceErrorResponse,
1616
+ Unauthorized,
1181
1617
  UnexpectedServiceError,
1618
+ UploadAborted,
1619
+ UploadTaskNotFound,
1620
+ UploadedPayloadTooLarge,
1182
1621
  axiosInstance,
1622
+ confirmDuplicationRequest,
1183
1623
  createAsset,
1184
1624
  createCubemap,
1625
+ createDuplicationRequest,
1185
1626
  createEntity,
1186
1627
  createFolder,
1187
1628
  createGroup,
@@ -1195,12 +1636,12 @@ export {
1195
1636
  deleteGroup,
1196
1637
  deleteSourceFiles,
1197
1638
  deleteUser,
1198
- downloadSourceFile,
1639
+ discardDuplicationRequest,
1640
+ errorOf,
1199
1641
  exportAsset,
1200
1642
  generateGuestToken,
1201
1643
  generateUserToken,
1202
1644
  getAssetCode,
1203
- getAssetCustomTypes,
1204
1645
  getAssetDependencies,
1205
1646
  getAssetDescription,
1206
1647
  getAssetDetails,
@@ -1215,6 +1656,7 @@ export {
1215
1656
  getClient,
1216
1657
  getConversionTaskMetadata,
1217
1658
  getCurrentUser,
1659
+ getDuplicationRequest,
1218
1660
  getEntity,
1219
1661
  getFolderAssets,
1220
1662
  getFolderInfo,
@@ -1238,12 +1680,12 @@ export {
1238
1680
  getUserUploadTasks,
1239
1681
  grantMemberAccessToFolder,
1240
1682
  grantMemberAccessToGroup,
1241
- importAssets,
1242
1683
  joinSession,
1243
1684
  joinSessionAsGuest,
1244
1685
  kickClientFromSession,
1245
1686
  killSession,
1246
1687
  listAssets,
1688
+ listDuplicationRequests,
1247
1689
  listFolderAccesses,
1248
1690
  listFolderSubFolders,
1249
1691
  listFolders,
@@ -1264,6 +1706,7 @@ export {
1264
1706
  setUserToken,
1265
1707
  updateAssetDescription,
1266
1708
  updateAssetGraph,
1709
+ updateDuplicationRequest,
1267
1710
  updateEntity,
1268
1711
  updateFolder,
1269
1712
  updateGroupDescription,