@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.
Files changed (67) hide show
  1. package/dist/ShapeDiverErrors.d.ts.map +1 -1
  2. package/dist/ShapeDiverErrors.js +1 -1
  3. package/dist/ShapeDiverErrors.js.map +1 -1
  4. package/dist/ShapeDiverSdk.d.ts.map +1 -1
  5. package/dist/ShapeDiverSdk.js.map +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/resources/ShapeDiverAnalyticsApi.d.ts.map +1 -1
  10. package/dist/resources/ShapeDiverAnalyticsApi.js +3 -1
  11. package/dist/resources/ShapeDiverAnalyticsApi.js.map +1 -1
  12. package/dist/resources/ShapeDiverArSceneApi.d.ts.map +1 -1
  13. package/dist/resources/ShapeDiverArSceneApi.js.map +1 -1
  14. package/dist/resources/ShapeDiverAssetApi.d.ts.map +1 -1
  15. package/dist/resources/ShapeDiverAssetApi.js.map +1 -1
  16. package/dist/resources/ShapeDiverExportApi.d.ts.map +1 -1
  17. package/dist/resources/ShapeDiverExportApi.js.map +1 -1
  18. package/dist/resources/ShapeDiverFileApi.d.ts.map +1 -1
  19. package/dist/resources/ShapeDiverFileApi.js +10 -7
  20. package/dist/resources/ShapeDiverFileApi.js.map +1 -1
  21. package/dist/resources/ShapeDiverGltfApi.d.ts.map +1 -1
  22. package/dist/resources/ShapeDiverGltfApi.js +4 -1
  23. package/dist/resources/ShapeDiverGltfApi.js.map +1 -1
  24. package/dist/resources/ShapeDiverModelApi.d.ts.map +1 -1
  25. package/dist/resources/ShapeDiverModelApi.js +52 -15
  26. package/dist/resources/ShapeDiverModelApi.js.map +1 -1
  27. package/dist/resources/ShapeDiverOutputApi.d.ts.map +1 -1
  28. package/dist/resources/ShapeDiverOutputApi.js +12 -4
  29. package/dist/resources/ShapeDiverOutputApi.js.map +1 -1
  30. package/dist/resources/ShapeDiverSdtfApi.d.ts.map +1 -1
  31. package/dist/resources/ShapeDiverSdtfApi.js +9 -3
  32. package/dist/resources/ShapeDiverSdtfApi.js.map +1 -1
  33. package/dist/resources/ShapeDiverSessionApi.d.ts.map +1 -1
  34. package/dist/resources/ShapeDiverSessionApi.js +3 -1
  35. package/dist/resources/ShapeDiverSessionApi.js.map +1 -1
  36. package/dist/resources/ShapeDiverSystemApi.d.ts.map +1 -1
  37. package/dist/resources/ShapeDiverSystemApi.js +18 -6
  38. package/dist/resources/ShapeDiverSystemApi.js.map +1 -1
  39. package/dist/resources/ShapeDiverTextureApi.d.ts.map +1 -1
  40. package/dist/resources/ShapeDiverTextureApi.js +3 -1
  41. package/dist/resources/ShapeDiverTextureApi.js.map +1 -1
  42. package/dist/resources/ShapeDiverUtilsApi.d.ts +3 -5
  43. package/dist/resources/ShapeDiverUtilsApi.d.ts.map +1 -1
  44. package/dist/resources/ShapeDiverUtilsApi.js +31 -15
  45. package/dist/resources/ShapeDiverUtilsApi.js.map +1 -1
  46. package/dist/utils/utils.d.ts +1 -1
  47. package/dist/utils/utils.d.ts.map +1 -1
  48. package/dist/utils/utils.js +9 -9
  49. package/dist/utils/utils.js.map +1 -1
  50. package/package.json +4 -2
  51. package/src/ShapeDiverErrors.ts +24 -23
  52. package/src/ShapeDiverSdk.ts +110 -109
  53. package/src/index.ts +15 -16
  54. package/src/resources/ShapeDiverAnalyticsApi.ts +30 -18
  55. package/src/resources/ShapeDiverArSceneApi.ts +68 -69
  56. package/src/resources/ShapeDiverAssetApi.ts +207 -183
  57. package/src/resources/ShapeDiverExportApi.ts +92 -77
  58. package/src/resources/ShapeDiverFileApi.ts +136 -108
  59. package/src/resources/ShapeDiverGltfApi.ts +41 -30
  60. package/src/resources/ShapeDiverModelApi.ts +351 -240
  61. package/src/resources/ShapeDiverOutputApi.ts +92 -56
  62. package/src/resources/ShapeDiverSdtfApi.ts +88 -54
  63. package/src/resources/ShapeDiverSessionApi.ts +104 -82
  64. package/src/resources/ShapeDiverSystemApi.ts +106 -70
  65. package/src/resources/ShapeDiverTextureApi.ts +24 -18
  66. package/src/resources/ShapeDiverUtilsApi.ts +290 -231
  67. package/src/utils/utils.ts +61 -53
@@ -1,189 +1,213 @@
1
1
  import {
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\/.+/
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
- constructor (api: ShapeDiverSdkApi) {
21
- super(api)
22
- }
23
-
24
- /**
25
- * Download an export.
26
- *
27
- * @param sessionId
28
- * @param assetData
29
- */
30
- async getExport (sessionId: string, assetData: string): Promise<[ ArrayBuffer, string ]> {
31
- return await sendRequest(async () => {
32
- const [ header, data ] = await this.api.get<ArrayBuffer>(
33
- `${ this.buildSessionUri(sessionId) }/export/${ assetData }`,
34
- { responseType: ShapeDiverSdkApiResponseType.DATA },
35
- )
36
- const contentType = header["Content-Type"] ?? header["content-type"]
37
- return [ data, contentType ]
38
- })
39
- }
40
-
41
- /**
42
- * Download an output.
43
- *
44
- * @param sessionId
45
- * @param assetData
46
- */
47
- async getOutput (sessionId: string, assetData: string): Promise<[ ArrayBuffer, string ]> {
48
- return await sendRequest(async () => {
49
- const [ header, data ] = await this.api.get<ArrayBuffer>(
50
- `${ this.buildSessionUri(sessionId) }/output/${ assetData }`,
51
- { responseType: ShapeDiverSdkApiResponseType.DATA },
52
- )
53
- const contentType = header["Content-Type"] ?? header["content-type"]
54
- return [ data, contentType ]
55
- })
56
- }
57
-
58
- /**
59
- * Downloads the JSON content part of a sdTF output.
60
- *
61
- * @param sessionId
62
- * @param assetData
63
- */
64
- async getSdtfJsonContent (sessionId: string, assetData: string): Promise<Record<string, any>> {
65
- return await sendRequest(async () =>
66
- (await this.api.get<ArrayBuffer>(
67
- `${ this.buildSessionUri(sessionId) }/output/${ assetData }`,
68
- {
69
- responseType: ShapeDiverSdkApiResponseType.JSON,
70
- accept: "model/vnd.sdtf+json",
71
- },
72
- ))[1],
73
- )
74
- }
75
-
76
- /**
77
- * Download a texture file.
78
- *
79
- * @param sessionId
80
- * @param assetData
81
- */
82
- async getTexture (sessionId: string, assetData: string): Promise<[ ArrayBuffer, string ]> {
83
- return await sendRequest(async () => {
84
- const [ header, data ] = await this.api.get<ArrayBuffer>(
85
- `${ this.buildSessionUri(sessionId) }/texture/${ assetData }`,
86
- { responseType: ShapeDiverSdkApiResponseType.DATA },
87
- )
88
- const contentType = header["Content-Type"] ?? header["content-type"]
89
- return [ data, contentType ]
90
- })
91
- }
92
-
93
- /**
94
- * Download a glTF file.
95
- *
96
- * @param sessionId
97
- * @param assetData
98
- */
99
- async getGltf (sessionId: string, assetData: string): Promise<ArrayBuffer> {
100
- return await sendRequest(async () =>
101
- (await this.api.get<ArrayBuffer>(
102
- `${ this.buildSessionUri(sessionId) }/gltf/${ assetData }`,
103
- { responseType: ShapeDiverSdkApiResponseType.DATA },
104
- ))[1],
105
- )
106
- }
107
-
108
- /**
109
- * Download a USDZ file.
110
- *
111
- * @param sessionId
112
- * @param assetData
113
- */
114
- async getUsdz (sessionId: string, assetData: string): Promise<ArrayBuffer> {
115
- return await sendRequest(async () =>
116
- (await this.api.get<ArrayBuffer>(
117
- `${ this.buildSessionUri(sessionId) }/usdz/${ assetData }`,
118
- { responseType: ShapeDiverSdkApiResponseType.DATA },
119
- ))[1],
120
- )
121
- }
122
-
123
- /**
124
- * Download an image.
125
- *
126
- * @param sessionId
127
- * @param url - The URL of the image that should be downloaded.
128
- * @returns Array of size 2: [0] = content data, [1] = content type.
129
- */
130
- async downloadImage (sessionId: string, url: string): Promise<[ ArrayBuffer, string ]> {
131
- let targetUrl: string
132
-
133
- if (apiAssetTextureUri.test(url) || cdnAssetTextureUri.test(url)) {
134
- // Call ShapeDiver texture-asset URLs directly
135
- targetUrl = url
136
- } else {
137
- // All other source URLs are called via the download-image endpoint
138
- targetUrl = `${ this.buildSessionUri(sessionId) }/image?url=${ encodeBase64(url) }`
139
- }
140
-
141
- return await sendRequest(async () => {
142
- const [ header, data ] = await this.api.get<ArrayBuffer>(
143
- targetUrl,
144
- {
145
- responseType: ShapeDiverSdkApiResponseType.DATA,
146
- disableAuthorization: cdnAssetUri.test(url), // disable for CDN URLs
147
- },
148
- )
149
- const contentType = header["Content-Type"] ?? header["content-type"]
150
- return [ data, contentType ]
151
- })
152
- }
153
-
154
- /**
155
- * Fetches a ShapeDiver asset of the following types:
156
- * * Output
157
- * * Export
158
- * * Texture
159
- *
160
- * This function works similar to {@link getOutput}, {@link getExport} and {@link getTexture}, but does not require
161
- * extracted _session ID_ and _asset data_ parameters.
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
- ShapeDiverRequestCache,
3
- ShapeDiverRequestExport,
4
- ShapeDiverRequestExportDefinition,
5
- ShapeDiverResponseDto,
6
- } from "@shapediver/api.geometry-api-dto-v2"
7
- import { BaseResourceApi, ShapeDiverSdkApi } from "@shapediver/sdk.geometry-api-sdk-core"
8
- import { sendRequest } from "../utils/utils"
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
- constructor(api: ShapeDiverSdkApi) {
13
- super(api)
14
- }
15
-
16
- /**
17
- * Request a specific version of an export.
18
- *
19
- * @param sessionId
20
- * @param body
21
- */
22
- async compute(
23
- sessionId: string,
24
- body: ShapeDiverRequestExport,
25
- ): Promise<ShapeDiverResponseDto> {
26
- return await sendRequest(async () =>
27
- (await this.api.put<ShapeDiverResponseDto>(
28
- this.buildSessionUri(sessionId) + "/export",
29
- body,
30
- ))[1],
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
- * List all cached versions of the specified export.
73
- *
74
- * @param sessionId
75
- * @param exportId
76
- */
77
- async listVersions(sessionId: string, exportId: string): Promise<ShapeDiverResponseDto> {
78
- return await sendRequest(async () =>
79
- (await this.api.get<ShapeDiverResponseDto>(
80
- this.buildSessionUri(sessionId) + "/export/" + exportId + "/list"
81
- ))[1],
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
  }