@3dverse/api 0.0.4 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -15,38 +15,17 @@ import axios from 'axios';
15
15
  * Do not edit this file class manually.
16
16
  */
17
17
  //--------------------------------------------------------------------------
18
- const axiosInstance = createAxiosInstance();
19
- //------------------------------------------------------------------------------
20
- function createAxiosInstance() {
21
- const axiosInstance = axios.create({
22
- baseURL: "https://api.3dverse.com/v1"
23
- });
24
- axiosInstance.interceptors.response.use(successFulResponse => {
25
- if (successFulResponse.config.responseType === 'stream') {
26
- successFulResponse.data.pause();
27
- }
28
- return successFulResponse;
29
- }, axiosError => {
30
- if (!axiosError.response) {
31
- return Promise.reject(axiosError);
32
- }
33
- const errorData = axiosError.response.data;
34
- const error = {
35
- errorCode: errorData.errorCode,
36
- message: errorData.message,
37
- status: axiosError.response.status,
38
- error: errorData.error || errorData,
39
- };
40
- return Promise.reject(error);
41
- });
42
- return axiosInstance;
43
- }
18
+ const axiosInstance = axios.create({
19
+ baseURL: "https://api.3dverse.com/app/v1",
20
+ operationId: "3dverse"
21
+ });
44
22
  //------------------------------------------------------------------------------
45
23
  function setBaseURL(baseURL) {
46
24
  axiosInstance.defaults.baseURL = baseURL;
47
25
  }
48
26
  function listUsers({ offset = 0, limit = 10 }) {
49
27
  return axiosInstance({
28
+ operationId: "listUsers",
50
29
  method: "get",
51
30
  url: "/users",
52
31
  params: {
@@ -57,6 +36,7 @@ function listUsers({ offset = 0, limit = 10 }) {
57
36
  }
58
37
  function registerUser({ username }) {
59
38
  return axiosInstance({
39
+ operationId: "registerUser",
60
40
  method: "post",
61
41
  url: "/users",
62
42
  data: {
@@ -66,6 +46,7 @@ function registerUser({ username }) {
66
46
  }
67
47
  function getUser({ user_id }) {
68
48
  return axiosInstance({
49
+ operationId: "getUser",
69
50
  method: "get",
70
51
  url: "/users/" + user_id + ""
71
52
  });
@@ -74,6 +55,7 @@ function getUser({ user_id }) {
74
55
  // Updates the details of the target user.
75
56
  function updateUser({ user_id, username }) {
76
57
  return axiosInstance({
58
+ operationId: "updateUser",
77
59
  method: "patch",
78
60
  url: "/users/" + user_id + "",
79
61
  data: {
@@ -83,12 +65,14 @@ function updateUser({ user_id, username }) {
83
65
  }
84
66
  function deleteUser({ user_id }) {
85
67
  return axiosInstance({
68
+ operationId: "deleteUser",
86
69
  method: "delete",
87
70
  url: "/users/" + user_id + ""
88
71
  });
89
72
  }
90
73
  function generateUserToken({ user_id, scope, ttl = '1h' }) {
91
74
  return axiosInstance({
75
+ operationId: "generateUserToken",
92
76
  method: "post",
93
77
  url: "/users/" + user_id + "/tokens",
94
78
  data: {
@@ -99,12 +83,14 @@ function generateUserToken({ user_id, scope, ttl = '1h' }) {
99
83
  }
100
84
  function getUserGroups({ user_id }) {
101
85
  return axiosInstance({
86
+ operationId: "getUserGroups",
102
87
  method: "get",
103
88
  url: "/users/" + user_id + "/groups"
104
89
  });
105
90
  }
106
91
  function getUserUploadTasks({ user_id, offset = 0, limit = 10 }) {
107
92
  return axiosInstance({
93
+ operationId: "getUserUploadTasks",
108
94
  method: "get",
109
95
  url: "/users/" + user_id + "/upload-tasks",
110
96
  params: {
@@ -115,6 +101,7 @@ function getUserUploadTasks({ user_id, offset = 0, limit = 10 }) {
115
101
  }
116
102
  function createGroup({ group_name, group_description, members }) {
117
103
  return axiosInstance({
104
+ operationId: "createGroup",
118
105
  method: "post",
119
106
  url: "/groups",
120
107
  data: {
@@ -126,6 +113,7 @@ function createGroup({ group_name, group_description, members }) {
126
113
  }
127
114
  function getGroup({ group_id }) {
128
115
  return axiosInstance({
116
+ operationId: "getGroup",
129
117
  method: "get",
130
118
  url: "/groups/" + group_id + ""
131
119
  });
@@ -134,6 +122,7 @@ function getGroup({ group_id }) {
134
122
  // Updates a group details.
135
123
  function updateGroupDescription({ group_id, group_name, group_description }) {
136
124
  return axiosInstance({
125
+ operationId: "updateGroupDescription",
137
126
  method: "patch",
138
127
  url: "/groups/" + group_id + "",
139
128
  data: {
@@ -146,6 +135,7 @@ function updateGroupDescription({ group_id, group_name, group_description }) {
146
135
  // Deletes a group and all its access rights.
147
136
  function deleteGroup({ group_id }) {
148
137
  return axiosInstance({
138
+ operationId: "deleteGroup",
149
139
  method: "delete",
150
140
  url: "/groups/" + group_id + ""
151
141
  });
@@ -154,6 +144,7 @@ function deleteGroup({ group_id }) {
154
144
  // Grants member access to the group.
155
145
  function grantMemberAccessToGroup({ group_id, member_type, member_id, group_access, folder_access }) {
156
146
  return axiosInstance({
147
+ operationId: "grantMemberAccessToGroup",
157
148
  method: "put",
158
149
  url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id + "",
159
150
  data: {
@@ -166,12 +157,14 @@ function grantMemberAccessToGroup({ group_id, member_type, member_id, group_acce
166
157
  // Revoke requested user access to group.
167
158
  function revokeMemberAccessToGroup({ group_id, member_type, member_id }) {
168
159
  return axiosInstance({
160
+ operationId: "revokeMemberAccessToGroup",
169
161
  method: "delete",
170
162
  url: "/groups/" + group_id + "/members/" + member_type + "/" + member_id + ""
171
163
  });
172
164
  }
173
165
  function listFolders({ offset = 0, limit = 10 }) {
174
166
  return axiosInstance({
167
+ operationId: "listFolders",
175
168
  method: "get",
176
169
  url: "/folders",
177
170
  params: {
@@ -182,6 +175,7 @@ function listFolders({ offset = 0, limit = 10 }) {
182
175
  }
183
176
  function createFolder({ folder_name, subfolders }) {
184
177
  return axiosInstance({
178
+ operationId: "createFolder",
185
179
  method: "post",
186
180
  url: "/folders",
187
181
  data: {
@@ -192,23 +186,26 @@ function createFolder({ folder_name, subfolders }) {
192
186
  }
193
187
  function getFolderInfo({ folder_id }) {
194
188
  return axiosInstance({
189
+ operationId: "getFolderInfo",
195
190
  method: "get",
196
191
  url: "/folders/" + folder_id + ""
197
192
  });
198
193
  }
199
194
  //--------------------------------------------------------------------------
200
195
  // Move folders inside the specified folder.
201
- function moveFolders({ folder_id, folder_ids }) {
196
+ function moveFolders({ folder_id, folderIds }) {
202
197
  return axiosInstance({
198
+ operationId: "moveFolders",
203
199
  method: "put",
204
200
  url: "/folders/" + folder_id + "",
205
- data: folder_ids
201
+ data: folderIds
206
202
  });
207
203
  }
208
204
  //--------------------------------------------------------------------------
209
205
  // Updates the folder details.
210
206
  function updateFolder({ folder_id, folder_name }) {
211
207
  return axiosInstance({
208
+ operationId: "updateFolder",
212
209
  method: "patch",
213
210
  url: "/folders/" + folder_id + "",
214
211
  data: {
@@ -220,12 +217,14 @@ function updateFolder({ folder_id, folder_name }) {
220
217
  // Deletes the requested folder. The target folder must be empty.
221
218
  function deleteFolder({ folder_id }) {
222
219
  return axiosInstance({
220
+ operationId: "deleteFolder",
223
221
  method: "delete",
224
222
  url: "/folders/" + folder_id + ""
225
223
  });
226
224
  }
227
225
  function listFolderAccesses({ folder_id }) {
228
226
  return axiosInstance({
227
+ operationId: "listFolderAccesses",
229
228
  method: "get",
230
229
  url: "/folders/" + folder_id + "/access"
231
230
  });
@@ -234,6 +233,7 @@ function listFolderAccesses({ folder_id }) {
234
233
  // Grants member access to the targeted folder.
235
234
  function grantMemberAccessToFolder({ folder_id, member_type, member_id, access }) {
236
235
  return axiosInstance({
236
+ operationId: "grantMemberAccessToFolder",
237
237
  method: "put",
238
238
  url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id + "",
239
239
  data: {
@@ -245,12 +245,14 @@ function grantMemberAccessToFolder({ folder_id, member_type, member_id, access }
245
245
  // Revokes member access to a target folder.
246
246
  function revokeMemberAccessToFolder({ folder_id, member_type, member_id }) {
247
247
  return axiosInstance({
248
+ operationId: "revokeMemberAccessToFolder",
248
249
  method: "delete",
249
250
  url: "/folders/" + folder_id + "/access/" + member_type + "/" + member_id + ""
250
251
  });
251
252
  }
252
253
  function createSubfolder({ folder_id, folder_name, subfolders }) {
253
254
  return axiosInstance({
255
+ operationId: "createSubfolder",
254
256
  method: "post",
255
257
  url: "/folders/" + folder_id + "/folders",
256
258
  data: {
@@ -261,6 +263,7 @@ function createSubfolder({ folder_id, folder_name, subfolders }) {
261
263
  }
262
264
  function listFolderSubFolders({ folder_id, depth = 0 }) {
263
265
  return axiosInstance({
266
+ operationId: "listFolderSubFolders",
264
267
  method: "get",
265
268
  url: "/folders/" + folder_id + "/folders",
266
269
  params: {
@@ -270,6 +273,7 @@ function listFolderSubFolders({ folder_id, depth = 0 }) {
270
273
  }
271
274
  function uploadSourceFiles({ folder_id, body }) {
272
275
  return axiosInstance({
276
+ operationId: "uploadSourceFiles",
273
277
  method: "post",
274
278
  url: "/folders/" + folder_id + "/source-files",
275
279
  headers: {
@@ -280,6 +284,7 @@ function uploadSourceFiles({ folder_id, body }) {
280
284
  }
281
285
  function getSourceFilesInFolder({ folder_id, offset = 0, limit = 10 }) {
282
286
  return axiosInstance({
287
+ operationId: "getSourceFilesInFolder",
283
288
  method: "get",
284
289
  url: "/folders/" + folder_id + "/source-files",
285
290
  params: {
@@ -290,15 +295,17 @@ function getSourceFilesInFolder({ folder_id, offset = 0, limit = 10 }) {
290
295
  }
291
296
  //--------------------------------------------------------------------------
292
297
  // Move source files inside the specified folder.
293
- function moveSourceFiles({ folder_id, source_file_ids }) {
298
+ function moveSourceFiles({ folder_id, sourceFileIds }) {
294
299
  return axiosInstance({
300
+ operationId: "moveSourceFiles",
295
301
  method: "put",
296
302
  url: "/folders/" + folder_id + "/source-files",
297
- data: source_file_ids
303
+ data: sourceFileIds
298
304
  });
299
305
  }
300
306
  function getUploadTasksInFolder({ folder_id, offset = 0, limit = 10 }) {
301
307
  return axiosInstance({
308
+ operationId: "getUploadTasksInFolder",
302
309
  method: "get",
303
310
  url: "/folders/" + folder_id + "/upload-tasks",
304
311
  params: {
@@ -307,36 +314,45 @@ function getUploadTasksInFolder({ folder_id, offset = 0, limit = 10 }) {
307
314
  }
308
315
  });
309
316
  }
310
- function getFolderAssets({ folder_id }) {
317
+ function getFolderAssets({ folder_id, offset = 0, limit = 10 }) {
311
318
  return axiosInstance({
319
+ operationId: "getFolderAssets",
312
320
  method: "get",
313
- url: "/folders/" + folder_id + "/assets"
321
+ url: "/folders/" + folder_id + "/assets",
322
+ params: {
323
+ offset: offset,
324
+ limit: limit
325
+ }
314
326
  });
315
327
  }
316
328
  //--------------------------------------------------------------------------
317
329
  // Move assets inside the specified folder.
318
- function moveAssets({ folder_id, asset_ids }) {
330
+ function moveAssets({ folder_id, assetIds }) {
319
331
  return axiosInstance({
332
+ operationId: "moveAssets",
320
333
  method: "put",
321
334
  url: "/folders/" + folder_id + "/assets",
322
- data: asset_ids
335
+ data: assetIds
323
336
  });
324
337
  }
325
- function createAsset({ folder_id, asset_container_creatable, body }) {
338
+ function createAsset({ folder_id, asset_container_creatable, assetCreationOptions }) {
326
339
  return axiosInstance({
340
+ operationId: "createAsset",
327
341
  method: "post",
328
342
  url: "/folders/" + folder_id + "/assets/" + asset_container_creatable + "",
329
- data: body
343
+ data: assetCreationOptions
330
344
  });
331
345
  }
332
346
  function getSessionsInFolder({ folder_id }) {
333
347
  return axiosInstance({
348
+ operationId: "getSessionsInFolder",
334
349
  method: "get",
335
350
  url: "/folders/" + folder_id + "/sessions"
336
351
  });
337
352
  }
338
353
  function listSourceFiles({ offset = 0, limit = 10 }) {
339
354
  return axiosInstance({
355
+ operationId: "listSourceFiles",
340
356
  method: "get",
341
357
  url: "/source-files",
342
358
  params: {
@@ -347,17 +363,19 @@ function listSourceFiles({ offset = 0, limit = 10 }) {
347
363
  }
348
364
  //--------------------------------------------------------------------------
349
365
  // Deletes the target source files. Deleting a source file is permanent.
350
- function deleteSourceFiles({ source_file_ids }) {
366
+ function deleteSourceFiles({ sourceFileIds }) {
351
367
  return axiosInstance({
368
+ operationId: "deleteSourceFiles",
352
369
  method: "delete",
353
370
  url: "/source-files",
354
- data: source_file_ids
371
+ data: sourceFileIds
355
372
  });
356
373
  }
357
374
  //--------------------------------------------------------------------------
358
375
  // Downloads the target source file.
359
376
  function downloadSourceFile({ source_file_id }) {
360
377
  return axiosInstance({
378
+ operationId: "downloadSourceFile",
361
379
  method: "get",
362
380
  url: "/source-files/" + source_file_id + "",
363
381
  responseType: "arraybuffer"
@@ -365,6 +383,7 @@ function downloadSourceFile({ source_file_id }) {
365
383
  }
366
384
  function getSourceFileDetails({ source_file_id }) {
367
385
  return axiosInstance({
386
+ operationId: "getSourceFileDetails",
368
387
  method: "get",
369
388
  url: "/source-files/" + source_file_id + "/details"
370
389
  });
@@ -373,6 +392,7 @@ function getSourceFileDetails({ source_file_id }) {
373
392
  // Updates details for a specific source file.
374
393
  function updateSourceFileDetails({ source_file_id, source_file_name }) {
375
394
  return axiosInstance({
395
+ operationId: "updateSourceFileDetails",
376
396
  method: "patch",
377
397
  url: "/source-files/" + source_file_id + "/details",
378
398
  data: {
@@ -382,18 +402,21 @@ function updateSourceFileDetails({ source_file_id, source_file_name }) {
382
402
  }
383
403
  function getSourceFileAssets({ source_file_id }) {
384
404
  return axiosInstance({
405
+ operationId: "getSourceFileAssets",
385
406
  method: "get",
386
407
  url: "/source-files/" + source_file_id + "/assets"
387
408
  });
388
409
  }
389
410
  function getUploadTask({ upload_task_id }) {
390
411
  return axiosInstance({
412
+ operationId: "getUploadTask",
391
413
  method: "get",
392
414
  url: "/upload-tasks/" + upload_task_id + ""
393
415
  });
394
416
  }
395
417
  function listAssets({ offset = 0, limit = 10 }) {
396
418
  return axiosInstance({
419
+ operationId: "listAssets",
397
420
  method: "get",
398
421
  url: "/assets",
399
422
  params: {
@@ -404,41 +427,47 @@ function listAssets({ offset = 0, limit = 10 }) {
404
427
  }
405
428
  //--------------------------------------------------------------------------
406
429
  // Batch delete assets. You **MUST NOT** reference assets.
407
- function deleteAssets({ asset_ids }) {
430
+ function deleteAssets({ assetIds }) {
408
431
  return axiosInstance({
432
+ operationId: "deleteAssets",
409
433
  method: "delete",
410
434
  url: "/assets",
411
- data: asset_ids
435
+ data: assetIds
412
436
  });
413
437
  }
414
438
  //--------------------------------------------------------------------------
415
439
  // Deletes the asset.
416
440
  function deleteAsset({ asset_container, asset_id }) {
417
441
  return axiosInstance({
442
+ operationId: "deleteAsset",
418
443
  method: "delete",
419
444
  url: "/assets/" + asset_container + "/" + asset_id + ""
420
445
  });
421
446
  }
422
447
  function getAssetSourceFile({ asset_container, asset_id }) {
423
448
  return axiosInstance({
449
+ operationId: "getAssetSourceFile",
424
450
  method: "get",
425
451
  url: "/assets/" + asset_container + "/" + asset_id + "/source-file"
426
452
  });
427
453
  }
428
454
  function getAssetDetails({ asset_container, asset_id }) {
429
455
  return axiosInstance({
456
+ operationId: "getAssetDetails",
430
457
  method: "get",
431
458
  url: "/assets/" + asset_container + "/" + asset_id + "/details"
432
459
  });
433
460
  }
434
461
  function getAssetFolder({ asset_container, asset_id }) {
435
462
  return axiosInstance({
463
+ operationId: "getAssetFolder",
436
464
  method: "get",
437
465
  url: "/assets/" + asset_container + "/" + asset_id + "/folder"
438
466
  });
439
467
  }
440
468
  function getAssetDependencies({ asset_container, asset_id, format = 'flat', depth = 'all', filter }) {
441
469
  return axiosInstance({
470
+ operationId: "getAssetDependencies",
442
471
  method: "get",
443
472
  url: "/assets/" + asset_container + "/" + asset_id + "/dependencies",
444
473
  params: {
@@ -450,31 +479,31 @@ function getAssetDependencies({ asset_container, asset_id, format = 'flat', dept
450
479
  }
451
480
  function getAssetReferences({ asset_container, asset_id }) {
452
481
  return axiosInstance({
482
+ operationId: "getAssetReferences",
453
483
  method: "get",
454
484
  url: "/assets/" + asset_container + "/" + asset_id + "/references"
455
485
  });
456
486
  }
457
487
  function getAssetDescription({ asset_container, asset_id }) {
458
488
  return axiosInstance({
489
+ operationId: "getAssetDescription",
459
490
  method: "get",
460
491
  url: "/assets/" + asset_container + "/" + asset_id + "/description"
461
492
  });
462
493
  }
463
- //--------------------------------------------------------------------------
464
- // Updates asset description. Supports only updating name.
465
- function updateAssetDescription({ asset_container, asset_id, name }) {
494
+ function updateAssetDescription({ asset_container, asset_id, assetDescription }) {
466
495
  return axiosInstance({
496
+ operationId: "updateAssetDescription",
467
497
  method: "patch",
468
498
  url: "/assets/" + asset_container + "/" + asset_id + "/description",
469
- data: {
470
- name: name
471
- }
499
+ data: assetDescription
472
500
  });
473
501
  }
474
502
  //--------------------------------------------------------------------------
475
503
  // Gets the asset payload from the specified asset.
476
504
  function getAssetPayload({ asset_container_with_payload, asset_id }) {
477
505
  return axiosInstance({
506
+ operationId: "getAssetPayload",
478
507
  method: "get",
479
508
  url: "/assets/" + asset_container_with_payload + "/" + asset_id + "/payload",
480
509
  responseType: "arraybuffer"
@@ -482,12 +511,14 @@ function getAssetPayload({ asset_container_with_payload, asset_id }) {
482
511
  }
483
512
  function getAssetHistory({ asset_container, asset_id }) {
484
513
  return axiosInstance({
514
+ operationId: "getAssetHistory",
485
515
  method: "get",
486
516
  url: "/assets/" + asset_container + "/" + asset_id + "/history"
487
517
  });
488
518
  }
489
519
  function getAssetMeta({ asset_container, asset_id }) {
490
520
  return axiosInstance({
521
+ operationId: "getAssetMeta",
491
522
  method: "get",
492
523
  url: "/assets/" + asset_container + "/" + asset_id + "/meta"
493
524
  });
@@ -496,6 +527,7 @@ function getAssetMeta({ asset_container, asset_id }) {
496
527
  // Gets the code of the specified asset.
497
528
  function getAssetCode({ asset_container_with_code, asset_id }) {
498
529
  return axiosInstance({
530
+ operationId: "getAssetCode",
499
531
  method: "get",
500
532
  url: "/assets/" + asset_container_with_code + "/" + asset_id + "/code"
501
533
  });
@@ -504,6 +536,7 @@ function getAssetCode({ asset_container_with_code, asset_id }) {
504
536
  // Gets the asset thumbnail from the specified asset.
505
537
  function getAssetThumbnail({ asset_container, asset_id, size, default_url }) {
506
538
  return axiosInstance({
539
+ operationId: "getAssetThumbnail",
507
540
  method: "get",
508
541
  url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
509
542
  params: {
@@ -516,6 +549,7 @@ function getAssetThumbnail({ asset_container, asset_id, size, default_url }) {
516
549
  // Assigns a thumbnail to the specified asset.
517
550
  function setAssetThumbnail({ asset_container, asset_id, body }, contentType) {
518
551
  return axiosInstance({
552
+ operationId: "setAssetThumbnail",
519
553
  method: "put",
520
554
  url: "/assets/" + asset_container + "/" + asset_id + "/thumbnail",
521
555
  headers: {
@@ -526,6 +560,7 @@ function setAssetThumbnail({ asset_container, asset_id, body }, contentType) {
526
560
  }
527
561
  function getAssetCustomTypes({ asset_container_with_custom_types, asset_id }) {
528
562
  return axiosInstance({
563
+ operationId: "getAssetCustomTypes",
529
564
  method: "get",
530
565
  url: "/assets/" + asset_container_with_custom_types + "/" + asset_id + "/custom-types"
531
566
  });
@@ -534,6 +569,7 @@ function getAssetCustomTypes({ asset_container_with_custom_types, asset_id }) {
534
569
  // Packages and downloads the target asset.
535
570
  function packageAsset({ asset_container, asset_id }) {
536
571
  return axiosInstance({
572
+ operationId: "packageAsset",
537
573
  method: "get",
538
574
  url: "/assets/" + asset_container + "/" + asset_id + "/package",
539
575
  responseType: "arraybuffer"
@@ -543,6 +579,7 @@ function packageAsset({ asset_container, asset_id }) {
543
579
  // Downloads an asset payload in a given format. Only mesh is supported for the moment. This endpoint requires special export permission.
544
580
  function exportAsset({ asset_container_exportable, asset_id, format, scale = 1 }) {
545
581
  return axiosInstance({
582
+ operationId: "exportAsset",
546
583
  method: "get",
547
584
  url: "/assets/" + asset_container_exportable + "/" + asset_id + "/exports/" + format + "",
548
585
  responseType: "arraybuffer",
@@ -553,18 +590,21 @@ function exportAsset({ asset_container_exportable, asset_id, format, scale = 1 }
553
590
  }
554
591
  function getSceneSessions({ scene_id }) {
555
592
  return axiosInstance({
593
+ operationId: "getSceneSessions",
556
594
  method: "get",
557
595
  url: "/assets/scenes/" + scene_id + "/sessions"
558
596
  });
559
597
  }
560
598
  function getSceneAABB({ scene_id }) {
561
599
  return axiosInstance({
600
+ operationId: "getSceneAABB",
562
601
  method: "get",
563
602
  url: "/assets/scenes/" + scene_id + "/aabb"
564
603
  });
565
604
  }
566
605
  function getEntity({ scene_id, entity_id, compute_global_transform = false }) {
567
606
  return axiosInstance({
607
+ operationId: "getEntity",
568
608
  method: "get",
569
609
  url: "/assets/scenes/" + scene_id + "/entities/" + entity_id + "",
570
610
  params: {
@@ -572,8 +612,26 @@ function getEntity({ scene_id, entity_id, compute_global_transform = false }) {
572
612
  }
573
613
  });
574
614
  }
615
+ function updateEntity({ scene_id, entity_id, entity }) {
616
+ return axiosInstance({
617
+ operationId: "updateEntity",
618
+ method: "patch",
619
+ url: "/assets/scenes/" + scene_id + "/entities/" + entity_id + "",
620
+ data: entity
621
+ });
622
+ }
623
+ //--------------------------------------------------------------------------
624
+ // Delete a specific entity from a scene
625
+ function deleteEntity({ scene_id, entity_id }) {
626
+ return axiosInstance({
627
+ operationId: "deleteEntity",
628
+ method: "delete",
629
+ url: "/assets/scenes/" + scene_id + "/entities/" + entity_id + ""
630
+ });
631
+ }
575
632
  function createSession({ scene_id }) {
576
633
  return axiosInstance({
634
+ operationId: "createSession",
577
635
  method: "post",
578
636
  url: "/sessions",
579
637
  data: {
@@ -583,6 +641,7 @@ function createSession({ scene_id }) {
583
641
  }
584
642
  function getSession({ session_id }) {
585
643
  return axiosInstance({
644
+ operationId: "getSession",
586
645
  method: "get",
587
646
  url: "/sessions/" + session_id + ""
588
647
  });
@@ -591,12 +650,14 @@ function getSession({ session_id }) {
591
650
  // Forcefully terminates a session.
592
651
  function killSession({ session_id }) {
593
652
  return axiosInstance({
653
+ operationId: "killSession",
594
654
  method: "delete",
595
655
  url: "/sessions/" + session_id + ""
596
656
  });
597
657
  }
598
658
  function joinSession({ session_id }) {
599
659
  return axiosInstance({
660
+ operationId: "joinSession",
600
661
  method: "post",
601
662
  url: "/sessions/" + session_id + "/clients"
602
663
  });
@@ -605,12 +666,26 @@ function joinSession({ session_id }) {
605
666
  // Kick a client from a running session.
606
667
  function kickClientFromSession({ session_id, client_id }) {
607
668
  return axiosInstance({
669
+ operationId: "kickClientFromSession",
608
670
  method: "delete",
609
671
  url: "/sessions/" + session_id + "/clients/" + client_id + ""
610
672
  });
611
673
  }
674
+ function joinSessionAsGuest() {
675
+ return axiosInstance({
676
+ operationId: "joinSessionAsGuest",
677
+ method: "post",
678
+ url: "/sessions/guests"
679
+ });
680
+ }
681
+ function generateGuestToken({ session_id }) {
682
+ return axiosInstance({
683
+ operationId: "generateGuestToken",
684
+ method: "post",
685
+ url: "/sessions/" + session_id + "/guests"
686
+ });
687
+ }
612
688
 
613
- //--------------------------------------------------------------------------
614
689
  //------------------------------------------------------------------------------
615
690
  function setApiKey(apiKey) {
616
691
  axiosInstance.defaults.headers.common['api_key'] = apiKey;
@@ -621,9 +696,70 @@ function setUserToken(userToken) {
621
696
  axiosInstance.defaults.headers.common['user_token'] = userToken;
622
697
  delete axiosInstance.defaults.headers.common['api_key'];
623
698
  }
699
+ //------------------------------------------------------------------------------
624
700
  function setBaseUrl(url) {
625
701
  axiosInstance.defaults.baseURL = url;
626
702
  }
703
+ //------------------------------------------------------------------------------
704
+ class ServiceError extends Error {
705
+ errorCode;
706
+ httpCode;
707
+ message;
708
+ //--------------------------------------------------------------------------
709
+ constructor(errorCode, httpCode, message) {
710
+ super();
711
+ this.errorCode = errorCode;
712
+ this.httpCode = httpCode;
713
+ this.message = message;
714
+ }
715
+ }
716
+ //------------------------------------------------------------------------------
717
+ class ApiError extends ServiceError {
718
+ serviceError;
719
+ constructor(errorCode, status, message, serviceError) {
720
+ super(errorCode, status, message);
721
+ this.serviceError = serviceError;
722
+ }
723
+ }
724
+ //------------------------------------------------------------------------------
725
+ class UnexpectedServiceError extends ServiceError {
726
+ unexpectedError;
727
+ constructor(status, unexpectedError) {
728
+ super(0, status, 'Unexpected service error error');
729
+ this.unexpectedError = unexpectedError;
730
+ }
731
+ }
732
+ //------------------------------------------------------------------------------
733
+ function installInterceptors() {
734
+ const CLIENT_ERROR = 400;
735
+ const INTERNAL_SERVER_ERROR = 500;
736
+ axiosInstance.interceptors.response.use(successFulResponse => {
737
+ if (successFulResponse.config.responseType === 'stream') {
738
+ successFulResponse.data.pause();
739
+ }
740
+ return successFulResponse;
741
+ }, error => {
742
+ if (!error.response) {
743
+ return Promise.reject(error);
744
+ }
745
+ const axiosError = error;
746
+ const status = axiosError.response?.status || INTERNAL_SERVER_ERROR;
747
+ const errorData = axiosError.response?.data;
748
+ if (!errorData &&
749
+ axiosError.request.method === 'HEAD' &&
750
+ status >= CLIENT_ERROR &&
751
+ status < INTERNAL_SERVER_ERROR) {
752
+ return axiosError.response;
753
+ }
754
+ if (!errorData || !('error' in errorData)) {
755
+ return Promise.reject(new UnexpectedServiceError(status, errorData));
756
+ }
757
+ const serviceError = errorData.error;
758
+ return Promise.reject(new ApiError(serviceError.errorCode, status, serviceError.message, serviceError));
759
+ });
760
+ }
761
+ //------------------------------------------------------------------------------
762
+ installInterceptors();
627
763
 
628
- export { axiosInstance, createAsset, createFolder, createGroup, createSession, createSubfolder, deleteAsset, deleteAssets, deleteFolder, deleteGroup, deleteSourceFiles, deleteUser, downloadSourceFile, exportAsset, generateUserToken, getAssetCode, getAssetCustomTypes, getAssetDependencies, getAssetDescription, getAssetDetails, getAssetFolder, getAssetHistory, getAssetMeta, getAssetPayload, getAssetReferences, getAssetSourceFile, getAssetThumbnail, getEntity, getFolderAssets, getFolderInfo, getGroup, getSceneAABB, getSceneSessions, getSession, getSessionsInFolder, getSourceFileAssets, getSourceFileDetails, getSourceFilesInFolder, getUploadTask, getUploadTasksInFolder, getUser, getUserGroups, getUserUploadTasks, grantMemberAccessToFolder, grantMemberAccessToGroup, joinSession, kickClientFromSession, killSession, listAssets, listFolderAccesses, listFolderSubFolders, listFolders, listSourceFiles, listUsers, moveAssets, moveFolders, moveSourceFiles, packageAsset, registerUser, revokeMemberAccessToFolder, revokeMemberAccessToGroup, setApiKey, setAssetThumbnail, setBaseURL, setBaseUrl, setUserToken, updateAssetDescription, updateFolder, updateGroupDescription, updateSourceFileDetails, updateUser, uploadSourceFiles };
764
+ export { ApiError, UnexpectedServiceError, axiosInstance, createAsset, createFolder, createGroup, createSession, createSubfolder, deleteAsset, deleteAssets, deleteEntity, deleteFolder, deleteGroup, deleteSourceFiles, deleteUser, downloadSourceFile, exportAsset, generateGuestToken, generateUserToken, getAssetCode, getAssetCustomTypes, getAssetDependencies, getAssetDescription, getAssetDetails, getAssetFolder, getAssetHistory, getAssetMeta, getAssetPayload, getAssetReferences, getAssetSourceFile, getAssetThumbnail, getEntity, getFolderAssets, getFolderInfo, getGroup, getSceneAABB, getSceneSessions, getSession, getSessionsInFolder, getSourceFileAssets, getSourceFileDetails, getSourceFilesInFolder, getUploadTask, getUploadTasksInFolder, getUser, getUserGroups, getUserUploadTasks, grantMemberAccessToFolder, grantMemberAccessToGroup, joinSession, joinSessionAsGuest, kickClientFromSession, killSession, listAssets, listFolderAccesses, listFolderSubFolders, listFolders, listSourceFiles, listUsers, moveAssets, moveFolders, moveSourceFiles, packageAsset, registerUser, revokeMemberAccessToFolder, revokeMemberAccessToGroup, setApiKey, setAssetThumbnail, setBaseURL, setBaseUrl, setUserToken, updateAssetDescription, updateEntity, updateFolder, updateGroupDescription, updateSourceFileDetails, updateUser, uploadSourceFiles };
629
765
  //# sourceMappingURL=index.esm.js.map