@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
|
@@ -1,189 +1,213 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@shapediver/sdk.geometry-api-sdk-core"
|
|
7
|
-
import { encodeBase64, sendRequest } from "../utils/utils"
|
|
8
|
-
|
|
9
|
-
const apiAssetExportUri = /.+\/session\/.+\/export
|
|
10
|
-
const apiAssetOutputUri = /.+\/session\/.+\/output
|
|
11
|
-
const apiAssetTextureUri = /.+\/session\/.+\/texture
|
|
12
|
-
|
|
13
|
-
const cdnAssetUri = /.+\/cdn-asset-(exports|outputs|textures)
|
|
14
|
-
const cdnAssetExportUri = /.+\/cdn-asset-exports
|
|
15
|
-
const cdnAssetOutputUri = /.+\/cdn-asset-outputs
|
|
16
|
-
const cdnAssetTextureUri = /.+\/cdn-asset-textures
|
|
2
|
+
BaseResourceApi,
|
|
3
|
+
ShapeDiverError,
|
|
4
|
+
ShapeDiverSdkApi,
|
|
5
|
+
ShapeDiverSdkApiResponseType,
|
|
6
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
7
|
+
import { encodeBase64, sendRequest } from "../utils/utils";
|
|
8
|
+
|
|
9
|
+
const apiAssetExportUri = /.+\/session\/.+\/export\/.+/;
|
|
10
|
+
const apiAssetOutputUri = /.+\/session\/.+\/output\/.+/;
|
|
11
|
+
const apiAssetTextureUri = /.+\/session\/.+\/texture\/.+/;
|
|
12
|
+
|
|
13
|
+
const cdnAssetUri = /.+\/cdn-asset-(exports|outputs|textures)\/.+/;
|
|
14
|
+
const cdnAssetExportUri = /.+\/cdn-asset-exports\/.+/;
|
|
15
|
+
const cdnAssetOutputUri = /.+\/cdn-asset-outputs\/.+/;
|
|
16
|
+
const cdnAssetTextureUri = /.+\/cdn-asset-textures\/.+/;
|
|
17
17
|
|
|
18
18
|
export class ShapeDiverAssetApi extends BaseResourceApi {
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*
|
|
163
|
-
* @param url - The URL of the asset that should be fetched.
|
|
164
|
-
* @returns Array of size 3: [0] = content data, [1] = content type, [2] = asset type.
|
|
165
|
-
* @throws {@link ShapeDiverError} when the given URL is not a valid ShapeDiver asset URL.
|
|
166
|
-
*/
|
|
167
|
-
async getAsset (url: string): Promise<[ ArrayBuffer, string, "output" | "export" | "texture" ]> {
|
|
168
|
-
let type: "output" | "export" | "texture"
|
|
169
|
-
|
|
170
|
-
// Check if the given URL is a valid API or CDN asset URL
|
|
171
|
-
if (apiAssetExportUri.test(url) || cdnAssetExportUri.test(url)) type = "export"
|
|
172
|
-
else if (apiAssetOutputUri.test(url) || cdnAssetOutputUri.test(url)) type = "output"
|
|
173
|
-
else if (apiAssetTextureUri.test(url) || cdnAssetTextureUri.test(url)) type = "texture"
|
|
174
|
-
else throw new ShapeDiverError("Cannot fetch asset: Invalid URL (only ShapeDiver asset URLs are allowed).")
|
|
175
|
-
|
|
176
|
-
return await sendRequest(async () => {
|
|
177
|
-
const [ header, data ] = await this.api.get<ArrayBuffer>(
|
|
178
|
-
url,
|
|
179
|
-
{
|
|
180
|
-
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
181
|
-
disableAuthorization: cdnAssetUri.test(url), // disable for CDN URLs
|
|
182
|
-
},
|
|
183
|
-
)
|
|
184
|
-
const contentType = header["Content-Type"] ?? header["content-type"]
|
|
185
|
-
return [ data, contentType, type ]
|
|
186
|
-
})
|
|
19
|
+
constructor(api: ShapeDiverSdkApi) {
|
|
20
|
+
super(api);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Download an export.
|
|
25
|
+
*
|
|
26
|
+
* @param sessionId
|
|
27
|
+
* @param assetData
|
|
28
|
+
*/
|
|
29
|
+
async getExport(
|
|
30
|
+
sessionId: string,
|
|
31
|
+
assetData: string,
|
|
32
|
+
): Promise<[ArrayBuffer, string]> {
|
|
33
|
+
return await sendRequest(async () => {
|
|
34
|
+
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
35
|
+
`${this.buildSessionUri(sessionId)}/export/${assetData}`,
|
|
36
|
+
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
37
|
+
);
|
|
38
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
39
|
+
return [data, contentType];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Download an output.
|
|
45
|
+
*
|
|
46
|
+
* @param sessionId
|
|
47
|
+
* @param assetData
|
|
48
|
+
*/
|
|
49
|
+
async getOutput(
|
|
50
|
+
sessionId: string,
|
|
51
|
+
assetData: string,
|
|
52
|
+
): Promise<[ArrayBuffer, string]> {
|
|
53
|
+
return await sendRequest(async () => {
|
|
54
|
+
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
55
|
+
`${this.buildSessionUri(sessionId)}/output/${assetData}`,
|
|
56
|
+
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
57
|
+
);
|
|
58
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
59
|
+
return [data, contentType];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Downloads the JSON content part of a sdTF output.
|
|
65
|
+
*
|
|
66
|
+
* @param sessionId
|
|
67
|
+
* @param assetData
|
|
68
|
+
*/
|
|
69
|
+
async getSdtfJsonContent(
|
|
70
|
+
sessionId: string,
|
|
71
|
+
assetData: string,
|
|
72
|
+
): Promise<Record<string, any>> {
|
|
73
|
+
return await sendRequest(
|
|
74
|
+
async () =>
|
|
75
|
+
(
|
|
76
|
+
await this.api.get<ArrayBuffer>(
|
|
77
|
+
`${this.buildSessionUri(sessionId)}/output/${assetData}`,
|
|
78
|
+
{
|
|
79
|
+
responseType: ShapeDiverSdkApiResponseType.JSON,
|
|
80
|
+
accept: "model/vnd.sdtf+json",
|
|
81
|
+
},
|
|
82
|
+
)
|
|
83
|
+
)[1],
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Download a texture file.
|
|
89
|
+
*
|
|
90
|
+
* @param sessionId
|
|
91
|
+
* @param assetData
|
|
92
|
+
*/
|
|
93
|
+
async getTexture(
|
|
94
|
+
sessionId: string,
|
|
95
|
+
assetData: string,
|
|
96
|
+
): Promise<[ArrayBuffer, string]> {
|
|
97
|
+
return await sendRequest(async () => {
|
|
98
|
+
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
99
|
+
`${this.buildSessionUri(sessionId)}/texture/${assetData}`,
|
|
100
|
+
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
101
|
+
);
|
|
102
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
103
|
+
return [data, contentType];
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Download a glTF file.
|
|
109
|
+
*
|
|
110
|
+
* @param sessionId
|
|
111
|
+
* @param assetData
|
|
112
|
+
*/
|
|
113
|
+
async getGltf(sessionId: string, assetData: string): Promise<ArrayBuffer> {
|
|
114
|
+
return await sendRequest(
|
|
115
|
+
async () =>
|
|
116
|
+
(
|
|
117
|
+
await this.api.get<ArrayBuffer>(
|
|
118
|
+
`${this.buildSessionUri(sessionId)}/gltf/${assetData}`,
|
|
119
|
+
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
120
|
+
)
|
|
121
|
+
)[1],
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Download a USDZ file.
|
|
127
|
+
*
|
|
128
|
+
* @param sessionId
|
|
129
|
+
* @param assetData
|
|
130
|
+
*/
|
|
131
|
+
async getUsdz(sessionId: string, assetData: string): Promise<ArrayBuffer> {
|
|
132
|
+
return await sendRequest(
|
|
133
|
+
async () =>
|
|
134
|
+
(
|
|
135
|
+
await this.api.get<ArrayBuffer>(
|
|
136
|
+
`${this.buildSessionUri(sessionId)}/usdz/${assetData}`,
|
|
137
|
+
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
138
|
+
)
|
|
139
|
+
)[1],
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Download an image.
|
|
145
|
+
*
|
|
146
|
+
* @param sessionId
|
|
147
|
+
* @param url - The URL of the image that should be downloaded.
|
|
148
|
+
* @returns Array of size 2: [0] = content data, [1] = content type.
|
|
149
|
+
*/
|
|
150
|
+
async downloadImage(
|
|
151
|
+
sessionId: string,
|
|
152
|
+
url: string,
|
|
153
|
+
): Promise<[ArrayBuffer, string]> {
|
|
154
|
+
let targetUrl: string;
|
|
155
|
+
|
|
156
|
+
if (apiAssetTextureUri.test(url) || cdnAssetTextureUri.test(url)) {
|
|
157
|
+
// Call ShapeDiver texture-asset URLs directly
|
|
158
|
+
targetUrl = url;
|
|
159
|
+
} else {
|
|
160
|
+
// All other source URLs are called via the download-image endpoint
|
|
161
|
+
targetUrl = `${this.buildSessionUri(sessionId)}/image?url=${encodeBase64(url)}`;
|
|
187
162
|
}
|
|
188
163
|
|
|
164
|
+
return await sendRequest(async () => {
|
|
165
|
+
const [header, data] = await this.api.get<ArrayBuffer>(targetUrl, {
|
|
166
|
+
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
167
|
+
disableAuthorization: cdnAssetUri.test(url), // disable for CDN URLs
|
|
168
|
+
});
|
|
169
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
170
|
+
return [data, contentType];
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Fetches a ShapeDiver asset of the following types:
|
|
176
|
+
* * Output
|
|
177
|
+
* * Export
|
|
178
|
+
* * Texture
|
|
179
|
+
*
|
|
180
|
+
* This function works similar to {@link getOutput}, {@link getExport} and {@link getTexture}, but does not require
|
|
181
|
+
* extracted _session ID_ and _asset data_ parameters.
|
|
182
|
+
*
|
|
183
|
+
* @param url - The URL of the asset that should be fetched.
|
|
184
|
+
* @returns Array of size 3: [0] = content data, [1] = content type, [2] = asset type.
|
|
185
|
+
* @throws {@link ShapeDiverError} when the given URL is not a valid ShapeDiver asset URL.
|
|
186
|
+
*/
|
|
187
|
+
async getAsset(
|
|
188
|
+
url: string,
|
|
189
|
+
): Promise<[ArrayBuffer, string, "output" | "export" | "texture"]> {
|
|
190
|
+
let type: "output" | "export" | "texture";
|
|
191
|
+
|
|
192
|
+
// Check if the given URL is a valid API or CDN asset URL
|
|
193
|
+
if (apiAssetExportUri.test(url) || cdnAssetExportUri.test(url))
|
|
194
|
+
type = "export";
|
|
195
|
+
else if (apiAssetOutputUri.test(url) || cdnAssetOutputUri.test(url))
|
|
196
|
+
type = "output";
|
|
197
|
+
else if (apiAssetTextureUri.test(url) || cdnAssetTextureUri.test(url))
|
|
198
|
+
type = "texture";
|
|
199
|
+
else
|
|
200
|
+
throw new ShapeDiverError(
|
|
201
|
+
"Cannot fetch asset: Invalid URL (only ShapeDiver asset URLs are allowed).",
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
return await sendRequest(async () => {
|
|
205
|
+
const [header, data] = await this.api.get<ArrayBuffer>(url, {
|
|
206
|
+
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
207
|
+
disableAuthorization: cdnAssetUri.test(url), // disable for CDN URLs
|
|
208
|
+
});
|
|
209
|
+
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
210
|
+
return [data, contentType, type];
|
|
211
|
+
});
|
|
212
|
+
}
|
|
189
213
|
}
|
|
@@ -1,85 +1,100 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@shapediver/api.geometry-api-dto-v2"
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
ShapeDiverRequestCache,
|
|
3
|
+
ShapeDiverRequestExport,
|
|
4
|
+
ShapeDiverRequestExportDefinition,
|
|
5
|
+
ShapeDiverResponseDto,
|
|
6
|
+
} from "@shapediver/api.geometry-api-dto-v2";
|
|
7
|
+
import {
|
|
8
|
+
BaseResourceApi,
|
|
9
|
+
ShapeDiverSdkApi,
|
|
10
|
+
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
11
|
+
import { sendRequest } from "../utils/utils";
|
|
9
12
|
|
|
10
13
|
export class ShapeDiverExportApi extends BaseResourceApi {
|
|
14
|
+
constructor(api: ShapeDiverSdkApi) {
|
|
15
|
+
super(api);
|
|
16
|
+
}
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Check if a specific version of a requested export has been computed yet.
|
|
36
|
-
*
|
|
37
|
-
* @param sessionId
|
|
38
|
-
* @param body
|
|
39
|
-
*/
|
|
40
|
-
async getCache(
|
|
41
|
-
sessionId: string,
|
|
42
|
-
body: ShapeDiverRequestCache | ShapeDiverRequestExport,
|
|
43
|
-
): Promise<ShapeDiverResponseDto> {
|
|
44
|
-
return await sendRequest(async () =>
|
|
45
|
-
(await this.api.put<ShapeDiverResponseDto>(
|
|
46
|
-
this.buildSessionUri(sessionId) + "/export/cache",
|
|
47
|
-
body,
|
|
48
|
-
))[1],
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Updates the definitions of the given exports.
|
|
54
|
-
*
|
|
55
|
-
* @param modelId
|
|
56
|
-
* @param body
|
|
57
|
-
*/
|
|
58
|
-
async updateDefinitions(
|
|
59
|
-
modelId: string,
|
|
60
|
-
body: ShapeDiverRequestExportDefinition,
|
|
61
|
-
): Promise<ShapeDiverResponseDto> {
|
|
62
|
-
return await sendRequest(async () =>
|
|
63
|
-
(await this.api.patch<ShapeDiverResponseDto>(
|
|
64
|
-
this.buildModelUri(modelId) + "/export",
|
|
65
|
-
body,
|
|
66
|
-
))[1],
|
|
67
|
-
)
|
|
68
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Request a specific version of an export.
|
|
20
|
+
*
|
|
21
|
+
* @param sessionId
|
|
22
|
+
* @param body
|
|
23
|
+
*/
|
|
24
|
+
async compute(
|
|
25
|
+
sessionId: string,
|
|
26
|
+
body: ShapeDiverRequestExport,
|
|
27
|
+
): Promise<ShapeDiverResponseDto> {
|
|
28
|
+
return await sendRequest(
|
|
29
|
+
async () =>
|
|
30
|
+
(
|
|
31
|
+
await this.api.put<ShapeDiverResponseDto>(
|
|
32
|
+
this.buildSessionUri(sessionId) + "/export",
|
|
33
|
+
body,
|
|
34
|
+
)
|
|
35
|
+
)[1],
|
|
36
|
+
);
|
|
37
|
+
}
|
|
69
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Check if a specific version of a requested export has been computed yet.
|
|
41
|
+
*
|
|
42
|
+
* @param sessionId
|
|
43
|
+
* @param body
|
|
44
|
+
*/
|
|
45
|
+
async getCache(
|
|
46
|
+
sessionId: string,
|
|
47
|
+
body: ShapeDiverRequestCache | ShapeDiverRequestExport,
|
|
48
|
+
): Promise<ShapeDiverResponseDto> {
|
|
49
|
+
return await sendRequest(
|
|
50
|
+
async () =>
|
|
51
|
+
(
|
|
52
|
+
await this.api.put<ShapeDiverResponseDto>(
|
|
53
|
+
this.buildSessionUri(sessionId) + "/export/cache",
|
|
54
|
+
body,
|
|
55
|
+
)
|
|
56
|
+
)[1],
|
|
57
|
+
);
|
|
58
|
+
}
|
|
70
59
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Updates the definitions of the given exports.
|
|
62
|
+
*
|
|
63
|
+
* @param modelId
|
|
64
|
+
* @param body
|
|
65
|
+
*/
|
|
66
|
+
async updateDefinitions(
|
|
67
|
+
modelId: string,
|
|
68
|
+
body: ShapeDiverRequestExportDefinition,
|
|
69
|
+
): Promise<ShapeDiverResponseDto> {
|
|
70
|
+
return await sendRequest(
|
|
71
|
+
async () =>
|
|
72
|
+
(
|
|
73
|
+
await this.api.patch<ShapeDiverResponseDto>(
|
|
74
|
+
this.buildModelUri(modelId) + "/export",
|
|
75
|
+
body,
|
|
76
|
+
)
|
|
77
|
+
)[1],
|
|
78
|
+
);
|
|
79
|
+
}
|
|
84
80
|
|
|
81
|
+
/**
|
|
82
|
+
* List all cached versions of the specified export.
|
|
83
|
+
*
|
|
84
|
+
* @param sessionId
|
|
85
|
+
* @param exportId
|
|
86
|
+
*/
|
|
87
|
+
async listVersions(
|
|
88
|
+
sessionId: string,
|
|
89
|
+
exportId: string,
|
|
90
|
+
): Promise<ShapeDiverResponseDto> {
|
|
91
|
+
return await sendRequest(
|
|
92
|
+
async () =>
|
|
93
|
+
(
|
|
94
|
+
await this.api.get<ShapeDiverResponseDto>(
|
|
95
|
+
this.buildSessionUri(sessionId) + "/export/" + exportId + "/list",
|
|
96
|
+
)
|
|
97
|
+
)[1],
|
|
98
|
+
);
|
|
99
|
+
}
|
|
85
100
|
}
|