@shapediver/sdk.geometry-api-sdk-v2 1.12.2 → 2.0.1
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/README.md +160 -60
- package/dist/UtilsApi.d.ts +20 -0
- package/dist/UtilsApi.d.ts.map +1 -0
- package/dist/UtilsApi.js +185 -0
- package/dist/UtilsApi.js.map +1 -0
- package/dist/client/api.d.ts +2117 -0
- package/dist/client/api.d.ts.map +1 -0
- package/dist/client/api.js +3473 -0
- package/dist/client/api.js.map +1 -0
- package/dist/client/base.d.ts +32 -0
- package/dist/client/base.d.ts.map +1 -0
- package/dist/client/base.js +37 -0
- package/dist/client/base.js.map +1 -0
- package/dist/client/common.d.ts +14 -0
- package/dist/client/common.d.ts.map +1 -0
- package/dist/client/common.js +108 -0
- package/dist/client/common.js.map +1 -0
- package/dist/client/configuration.d.ts +23 -0
- package/dist/client/configuration.d.ts.map +1 -0
- package/dist/client/configuration.js +21 -0
- package/dist/client/configuration.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +19 -0
- package/dist/client/index.js.map +1 -0
- package/dist/configuration.d.ts +8 -0
- package/dist/configuration.d.ts.map +1 -0
- package/dist/configuration.js +22 -0
- package/dist/configuration.js.map +1 -0
- package/dist/error.d.ts +22 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +48 -0
- package/dist/error.js.map +1 -0
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -17
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +93 -0
- package/dist/utils.js.map +1 -0
- package/package.json +55 -57
- package/src/UtilsApi.ts +393 -0
- package/src/client/api.ts +14084 -0
- package/src/client/base.ts +86 -0
- package/src/client/common.ts +150 -0
- package/src/client/configuration.ts +110 -0
- package/src/client/index.ts +18 -0
- package/src/configuration.ts +27 -0
- package/src/error.ts +92 -0
- package/src/index.ts +5 -17
- package/src/utils.ts +126 -0
- package/dist/ShapeDiverErrors.d.ts +0 -10
- package/dist/ShapeDiverErrors.d.ts.map +0 -1
- package/dist/ShapeDiverErrors.js +0 -18
- package/dist/ShapeDiverErrors.js.map +0 -1
- package/dist/ShapeDiverSdk.d.ts +0 -48
- package/dist/ShapeDiverSdk.d.ts.map +0 -1
- package/dist/ShapeDiverSdk.js +0 -87
- package/dist/ShapeDiverSdk.js.map +0 -1
- package/dist/resources/ShapeDiverAnalyticsApi.d.ts +0 -12
- package/dist/resources/ShapeDiverAnalyticsApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverAnalyticsApi.js +0 -63
- package/dist/resources/ShapeDiverAnalyticsApi.js.map +0 -1
- package/dist/resources/ShapeDiverArSceneApi.d.ts +0 -8
- package/dist/resources/ShapeDiverArSceneApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverArSceneApi.js +0 -63
- package/dist/resources/ShapeDiverArSceneApi.js.map +0 -1
- package/dist/resources/ShapeDiverAssetApi.d.ts +0 -13
- package/dist/resources/ShapeDiverAssetApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverAssetApi.js +0 -131
- package/dist/resources/ShapeDiverAssetApi.js.map +0 -1
- package/dist/resources/ShapeDiverExportApi.d.ts +0 -10
- package/dist/resources/ShapeDiverExportApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverExportApi.js +0 -49
- package/dist/resources/ShapeDiverExportApi.js.map +0 -1
- package/dist/resources/ShapeDiverFileApi.d.ts +0 -15
- package/dist/resources/ShapeDiverFileApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverFileApi.js +0 -67
- package/dist/resources/ShapeDiverFileApi.js.map +0 -1
- package/dist/resources/ShapeDiverGltfApi.d.ts +0 -7
- package/dist/resources/ShapeDiverGltfApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverGltfApi.js +0 -32
- package/dist/resources/ShapeDiverGltfApi.js.map +0 -1
- package/dist/resources/ShapeDiverModelApi.d.ts +0 -22
- package/dist/resources/ShapeDiverModelApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverModelApi.js +0 -156
- package/dist/resources/ShapeDiverModelApi.js.map +0 -1
- package/dist/resources/ShapeDiverModelStateApi.d.ts +0 -14
- package/dist/resources/ShapeDiverModelStateApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverModelStateApi.js +0 -104
- package/dist/resources/ShapeDiverModelStateApi.js.map +0 -1
- package/dist/resources/ShapeDiverOutputApi.d.ts +0 -10
- package/dist/resources/ShapeDiverOutputApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverOutputApi.js +0 -52
- package/dist/resources/ShapeDiverOutputApi.js.map +0 -1
- package/dist/resources/ShapeDiverSdtfApi.d.ts +0 -10
- package/dist/resources/ShapeDiverSdtfApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverSdtfApi.js +0 -52
- package/dist/resources/ShapeDiverSdtfApi.js.map +0 -1
- package/dist/resources/ShapeDiverSessionApi.d.ts +0 -11
- package/dist/resources/ShapeDiverSessionApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverSessionApi.js +0 -66
- package/dist/resources/ShapeDiverSessionApi.js.map +0 -1
- package/dist/resources/ShapeDiverSystemApi.d.ts +0 -12
- package/dist/resources/ShapeDiverSystemApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverSystemApi.js +0 -63
- package/dist/resources/ShapeDiverSystemApi.js.map +0 -1
- package/dist/resources/ShapeDiverTextureApi.d.ts +0 -7
- package/dist/resources/ShapeDiverTextureApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverTextureApi.js +0 -31
- package/dist/resources/ShapeDiverTextureApi.js.map +0 -1
- package/dist/resources/ShapeDiverUtilsApi.d.ts +0 -18
- package/dist/resources/ShapeDiverUtilsApi.d.ts.map +0 -1
- package/dist/resources/ShapeDiverUtilsApi.js +0 -146
- package/dist/resources/ShapeDiverUtilsApi.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -12
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js +0 -109
- package/dist/utils/utils.js.map +0 -1
- package/src/ShapeDiverErrors.ts +0 -34
- package/src/ShapeDiverSdk.ts +0 -121
- package/src/resources/ShapeDiverAnalyticsApi.ts +0 -108
- package/src/resources/ShapeDiverArSceneApi.ts +0 -77
- package/src/resources/ShapeDiverAssetApi.ts +0 -241
- package/src/resources/ShapeDiverExportApi.ts +0 -103
- package/src/resources/ShapeDiverFileApi.ts +0 -150
- package/src/resources/ShapeDiverGltfApi.ts +0 -46
- package/src/resources/ShapeDiverModelApi.ts +0 -374
- package/src/resources/ShapeDiverModelStateApi.ts +0 -163
- package/src/resources/ShapeDiverOutputApi.ts +0 -109
- package/src/resources/ShapeDiverSdtfApi.ts +0 -103
- package/src/resources/ShapeDiverSessionApi.ts +0 -142
- package/src/resources/ShapeDiverSystemApi.ts +0 -118
- package/src/resources/ShapeDiverTextureApi.ts +0 -36
- package/src/resources/ShapeDiverUtilsApi.ts +0 -318
- package/src/utils/utils.ts +0 -135
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestFileUpload,
|
|
3
|
-
ShapeDiverResponseDto,
|
|
4
|
-
} from "@shapediver/api.geometry-api-dto-v2";
|
|
5
|
-
import {
|
|
6
|
-
BaseResourceApi,
|
|
7
|
-
ShapeDiverSdkApi,
|
|
8
|
-
ShapeDiverSdkApiResponseType,
|
|
9
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
10
|
-
import { filenameFromContentDisposition, sendRequest } from "../utils/utils";
|
|
11
|
-
|
|
12
|
-
export interface ShapeDiverResponseFileInfo {
|
|
13
|
-
filename?: string;
|
|
14
|
-
size?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class ShapeDiverFileApi extends BaseResourceApi {
|
|
18
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
19
|
-
super(api);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* List all file-assets of the given parameter.
|
|
24
|
-
*
|
|
25
|
-
* @param sessionId
|
|
26
|
-
* @param paramId
|
|
27
|
-
*/
|
|
28
|
-
async list(
|
|
29
|
-
sessionId: string,
|
|
30
|
-
paramId: string,
|
|
31
|
-
offset?: string,
|
|
32
|
-
): Promise<ShapeDiverResponseDto> {
|
|
33
|
-
// Build queries
|
|
34
|
-
const queries: string[] = [];
|
|
35
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
36
|
-
|
|
37
|
-
return await sendRequest(
|
|
38
|
-
async () =>
|
|
39
|
-
(
|
|
40
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
41
|
-
`${this.buildSessionUri(sessionId)}/file/${paramId}/list`,
|
|
42
|
-
queries,
|
|
43
|
-
)
|
|
44
|
-
)[1],
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get information about a file-asset of a parameter.
|
|
50
|
-
*
|
|
51
|
-
* @param sessionId
|
|
52
|
-
* @param paramId
|
|
53
|
-
*/
|
|
54
|
-
async info(
|
|
55
|
-
sessionId: string,
|
|
56
|
-
paramId: string,
|
|
57
|
-
fileId: string,
|
|
58
|
-
): Promise<ShapeDiverResponseFileInfo> {
|
|
59
|
-
return await sendRequest(async () => {
|
|
60
|
-
const headers = (
|
|
61
|
-
await this.api.head(
|
|
62
|
-
`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`,
|
|
63
|
-
)
|
|
64
|
-
)[0];
|
|
65
|
-
|
|
66
|
-
const res: ShapeDiverResponseFileInfo = {
|
|
67
|
-
size: Number(
|
|
68
|
-
headers.get("Content-Length") || headers.get("content-length"),
|
|
69
|
-
),
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// Extract filename from Content-Disposition header if available
|
|
73
|
-
const contentDispositionHeader =
|
|
74
|
-
headers.get("Content-Disposition") ||
|
|
75
|
-
headers.get("content-disposition");
|
|
76
|
-
if (typeof contentDispositionHeader === "string")
|
|
77
|
-
res.filename = filenameFromContentDisposition(contentDispositionHeader);
|
|
78
|
-
|
|
79
|
-
return res;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Download a file-asset.
|
|
85
|
-
*
|
|
86
|
-
* @param sessionId
|
|
87
|
-
* @param paramId
|
|
88
|
-
* @param fileId
|
|
89
|
-
*/
|
|
90
|
-
async get(
|
|
91
|
-
sessionId: string,
|
|
92
|
-
paramId: string,
|
|
93
|
-
fileId: string,
|
|
94
|
-
): Promise<ArrayBuffer> {
|
|
95
|
-
return await sendRequest(
|
|
96
|
-
async () =>
|
|
97
|
-
(
|
|
98
|
-
await this.api.get<ArrayBuffer>(
|
|
99
|
-
`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`,
|
|
100
|
-
undefined,
|
|
101
|
-
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
102
|
-
)
|
|
103
|
-
)[1],
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Delete a file-asset.
|
|
109
|
-
*
|
|
110
|
-
* @param sessionId
|
|
111
|
-
* @param paramId
|
|
112
|
-
* @param fileId
|
|
113
|
-
*/
|
|
114
|
-
async delete(
|
|
115
|
-
sessionId: string,
|
|
116
|
-
paramId: string,
|
|
117
|
-
fileId: string,
|
|
118
|
-
): Promise<ShapeDiverResponseDto> {
|
|
119
|
-
return await sendRequest(
|
|
120
|
-
async () =>
|
|
121
|
-
(
|
|
122
|
-
await this.api.delete<ShapeDiverResponseDto>(
|
|
123
|
-
`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`,
|
|
124
|
-
)
|
|
125
|
-
)[1],
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Request an Upload-URL for a file.
|
|
131
|
-
*
|
|
132
|
-
* @param sessionId
|
|
133
|
-
* @param body
|
|
134
|
-
*/
|
|
135
|
-
async requestUpload(
|
|
136
|
-
sessionId: string,
|
|
137
|
-
body: ShapeDiverRequestFileUpload,
|
|
138
|
-
): Promise<ShapeDiverResponseDto> {
|
|
139
|
-
return await sendRequest(
|
|
140
|
-
async () =>
|
|
141
|
-
(
|
|
142
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
143
|
-
this.buildSessionUri(sessionId) + "/file/upload",
|
|
144
|
-
undefined,
|
|
145
|
-
body,
|
|
146
|
-
)
|
|
147
|
-
)[1],
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestGltfUploadQueryConversion,
|
|
3
|
-
ShapeDiverResponseDto,
|
|
4
|
-
} from "@shapediver/api.geometry-api-dto-v2";
|
|
5
|
-
import {
|
|
6
|
-
BaseResourceApi,
|
|
7
|
-
ShapeDiverSdkApi,
|
|
8
|
-
ShapeDiverSdkApiResponseType,
|
|
9
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
10
|
-
import { sendRequest } from "../utils/utils";
|
|
11
|
-
|
|
12
|
-
export class ShapeDiverGltfApi extends BaseResourceApi {
|
|
13
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
14
|
-
super(api);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Upload a glTF file.
|
|
19
|
-
*
|
|
20
|
-
* @param sessionId
|
|
21
|
-
* @param body
|
|
22
|
-
* @param type
|
|
23
|
-
* @param queryConvert
|
|
24
|
-
*/
|
|
25
|
-
async upload(
|
|
26
|
-
sessionId: string,
|
|
27
|
-
body: ArrayBuffer,
|
|
28
|
-
type: string,
|
|
29
|
-
queryConvert: ShapeDiverRequestGltfUploadQueryConversion = ShapeDiverRequestGltfUploadQueryConversion.NONE,
|
|
30
|
-
): Promise<ShapeDiverResponseDto> {
|
|
31
|
-
return await sendRequest(
|
|
32
|
-
async () =>
|
|
33
|
-
(
|
|
34
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
35
|
-
`${this.buildSessionUri(sessionId)}/gltf`,
|
|
36
|
-
[`conversion=${queryConvert}`],
|
|
37
|
-
body,
|
|
38
|
-
{
|
|
39
|
-
contentType: type,
|
|
40
|
-
responseType: ShapeDiverSdkApiResponseType.JSON,
|
|
41
|
-
},
|
|
42
|
-
)
|
|
43
|
-
)[1],
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,374 +0,0 @@
|
|
|
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 {
|
|
12
|
-
BaseResourceApi,
|
|
13
|
-
ShapeDiverSdkApi,
|
|
14
|
-
ShapeDiverSdkApiResponseType,
|
|
15
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
16
|
-
import { sendRequest } from "../utils/utils";
|
|
17
|
-
|
|
18
|
-
export class ShapeDiverModelApi extends BaseResourceApi {
|
|
19
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
20
|
-
super(api);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Get information about a ShapeDiver Model.
|
|
25
|
-
*
|
|
26
|
-
* @param modelId
|
|
27
|
-
*/
|
|
28
|
-
async get(modelId: string): Promise<ShapeDiverResponseDto> {
|
|
29
|
-
return await sendRequest(
|
|
30
|
-
async () =>
|
|
31
|
-
(
|
|
32
|
-
await this.api.get<ShapeDiverResponseDto>(this.buildModelUri(modelId))
|
|
33
|
-
)[1],
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Create a new ShapeDiver Model.
|
|
39
|
-
*
|
|
40
|
-
* @param body
|
|
41
|
-
*/
|
|
42
|
-
async create(body: ShapeDiverRequestModel): Promise<ShapeDiverResponseDto> {
|
|
43
|
-
return await sendRequest(
|
|
44
|
-
async () =>
|
|
45
|
-
(
|
|
46
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
47
|
-
this.commonPath,
|
|
48
|
-
undefined,
|
|
49
|
-
body,
|
|
50
|
-
)
|
|
51
|
-
)[1],
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Update properties of a ShapeDiver Model.
|
|
57
|
-
*
|
|
58
|
-
* @param modelId
|
|
59
|
-
* @param body
|
|
60
|
-
*/
|
|
61
|
-
async update(
|
|
62
|
-
modelId: string,
|
|
63
|
-
body: ShapeDiverRequestModel,
|
|
64
|
-
): Promise<ShapeDiverResponseDto> {
|
|
65
|
-
return await sendRequest(
|
|
66
|
-
async () =>
|
|
67
|
-
(
|
|
68
|
-
await this.api.put<ShapeDiverResponseDto>(
|
|
69
|
-
this.buildModelUri(modelId),
|
|
70
|
-
undefined,
|
|
71
|
-
body,
|
|
72
|
-
)
|
|
73
|
-
)[1],
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Delete a ShapeDiver Model.
|
|
79
|
-
*
|
|
80
|
-
* @param modelId
|
|
81
|
-
*/
|
|
82
|
-
async delete(modelId: string): Promise<ShapeDiverResponseDto> {
|
|
83
|
-
return await sendRequest(
|
|
84
|
-
async () =>
|
|
85
|
-
(
|
|
86
|
-
await this.api.delete<ShapeDiverResponseDto>(
|
|
87
|
-
this.buildModelUri(modelId),
|
|
88
|
-
)
|
|
89
|
-
)[1],
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* List models.
|
|
95
|
-
*/
|
|
96
|
-
async list(offset?: string): Promise<ShapeDiverResponseDto> {
|
|
97
|
-
// Build queries
|
|
98
|
-
const queries: string[] = [];
|
|
99
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
100
|
-
|
|
101
|
-
return await sendRequest(
|
|
102
|
-
async () =>
|
|
103
|
-
(
|
|
104
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
105
|
-
`${this.commonPath}/list`,
|
|
106
|
-
queries,
|
|
107
|
-
)
|
|
108
|
-
)[1],
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get configurations of the viewer.
|
|
114
|
-
*
|
|
115
|
-
* @param modelId
|
|
116
|
-
*/
|
|
117
|
-
async getConfig(modelId: string): Promise<ShapeDiverResponseDto> {
|
|
118
|
-
return await sendRequest(
|
|
119
|
-
async () =>
|
|
120
|
-
(
|
|
121
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
122
|
-
this.buildModelUri(modelId) + "/config",
|
|
123
|
-
)
|
|
124
|
-
)[1],
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Create viewer configurations.
|
|
130
|
-
*
|
|
131
|
-
* @param modelId
|
|
132
|
-
* @param body
|
|
133
|
-
*/
|
|
134
|
-
async createConfig(
|
|
135
|
-
modelId: string,
|
|
136
|
-
body: ShapeDiverRequestConfigure,
|
|
137
|
-
): Promise<ShapeDiverResponseDto> {
|
|
138
|
-
return await sendRequest(
|
|
139
|
-
async () =>
|
|
140
|
-
(
|
|
141
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
142
|
-
this.buildModelUri(modelId) + "/config",
|
|
143
|
-
undefined,
|
|
144
|
-
body,
|
|
145
|
-
)
|
|
146
|
-
)[1],
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Update viewer configurations.
|
|
152
|
-
*
|
|
153
|
-
* @param modelId
|
|
154
|
-
* @param body
|
|
155
|
-
*/
|
|
156
|
-
async updateConfig(
|
|
157
|
-
modelId: string,
|
|
158
|
-
body: ShapeDiverRequestConfigure,
|
|
159
|
-
): Promise<ShapeDiverResponseDto> {
|
|
160
|
-
return await sendRequest(
|
|
161
|
-
async () =>
|
|
162
|
-
(
|
|
163
|
-
await this.api.patch<ShapeDiverResponseDto>(
|
|
164
|
-
this.buildModelUri(modelId) + "/config",
|
|
165
|
-
undefined,
|
|
166
|
-
body,
|
|
167
|
-
)
|
|
168
|
-
)[1],
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Download the Grasshopper file of the ShapeDiver Model.
|
|
174
|
-
*
|
|
175
|
-
* @param modelId
|
|
176
|
-
*/
|
|
177
|
-
async getFile(modelId: string): Promise<ArrayBuffer> {
|
|
178
|
-
return await sendRequest(
|
|
179
|
-
async () =>
|
|
180
|
-
(
|
|
181
|
-
await this.api.get<ArrayBuffer>(
|
|
182
|
-
this.buildModelUri(modelId) + "/file/download",
|
|
183
|
-
undefined,
|
|
184
|
-
{
|
|
185
|
-
contentType: "application/json",
|
|
186
|
-
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
187
|
-
},
|
|
188
|
-
)
|
|
189
|
-
)[1],
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Set the default parameters for the ShapeDiver Model.
|
|
195
|
-
*
|
|
196
|
-
* @param modelId
|
|
197
|
-
* @param body
|
|
198
|
-
*/
|
|
199
|
-
async setDefaultParams(
|
|
200
|
-
modelId: string,
|
|
201
|
-
body: ShapeDiverRequestCustomization,
|
|
202
|
-
): Promise<ShapeDiverResponseDto> {
|
|
203
|
-
return await sendRequest(
|
|
204
|
-
async () =>
|
|
205
|
-
(
|
|
206
|
-
await this.api.patch<ShapeDiverResponseDto>(
|
|
207
|
-
this.buildModelUri(modelId) + "/parameter/defval",
|
|
208
|
-
undefined,
|
|
209
|
-
body,
|
|
210
|
-
)
|
|
211
|
-
)[1],
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Updates the definitions of the given parameters.
|
|
217
|
-
*
|
|
218
|
-
* @param modelId
|
|
219
|
-
* @param body
|
|
220
|
-
*/
|
|
221
|
-
async updateParameterDefinitions(
|
|
222
|
-
modelId: string,
|
|
223
|
-
body: ShapeDiverRequestParameterDefinition,
|
|
224
|
-
): Promise<ShapeDiverResponseDto> {
|
|
225
|
-
return await sendRequest(
|
|
226
|
-
async () =>
|
|
227
|
-
(
|
|
228
|
-
await this.api.patch<ShapeDiverResponseDto>(
|
|
229
|
-
this.buildModelUri(modelId) + "/parameter",
|
|
230
|
-
undefined,
|
|
231
|
-
body,
|
|
232
|
-
)
|
|
233
|
-
)[1],
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Query model computation statistics.
|
|
239
|
-
*
|
|
240
|
-
* @param modelId
|
|
241
|
-
* @param timestampFrom - Timestamp to query from
|
|
242
|
-
* @param timestampTo - Timestamp to query to.
|
|
243
|
-
* @param limit - How many items to return at most.
|
|
244
|
-
* @param strictLimit - Whether the limit shall be attained (if there are enough items).
|
|
245
|
-
* @param order - Order in which to query computation stats items.
|
|
246
|
-
* @param status - Filter computations by the result status.
|
|
247
|
-
* @param type - Filter computations by type.
|
|
248
|
-
* @param offset - Continuation token for pagination.
|
|
249
|
-
*/
|
|
250
|
-
async queryComputations(
|
|
251
|
-
modelId: string,
|
|
252
|
-
timestampFrom?: string,
|
|
253
|
-
timestampTo?: string,
|
|
254
|
-
limit?: number,
|
|
255
|
-
strictLimit?: boolean,
|
|
256
|
-
order?: ShapeDiverRequestModelComputationQueryOrder,
|
|
257
|
-
status?: ShapeDiverRequestModelComputationQueryStatus,
|
|
258
|
-
type?: ShapeDiverRequestModelComputationQueryType,
|
|
259
|
-
offset?: string,
|
|
260
|
-
): Promise<ShapeDiverResponseDto> {
|
|
261
|
-
// Build queries
|
|
262
|
-
const queries: string[] = [];
|
|
263
|
-
if (timestampFrom !== undefined)
|
|
264
|
-
queries.push("timestamp_from=" + timestampFrom);
|
|
265
|
-
if (timestampTo !== undefined) queries.push("timestamp_to=" + timestampTo);
|
|
266
|
-
if (limit !== undefined) queries.push("limit=" + limit);
|
|
267
|
-
if (strictLimit !== undefined) queries.push("strict_limit=" + strictLimit);
|
|
268
|
-
if (order !== undefined) queries.push("order=" + order);
|
|
269
|
-
if (status !== undefined) queries.push("status=" + status);
|
|
270
|
-
if (type !== undefined) queries.push("type=" + type);
|
|
271
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
272
|
-
|
|
273
|
-
return await sendRequest(
|
|
274
|
-
async () =>
|
|
275
|
-
(
|
|
276
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
277
|
-
this.buildModelUri(modelId) + "/computations",
|
|
278
|
-
queries,
|
|
279
|
-
)
|
|
280
|
-
)[1],
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Delete all export components that have been last used at or before {@link untilLastSeen} timestamp.
|
|
286
|
-
*
|
|
287
|
-
* @param modelId
|
|
288
|
-
* @param untilLastSeen - Timestamp, inclusive limit.
|
|
289
|
-
* Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
|
|
290
|
-
* @example
|
|
291
|
-
* untilLastSeen = "20221104112923123"
|
|
292
|
-
* represents the date-time "2022-11-04T11:29:23.123"
|
|
293
|
-
*/
|
|
294
|
-
async enqueueCleanupExports(
|
|
295
|
-
modelId: string,
|
|
296
|
-
untilLastSeen: string,
|
|
297
|
-
): Promise<ShapeDiverResponseDto> {
|
|
298
|
-
return await sendRequest(
|
|
299
|
-
async () =>
|
|
300
|
-
(
|
|
301
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
302
|
-
this.buildModelUri(modelId) + "/cleanup/export",
|
|
303
|
-
[`untilLastSeen=${untilLastSeen}`],
|
|
304
|
-
)
|
|
305
|
-
)[1],
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Delete all output components that have been last used at or before {@link untilLastSeen} timestamp.
|
|
311
|
-
*
|
|
312
|
-
* @param modelId
|
|
313
|
-
* @param untilLastSeen - Timestamp, inclusive limit.
|
|
314
|
-
* Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
|
|
315
|
-
* @example
|
|
316
|
-
* untilLastSeen = "20221104112923123"
|
|
317
|
-
* represents the date-time "2022-11-04T11:29:23.123"
|
|
318
|
-
*/
|
|
319
|
-
async enqueueCleanupOutputs(
|
|
320
|
-
modelId: string,
|
|
321
|
-
untilLastSeen: string,
|
|
322
|
-
): Promise<ShapeDiverResponseDto> {
|
|
323
|
-
return await sendRequest(
|
|
324
|
-
async () =>
|
|
325
|
-
(
|
|
326
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
327
|
-
this.buildModelUri(modelId) + "/cleanup/output",
|
|
328
|
-
[`untilLastSeen=${untilLastSeen}`],
|
|
329
|
-
)
|
|
330
|
-
)[1],
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Delete all texture components that have been last used at or before {@link untilLastSeen} timestamp.
|
|
336
|
-
*
|
|
337
|
-
* @param modelId
|
|
338
|
-
* @param untilLastSeen - Timestamp, inclusive limit.
|
|
339
|
-
* Allowed Patterns: YYYY, YYYYMM, YYYYMMDD, YYYYMMDDhh, YYYYMMDDhhmm, YYYYMMDDhhmmss, YYYYMMDDhhmmssSSS
|
|
340
|
-
* @example
|
|
341
|
-
* untilLastSeen = "20221104112923123"
|
|
342
|
-
* represents the date-time "2022-11-04T11:29:23.123"
|
|
343
|
-
*/
|
|
344
|
-
async enqueueCleanupTextures(
|
|
345
|
-
modelId: string,
|
|
346
|
-
untilLastSeen: string,
|
|
347
|
-
): Promise<ShapeDiverResponseDto> {
|
|
348
|
-
return await sendRequest(
|
|
349
|
-
async () =>
|
|
350
|
-
(
|
|
351
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
352
|
-
this.buildModelUri(modelId) + "/cleanup/texture",
|
|
353
|
-
[`untilLastSeen=${untilLastSeen}`],
|
|
354
|
-
)
|
|
355
|
-
)[1],
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Get the status of all running model cleanup processes.
|
|
361
|
-
*
|
|
362
|
-
* @param modelId
|
|
363
|
-
*/
|
|
364
|
-
async getCleanupStatus(modelId: string): Promise<ShapeDiverResponseDto> {
|
|
365
|
-
return await sendRequest(
|
|
366
|
-
async () =>
|
|
367
|
-
(
|
|
368
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
369
|
-
this.buildModelUri(modelId) + "/cleanup/status",
|
|
370
|
-
)
|
|
371
|
-
)[1],
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
}
|