@3dverse/api 0.9.0 → 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
@@ -464,7 +655,83 @@ function getSessionsInFolder({
464
655
  }, headers) {
465
656
  return axiosInstance({
466
657
  method: "get",
467
- url: "/folders/" + folder_id + "/sessions",
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",
685
+ params: {
686
+ offset,
687
+ limit,
688
+ states,
689
+ mine
690
+ },
691
+ headers
692
+ });
693
+ }
694
+ function getDuplicationRequest({
695
+ duplication_request_id
696
+ }, headers) {
697
+ return axiosInstance({
698
+ method: "get",
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",
468
735
  headers
469
736
  });
470
737
  }
@@ -508,22 +775,12 @@ function getSupportedSourceFileFormats(headers) {
508
775
  headers
509
776
  });
510
777
  }
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
778
  function getSourceFileDetails({
522
779
  source_file_id
523
780
  }, headers) {
524
781
  return axiosInstance({
525
782
  method: "get",
526
- url: "/source-files/" + source_file_id + "/details",
783
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
527
784
  headers
528
785
  });
529
786
  }
@@ -533,7 +790,7 @@ function updateSourceFileDetails({
533
790
  }, headers) {
534
791
  return axiosInstance({
535
792
  method: "patch",
536
- url: "/source-files/" + source_file_id + "/details",
793
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/details",
537
794
  data: {
538
795
  name
539
796
  },
@@ -545,7 +802,7 @@ function getSourceFileAssets({
545
802
  }, headers) {
546
803
  return axiosInstance({
547
804
  method: "get",
548
- url: "/source-files/" + source_file_id + "/assets",
805
+ url: "/source-files/" + encodeURIComponent(source_file_id) + "/assets",
549
806
  headers
550
807
  });
551
808
  }
@@ -568,7 +825,7 @@ function getUploadTask({
568
825
  }, headers) {
569
826
  return axiosInstance({
570
827
  method: "get",
571
- url: "/upload-tasks/" + upload_task_id,
828
+ url: "/upload-tasks/" + encodeURIComponent(upload_task_id),
572
829
  headers
573
830
  });
574
831
  }
@@ -578,7 +835,7 @@ function getConversionTaskMetadata({
578
835
  }, headers, responseType) {
579
836
  return axiosInstance({
580
837
  method: "get",
581
- url: "/conversion_tasks/" + conversion_task_id + "/metadata/" + filename,
838
+ url: "/conversion_tasks/" + encodeURIComponent(conversion_task_id) + "/metadata/" + encodeURIComponent(filename),
582
839
  headers,
583
840
  responseType: responseType || "arraybuffer"
584
841
  });
@@ -608,7 +865,7 @@ function getPipeline({
608
865
  }, headers) {
609
866
  return axiosInstance({
610
867
  method: "get",
611
- url: "/pipelines/" + pipeline_id,
868
+ url: "/pipelines/" + encodeURIComponent(pipeline_id),
612
869
  headers
613
870
  });
614
871
  }
@@ -644,7 +901,7 @@ function deleteAsset({
644
901
  }, headers) {
645
902
  return axiosInstance({
646
903
  method: "delete",
647
- url: "/assets/" + asset_container + "/" + asset_id,
904
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id),
648
905
  headers
649
906
  });
650
907
  }
@@ -654,7 +911,7 @@ function getAssetSourceFile({
654
911
  }, headers) {
655
912
  return axiosInstance({
656
913
  method: "get",
657
- url: "/assets/" + asset_container + "/" + asset_id + "/source-file",
914
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/source-file",
658
915
  headers
659
916
  });
660
917
  }
@@ -664,7 +921,7 @@ function getAssetDetails({
664
921
  }, headers) {
665
922
  return axiosInstance({
666
923
  method: "get",
667
- url: "/assets/" + asset_container + "/" + asset_id + "/details",
924
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/details",
668
925
  headers
669
926
  });
670
927
  }
@@ -674,7 +931,7 @@ function getAssetFolder({
674
931
  }, headers) {
675
932
  return axiosInstance({
676
933
  method: "get",
677
- url: "/assets/" + asset_container + "/" + asset_id + "/folder",
934
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/folder",
678
935
  headers
679
936
  });
680
937
  }
@@ -689,7 +946,7 @@ function getAssetDependencies({
689
946
  }, headers) {
690
947
  return axiosInstance({
691
948
  method: "get",
692
- url: "/assets/" + asset_container + "/" + asset_id + "/dependencies",
949
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/dependencies",
693
950
  params: {
694
951
  offset,
695
952
  limit,
@@ -709,7 +966,7 @@ function getAssetReferences({
709
966
  }, headers) {
710
967
  return axiosInstance({
711
968
  method: "get",
712
- url: "/assets/" + asset_container + "/" + asset_id + "/references",
969
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/references",
713
970
  params: {
714
971
  offset,
715
972
  limit,
@@ -724,7 +981,7 @@ function getAssetDescription({
724
981
  }, headers) {
725
982
  return axiosInstance({
726
983
  method: "get",
727
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
984
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
728
985
  headers
729
986
  });
730
987
  }
@@ -735,7 +992,7 @@ function updateAssetDescription({
735
992
  }, headers) {
736
993
  return axiosInstance({
737
994
  method: "put",
738
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
995
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
739
996
  data: asset_description,
740
997
  headers
741
998
  });
@@ -747,7 +1004,7 @@ function renameAsset({
747
1004
  }, headers) {
748
1005
  return axiosInstance({
749
1006
  method: "patch",
750
- url: "/assets/" + asset_container + "/" + asset_id + "/description",
1007
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/description",
751
1008
  data: {
752
1009
  name
753
1010
  },
@@ -761,7 +1018,7 @@ function getAssetPayload({
761
1018
  }, headers, responseType) {
762
1019
  return axiosInstance({
763
1020
  method: "get",
764
- url: "/assets/" + asset_container_with_payload + "/" + asset_id + "/payload",
1021
+ url: "/assets/" + encodeURIComponent(asset_container_with_payload) + "/" + encodeURIComponent(asset_id) + "/payload",
765
1022
  params: {
766
1023
  sub_resource
767
1024
  },
@@ -775,7 +1032,7 @@ function getAssetGraph({
775
1032
  }, headers) {
776
1033
  return axiosInstance({
777
1034
  method: "get",
778
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1035
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
779
1036
  headers
780
1037
  });
781
1038
  }
@@ -786,7 +1043,7 @@ function updateAssetGraph({
786
1043
  }, headers) {
787
1044
  return axiosInstance({
788
1045
  method: "put",
789
- url: "/assets/" + asset_container_with_graph + "/" + asset_id + "/graph",
1046
+ url: "/assets/" + encodeURIComponent(asset_container_with_graph) + "/" + encodeURIComponent(asset_id) + "/graph",
790
1047
  data: asset_graph,
791
1048
  headers
792
1049
  });
@@ -797,7 +1054,7 @@ function getAssetHistory({
797
1054
  }, headers) {
798
1055
  return axiosInstance({
799
1056
  method: "get",
800
- url: "/assets/" + asset_container + "/" + asset_id + "/history",
1057
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/history",
801
1058
  headers
802
1059
  });
803
1060
  }
@@ -807,7 +1064,7 @@ function getAssetMeta({
807
1064
  }, headers) {
808
1065
  return axiosInstance({
809
1066
  method: "get",
810
- url: "/assets/" + asset_container + "/" + asset_id + "/meta",
1067
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/meta",
811
1068
  headers
812
1069
  });
813
1070
  }
@@ -817,7 +1074,7 @@ function getAssetCode({
817
1074
  }, headers) {
818
1075
  return axiosInstance({
819
1076
  method: "get",
820
- url: "/assets/" + asset_container_with_code + "/" + asset_id + "/code",
1077
+ url: "/assets/" + encodeURIComponent(asset_container_with_code) + "/" + encodeURIComponent(asset_id) + "/code",
821
1078
  headers,
822
1079
  responseType: "text"
823
1080
  });
@@ -830,7 +1087,7 @@ function getAssetThumbnail({
830
1087
  }, headers, responseType) {
831
1088
  return axiosInstance({
832
1089
  method: "get",
833
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1090
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
834
1091
  params: {
835
1092
  size,
836
1093
  default_url
@@ -846,32 +1103,22 @@ function setAssetThumbnail({
846
1103
  }, contentType, headers) {
847
1104
  return axiosInstance({
848
1105
  method: "put",
849
- url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
1106
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/thumbnail",
850
1107
  data: body,
851
1108
  maxRedirects: 0,
852
1109
  headers: {
853
1110
  "Content-Type": contentType,
854
- ...headers?.toJSON()
1111
+ ...plainHeaders(headers)
855
1112
  }
856
1113
  });
857
1114
  }
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
1115
  function packageAsset({
869
1116
  asset_container,
870
1117
  asset_id
871
1118
  }, headers, responseType) {
872
1119
  return axiosInstance({
873
1120
  method: "get",
874
- url: "/assets/" + asset_container + "/" + asset_id + "/package",
1121
+ url: "/assets/" + encodeURIComponent(asset_container) + "/" + encodeURIComponent(asset_id) + "/package",
875
1122
  headers,
876
1123
  responseType: responseType || "arraybuffer"
877
1124
  });
@@ -885,7 +1132,7 @@ function exportAsset({
885
1132
  }, headers, responseType) {
886
1133
  return axiosInstance({
887
1134
  method: "get",
888
- url: "/assets/" + asset_container_exportable + "/" + asset_id + "/exports/" + format,
1135
+ url: "/assets/" + encodeURIComponent(asset_container_exportable) + "/" + encodeURIComponent(asset_id) + "/exports/" + encodeURIComponent(format),
889
1136
  params: {
890
1137
  scale,
891
1138
  sub_mesh_index
@@ -899,7 +1146,7 @@ function getSceneSessions({
899
1146
  }, headers) {
900
1147
  return axiosInstance({
901
1148
  method: "get",
902
- url: "/assets/scenes/" + scene_id + "/sessions",
1149
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/sessions",
903
1150
  headers
904
1151
  });
905
1152
  }
@@ -908,18 +1155,116 @@ function getSceneAABB({
908
1155
  }, headers) {
909
1156
  return axiosInstance({
910
1157
  method: "get",
911
- url: "/assets/scenes/" + scene_id + "/aabb",
1158
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/aabb",
912
1159
  headers
913
1160
  });
914
1161
  }
915
1162
  function createEntity({
916
1163
  scene_id,
917
- 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
918
1213
  }, headers) {
919
1214
  return axiosInstance({
920
1215
  method: "post",
921
- url: "/assets/scenes/" + scene_id + "/entities",
922
- 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
+ },
923
1268
  headers
924
1269
  });
925
1270
  }
@@ -930,7 +1275,7 @@ function getEntity({
930
1275
  }, headers) {
931
1276
  return axiosInstance({
932
1277
  method: "get",
933
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1278
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
934
1279
  params: {
935
1280
  compute_global_transform
936
1281
  },
@@ -940,12 +1285,110 @@ function getEntity({
940
1285
  function updateEntity({
941
1286
  scene_id,
942
1287
  entity_id,
943
- 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
944
1337
  }, headers) {
945
1338
  return axiosInstance({
946
1339
  method: "patch",
947
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
948
- 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
+ },
949
1392
  headers
950
1393
  });
951
1394
  }
@@ -955,7 +1398,7 @@ function deleteEntity({
955
1398
  }, headers) {
956
1399
  return axiosInstance({
957
1400
  method: "delete",
958
- url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
1401
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/entities/" + encodeURIComponent(entity_id),
959
1402
  headers
960
1403
  });
961
1404
  }
@@ -964,7 +1407,7 @@ function getSceneSettings({
964
1407
  }, headers) {
965
1408
  return axiosInstance({
966
1409
  method: "get",
967
- url: "/assets/scenes/" + scene_id + "/settings",
1410
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
968
1411
  headers
969
1412
  });
970
1413
  }
@@ -974,7 +1417,7 @@ function updateSceneSettings({
974
1417
  }, headers) {
975
1418
  return axiosInstance({
976
1419
  method: "patch",
977
- url: "/assets/scenes/" + scene_id + "/settings",
1420
+ url: "/assets/scenes/" + encodeURIComponent(scene_id) + "/settings",
978
1421
  data: body,
979
1422
  headers
980
1423
  });
@@ -1014,7 +1457,7 @@ function getSession({
1014
1457
  }, headers) {
1015
1458
  return axiosInstance({
1016
1459
  method: "get",
1017
- url: "/sessions/" + session_id,
1460
+ url: "/sessions/" + encodeURIComponent(session_id),
1018
1461
  headers
1019
1462
  });
1020
1463
  }
@@ -1023,7 +1466,7 @@ function killSession({
1023
1466
  }, headers) {
1024
1467
  return axiosInstance({
1025
1468
  method: "delete",
1026
- url: "/sessions/" + session_id,
1469
+ url: "/sessions/" + encodeURIComponent(session_id),
1027
1470
  headers
1028
1471
  });
1029
1472
  }
@@ -1033,10 +1476,10 @@ function joinSession({
1033
1476
  }, headers) {
1034
1477
  return axiosInstance({
1035
1478
  method: "post",
1036
- url: "/sessions/" + session_id + "/clients",
1037
- data: {
1479
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients",
1480
+ data: optionalBody({
1038
1481
  is_headless
1039
- },
1482
+ }),
1040
1483
  headers
1041
1484
  });
1042
1485
  }
@@ -1046,7 +1489,7 @@ function getClient({
1046
1489
  }, headers) {
1047
1490
  return axiosInstance({
1048
1491
  method: "get",
1049
- url: "/sessions/" + session_id + "/clients/" + client_id,
1492
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1050
1493
  headers
1051
1494
  });
1052
1495
  }
@@ -1056,7 +1499,7 @@ function kickClientFromSession({
1056
1499
  }, headers) {
1057
1500
  return axiosInstance({
1058
1501
  method: "delete",
1059
- url: "/sessions/" + session_id + "/clients/" + client_id,
1502
+ url: "/sessions/" + encodeURIComponent(session_id) + "/clients/" + encodeURIComponent(client_id),
1060
1503
  headers
1061
1504
  });
1062
1505
  }
@@ -1072,7 +1515,7 @@ function generateGuestToken({
1072
1515
  }, headers) {
1073
1516
  return axiosInstance({
1074
1517
  method: "post",
1075
- url: "/sessions/" + session_id + "/guests",
1518
+ url: "/sessions/" + encodeURIComponent(session_id) + "/guests",
1076
1519
  headers
1077
1520
  });
1078
1521
  }
@@ -1158,10 +1601,28 @@ function shouldRetryRequest(error) {
1158
1601
  installInterceptors();
1159
1602
  export {
1160
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,
1161
1617
  UnexpectedServiceError,
1618
+ UploadAborted,
1619
+ UploadTaskNotFound,
1620
+ UploadedPayloadTooLarge,
1162
1621
  axiosInstance,
1622
+ confirmDuplicationRequest,
1163
1623
  createAsset,
1164
1624
  createCubemap,
1625
+ createDuplicationRequest,
1165
1626
  createEntity,
1166
1627
  createFolder,
1167
1628
  createGroup,
@@ -1175,12 +1636,12 @@ export {
1175
1636
  deleteGroup,
1176
1637
  deleteSourceFiles,
1177
1638
  deleteUser,
1178
- downloadSourceFile,
1639
+ discardDuplicationRequest,
1640
+ errorOf,
1179
1641
  exportAsset,
1180
1642
  generateGuestToken,
1181
1643
  generateUserToken,
1182
1644
  getAssetCode,
1183
- getAssetCustomTypes,
1184
1645
  getAssetDependencies,
1185
1646
  getAssetDescription,
1186
1647
  getAssetDetails,
@@ -1195,6 +1656,7 @@ export {
1195
1656
  getClient,
1196
1657
  getConversionTaskMetadata,
1197
1658
  getCurrentUser,
1659
+ getDuplicationRequest,
1198
1660
  getEntity,
1199
1661
  getFolderAssets,
1200
1662
  getFolderInfo,
@@ -1223,6 +1685,7 @@ export {
1223
1685
  kickClientFromSession,
1224
1686
  killSession,
1225
1687
  listAssets,
1688
+ listDuplicationRequests,
1226
1689
  listFolderAccesses,
1227
1690
  listFolderSubFolders,
1228
1691
  listFolders,
@@ -1243,6 +1706,7 @@ export {
1243
1706
  setUserToken,
1244
1707
  updateAssetDescription,
1245
1708
  updateAssetGraph,
1709
+ updateDuplicationRequest,
1246
1710
  updateEntity,
1247
1711
  updateFolder,
1248
1712
  updateGroupDescription,