@shapediver/sdk.geometry-api-sdk-v2 1.8.3 → 1.9.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/ShapeDiverErrors.d.ts.map +1 -1
- package/dist/ShapeDiverErrors.js +1 -1
- package/dist/ShapeDiverErrors.js.map +1 -1
- package/dist/ShapeDiverSdk.d.ts.map +1 -1
- package/dist/ShapeDiverSdk.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/ShapeDiverAnalyticsApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverAnalyticsApi.js +3 -1
- package/dist/resources/ShapeDiverAnalyticsApi.js.map +1 -1
- package/dist/resources/ShapeDiverArSceneApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverArSceneApi.js.map +1 -1
- package/dist/resources/ShapeDiverAssetApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverAssetApi.js.map +1 -1
- package/dist/resources/ShapeDiverExportApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverExportApi.js.map +1 -1
- package/dist/resources/ShapeDiverFileApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverFileApi.js +10 -7
- package/dist/resources/ShapeDiverFileApi.js.map +1 -1
- package/dist/resources/ShapeDiverGltfApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverGltfApi.js +4 -1
- package/dist/resources/ShapeDiverGltfApi.js.map +1 -1
- package/dist/resources/ShapeDiverModelApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverModelApi.js +52 -15
- package/dist/resources/ShapeDiverModelApi.js.map +1 -1
- package/dist/resources/ShapeDiverOutputApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverOutputApi.js +12 -4
- package/dist/resources/ShapeDiverOutputApi.js.map +1 -1
- package/dist/resources/ShapeDiverSdtfApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverSdtfApi.js +9 -3
- package/dist/resources/ShapeDiverSdtfApi.js.map +1 -1
- package/dist/resources/ShapeDiverSessionApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverSessionApi.js +3 -1
- package/dist/resources/ShapeDiverSessionApi.js.map +1 -1
- package/dist/resources/ShapeDiverSystemApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverSystemApi.js +18 -6
- package/dist/resources/ShapeDiverSystemApi.js.map +1 -1
- package/dist/resources/ShapeDiverTextureApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverTextureApi.js +3 -1
- package/dist/resources/ShapeDiverTextureApi.js.map +1 -1
- package/dist/resources/ShapeDiverUtilsApi.d.ts +3 -5
- package/dist/resources/ShapeDiverUtilsApi.d.ts.map +1 -1
- package/dist/resources/ShapeDiverUtilsApi.js +31 -15
- package/dist/resources/ShapeDiverUtilsApi.js.map +1 -1
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +9 -9
- package/dist/utils/utils.js.map +1 -1
- package/package.json +4 -2
- package/src/ShapeDiverErrors.ts +24 -23
- package/src/ShapeDiverSdk.ts +110 -109
- package/src/index.ts +15 -16
- package/src/resources/ShapeDiverAnalyticsApi.ts +30 -18
- package/src/resources/ShapeDiverArSceneApi.ts +68 -69
- package/src/resources/ShapeDiverAssetApi.ts +207 -183
- package/src/resources/ShapeDiverExportApi.ts +92 -77
- package/src/resources/ShapeDiverFileApi.ts +136 -108
- package/src/resources/ShapeDiverGltfApi.ts +41 -30
- package/src/resources/ShapeDiverModelApi.ts +351 -240
- package/src/resources/ShapeDiverOutputApi.ts +92 -56
- package/src/resources/ShapeDiverSdtfApi.ts +88 -54
- package/src/resources/ShapeDiverSessionApi.ts +104 -82
- package/src/resources/ShapeDiverSystemApi.ts +106 -70
- package/src/resources/ShapeDiverTextureApi.ts +24 -18
- package/src/resources/ShapeDiverUtilsApi.ts +290 -231
- package/src/utils/utils.ts +61 -53
package/src/ShapeDiverSdk.ts
CHANGED
|
@@ -1,113 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {
|
|
2
|
+
BaseShapeDiverSdk,
|
|
3
|
+
ShapeDiverSdkConfigType,
|
|
4
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
5
|
+
import { ShapeDiverAnalyticsApi } from "./resources/ShapeDiverAnalyticsApi";
|
|
6
|
+
import { ShapeDiverArSceneApi } from "./resources/ShapeDiverArSceneApi";
|
|
7
|
+
import { ShapeDiverAssetApi } from "./resources/ShapeDiverAssetApi";
|
|
8
|
+
import { ShapeDiverExportApi } from "./resources/ShapeDiverExportApi";
|
|
9
|
+
import { ShapeDiverFileApi } from "./resources/ShapeDiverFileApi";
|
|
10
|
+
import { ShapeDiverGltfApi } from "./resources/ShapeDiverGltfApi";
|
|
11
|
+
import { ShapeDiverModelApi } from "./resources/ShapeDiverModelApi";
|
|
12
|
+
import { ShapeDiverOutputApi } from "./resources/ShapeDiverOutputApi";
|
|
13
|
+
import { ShapeDiverSdtfApi } from "./resources/ShapeDiverSdtfApi";
|
|
14
|
+
import { ShapeDiverSessionApi } from "./resources/ShapeDiverSessionApi";
|
|
15
|
+
import { ShapeDiverSystemApi } from "./resources/ShapeDiverSystemApi";
|
|
16
|
+
import { ShapeDiverTextureApi } from "./resources/ShapeDiverTextureApi";
|
|
17
|
+
import { ShapeDiverUtilsApi } from "./resources/ShapeDiverUtilsApi";
|
|
18
|
+
|
|
19
|
+
export function create(baseUrl: string, jwt?: string): ShapeDiverSdk {
|
|
20
|
+
return new ShapeDiverSdk(baseUrl, jwt);
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export class ShapeDiverSdk extends BaseShapeDiverSdk {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
24
|
+
private readonly _analytics: ShapeDiverAnalyticsApi;
|
|
25
|
+
private readonly _arScene: ShapeDiverArSceneApi;
|
|
26
|
+
private readonly _asset: ShapeDiverAssetApi;
|
|
27
|
+
private readonly _export: ShapeDiverExportApi;
|
|
28
|
+
private readonly _file: ShapeDiverFileApi;
|
|
29
|
+
private readonly _gltf: ShapeDiverGltfApi;
|
|
30
|
+
private readonly _model: ShapeDiverModelApi;
|
|
31
|
+
private readonly _output: ShapeDiverOutputApi;
|
|
32
|
+
private readonly _sdtf: ShapeDiverSdtfApi;
|
|
33
|
+
private readonly _session: ShapeDiverSessionApi;
|
|
34
|
+
private readonly _system: ShapeDiverSystemApi;
|
|
35
|
+
private readonly _texture: ShapeDiverTextureApi;
|
|
36
|
+
private readonly _utils: ShapeDiverUtilsApi;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* ShapeDiverSDK constructor
|
|
40
|
+
*
|
|
41
|
+
* @param baseUrl - the URL of the target system
|
|
42
|
+
* @param jwt - the client's jwt
|
|
43
|
+
*/
|
|
44
|
+
constructor(baseUrl: string, jwt?: string) {
|
|
45
|
+
super(baseUrl);
|
|
46
|
+
if (jwt) this.setConfigurationValue(ShapeDiverSdkConfigType.JWT_TOKEN, jwt);
|
|
47
|
+
|
|
48
|
+
this._analytics = new ShapeDiverAnalyticsApi(this.sdkApi);
|
|
49
|
+
this._arScene = new ShapeDiverArSceneApi(this.sdkApi);
|
|
50
|
+
this._asset = new ShapeDiverAssetApi(this.sdkApi);
|
|
51
|
+
this._export = new ShapeDiverExportApi(this.sdkApi);
|
|
52
|
+
this._file = new ShapeDiverFileApi(this.sdkApi);
|
|
53
|
+
this._gltf = new ShapeDiverGltfApi(this.sdkApi);
|
|
54
|
+
this._model = new ShapeDiverModelApi(this.sdkApi);
|
|
55
|
+
this._output = new ShapeDiverOutputApi(this.sdkApi);
|
|
56
|
+
this._sdtf = new ShapeDiverSdtfApi(this.sdkApi);
|
|
57
|
+
this._session = new ShapeDiverSessionApi(this.sdkApi);
|
|
58
|
+
this._system = new ShapeDiverSystemApi(this.sdkApi);
|
|
59
|
+
this._texture = new ShapeDiverTextureApi(this.sdkApi);
|
|
60
|
+
this._utils = new ShapeDiverUtilsApi(this.sdkApi);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get analytics(): ShapeDiverAnalyticsApi {
|
|
64
|
+
return this._analytics;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get arScene(): ShapeDiverArSceneApi {
|
|
68
|
+
return this._arScene;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get asset(): ShapeDiverAssetApi {
|
|
72
|
+
return this._asset;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get export(): ShapeDiverExportApi {
|
|
76
|
+
return this._export;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get file(): ShapeDiverFileApi {
|
|
80
|
+
return this._file;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get gltf(): ShapeDiverGltfApi {
|
|
84
|
+
return this._gltf;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get model(): ShapeDiverModelApi {
|
|
88
|
+
return this._model;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get output(): ShapeDiverOutputApi {
|
|
92
|
+
return this._output;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get sdtf(): ShapeDiverSdtfApi {
|
|
96
|
+
return this._sdtf;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get session(): ShapeDiverSessionApi {
|
|
100
|
+
return this._session;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
get system(): ShapeDiverSystemApi {
|
|
104
|
+
return this._system;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
get texture(): ShapeDiverTextureApi {
|
|
108
|
+
return this._texture;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get utils(): ShapeDiverUtilsApi {
|
|
112
|
+
return this._utils;
|
|
113
|
+
}
|
|
113
114
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export * from "@shapediver/api.geometry-api-dto-v2"
|
|
1
|
+
export * from "@shapediver/api.geometry-api-dto-v2";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "@shapediver/sdk.geometry-api-sdk-core"
|
|
9
|
-
export { ShapeDiverResponseError } from "./ShapeDiverErrors"
|
|
10
|
-
export { ShapeDiverSdk, create } from "./ShapeDiverSdk"
|
|
11
|
-
export { ShapeDiverResponseFileInfo } from "./resources/ShapeDiverFileApi"
|
|
3
|
+
ShapeDiverError,
|
|
4
|
+
ShapeDiverRequestError,
|
|
5
|
+
ShapeDiverSdkApiResponseType,
|
|
6
|
+
ShapeDiverSdkConfig,
|
|
7
|
+
ShapeDiverSdkConfigType,
|
|
8
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
9
|
+
export { ShapeDiverResponseError } from "./ShapeDiverErrors";
|
|
10
|
+
export { ShapeDiverSdk, create } from "./ShapeDiverSdk";
|
|
11
|
+
export { ShapeDiverResponseFileInfo } from "./resources/ShapeDiverFileApi";
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "./utils/utils"
|
|
18
|
-
|
|
13
|
+
isGBError,
|
|
14
|
+
isGBGenericError,
|
|
15
|
+
isGBRequestError,
|
|
16
|
+
isGBResponseError,
|
|
17
|
+
} from "./utils/utils";
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ShapeDiverRequestAnalyticsModel,
|
|
3
|
+
ShapeDiverResponseDto,
|
|
4
|
+
} from "@shapediver/api.geometry-api-dto-v2";
|
|
5
|
+
import {
|
|
6
|
+
BaseResourceApi,
|
|
7
|
+
ShapeDiverSdkApi,
|
|
8
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
9
|
+
import { sendRequest } from "../utils/utils";
|
|
4
10
|
|
|
5
11
|
export class ShapeDiverAnalyticsApi extends BaseResourceApi {
|
|
12
|
+
constructor(api: ShapeDiverSdkApi) {
|
|
13
|
+
super(api);
|
|
14
|
+
}
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Get model session analytics.
|
|
18
|
+
*
|
|
19
|
+
* @param body
|
|
20
|
+
*/
|
|
21
|
+
async modelSessionStatistics(
|
|
22
|
+
body: ShapeDiverRequestAnalyticsModel,
|
|
23
|
+
): Promise<ShapeDiverResponseDto> {
|
|
24
|
+
return await sendRequest(
|
|
25
|
+
async () =>
|
|
26
|
+
(
|
|
27
|
+
await this.api.put<ShapeDiverResponseDto>(
|
|
28
|
+
this.buildAnalyticsUri() + "/session/model",
|
|
29
|
+
body,
|
|
30
|
+
)
|
|
31
|
+
)[1],
|
|
32
|
+
);
|
|
33
|
+
}
|
|
22
34
|
}
|
|
@@ -1,76 +1,75 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@shapediver/sdk.geometry-api-sdk-core"
|
|
7
|
-
import { sendRequest } from "../utils/utils"
|
|
2
|
+
BaseResourceApi,
|
|
3
|
+
ShapeDiverResponseError,
|
|
4
|
+
ShapeDiverSdkApi,
|
|
5
|
+
ShapeDiverSdkApiResponseType,
|
|
6
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
7
|
+
import { sendRequest } from "../utils/utils";
|
|
8
8
|
|
|
9
9
|
export class ShapeDiverArSceneApi extends BaseResourceApi {
|
|
10
|
+
constructor(api: ShapeDiverSdkApi) {
|
|
11
|
+
super(api);
|
|
12
|
+
}
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Checks the existence of the specific AR scene.
|
|
16
|
+
* @param sceneId
|
|
17
|
+
* @returns `true` when the AR scene exists, otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
async exists(sceneId: string): Promise<boolean> {
|
|
20
|
+
return await sendRequest(async () => {
|
|
21
|
+
try {
|
|
22
|
+
const [_, status] = await this.api.head(
|
|
23
|
+
`${this.buildArSceneUri()}/${sceneId}`,
|
|
24
|
+
{ disableAuthorization: true },
|
|
25
|
+
);
|
|
26
|
+
return status === 200;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
// A 404 HTTP status is returned when the AR scene was not found.
|
|
29
|
+
if (e instanceof ShapeDiverResponseError && e.status === 404)
|
|
30
|
+
return false;
|
|
31
|
+
else throw e;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Download the glTF file of the specified AR scene.
|
|
38
|
-
*
|
|
39
|
-
* @param sceneId - The ID of the AR scene.
|
|
40
|
-
* @returns Array of size 2: [0] = content data, [1] = content type
|
|
41
|
-
*/
|
|
42
|
-
async getGltf (sceneId: string): Promise<[ ArrayBuffer, string ]> {
|
|
43
|
-
return await sendRequest(async () => {
|
|
44
|
-
const [ header, data ] = await this.api.get<ArrayBuffer>(
|
|
45
|
-
`${ this.buildArSceneUri() }/${ sceneId }/gltf`,
|
|
46
|
-
{
|
|
47
|
-
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
48
|
-
disableAuthorization: true,
|
|
49
|
-
},
|
|
50
|
-
)
|
|
51
|
-
const contentType = header["Content-Type"] ?? header["content-type"]
|
|
52
|
-
return [ data, contentType ]
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Download the USDZ file of the specified AR scene.
|
|
58
|
-
*
|
|
59
|
-
* @param sceneId - The ID of the AR scene.
|
|
60
|
-
* @returns Array of size 2: [0] = content data, [1] = content type
|
|
61
|
-
*/
|
|
62
|
-
async getUsdz (sceneId: string): Promise<[ ArrayBuffer, string ]> {
|
|
63
|
-
return await sendRequest(async () => {
|
|
64
|
-
const [ header, data ] = await this.api.get<ArrayBuffer>(
|
|
65
|
-
`${ this.buildArSceneUri() }/${ sceneId }/usdz`,
|
|
66
|
-
{
|
|
67
|
-
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
68
|
-
disableAuthorization: true,
|
|
69
|
-
},
|
|
70
|
-
)
|
|
71
|
-
const contentType = header["Content-Type"] ?? header["content-type"]
|
|
72
|
-
return [ data, contentType ]
|
|
73
|
-
})
|
|
74
|
-
}
|
|
36
|
+
/**
|
|
37
|
+
* Download the glTF file of the specified AR scene.
|
|
38
|
+
*
|
|
39
|
+
* @param sceneId - The ID of the AR scene.
|
|
40
|
+
* @returns Array of size 2: [0] = content data, [1] = content type
|
|
41
|
+
*/
|
|
42
|
+
async getGltf(sceneId: string): Promise<[ArrayBuffer, string]> {
|
|
43
|
+
return await sendRequest(async () => {
|
|
44
|
+
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
45
|
+
`${this.buildArSceneUri()}/${sceneId}/gltf`,
|
|
46
|
+
{
|
|
47
|
+
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
48
|
+
disableAuthorization: true,
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
52
|
+
return [data, contentType];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
75
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Download the USDZ file of the specified AR scene.
|
|
58
|
+
*
|
|
59
|
+
* @param sceneId - The ID of the AR scene.
|
|
60
|
+
* @returns Array of size 2: [0] = content data, [1] = content type
|
|
61
|
+
*/
|
|
62
|
+
async getUsdz(sceneId: string): Promise<[ArrayBuffer, string]> {
|
|
63
|
+
return await sendRequest(async () => {
|
|
64
|
+
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
65
|
+
`${this.buildArSceneUri()}/${sceneId}/usdz`,
|
|
66
|
+
{
|
|
67
|
+
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
68
|
+
disableAuthorization: true,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
72
|
+
return [data, contentType];
|
|
73
|
+
});
|
|
74
|
+
}
|
|
76
75
|
}
|