@3dverse/api 0.0.1 → 0.0.2

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 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
+