@shapediver/sdk.geometry-api-sdk-v2 1.12.2 → 2.0.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/README.md +133 -58
- 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,163 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseResourceApi,
|
|
3
|
-
ShapeDiverResponseError,
|
|
4
|
-
ShapeDiverSdkApi,
|
|
5
|
-
ShapeDiverSdkApiResponseType,
|
|
6
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
7
|
-
import { sendRequest } from "../utils/utils";
|
|
8
|
-
import {
|
|
9
|
-
ShapeDiverRequestModelState,
|
|
10
|
-
ShapeDiverResponseDto,
|
|
11
|
-
} from "@shapediver/api.geometry-api-dto-v2";
|
|
12
|
-
|
|
13
|
-
export class ShapeDiverModelStateApi extends BaseResourceApi {
|
|
14
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
15
|
-
super(api);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Checks the existence of a Model-State.
|
|
20
|
-
* @param modelStateId The ID of the Model-State.
|
|
21
|
-
* @returns A boolean indicating whether the Model-State exists.
|
|
22
|
-
*/
|
|
23
|
-
async exists(modelStateId: string): Promise<boolean> {
|
|
24
|
-
return await sendRequest(async () => {
|
|
25
|
-
try {
|
|
26
|
-
const [_, status] = await this.api.head(
|
|
27
|
-
this.buildModelStateUri(modelStateId),
|
|
28
|
-
{ disableAuthorization: true },
|
|
29
|
-
);
|
|
30
|
-
return status === 200;
|
|
31
|
-
} catch (e) {
|
|
32
|
-
// A 404 HTTP status is returned when the Model-State was not found.
|
|
33
|
-
if (e instanceof ShapeDiverResponseError && e.status === 404)
|
|
34
|
-
return false;
|
|
35
|
-
else throw e;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get a Model-State.
|
|
42
|
-
* @param modelStateId The ID of the Model-State.
|
|
43
|
-
*/
|
|
44
|
-
async get(modelStateId: string): Promise<ShapeDiverResponseDto> {
|
|
45
|
-
return await sendRequest(
|
|
46
|
-
async () =>
|
|
47
|
-
(
|
|
48
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
49
|
-
this.buildModelStateUri(modelStateId),
|
|
50
|
-
)
|
|
51
|
-
)[1],
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Delete a Model-State.
|
|
57
|
-
* @param modelStateId The ID of the Model-State.
|
|
58
|
-
*/
|
|
59
|
-
async delete(modelStateId: string): Promise<void> {
|
|
60
|
-
return await sendRequest(async () => {
|
|
61
|
-
await this.api.delete(this.buildModelStateUri(modelStateId));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get a Model-State's parameter and additional data.
|
|
67
|
-
* @param modelStateId The ID of the Model-State.
|
|
68
|
-
*/
|
|
69
|
-
async getData(modelStateId: string): Promise<ShapeDiverResponseDto> {
|
|
70
|
-
return await sendRequest(
|
|
71
|
-
async () =>
|
|
72
|
-
(
|
|
73
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
74
|
-
`${this.buildModelStateUri(modelStateId)}/data`,
|
|
75
|
-
)
|
|
76
|
-
)[1],
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Check if the Model-State has an image.
|
|
82
|
-
* @param modelStateId The ID of the Model-State.
|
|
83
|
-
* @returns A boolean indicating whether the Model-State has an image.
|
|
84
|
-
*/
|
|
85
|
-
async hasImage(modelStateId: string): Promise<boolean> {
|
|
86
|
-
return await sendRequest(async () => {
|
|
87
|
-
try {
|
|
88
|
-
const [_, status] = await this.api.head(
|
|
89
|
-
`${this.buildModelStateUri(modelStateId)}/image`,
|
|
90
|
-
{ disableAuthorization: true },
|
|
91
|
-
);
|
|
92
|
-
return status === 200;
|
|
93
|
-
} catch (e) {
|
|
94
|
-
// A 404 HTTP status is returned when the Model-State image was not found.
|
|
95
|
-
if (e instanceof ShapeDiverResponseError && e.status === 404)
|
|
96
|
-
return false;
|
|
97
|
-
else throw e;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Downloads the Model-State image.
|
|
104
|
-
* @param modelStateId The ID of the Model-State.
|
|
105
|
-
* @returns Array of size 2: [0] = content data, [1] = content type.
|
|
106
|
-
*/
|
|
107
|
-
async getImage(modelStateId: string): Promise<[ArrayBuffer, string]> {
|
|
108
|
-
return await sendRequest(async () => {
|
|
109
|
-
const [header, data] = await this.api.get<ArrayBuffer>(
|
|
110
|
-
`${this.buildModelStateUri(modelStateId)}/image`,
|
|
111
|
-
undefined,
|
|
112
|
-
{
|
|
113
|
-
responseType: ShapeDiverSdkApiResponseType.DATA,
|
|
114
|
-
disableAuthorization: true,
|
|
115
|
-
},
|
|
116
|
-
);
|
|
117
|
-
const contentType = header["Content-Type"] ?? header["content-type"];
|
|
118
|
-
return [data, contentType];
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* List Model-States of a ShapeDiver model.
|
|
124
|
-
* @param modelId The ID of the ShapeDiver model.
|
|
125
|
-
* @param offset The offset to start the list from.
|
|
126
|
-
*/
|
|
127
|
-
async list(modelId: string, offset?: string): Promise<ShapeDiverResponseDto> {
|
|
128
|
-
// Build queries
|
|
129
|
-
const queries: string[] = [];
|
|
130
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
131
|
-
|
|
132
|
-
return await sendRequest(
|
|
133
|
-
async () =>
|
|
134
|
-
(
|
|
135
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
136
|
-
`${this.buildModelStateUri()}/model/${modelId}/list`,
|
|
137
|
-
queries,
|
|
138
|
-
)
|
|
139
|
-
)[1],
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Create a new Model-State.
|
|
145
|
-
* @param modelId The ID of the ShapeDiver model.
|
|
146
|
-
* @param body The Model-State data.
|
|
147
|
-
*/
|
|
148
|
-
async create(
|
|
149
|
-
sessionId: string,
|
|
150
|
-
body: ShapeDiverRequestModelState,
|
|
151
|
-
): Promise<ShapeDiverResponseDto> {
|
|
152
|
-
return await sendRequest(
|
|
153
|
-
async () =>
|
|
154
|
-
(
|
|
155
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
156
|
-
`${this.buildSessionUri(sessionId)}/model-state`,
|
|
157
|
-
undefined,
|
|
158
|
-
body,
|
|
159
|
-
)
|
|
160
|
-
)[1],
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestCache,
|
|
3
|
-
ShapeDiverRequestCustomization,
|
|
4
|
-
ShapeDiverRequestOutputDefinition,
|
|
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";
|
|
12
|
-
|
|
13
|
-
export class ShapeDiverOutputApi extends BaseResourceApi {
|
|
14
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
15
|
-
super(api);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Request a specific version of an output.
|
|
20
|
-
*
|
|
21
|
-
* @param sessionId
|
|
22
|
-
* @param body
|
|
23
|
-
*/
|
|
24
|
-
async customize(
|
|
25
|
-
sessionId: string,
|
|
26
|
-
body: ShapeDiverRequestCustomization,
|
|
27
|
-
): Promise<ShapeDiverResponseDto> {
|
|
28
|
-
return await sendRequest(
|
|
29
|
-
async () =>
|
|
30
|
-
(
|
|
31
|
-
await this.api.put<ShapeDiverResponseDto>(
|
|
32
|
-
this.buildSessionUri(sessionId) + "/output",
|
|
33
|
-
undefined,
|
|
34
|
-
body,
|
|
35
|
-
)
|
|
36
|
-
)[1],
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Check if a specific version of a requested output has been computed yet.
|
|
42
|
-
*
|
|
43
|
-
* @param sessionId
|
|
44
|
-
* @param body
|
|
45
|
-
*/
|
|
46
|
-
async getCache(
|
|
47
|
-
sessionId: string,
|
|
48
|
-
body: ShapeDiverRequestCache,
|
|
49
|
-
): Promise<ShapeDiverResponseDto> {
|
|
50
|
-
return await sendRequest(
|
|
51
|
-
async () =>
|
|
52
|
-
(
|
|
53
|
-
await this.api.put<ShapeDiverResponseDto>(
|
|
54
|
-
this.buildSessionUri(sessionId) + "/output/cache",
|
|
55
|
-
undefined,
|
|
56
|
-
body,
|
|
57
|
-
)
|
|
58
|
-
)[1],
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Updates the definitions of the given outputs.
|
|
64
|
-
*
|
|
65
|
-
* @param modelId
|
|
66
|
-
* @param body
|
|
67
|
-
*/
|
|
68
|
-
async updateDefinitions(
|
|
69
|
-
modelId: string,
|
|
70
|
-
body: ShapeDiverRequestOutputDefinition,
|
|
71
|
-
): Promise<ShapeDiverResponseDto> {
|
|
72
|
-
return await sendRequest(
|
|
73
|
-
async () =>
|
|
74
|
-
(
|
|
75
|
-
await this.api.patch<ShapeDiverResponseDto>(
|
|
76
|
-
this.buildModelUri(modelId) + "/output",
|
|
77
|
-
undefined,
|
|
78
|
-
body,
|
|
79
|
-
)
|
|
80
|
-
)[1],
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* List all cached versions of the specified output.
|
|
86
|
-
*
|
|
87
|
-
* @param sessionId
|
|
88
|
-
* @param outputId
|
|
89
|
-
*/
|
|
90
|
-
async listVersions(
|
|
91
|
-
sessionId: string,
|
|
92
|
-
outputId: string,
|
|
93
|
-
offset?: string,
|
|
94
|
-
): Promise<ShapeDiverResponseDto> {
|
|
95
|
-
// Build queries
|
|
96
|
-
const queries: string[] = [];
|
|
97
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
98
|
-
|
|
99
|
-
return await sendRequest(
|
|
100
|
-
async () =>
|
|
101
|
-
(
|
|
102
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
103
|
-
`${this.buildSessionUri(sessionId)}/output/${outputId}/list`,
|
|
104
|
-
queries,
|
|
105
|
-
)
|
|
106
|
-
)[1],
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestSdtfUpload,
|
|
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 ShapeDiverSdtfApi extends BaseResourceApi {
|
|
13
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
14
|
-
super(api);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* List all sdTF-assets of the given namespace.
|
|
19
|
-
*
|
|
20
|
-
* @param sessionId
|
|
21
|
-
* @param namespace
|
|
22
|
-
*/
|
|
23
|
-
async list(
|
|
24
|
-
sessionId: string,
|
|
25
|
-
namespace: string,
|
|
26
|
-
offset?: string,
|
|
27
|
-
): Promise<ShapeDiverResponseDto> {
|
|
28
|
-
// Build queries
|
|
29
|
-
const queries: string[] = [];
|
|
30
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
31
|
-
|
|
32
|
-
return await sendRequest(
|
|
33
|
-
async () =>
|
|
34
|
-
(
|
|
35
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
36
|
-
`${this.buildSessionUri(sessionId)}/sdtf/${namespace}/list`,
|
|
37
|
-
queries,
|
|
38
|
-
)
|
|
39
|
-
)[1],
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Download a sdTF-asset.
|
|
45
|
-
*
|
|
46
|
-
* @param sessionId
|
|
47
|
-
* @param sdtfId - Format: "<namespace>/<sdTF id>"
|
|
48
|
-
*/
|
|
49
|
-
async get(sessionId: string, sdtfId: string): Promise<ArrayBuffer> {
|
|
50
|
-
return await sendRequest(
|
|
51
|
-
async () =>
|
|
52
|
-
(
|
|
53
|
-
await this.api.get<ArrayBuffer>(
|
|
54
|
-
`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`,
|
|
55
|
-
undefined,
|
|
56
|
-
{ responseType: ShapeDiverSdkApiResponseType.DATA },
|
|
57
|
-
)
|
|
58
|
-
)[1],
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Delete a sdTF-asset.
|
|
64
|
-
*
|
|
65
|
-
* @param sessionId
|
|
66
|
-
* @param sdtfId
|
|
67
|
-
*/
|
|
68
|
-
async delete(
|
|
69
|
-
sessionId: string,
|
|
70
|
-
sdtfId: string,
|
|
71
|
-
): Promise<ShapeDiverResponseDto> {
|
|
72
|
-
return await sendRequest(
|
|
73
|
-
async () =>
|
|
74
|
-
(
|
|
75
|
-
await this.api.delete<ShapeDiverResponseDto>(
|
|
76
|
-
`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`,
|
|
77
|
-
)
|
|
78
|
-
)[1],
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Request an Upload-URL for a sdTF-asset.
|
|
84
|
-
*
|
|
85
|
-
* @param sessionId
|
|
86
|
-
* @param body
|
|
87
|
-
*/
|
|
88
|
-
async requestUpload(
|
|
89
|
-
sessionId: string,
|
|
90
|
-
body: ShapeDiverRequestSdtfUpload,
|
|
91
|
-
): Promise<ShapeDiverResponseDto> {
|
|
92
|
-
return await sendRequest(
|
|
93
|
-
async () =>
|
|
94
|
-
(
|
|
95
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
96
|
-
this.buildSessionUri(sessionId) + "/sdtf/upload",
|
|
97
|
-
undefined,
|
|
98
|
-
body,
|
|
99
|
-
)
|
|
100
|
-
)[1],
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestCustomization,
|
|
3
|
-
ShapeDiverRequestExport,
|
|
4
|
-
ShapeDiverRequestTicket,
|
|
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";
|
|
12
|
-
|
|
13
|
-
export class ShapeDiverSessionApi extends BaseResourceApi {
|
|
14
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
15
|
-
super(api);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new ticket that allows to initialize new sessions for the
|
|
20
|
-
* specified model.
|
|
21
|
-
*
|
|
22
|
-
* @param modelId
|
|
23
|
-
* @param body
|
|
24
|
-
*/
|
|
25
|
-
async ticket(
|
|
26
|
-
modelId: string,
|
|
27
|
-
body: ShapeDiverRequestTicket,
|
|
28
|
-
): Promise<ShapeDiverResponseDto> {
|
|
29
|
-
return await sendRequest(
|
|
30
|
-
async () =>
|
|
31
|
-
(
|
|
32
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
33
|
-
this.buildModelUri(modelId) + "/ticket",
|
|
34
|
-
undefined,
|
|
35
|
-
body,
|
|
36
|
-
)
|
|
37
|
-
)[1],
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Create a new session for a ShapeDiver Model via a ticket.
|
|
43
|
-
*
|
|
44
|
-
* @param ticket
|
|
45
|
-
* @param request - Optional customization or export request.
|
|
46
|
-
* @param modelStateId - ID of the Model-State to apply.
|
|
47
|
-
* @param strictValidation - When `false`, any Model-State parameter that cannot be applied to the
|
|
48
|
-
* model is ignored. However, when set to `true`, any validation error will result in an error
|
|
49
|
-
* response.
|
|
50
|
-
*/
|
|
51
|
-
async init(
|
|
52
|
-
ticket: string,
|
|
53
|
-
request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
|
|
54
|
-
modelStateId?: string,
|
|
55
|
-
strictValidation?: boolean,
|
|
56
|
-
): Promise<ShapeDiverResponseDto> {
|
|
57
|
-
// Build queries
|
|
58
|
-
const queries: string[] = [];
|
|
59
|
-
if (modelStateId !== undefined)
|
|
60
|
-
queries.push("modelStateId=" + modelStateId);
|
|
61
|
-
if (strictValidation !== undefined)
|
|
62
|
-
queries.push("strictValidation=" + strictValidation);
|
|
63
|
-
|
|
64
|
-
return await sendRequest(
|
|
65
|
-
async () =>
|
|
66
|
-
(
|
|
67
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
68
|
-
this.buildTicketUri(ticket),
|
|
69
|
-
queries,
|
|
70
|
-
request,
|
|
71
|
-
)
|
|
72
|
-
)[1],
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Create a new session for a ShapeDiver Model.
|
|
78
|
-
*
|
|
79
|
-
* @param ticket
|
|
80
|
-
* @param request - Optional customization or export request.
|
|
81
|
-
* @param modelStateId - ID of the Model-State to apply.
|
|
82
|
-
* @param strictValidation - When `false`, any Model-State parameter that cannot be applied to the
|
|
83
|
-
* model is ignored. However, when set to `true`, any validation error will result in an error
|
|
84
|
-
* response.
|
|
85
|
-
*/
|
|
86
|
-
async initForModel(
|
|
87
|
-
modelId: string,
|
|
88
|
-
request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
|
|
89
|
-
modelStateId?: string,
|
|
90
|
-
strictValidation?: boolean,
|
|
91
|
-
): Promise<ShapeDiverResponseDto> {
|
|
92
|
-
// Build queries
|
|
93
|
-
const queries: string[] = [];
|
|
94
|
-
if (modelStateId !== undefined)
|
|
95
|
-
queries.push("modelStateId=" + modelStateId);
|
|
96
|
-
if (strictValidation !== undefined)
|
|
97
|
-
queries.push("strictValidation=" + strictValidation);
|
|
98
|
-
|
|
99
|
-
return await sendRequest(
|
|
100
|
-
async () =>
|
|
101
|
-
(
|
|
102
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
103
|
-
this.buildModelUri(modelId) + "/session",
|
|
104
|
-
queries,
|
|
105
|
-
request,
|
|
106
|
-
)
|
|
107
|
-
)[1],
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Get the full description of a ShapeDiver Model.
|
|
113
|
-
*
|
|
114
|
-
* @param sessionId
|
|
115
|
-
*/
|
|
116
|
-
async default(sessionId: string): Promise<ShapeDiverResponseDto> {
|
|
117
|
-
return await sendRequest(
|
|
118
|
-
async () =>
|
|
119
|
-
(
|
|
120
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
121
|
-
this.buildSessionUri(sessionId) + "/default",
|
|
122
|
-
)
|
|
123
|
-
)[1],
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Close the specified session.
|
|
129
|
-
*
|
|
130
|
-
* @param sessionId
|
|
131
|
-
*/
|
|
132
|
-
async close(sessionId: string): Promise<ShapeDiverResponseDto> {
|
|
133
|
-
return await sendRequest(
|
|
134
|
-
async () =>
|
|
135
|
-
(
|
|
136
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
137
|
-
this.buildSessionUri(sessionId) + "/close",
|
|
138
|
-
)
|
|
139
|
-
)[1],
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ShapeDiverRequestAuthorizationGroup,
|
|
3
|
-
ShapeDiverRequestLogMessage,
|
|
4
|
-
ShapeDiverResponseDto,
|
|
5
|
-
} from "@shapediver/api.geometry-api-dto-v2";
|
|
6
|
-
import {
|
|
7
|
-
BaseResourceApi,
|
|
8
|
-
ShapeDiverSdkApi,
|
|
9
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
10
|
-
import { sendRequest } from "../utils/utils";
|
|
11
|
-
|
|
12
|
-
export class ShapeDiverSystemApi extends BaseResourceApi {
|
|
13
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
14
|
-
super(api);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Log the specified message.
|
|
19
|
-
*
|
|
20
|
-
* @param sessionId
|
|
21
|
-
* @param body
|
|
22
|
-
*/
|
|
23
|
-
async log(
|
|
24
|
-
sessionId: string,
|
|
25
|
-
body: ShapeDiverRequestLogMessage,
|
|
26
|
-
): Promise<ShapeDiverResponseDto> {
|
|
27
|
-
return await sendRequest(
|
|
28
|
-
async () =>
|
|
29
|
-
(
|
|
30
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
31
|
-
this.buildSessionUri(sessionId) + "/log/message",
|
|
32
|
-
undefined,
|
|
33
|
-
body,
|
|
34
|
-
)
|
|
35
|
-
)[1],
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Remove a model with all it's components.
|
|
41
|
-
*
|
|
42
|
-
* **WARNING: This operation cannot be undone!**
|
|
43
|
-
*
|
|
44
|
-
* @param modelId
|
|
45
|
-
*/
|
|
46
|
-
async pruneModel(modelId: string): Promise<ShapeDiverResponseDto> {
|
|
47
|
-
return await sendRequest(
|
|
48
|
-
async () =>
|
|
49
|
-
(
|
|
50
|
-
await this.api.delete<ShapeDiverResponseDto>(
|
|
51
|
-
`${this.buildSystemUri()}/model/${modelId}`,
|
|
52
|
-
)
|
|
53
|
-
)[1],
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Decrypt the given ticket.
|
|
59
|
-
*
|
|
60
|
-
* @param ticket
|
|
61
|
-
*/
|
|
62
|
-
async decryptTicket(ticket: string): Promise<ShapeDiverResponseDto> {
|
|
63
|
-
return await sendRequest(
|
|
64
|
-
async () =>
|
|
65
|
-
(
|
|
66
|
-
await this.api.get<ShapeDiverResponseDto>(this.buildTicketUri(ticket))
|
|
67
|
-
)[1],
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Create a new authentication group.
|
|
73
|
-
*
|
|
74
|
-
* @param body
|
|
75
|
-
*/
|
|
76
|
-
async authGroup(
|
|
77
|
-
body: ShapeDiverRequestAuthorizationGroup,
|
|
78
|
-
): Promise<ShapeDiverResponseDto> {
|
|
79
|
-
return await sendRequest(
|
|
80
|
-
async () =>
|
|
81
|
-
(
|
|
82
|
-
await this.api.post<ShapeDiverResponseDto>(
|
|
83
|
-
this.buildAuthGroupUri(),
|
|
84
|
-
undefined,
|
|
85
|
-
body,
|
|
86
|
-
)
|
|
87
|
-
)[1],
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Returns system information about the Geometry Minions.
|
|
93
|
-
*/
|
|
94
|
-
async getMinionInfo(): Promise<ShapeDiverResponseDto> {
|
|
95
|
-
return sendRequest(
|
|
96
|
-
async () =>
|
|
97
|
-
(
|
|
98
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
99
|
-
`${this.buildSystemUri()}/minions/info`,
|
|
100
|
-
)
|
|
101
|
-
)[1],
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Returns system information about the Geometry Workers.
|
|
107
|
-
*/
|
|
108
|
-
async getWorkerInfo(): Promise<ShapeDiverResponseDto> {
|
|
109
|
-
return sendRequest(
|
|
110
|
-
async () =>
|
|
111
|
-
(
|
|
112
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
113
|
-
`${this.buildSystemUri()}/workers/info`,
|
|
114
|
-
)
|
|
115
|
-
)[1],
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2";
|
|
2
|
-
import {
|
|
3
|
-
BaseResourceApi,
|
|
4
|
-
ShapeDiverSdkApi,
|
|
5
|
-
} from "@shapediver/sdk.geometry-api-sdk-core";
|
|
6
|
-
import { sendRequest } from "../utils/utils";
|
|
7
|
-
|
|
8
|
-
export class ShapeDiverTextureApi extends BaseResourceApi {
|
|
9
|
-
constructor(api: ShapeDiverSdkApi) {
|
|
10
|
-
super(api);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* List all textures of the specified model.
|
|
15
|
-
*
|
|
16
|
-
* @param sessionId
|
|
17
|
-
*/
|
|
18
|
-
async listModelTextures(
|
|
19
|
-
sessionId: string,
|
|
20
|
-
offset?: string,
|
|
21
|
-
): Promise<ShapeDiverResponseDto> {
|
|
22
|
-
// Build queries
|
|
23
|
-
const queries: string[] = [];
|
|
24
|
-
if (offset !== undefined) queries.push("offset=" + offset);
|
|
25
|
-
|
|
26
|
-
return await sendRequest(
|
|
27
|
-
async () =>
|
|
28
|
-
(
|
|
29
|
-
await this.api.get<ShapeDiverResponseDto>(
|
|
30
|
-
this.buildSessionUri(sessionId) + "/texture/list",
|
|
31
|
-
queries,
|
|
32
|
-
)
|
|
33
|
-
)[1],
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|