@shapediver/sdk.geometry-api-sdk-v2 1.8.1 → 1.8.3

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.
@@ -0,0 +1,189 @@
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\/.+/
17
+
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
+ })
187
+ }
188
+
189
+ }
@@ -0,0 +1,85 @@
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"
9
+
10
+ export class ShapeDiverExportApi extends BaseResourceApi {
11
+
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
+ }
69
+
70
+
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
+ }
84
+
85
+ }
@@ -0,0 +1,123 @@
1
+ import { ShapeDiverRequestFileUpload, ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2"
2
+ import { BaseResourceApi, ShapeDiverSdkApi, ShapeDiverSdkApiResponseType } from "@shapediver/sdk.geometry-api-sdk-core"
3
+ import { sendRequest } from "../utils/utils"
4
+
5
+ export interface ShapeDiverResponseFileInfo {
6
+ filename?: string,
7
+ size?: number,
8
+ }
9
+
10
+ export class ShapeDiverFileApi extends BaseResourceApi {
11
+
12
+ constructor (api: ShapeDiverSdkApi) {
13
+ super(api)
14
+ }
15
+
16
+ /**
17
+ * List all file-assets of the given parameter.
18
+ *
19
+ * @param sessionId
20
+ * @param paramId
21
+ */
22
+ async list (sessionId: string, paramId: string): Promise<ShapeDiverResponseDto> {
23
+ return await sendRequest(async () =>
24
+ (await this.api.get<ShapeDiverResponseDto>(
25
+ `${ this.buildSessionUri(sessionId) }/file/${ paramId }/list`,
26
+ ))[1],
27
+ )
28
+ }
29
+
30
+ /**
31
+ * Get information about a file-asset of a parameter.
32
+ *
33
+ * @param sessionId
34
+ * @param paramId
35
+ */
36
+ async info (
37
+ sessionId: string,
38
+ paramId: string,
39
+ fileId: string,
40
+ ): Promise<ShapeDiverResponseFileInfo> {
41
+ return await sendRequest(async () => {
42
+ const headers = (await this.api.head(
43
+ `${ this.buildSessionUri(sessionId) }/file/${ paramId }/${ fileId }`,
44
+ ))[0]
45
+
46
+ const res: ShapeDiverResponseFileInfo = {
47
+ size: Number(headers.get("Content-Length") || headers.get("content-length")),
48
+ }
49
+
50
+ // Extract filename from Content-Disposition header if available
51
+ const contentDisposition = headers.get("Content-Disposition")
52
+ || headers.get("content-disposition")
53
+ if (
54
+ typeof contentDisposition === "string" &&
55
+ contentDisposition.indexOf("=") > 0
56
+ ) {
57
+ res.filename = contentDisposition
58
+ .split("=")[1] // Extract filename
59
+ .slice(1, -1) // remove leading and trailing double quotes
60
+ }
61
+
62
+ return res
63
+ })
64
+ }
65
+
66
+ /**
67
+ * Download a file-asset.
68
+ *
69
+ * @param sessionId
70
+ * @param paramId
71
+ * @param fileId
72
+ */
73
+ async get (
74
+ sessionId: string,
75
+ paramId: string,
76
+ fileId: string,
77
+ ): Promise<ArrayBuffer> {
78
+ return await sendRequest(async () =>
79
+ (await this.api.get<ArrayBuffer>(
80
+ `${ this.buildSessionUri(sessionId) }/file/${ paramId }/${ fileId }`,
81
+ { responseType: ShapeDiverSdkApiResponseType.DATA },
82
+ ))[1],
83
+ )
84
+ }
85
+
86
+ /**
87
+ * Delete a file-asset.
88
+ *
89
+ * @param sessionId
90
+ * @param paramId
91
+ * @param fileId
92
+ */
93
+ async delete (
94
+ sessionId: string,
95
+ paramId: string,
96
+ fileId: string,
97
+ ): Promise<ShapeDiverResponseDto> {
98
+ return await sendRequest(async () =>
99
+ (await this.api.delete<ShapeDiverResponseDto>(
100
+ `${ this.buildSessionUri(sessionId) }/file/${ paramId }/${ fileId }`,
101
+ ))[1],
102
+ )
103
+ }
104
+
105
+ /**
106
+ * Request an Upload-URL for a file.
107
+ *
108
+ * @param sessionId
109
+ * @param body
110
+ */
111
+ async requestUpload (
112
+ sessionId: string,
113
+ body: ShapeDiverRequestFileUpload,
114
+ ): Promise<ShapeDiverResponseDto> {
115
+ return await sendRequest(async () =>
116
+ (await this.api.post<ShapeDiverResponseDto>(
117
+ this.buildSessionUri(sessionId) + "/file/upload",
118
+ body
119
+ ))[1],
120
+ )
121
+ }
122
+
123
+ }
@@ -0,0 +1,34 @@
1
+ import { ShapeDiverRequestGltfUploadQueryConversion, ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2"
2
+ import { BaseResourceApi, ShapeDiverSdkApi, ShapeDiverSdkApiResponseType } from "@shapediver/sdk.geometry-api-sdk-core"
3
+ import { sendRequest } from "../utils/utils"
4
+
5
+ export class ShapeDiverGltfApi extends BaseResourceApi {
6
+
7
+ constructor (api: ShapeDiverSdkApi) {
8
+ super(api)
9
+ }
10
+
11
+ /**
12
+ * Upload a glTF file.
13
+ *
14
+ * @param sessionId
15
+ * @param body
16
+ * @param type
17
+ * @param queryConvert
18
+ */
19
+ async upload (
20
+ sessionId: string,
21
+ body: ArrayBuffer,
22
+ type: string,
23
+ queryConvert: ShapeDiverRequestGltfUploadQueryConversion = ShapeDiverRequestGltfUploadQueryConversion.NONE,
24
+ ): Promise<ShapeDiverResponseDto> {
25
+ return await sendRequest(async () =>
26
+ (await this.api.post<ShapeDiverResponseDto>(
27
+ `${ this.buildSessionUri(sessionId) }/gltf?conversion=${ queryConvert }`,
28
+ body,
29
+ { contentType: type, responseType: ShapeDiverSdkApiResponseType.JSON },
30
+ ))[1],
31
+ )
32
+ }
33
+
34
+ }
@@ -0,0 +1,246 @@
1
+ import {
2
+ ShapeDiverRequestConfigure,
3
+ ShapeDiverRequestCustomization,
4
+ ShapeDiverRequestModel,
5
+ ShapeDiverRequestModelComputationQueryOrder,
6
+ ShapeDiverRequestModelComputationQueryStatus,
7
+ ShapeDiverRequestModelComputationQueryType,
8
+ ShapeDiverRequestParameterDefinition,
9
+ ShapeDiverResponseDto,
10
+ } from "@shapediver/api.geometry-api-dto-v2"
11
+ import { BaseResourceApi, ShapeDiverSdkApi, ShapeDiverSdkApiResponseType } from "@shapediver/sdk.geometry-api-sdk-core"
12
+ import { sendRequest } from "../utils/utils"
13
+
14
+ export class ShapeDiverModelApi extends BaseResourceApi {
15
+
16
+ constructor (api: ShapeDiverSdkApi) {
17
+ super(api)
18
+ }
19
+
20
+ /**
21
+ * Get information about a ShapeDiver Model.
22
+ *
23
+ * @param modelId
24
+ */
25
+ async get (modelId: string): Promise<ShapeDiverResponseDto> {
26
+ return await sendRequest(async () =>
27
+ (await this.api.get<ShapeDiverResponseDto>(this.buildModelUri(modelId)))[1],
28
+ )
29
+ }
30
+
31
+ /**
32
+ * Create a new ShapeDiver Model.
33
+ *
34
+ * @param body
35
+ */
36
+ async create (body: ShapeDiverRequestModel): Promise<ShapeDiverResponseDto> {
37
+ return await sendRequest(async () =>
38
+ (await this.api.post<ShapeDiverResponseDto>(this.commonPath, body))[1],
39
+ )
40
+ }
41
+
42
+ /**
43
+ * Update properties of a ShapeDiver Model.
44
+ *
45
+ * @param modelId
46
+ * @param body
47
+ */
48
+ async update (modelId: string, body: ShapeDiverRequestModel): Promise<ShapeDiverResponseDto> {
49
+ return await sendRequest(async () =>
50
+ (await this.api.put<ShapeDiverResponseDto>(this.buildModelUri(modelId), body))[1],
51
+ )
52
+ }
53
+
54
+ /**
55
+ * Delete a ShapeDiver Model.
56
+ *
57
+ * @param modelId
58
+ */
59
+ async delete (modelId: string): Promise<ShapeDiverResponseDto> {
60
+ return await sendRequest(async () =>
61
+ (await this.api.delete<ShapeDiverResponseDto>(this.buildModelUri(modelId)))[1],
62
+ )
63
+ }
64
+
65
+ /**
66
+ * List models.
67
+ */
68
+ async list (): Promise<ShapeDiverResponseDto> {
69
+ return await sendRequest(async () =>
70
+ (await this.api.get<ShapeDiverResponseDto>(`${ this.commonPath }/list`))[1],
71
+ )
72
+ }
73
+
74
+ /**
75
+ * Get configurations of the viewer.
76
+ *
77
+ * @param modelId
78
+ */
79
+ async getConfig (modelId: string): Promise<ShapeDiverResponseDto> {
80
+ return await sendRequest(async () =>
81
+ (await this.api.get<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/config"))[1],
82
+ )
83
+ }
84
+
85
+ /**
86
+ * Create viewer configurations.
87
+ *
88
+ * @param modelId
89
+ * @param body
90
+ */
91
+ async createConfig (modelId: string, body: ShapeDiverRequestConfigure): Promise<ShapeDiverResponseDto> {
92
+ return await sendRequest(async () =>
93
+ (await this.api.post<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/config", body))[1],
94
+ )
95
+ }
96
+
97
+ /**
98
+ * Update viewer configurations.
99
+ *
100
+ * @param modelId
101
+ * @param body
102
+ */
103
+ async updateConfig (modelId: string, body: ShapeDiverRequestConfigure): Promise<ShapeDiverResponseDto> {
104
+ return await sendRequest(async () =>
105
+ (await this.api.patch<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/config", body))[1],
106
+ )
107
+ }
108
+
109
+ /**
110
+ * Download the Grasshopper file of the ShapeDiver Model.
111
+ *
112
+ * @param modelId
113
+ */
114
+ async getFile (modelId: string): Promise<ArrayBuffer> {
115
+ return await sendRequest(async () =>
116
+ (await this.api.get<ArrayBuffer>(
117
+ this.buildModelUri(modelId) + "/file/download",
118
+ { contentType: "application/json", responseType: ShapeDiverSdkApiResponseType.DATA },
119
+ ))[1],
120
+ )
121
+ }
122
+
123
+ /**
124
+ * Set the default parameters for the ShapeDiver Model.
125
+ *
126
+ * @param modelId
127
+ * @param body
128
+ */
129
+ async setDefaultParams (modelId: string, body: ShapeDiverRequestCustomization): Promise<ShapeDiverResponseDto> {
130
+ return await sendRequest(async () =>
131
+ (await this.api.patch<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/parameter/defval", body))[1],
132
+ )
133
+ }
134
+
135
+ /**
136
+ * Updates the definitions of the given parameters.
137
+ *
138
+ * @param modelId
139
+ * @param body
140
+ */
141
+ async updateParameterDefinitions (modelId: string, body: ShapeDiverRequestParameterDefinition): Promise<ShapeDiverResponseDto> {
142
+ return await sendRequest(async () =>
143
+ (await this.api.patch<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/parameter", body))[1],
144
+ )
145
+ }
146
+
147
+ /**
148
+ * Query model computation statistics.
149
+ *
150
+ * @param modelId
151
+ * @param timestampFrom - Timestamp to query from
152
+ * @param timestampTo - Timestamp to query to.
153
+ * @param limit - How many items to return at most.
154
+ * @param strictLimit - Whether the limit shall be attained (if there are enough items).
155
+ * @param order - Order in which to query computation stats items.
156
+ * @param status - Filter computations by the result status.
157
+ * @param type - Filter computations by type.
158
+ * @param offset - Continuation token for pagination.
159
+ */
160
+ async queryComputations (
161
+ modelId: string,
162
+ timestampFrom?: string,
163
+ timestampTo?: string,
164
+ limit?: number,
165
+ strictLimit?: boolean,
166
+ order?: ShapeDiverRequestModelComputationQueryOrder,
167
+ status?: ShapeDiverRequestModelComputationQueryStatus,
168
+ type?: ShapeDiverRequestModelComputationQueryType,
169
+ offset?: string,
170
+ ): Promise<ShapeDiverResponseDto> {
171
+ // Build queries
172
+ const queries: string[] = []
173
+ if (timestampFrom !== undefined) queries.push("timestamp_from=" + timestampFrom)
174
+ if (timestampTo !== undefined) queries.push("timestamp_to=" + timestampTo)
175
+ if (limit !== undefined) queries.push("limit=" + limit)
176
+ if (strictLimit !== undefined) queries.push("strict_limit=" + strictLimit)
177
+ if (order !== undefined) queries.push("order=" + order)
178
+ if (status !== undefined) queries.push("status=" + status)
179
+ if (type !== undefined) queries.push("type=" + type)
180
+ if (offset !== undefined) queries.push("offset=" + offset)
181
+
182
+ return await sendRequest(async () =>
183
+ (await this.api.get<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/computations?" + queries.join("&")))[1],
184
+ )
185
+ }
186
+
187
+ /**
188
+ * Delete all export components that have been last used at or before {@link untilLastSeen} timestamp.
189
+ *
190
+ * @param modelId
191
+ * @param untilLastSeen - Timestamp, inclusive limit.
192
+ * Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
193
+ * @example
194
+ * untilLastSeen = "20221104112923123"
195
+ * represents the date-time "2022-11-04T11:29:23.123"
196
+ */
197
+ async enqueueCleanupExports (modelId: string, untilLastSeen: string): Promise<ShapeDiverResponseDto> {
198
+ return await sendRequest(async () =>
199
+ (await this.api.post<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/cleanup/export?untilLastSeen=" + untilLastSeen))[1],
200
+ )
201
+ }
202
+
203
+ /**
204
+ * Delete all output components that have been last used at or before {@link untilLastSeen} timestamp.
205
+ *
206
+ * @param modelId
207
+ * @param untilLastSeen - Timestamp, inclusive limit.
208
+ * Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
209
+ * @example
210
+ * untilLastSeen = "20221104112923123"
211
+ * represents the date-time "2022-11-04T11:29:23.123"
212
+ */
213
+ async enqueueCleanupOutputs (modelId: string, untilLastSeen: string): Promise<ShapeDiverResponseDto> {
214
+ return await sendRequest(async () =>
215
+ (await this.api.post<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/cleanup/output?untilLastSeen=" + untilLastSeen))[1],
216
+ )
217
+ }
218
+
219
+ /**
220
+ * Delete all texture components that have been last used at or before {@link untilLastSeen} timestamp.
221
+ *
222
+ * @param modelId
223
+ * @param untilLastSeen - Timestamp, inclusive limit.
224
+ * Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
225
+ * @example
226
+ * untilLastSeen = "20221104112923123"
227
+ * represents the date-time "2022-11-04T11:29:23.123"
228
+ */
229
+ async enqueueCleanupTextures (modelId: string, untilLastSeen: string): Promise<ShapeDiverResponseDto> {
230
+ return await sendRequest(async () =>
231
+ (await this.api.post<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/cleanup/texture?untilLastSeen=" + untilLastSeen))[1],
232
+ )
233
+ }
234
+
235
+ /**
236
+ * Get the status of all running model cleanup processes.
237
+ *
238
+ * @param modelId
239
+ */
240
+ async getCleanupStatus (modelId: string): Promise<ShapeDiverResponseDto> {
241
+ return await sendRequest(async () =>
242
+ (await this.api.get<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/cleanup/status"))[1],
243
+ )
244
+ }
245
+
246
+ }