@3dverse/api 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +55 -0
- package/dist/{_prebuild/wrapper.js → index.cjs.js} +165 -144
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1078 -3
- package/dist/index.esm.js +627 -0
- package/dist/index.esm.js.map +1 -0
- package/index.ts +5 -0
- package/package.json +11 -2
- package/dist/_prebuild/wrapper.d.ts +0 -946
- package/dist/_prebuild/wrapper.js.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/tsconfig.json +0 -9
package/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# 3dverse API library
|
2
|
+
|
3
|
+
Wrapper library for the 3dverse REST API: https://docs.3dverse.com/api/.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
|
8
|
+
### Install
|
9
|
+
|
10
|
+
```
|
11
|
+
npm i @3dverse/api
|
12
|
+
```
|
13
|
+
|
14
|
+
### Import
|
15
|
+
|
16
|
+
```
|
17
|
+
import * as api3dverse from '@3dverse/api';
|
18
|
+
```
|
19
|
+
|
20
|
+
or
|
21
|
+
|
22
|
+
```
|
23
|
+
import { createUser } from '3dverse/api';
|
24
|
+
```
|
25
|
+
|
26
|
+
### Authentication
|
27
|
+
|
28
|
+
Only use the API key on the server.
|
29
|
+
|
30
|
+
```
|
31
|
+
import { setApiKey, createUser } from '3dverse/api';
|
32
|
+
|
33
|
+
|
34
|
+
setApiKey(MY_3DVERSE_API_KEY);
|
35
|
+
|
36
|
+
async () => {
|
37
|
+
const { user_id } = await createUser({ username: 'my_username' });
|
38
|
+
}
|
39
|
+
```
|
40
|
+
|
41
|
+
For client-side request, you can authenticate with the User Token.
|
42
|
+
|
43
|
+
```
|
44
|
+
import { setUserToken, uploadSourceFiles } from '@3dverse/api';
|
45
|
+
|
46
|
+
setUserToken(MY_USER_TOKEN);
|
47
|
+
|
48
|
+
async () => {
|
49
|
+
const upload = await uploadSourceFiles({
|
50
|
+
folder_id: 'my_folder_id',
|
51
|
+
body: formData
|
52
|
+
});
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|