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