@shapediver/sdk.geometry-api-sdk-v2 1.8.3 → 1.9.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.
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 +4 -8
  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 +32 -15
  45. package/dist/resources/ShapeDiverUtilsApi.js.map +1 -1
  46. package/dist/utils/utils.d.ts +3 -1
  47. package/dist/utils/utils.d.ts.map +1 -1
  48. package/dist/utils/utils.js +35 -9
  49. package/dist/utils/utils.js.map +1 -1
  50. package/package.json +2 -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 +127 -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 +294 -231
  67. package/src/utils/utils.ts +100 -54
@@ -1,64 +1,100 @@
1
1
  import {
2
- ShapeDiverRequestCache,
3
- ShapeDiverRequestCustomization,
4
- ShapeDiverRequestOutputDefinition,
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
+ 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";
9
12
 
10
13
  export class ShapeDiverOutputApi 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 output.
18
- *
19
- * @param sessionId
20
- * @param body
21
- */
22
- async customize (sessionId: string, body: ShapeDiverRequestCustomization): Promise<ShapeDiverResponseDto> {
23
- return await sendRequest(async () =>
24
- (await this.api.put<ShapeDiverResponseDto>(this.buildSessionUri(sessionId) + "/output", body))[1],
25
- )
26
- }
27
-
28
- /**
29
- * Check if a specific version of a requested output has been computed yet.
30
- *
31
- * @param sessionId
32
- * @param body
33
- */
34
- async getCache (sessionId: string, body: ShapeDiverRequestCache): Promise<ShapeDiverResponseDto> {
35
- return await sendRequest(async () =>
36
- (await this.api.put<ShapeDiverResponseDto>(this.buildSessionUri(sessionId) + "/output/cache", body))[1],
37
- )
38
- }
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
+ body,
34
+ )
35
+ )[1],
36
+ );
37
+ }
39
38
 
40
- /**
41
- * Updates the definitions of the given outputs.
42
- *
43
- * @param modelId
44
- * @param body
45
- */
46
- async updateDefinitions (modelId: string, body: ShapeDiverRequestOutputDefinition): Promise<ShapeDiverResponseDto> {
47
- return await sendRequest(async () =>
48
- (await this.api.patch<ShapeDiverResponseDto>(this.buildModelUri(modelId) + "/output", body))[1],
49
- )
50
- }
39
+ /**
40
+ * Check if a specific version of a requested output has been computed yet.
41
+ *
42
+ * @param sessionId
43
+ * @param body
44
+ */
45
+ async getCache(
46
+ sessionId: string,
47
+ body: ShapeDiverRequestCache,
48
+ ): Promise<ShapeDiverResponseDto> {
49
+ return await sendRequest(
50
+ async () =>
51
+ (
52
+ await this.api.put<ShapeDiverResponseDto>(
53
+ this.buildSessionUri(sessionId) + "/output/cache",
54
+ body,
55
+ )
56
+ )[1],
57
+ );
58
+ }
51
59
 
52
- /**
53
- * List all cached versions of the specified output.
54
- *
55
- * @param sessionId
56
- * @param outputId
57
- */
58
- async listVersions (sessionId: string, outputId: string): Promise<ShapeDiverResponseDto> {
59
- return await sendRequest(async () =>
60
- (await this.api.get<ShapeDiverResponseDto>(this.buildSessionUri(sessionId) + "/output/" + outputId + "/list"))[1],
61
- )
62
- }
60
+ /**
61
+ * Updates the definitions of the given outputs.
62
+ *
63
+ * @param modelId
64
+ * @param body
65
+ */
66
+ async updateDefinitions(
67
+ modelId: string,
68
+ body: ShapeDiverRequestOutputDefinition,
69
+ ): Promise<ShapeDiverResponseDto> {
70
+ return await sendRequest(
71
+ async () =>
72
+ (
73
+ await this.api.patch<ShapeDiverResponseDto>(
74
+ this.buildModelUri(modelId) + "/output",
75
+ body,
76
+ )
77
+ )[1],
78
+ );
79
+ }
63
80
 
81
+ /**
82
+ * List all cached versions of the specified output.
83
+ *
84
+ * @param sessionId
85
+ * @param outputId
86
+ */
87
+ async listVersions(
88
+ sessionId: string,
89
+ outputId: string,
90
+ ): Promise<ShapeDiverResponseDto> {
91
+ return await sendRequest(
92
+ async () =>
93
+ (
94
+ await this.api.get<ShapeDiverResponseDto>(
95
+ this.buildSessionUri(sessionId) + "/output/" + outputId + "/list",
96
+ )
97
+ )[1],
98
+ );
99
+ }
64
100
  }
@@ -1,61 +1,95 @@
1
- import { ShapeDiverRequestSdtfUpload, 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"
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";
4
11
 
5
12
  export class ShapeDiverSdtfApi extends BaseResourceApi {
13
+ constructor(api: ShapeDiverSdkApi) {
14
+ super(api);
15
+ }
6
16
 
7
- constructor (api: ShapeDiverSdkApi) {
8
- super(api)
9
- }
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
+ ): Promise<ShapeDiverResponseDto> {
27
+ return await sendRequest(
28
+ async () =>
29
+ (
30
+ await this.api.get<ShapeDiverResponseDto>(
31
+ `${this.buildSessionUri(sessionId)}/sdtf/${namespace}/list`,
32
+ )
33
+ )[1],
34
+ );
35
+ }
10
36
 
11
- /**
12
- * List all sdTF-assets of the given namespace.
13
- *
14
- * @param sessionId
15
- * @param namespace
16
- */
17
- async list (sessionId: string, namespace: string): Promise<ShapeDiverResponseDto> {
18
- return await sendRequest(async () =>
19
- (await this.api.get<ShapeDiverResponseDto>(`${ this.buildSessionUri(sessionId) }/sdtf/${ namespace }/list`))[1])
20
- }
37
+ /**
38
+ * Download a sdTF-asset.
39
+ *
40
+ * @param sessionId
41
+ * @param sdtfId - Format: "<namespace>/<sdTF id>"
42
+ */
43
+ async get(sessionId: string, sdtfId: string): Promise<ArrayBuffer> {
44
+ return await sendRequest(
45
+ async () =>
46
+ (
47
+ await this.api.get<ArrayBuffer>(
48
+ `${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`,
49
+ { responseType: ShapeDiverSdkApiResponseType.DATA },
50
+ )
51
+ )[1],
52
+ );
53
+ }
21
54
 
22
- /**
23
- * Download a sdTF-asset.
24
- *
25
- * @param sessionId
26
- * @param sdtfId - Format: "<namespace>/<sdTF id>"
27
- */
28
- async get (sessionId: string, sdtfId: string): Promise<ArrayBuffer> {
29
- return await sendRequest(async () =>
30
- (await this.api.get<ArrayBuffer>(
31
- `${ this.buildSessionUri(sessionId) }/sdtf/${ sdtfId }`,
32
- { responseType: ShapeDiverSdkApiResponseType.DATA },
33
- ))[1],
34
- )
35
- }
36
-
37
- /**
38
- * Delete a sdTF-asset.
39
- *
40
- * @param sessionId
41
- * @param sdtfId
42
- */
43
- async delete (sessionId: string, sdtfId: string): Promise<ShapeDiverResponseDto> {
44
- return await sendRequest(async () =>
45
- (await this.api.delete<ShapeDiverResponseDto>(`${ this.buildSessionUri(sessionId) }/sdtf/${ sdtfId }`))[1],
46
- )
47
- }
48
-
49
- /**
50
- * Request an Upload-URL for a sdTF-asset.
51
- *
52
- * @param sessionId
53
- * @param body
54
- */
55
- async requestUpload (sessionId: string, body: ShapeDiverRequestSdtfUpload): Promise<ShapeDiverResponseDto> {
56
- return await sendRequest(async () =>
57
- (await this.api.post<ShapeDiverResponseDto>(this.buildSessionUri(sessionId) + "/sdtf/upload", body))[1],
58
- )
59
- }
55
+ /**
56
+ * Delete a sdTF-asset.
57
+ *
58
+ * @param sessionId
59
+ * @param sdtfId
60
+ */
61
+ async delete(
62
+ sessionId: string,
63
+ sdtfId: string,
64
+ ): Promise<ShapeDiverResponseDto> {
65
+ return await sendRequest(
66
+ async () =>
67
+ (
68
+ await this.api.delete<ShapeDiverResponseDto>(
69
+ `${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`,
70
+ )
71
+ )[1],
72
+ );
73
+ }
60
74
 
75
+ /**
76
+ * Request an Upload-URL for a sdTF-asset.
77
+ *
78
+ * @param sessionId
79
+ * @param body
80
+ */
81
+ async requestUpload(
82
+ sessionId: string,
83
+ body: ShapeDiverRequestSdtfUpload,
84
+ ): Promise<ShapeDiverResponseDto> {
85
+ return await sendRequest(
86
+ async () =>
87
+ (
88
+ await this.api.post<ShapeDiverResponseDto>(
89
+ this.buildSessionUri(sessionId) + "/sdtf/upload",
90
+ body,
91
+ )
92
+ )[1],
93
+ );
94
+ }
61
95
  }
@@ -1,91 +1,113 @@
1
1
  import {
2
- ShapeDiverRequestCustomization,
3
- ShapeDiverRequestExport,
4
- ShapeDiverRequestTicket,
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
+ 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";
9
12
 
10
13
  export class ShapeDiverSessionApi extends BaseResourceApi {
14
+ constructor(api: ShapeDiverSdkApi) {
15
+ super(api);
16
+ }
11
17
 
12
- constructor(api: ShapeDiverSdkApi) {
13
- super(api)
14
- }
15
-
16
- /**
17
- * Create a new ticket that allows to initialize new sessions for the
18
- * specified model.
19
- *
20
- * @param modelId
21
- * @param body
22
- */
23
- async ticket(modelId: string, body: ShapeDiverRequestTicket): Promise<ShapeDiverResponseDto> {
24
- return await sendRequest(async () =>
25
- (await this.api.post<ShapeDiverResponseDto>(
26
- this.buildModelUri(modelId) + "/ticket",
27
- body,
28
- ))[1],
29
- )
30
- }
31
-
32
- /**
33
- * Create a new session for a ShapeDiver Model via a ticket.
34
- *
35
- * @param ticket
36
- * @param request - Optional customization or export request.
37
- */
38
- async init(
39
- ticket: string,
40
- request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
41
- ): Promise<ShapeDiverResponseDto> {
42
- return await sendRequest(async () =>
43
- (await this.api.post<ShapeDiverResponseDto>(this.buildTicketUri(ticket), request))[1],
44
- )
45
- }
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
+ body,
35
+ )
36
+ )[1],
37
+ );
38
+ }
46
39
 
47
- /**
48
- * Create a new session for a ShapeDiver Model.
49
- *
50
- * @param ticket
51
- * @param request - Optional customization or export request.
52
- */
53
- async initForModel(
54
- modelId: string,
55
- request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
56
- ): Promise<ShapeDiverResponseDto> {
57
- return await sendRequest(async () =>
58
- (await this.api.post<ShapeDiverResponseDto>(
59
- this.buildModelUri(modelId) + "/session",
60
- request,
61
- ))[1],
62
- )
63
- }
40
+ /**
41
+ * Create a new session for a ShapeDiver Model via a ticket.
42
+ *
43
+ * @param ticket
44
+ * @param request - Optional customization or export request.
45
+ */
46
+ async init(
47
+ ticket: string,
48
+ request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
49
+ ): Promise<ShapeDiverResponseDto> {
50
+ return await sendRequest(
51
+ async () =>
52
+ (
53
+ await this.api.post<ShapeDiverResponseDto>(
54
+ this.buildTicketUri(ticket),
55
+ request,
56
+ )
57
+ )[1],
58
+ );
59
+ }
64
60
 
65
- /**
66
- * Get the full description of a ShapeDiver Model.
67
- *
68
- * @param sessionId
69
- */
70
- async default(sessionId: string): Promise<ShapeDiverResponseDto> {
71
- return await sendRequest(async () =>
72
- (await this.api.get<ShapeDiverResponseDto>(
73
- this.buildSessionUri(sessionId) + "/default",
74
- ))[1],
75
- )
76
- }
61
+ /**
62
+ * Create a new session for a ShapeDiver Model.
63
+ *
64
+ * @param ticket
65
+ * @param request - Optional customization or export request.
66
+ */
67
+ async initForModel(
68
+ modelId: string,
69
+ request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport,
70
+ ): Promise<ShapeDiverResponseDto> {
71
+ return await sendRequest(
72
+ async () =>
73
+ (
74
+ await this.api.post<ShapeDiverResponseDto>(
75
+ this.buildModelUri(modelId) + "/session",
76
+ request,
77
+ )
78
+ )[1],
79
+ );
80
+ }
77
81
 
78
- /**
79
- * Close the specified session.
80
- *
81
- * @param sessionId
82
- */
83
- async close(sessionId: string): Promise<ShapeDiverResponseDto> {
84
- return await sendRequest(async () =>
85
- (await this.api.post<ShapeDiverResponseDto>(
86
- this.buildSessionUri(sessionId) + "/close",
87
- ))[1],
88
- )
89
- }
82
+ /**
83
+ * Get the full description of a ShapeDiver Model.
84
+ *
85
+ * @param sessionId
86
+ */
87
+ async default(sessionId: string): Promise<ShapeDiverResponseDto> {
88
+ return await sendRequest(
89
+ async () =>
90
+ (
91
+ await this.api.get<ShapeDiverResponseDto>(
92
+ this.buildSessionUri(sessionId) + "/default",
93
+ )
94
+ )[1],
95
+ );
96
+ }
90
97
 
98
+ /**
99
+ * Close the specified session.
100
+ *
101
+ * @param sessionId
102
+ */
103
+ async close(sessionId: string): Promise<ShapeDiverResponseDto> {
104
+ return await sendRequest(
105
+ async () =>
106
+ (
107
+ await this.api.post<ShapeDiverResponseDto>(
108
+ this.buildSessionUri(sessionId) + "/close",
109
+ )
110
+ )[1],
111
+ );
112
+ }
91
113
  }