@neuralinnovations/dataisland-sdk 0.0.1-dev5 → 0.0.1-dev6

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 (2) hide show
  1. package/README.md +52 -34
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ The DataIsland Client SDK is a TypeScript library designed to seamlessly integra
4
4
 
5
5
  ## Table of contents
6
6
 
7
- 1. [Connect](#connect)
7
+ 1. [Install](#install)
8
8
  2. [Create app](#create-app)
9
9
  3. [Use organizations](#use-organizations)
10
10
  4. [Use chat](#use-chat)
@@ -13,41 +13,49 @@ The DataIsland Client SDK is a TypeScript library designed to seamlessly integra
13
13
  7. [Use access groups](#use-access-groups)
14
14
  8. [Use invites](#use-invites)
15
15
 
16
- ### Connect
16
+ ### Install
17
17
 
18
18
  For connecting this library to your website project simply install it using npm package manager.
19
19
 
20
- `npm i @neuralinnovations/dataisland-sdk`
20
+ ```shell
21
+ npm i @neuralinnovations/dataisland-sdk
22
+ ```
21
23
 
22
24
  ### Create app
23
25
 
24
26
  You can initialize default app sdk instance using this code example.
25
27
 
26
- ```
27
- const app = await dataIslandApp("your-app-name", async (builder: AppBuilder) => {
28
- builder.useHost(HOST)
29
- builder.useCredential(new BearerCredential(TOKEN))
30
- })
28
+ ```typescript
29
+ // default production app sdk instance
30
+ const dataIslandSdk = await dataIslandApp()
31
+
32
+ // specific app sdk instance
33
+ // use this if you have more than one app
34
+ // or using custom api server
35
+ const yourAppNameSdk = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
36
+ builder.useHost(HOST)
37
+ builder.useCredential(new BearerCredential(TOKEN))
38
+ })
31
39
  ```
32
40
 
33
- It is immpossible to create more than one app sdk intance with same name.
41
+ _It is immpossible to create more than one app sdk intance with same name._
34
42
 
35
43
  **HOST** is a DataIsland API url which can be passed using environment file.
36
44
 
37
- Second required parameter for builder is Credentials. It is recomended to use Bearer credentials instance and pass your user Auth0 **TOKEN** in order to get access to API.
45
+ Second required parameter for builder is Credentials. It is recomended to use Bearer credentials instance and pass your user **TOKEN** in order to get access to API.
38
46
 
39
47
  You can also add requests middlewares with builder options.
40
48
 
41
- ```
42
- const app = await dataIslandApp("your-app-name", async (builder: AppBuilder) => {
43
- builder.useHost(YOUR_HOST)
44
- builder.useAutomaticDataCollectionEnabled(false)
45
- builder.useCredential(new BasicCredential("email", "password"))
46
- builder.registerMiddleware(async (req, next) => {
47
- req.headers.set("Your-header-name", "value")
48
- return await next(req)
49
- })
50
- })
49
+ ```typescript
50
+ const app = await dataIslandApp('your-app-name', async (builder: AppBuilder) => {
51
+ builder.useHost(YOUR_HOST)
52
+ builder.useAutomaticDataCollectionEnabled(false)
53
+ builder.useCredential(new BasicCredential('email', 'password'))
54
+ builder.registerMiddleware(async (req, next) => {
55
+ req.headers.set('Your-header-name', 'value')
56
+ return await next(req)
57
+ })
58
+ })
51
59
  ```
52
60
 
53
61
  ### Use organizations
@@ -61,12 +69,12 @@ By default all user organizations are fetched with user profile during app sdk s
61
69
 
62
70
  Default organization creation code example:
63
71
 
64
- ```
72
+ ```typescript
65
73
  // create organization
66
- const org = await app.organizations.create(
67
- "your-organization-name",
68
- "your-organization-description"
69
- )
74
+ const org = await app.organizations.create(
75
+ 'your-organization-name',
76
+ 'your-organization-description'
77
+ )
70
78
  ```
71
79
 
72
80
  ### Use workspaces
@@ -75,16 +83,26 @@ Workspaces are folder-like objects used to store files and controll access to it
75
83
 
76
84
  Default workspace creation example:
77
85
 
78
- ```
86
+ ```typescript
87
+ // create workspace
88
+ // isCreateNewGroup: boolean - "Bool option for new group creation"
89
+ // newGroupName: string - "New group name"
90
+ // groupIds: string[] - "Array of selected accessed groups IDs"
79
91
  const workspace = await org.workspaces.create(
80
- "your-workspace-name",
81
- "your-workspace-description",
82
- regulation: {
83
- isCreateNewGroup: boolean - "Bool option for new group creation"
84
- newGroupName: string - "New group name"
85
- groupIds: string[] - "Array of selected accessed groups IDs"
86
- }
87
- )
92
+ // name of new workspace
93
+ 'your-workspace-name',
94
+ // description of new workspace
95
+ 'your-workspace-description',
96
+ // regulation options
97
+ {
98
+ // create new group for this workspace
99
+ isCreateNewGroup: true,
100
+ // new group name
101
+ newGroupName: 'your-new-group-name',
102
+ // array of selected groups IDs
103
+ groupIds: []
104
+ }
105
+ )
88
106
  ```
89
107
 
90
108
  ### Use files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralinnovations/dataisland-sdk",
3
- "version": "0.0.1-dev5",
3
+ "version": "0.0.1-dev6",
4
4
  "description": "SDK for DataIsland project",
5
5
  "licenses": [
6
6
  {