@shapediver/sdk.geometry-api-sdk-v2 1.12.1 → 1.13.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 +25 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
# ShapeDiver Geometry Backend API - SDK v2
|
|
8
|
+
|
|
9
|
+
> :warning: **Version 1 is deprecated. Please upgrade to [v2](https://github.com/shapediver/GeometryBackendSdkTypeScript/tree/master/packages/sdk.geometry-api-sdk-v2) to receive the newest features - [Migration Guide](<https://help.shapediver.com/doc/geometry-backend-sdk-typescript-migration-guide#GeometryBackendSDKTypeScript-MigrationGuide-MigratingfromVersion1.x.xto2.x.x(03/11/2024)>).**
|
|
10
|
+
|
|
8
11
|
[ShapeDiver](https://www.shapediver.com/) is a cloud platform for building online applications based on parametric 3D files made with Rhinoceros 3D and Grasshopper.
|
|
9
12
|
|
|
10
13
|
Using the **ShapeDiver Geometry Backend API** allows accessing ShapeDiver models without using the **ShapeDiver Viewer**.
|
|
@@ -14,20 +17,22 @@ This SDK provides functionality to communicate with the **ShapeDiver Geometry Ba
|
|
|
14
17
|
See the [API documentation](https://sdeuc1.eu-central-1.shapediver.com/api/v2/docs/) for more details.
|
|
15
18
|
|
|
16
19
|
## Authentication
|
|
20
|
+
|
|
17
21
|
The authentication system for the Geometry Backend API is based on **ticket objects** and **JWT tokens**, which are handled by the [ShapeDiver Platform](https://www.shapediver.com/app/).
|
|
18
22
|
You can obtain **tickets** and **JWT tokens** by
|
|
19
|
-
|
|
20
|
-
* using your account on the [ShapeDiver Platform](https://www.shapediver.com/app/) (tickets only), or
|
|
21
|
-
* you can obtain them programmatically using the [ShapeDiver Platform API](https://app.shapediver.com/api/documentation) (both tickets and JWT tokens).
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
- using your account on the [ShapeDiver Platform](https://www.shapediver.com/app/) (tickets only), or
|
|
25
|
+
- you can obtain them programmatically using the [ShapeDiver Platform API](https://app.shapediver.com/api/documentation) (both tickets and JWT tokens).
|
|
26
|
+
|
|
27
|
+
An SDK for the [ShapeDiver Platform API](https://app.shapediver.com/api/documentation) will be released soon.
|
|
24
28
|
|
|
25
|
-
When obtaining a ticket for your model from the ShapeDiver Platform, please be aware that you will need a
|
|
29
|
+
When obtaining a ticket for your model from the ShapeDiver Platform, please be aware that you will need a
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
- _ticket for direct embedding_ in case you are accessing the Geometry Backend API from a web browser, or a
|
|
32
|
+
- _ticket for backend access_ in case you are accessing the Geometry Backend API from an arbitrary client application that is not a web browser.
|
|
29
33
|
|
|
30
34
|
## Base URL
|
|
35
|
+
|
|
31
36
|
The base URL to use depends on which ShapeDiver Geometry Backend System your model was uploaded to.
|
|
32
37
|
You can find the base URL in your model's dashboard on the ShapeDiver Platform, it is also called the _model view url_.
|
|
33
38
|
|
|
@@ -39,10 +44,10 @@ import { create } from "@shapediver/sdk.geometry-api-sdk-v2"
|
|
|
39
44
|
(async function () {
|
|
40
45
|
# Please see above on how to obtain a ticket
|
|
41
46
|
const ticket = "8b23fae66cf535719a9ec797e390208b2003e3cfc894b7624ada2f6894515f8836a4-66303337623538322d34386"
|
|
42
|
-
|
|
43
|
-
# Initialize the SDK by providing the base URL
|
|
47
|
+
|
|
48
|
+
# Initialize the SDK by providing the base URL
|
|
44
49
|
const sdk = create("https://sdeuc1.eu-central-1.shapediver.com")
|
|
45
|
-
|
|
50
|
+
|
|
46
51
|
# This initializes a new session and returns your ShapeDiver Model and your session
|
|
47
52
|
const res = await sdk.session.init(ticket)
|
|
48
53
|
console.log(res)
|
|
@@ -50,6 +55,7 @@ import { create } from "@shapediver/sdk.geometry-api-sdk-v2"
|
|
|
50
55
|
```
|
|
51
56
|
|
|
52
57
|
## Usage - Ticket and JWT
|
|
58
|
+
|
|
53
59
|
It is possible to configure your ShapeDiver models such that JWT tokens are required to communicate with them, which provides a strong authorisation mechanism.
|
|
54
60
|
In this case you will need to use the [ShapeDiver Platform API](https://app.shapediver.com/api/documentation) to obtain a JWT token for your model on demand.
|
|
55
61
|
|
|
@@ -60,10 +66,10 @@ import { create } from "@shapediver/sdk.geometry-api-sdk-v2"
|
|
|
60
66
|
# Please see above on how to obtain a ticket and a JWT
|
|
61
67
|
const jwt = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikp1c3QgYSB0ZXN0IiwiaWF0IjoxNjE4OTExMjcxLCJleHAiOjE2MTg5MTQ4OTcsImp0aSI6IjYzMjA3ODE3LWJiNWQtNDY3Zi04NzRkLWM4N2EyYzAxYmZlZCJ9.S5Ps_Fx5p6aJxdBOJMBKgpf2SIlp--6kkIZU55tiqEg"
|
|
62
68
|
const ticket = "8b23fae66cf535719a9ec797e390208b2003e3cfc894b7624ada2f6894515f8836a4-66303337623538322d34386"
|
|
63
|
-
|
|
64
|
-
# Initialize the SDK by providing the base URL and your JWT
|
|
69
|
+
|
|
70
|
+
# Initialize the SDK by providing the base URL and your JWT
|
|
65
71
|
const sdk = create("https://sdeuc1.eu-central-1.shapediver.com", jwt)
|
|
66
|
-
|
|
72
|
+
|
|
67
73
|
# This initializes a new session and returns your ShapeDiver Model and your session
|
|
68
74
|
const res = await sdk.session.init(ticket)
|
|
69
75
|
console.log(res)
|
|
@@ -71,6 +77,7 @@ import { create } from "@shapediver/sdk.geometry-api-sdk-v2"
|
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
## Handling Errors
|
|
80
|
+
|
|
74
81
|
The SDK provides type guards to distinguish between error types.
|
|
75
82
|
|
|
76
83
|
```
|
|
@@ -107,15 +114,18 @@ catch (e: any) {
|
|
|
107
114
|
```
|
|
108
115
|
|
|
109
116
|
## Examples
|
|
110
|
-
Some practical use cases, we will regularly extend the list:
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
Some practical use cases, we will regularly extend the list:
|
|
119
|
+
|
|
120
|
+
- [A Twitter Bot calling a ShapeDiver Model](https://github.com/shapediver/ServerlessExample-TwitterBot):
|
|
113
121
|
This example shows how to run computations using a ShapeDiver Model which has image and data inputs and outputs.
|
|
114
122
|
|
|
115
123
|
## Support
|
|
124
|
+
|
|
116
125
|
If you have questions, please use the [ShapeDiver Help Center](https://help.shapediver.com/).
|
|
117
126
|
|
|
118
127
|
You can find out more about ShapeDiver [right here](https://www.shapediver.com/).
|
|
119
128
|
|
|
120
129
|
## Licensing
|
|
130
|
+
|
|
121
131
|
This project is released under the [MIT License](https://github.com/shapediver/GeometryBackendSdkTypeScript/blob/master/packages/sdk.geometry-api-sdk-v2/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapediver/sdk.geometry-api-sdk-v2",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "SDK to communicate with the Geometry API version 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapediver",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@shapediver/sdk.geometry-api-sdk-core": "~1.5.0",
|
|
58
|
-
"@shapediver/api.geometry-api-dto-v2": "~1.
|
|
58
|
+
"@shapediver/api.geometry-api-dto-v2": "~1.26.0"
|
|
59
59
|
}
|
|
60
60
|
}
|