@gudhub/core 1.1.13 → 1.1.16

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 CHANGED
@@ -1,48 +1,50 @@
1
1
  # GUDHUB
2
2
 
3
- I't a Library to simplify work with GudHub API. Also this Library cantains utilites for beter aperation with `items`, `fields` and `apps`!
3
+ I't a Library to simplify work with GudHub API. Also this Library contains utilities for better operation with `items`, `fields` and `apps`!
4
4
 
5
- # npm Package
5
+ ## npm Package
6
6
 
7
- The package name is `@gudhub/gudhub` It a privet package, that is why `.npmrc` file should be in a root folder to download it from **npm**. It means that If you have `@gudhub/gudhub` in package.json for `GudHubClient` the `.npmrc` file should be in the root folder too.
7
+ The package name is `@gudhub/core`. This is a private package, so the `.npmrc` file must be in the root folder in order to load it from **npm**. This means that if you have `@gudhub/core` in package.json for `GudHubClient`, the `.npmrc` file should be in the root folder too.
8
8
 
9
- ## Publishing gudhub lib to npm
9
+ ## Publishing gudhub lib to npm
10
10
 
11
11
  In order to publish new version of the GudHub Lib you have to:
12
12
 
13
- 1. Change vertsion in `package.json`
14
- 1. Commit your chagnes into repository to the `master` branch
13
+ 1. Change version in `package.json`
14
+ 1. Commit your changes into repository to the `master` branch
15
15
  1. Run `npm publish` command which will publish new version to **npm**
16
16
 
17
- ## Development gudhub lib
17
+ ### Development gudhub lib
18
18
 
19
- If you'd like to develop **GudHub Lib** in another enviroment, let's say in **GudHubClient** you have to do the falowing things:
19
+ If you want to develop the **GudHub Lib** in another environment, say in **GudHubClient**, you need to do the following:
20
20
 
21
- 1. You should go to the `gudhub` folder and run there `npm init @gudhub/gudhub` command, it will install the *@gudhub/gudhub* package in to your global enviroment
22
- 1. Then you have to add `@gudhub/gudhub` to your `package.json` as a dependency.
21
+ 1. You should go to the `gudhub` folder and run there `npm init @gudhub/core` command, it will install the *@gudhub/core* package in to your global environment
22
+ 1. Then you have to add `@gudhub/core` to your `package.json` as a dependency.
23
23
  1. Then package will be downloaded from your local computer after you run `npm run dev` or `npm install` command
24
24
 
25
- # Initialization
25
+ ## Initialization
26
26
 
27
- There are several ways to initialize GudHub. The most simple way is initializing gudhub without arguments. It this way will be available utils only
27
+ There are several ways to initialize GudHub. The most simple way is initializing gudhub without arguments. In this case only the utils will be available.
28
28
 
29
29
  ```js
30
- import {GudHub} from '@gudhub/gudhub';
30
+ import {GudHub} from '@gudhub/core';
31
31
  const gudhub = new GudHub();
32
32
  ```
33
33
 
34
- The second way is initialization GudHub with autorization key. It's the most comon way for using GudHub in your project. You just need to pass `auth_key` as argument.
35
- In this case you will be able to operate with GudHub data and use all mothods those are listed here.
34
+ The second way is initialization GudHub with authorization key. It's the most common way for using GudHub in your project. You just need to pass `auth_key` as argument.
35
+ In this case you will be able to work with GudHub data and use all the methods listed below.
36
36
 
37
37
  ```js
38
- import {GudHub} from '@gudhub/gudhub';
38
+ import {GudHub} from '@gudhub/core';
39
+ const auth_key = 'JLKHKJSKJhkjsclkdjcijIOIoiuSTg';
39
40
  const gudhub = new GudHub(auth_key);
40
41
  ```
41
42
 
42
- The third way is initialisation GudHub with aditionals parameters. It's usefull for development server app on Node.js and for testin on local server.At the exampe belw you can see how to initialize GudHub ( in the example you can see default params )
43
+ The third way is initialization GudHub with additional parameters. It's useful for development server app on Node.js and for testing on local server. In the example below you can see how to initialize GudHub (in the example you can see default params).
43
44
 
44
45
  ```js
45
- import {GudHub} from '@gudhub/gudhub';
46
+ import {GudHub} from '@gudhub/core';
47
+ const auth_key = 'JLKHKJSKJhkjsclkdjcijIOIoiuSTg';
46
48
  const gudhub = new GudHub(auth_key,{
47
49
  server_url : "https://gudhub.com/GudHub",
48
50
  wss_url : "wss://gudhub.com/GudHub/ws/app/",
@@ -52,484 +54,464 @@ const gudhub = new GudHub(auth_key,{
52
54
 
53
55
  Param Name|Description|Default Value
54
56
  ------------ | ------------- | -------------
55
- *server_url* |All request will send to this url |https://gudhub.com/GudHub
56
- *wss_url* | url to setup websoket connection |wss://gudhub.com/GudHub/ws/app/
57
- *initWebsocket* |here we can turn off websoket connection|false
57
+ *server_url*|All request will send to this url |https://gudhub.com/GudHub
58
+ *wss_url*|url to setup websoket connection |wss://gudhub.com/GudHub/ws/app/
59
+ *initWebsocket*|here we can turn off websoket connection|false
58
60
 
59
- # Utils:
61
+ ## Utils
60
62
 
61
- ## jsonConstructor(scheme, items)
63
+ ### jsonConstructor()
62
64
 
63
65
  With this method you can get json according to the scheme.
64
66
 
65
67
  ```js
66
- import {GudHub} from '@gudhub/gudhub';
67
- const gudhub = new GudHub();
68
- gudhub.jsonConstructor(scheme);
69
- ```
70
-
71
- **Sheme Example:**
72
-
73
- ```json
74
- {
75
- "type": "array",
76
- "id": 1,
77
- "childs": [
78
- {
79
- "type": "property",
80
- "id": 3,
81
- "property_name": "name",
82
- "property_type": "field_value",
83
- "field_id": "254056"
84
- },
85
- {
86
- "type": "property",
87
- "id": 4,
88
- "property_name": "state",
89
- "property_type": "field_value",
90
- "field_id": "270607"
91
- }
92
- ],
93
- "property_name": "fishtank",
94
- "app_id": "16259",
95
- "filter": []
96
- }
97
- ```
98
-
99
- ## jsonToItems(json, fieldsMap)
100
-
101
- This method converts json to gudhub items. the conversion is made based on `fieldMap`. After items generated You can send them to create new items.
102
-
103
- ```js
104
- import {GudHub} from '@gudhub/gudhub';
105
- const gudhub = new GudHub();
68
+ gudhub.jsonConstructor(scheme, item, variables)
69
+ ```
70
+
71
+ Read more information about [jsonConstructor on GudHub](https://gudhub.com/docs/utils/json-constructor/json-constustor-overview/).
72
+
73
+ ### jsonToItems()
74
+
75
+ This method converts json to gudhub items. The conversion is made based on `fieldMap`. After generating items, you can send them to create new items.
76
+
77
+ ```js
106
78
  gudhub.jsonToItems(json, fieldsMap);
107
79
  ```
108
80
 
109
- Argument Name|Type|Description
110
- ------------ | ------------- | -------------
111
- *json* | `object` | json that is going to be converted to gudhub items
112
- *fieldsMap* | `object` | and object in json format which contains instructions of how to convert to items
81
+ Read more information about [jsonConstructor on GudHub](https://gudhub.com/docs/utils/json-to-item/jsontoitem-overview/).
113
82
 
114
- fieldsMap this map is an object array that contains field_id and jsonPath to get data from. We use jsonPath [jsonpath](https://www.npmjs.com/package/jsonpath) to parse json.
83
+ ### populateWithItemRef()
115
84
 
116
- ```json
117
- [
118
- {
119
- field_id: 431,
120
- json_path : "$..item_id"
121
- }
122
- ]
85
+ This method updates destination items with item_ref of source items. The connection between sorceItemsRef & srcFieldIdToCompare is checked with srcFieldIdToCompare & destFieldIdToCompare. After connection is detected we save the item_ref into destFieldForRef.
86
+
87
+ ```js
88
+ gudhub.populateWithItemRef(sorceItemsRef, srcFieldIdToCompare, destinationItems, destFieldIdToCompare, destFieldForRef, APPID)
123
89
  ```
124
90
 
125
- The method returns items list:
91
+ Read more information about [populateWithItemRef on GudHub](https://gudhub.com/docs/utils/populate-with-item-reference/).
126
92
 
127
- ```json
128
- [
129
- {
130
- fields:[
131
- {
132
- field_id: 12356,
133
- field_value: "test value"
134
- }
135
- ]
136
- },
137
- {
138
- fields:[
139
- {
140
- field_id: 12356,
141
- field_value: "test value2"
142
- }
143
- ]
144
- }
145
- ]
93
+ ### mergeItems()
94
+
95
+ The current method replaces all fields with values in destinationItems by values from sorceItems. If destinationItems does not have the fields that sorceItems has, they will be created in destinationItems.
96
+
97
+ ```js
98
+ gudhub.mergeItems(sorceItems, destinationItems, mergeByFieldId);
146
99
  ```
147
100
 
148
- ## populateWithItemRef()
101
+ Read more information about [mergeItems on GudHub](https://gudhub.com/docs/utils/merge-items/).
149
102
 
150
- We update destination Items with item_ref of sorce Items. Connectiontion between sorceItemsRef & srcFieldIdToCompare we are checking with help of srcFieldIdToCompare & destFieldIdToCompare. After connection is detected we save the item_ref into destFieldForRef.
103
+ ### compareItems()
104
+
105
+ This method compare fields of sorceItems with fields of destinationItems. This means that if sorceItems has the same fields with the same values as destinationItems, they will be described as 'same_items' even if destinationItems has additional fields that sorceItems does not have.
151
106
 
152
107
  ```js
153
- import {GudHub} from '@gudhub/gudhub';
154
- const gudhub = new GudHub();
155
- gudhub.populateWithItemRef(sorceItemsRef, srcFieldIdToCompare, destinationItems, destFieldIdToCompare, destFieldForRef, appId);
108
+ gudhub.compareItems(sorceItems, destinationItems, fieldToCompare);
156
109
  ```
157
110
 
158
- Argument Name|Type|Description
159
- ------------ | ------------- | -------------
160
- *sorceItemsRef* | `items` | items which will be used as referense for item_ref
161
- *srcFieldIdToCompare* | `field_id` | we use value from this field to find the similar items in source and destimation items array
162
- *destinationItems* | `items` | items those will be used to save item_ref to sorceItemsRef
163
- *destFieldIdToCompare* | `field_id` | we use value from this field to find the similar items in source and destimation items array
164
- *destFieldForRef* | `field_id` | field where we save value of item_ref
165
- *appId* | `app_id` | we use app_id to generate value for item_ref
111
+ Read more information about [compareItems on GudHub](https://gudhub.com/docs/utils/compare-items/).
166
112
 
167
- ## mergeItems()
113
+ ### getDate()
168
114
 
169
- We replace all fields with values in destinationItems by values from sorceItems. If destinationItems doesn't have fields that sorceItems then we create them in destinationItems.
115
+ This method will return a date according to specified namespace. The name space should be in string format
170
116
 
171
117
  ```js
172
- import {GudHub} from '@gudhub/gudhub';
173
- const gudhub = new GudHub();
174
- gudhub.mergeItems(sorceItems, destinationItems);
118
+ gudhub.getDate(date_type);
175
119
  ```
176
120
 
177
- ## compareItems()
121
+ Read more information about [getDate on GudHub](https://gudhub.com/docs/utils/date-utils/#get-date).
122
+
123
+ ### makeNestedList()
178
124
 
179
- We compare fields of sorceItems with fields of destinationItems. It means that if sorceItems have the same fields with the same values as destinationItems thay will be described as 'same_items' even if destinationItems have additional fields those sorceItems doesn't have.
125
+ This method creates the list of fields with infinite nesting. It takes an array of fields and depends of their IDs makes attachments for each of them.
180
126
 
181
127
  ```js
182
- import {GudHub} from '@gudhub/gudhub';
183
- const gudhub = new GudHub();
184
- gudhub.compareItems (sorceItems, destinationItems, fieldToCompare) ;
128
+ gudhub.makeNestedList(arr, 'id', 'parent_id', 'children_property', 'priority')
185
129
  ```
186
130
 
187
- There to ways how it works:
131
+ Read more information about [makeNestedList on GudHub](https://gudhub.com/docs/utils/nested-list/).
132
+
133
+ ## App Processor
188
134
 
189
- 1. Compering items by item_id (if fieldToCompare is undefined)
190
- 1. Compering items by value of specific field_id (if fieldToCompare is defined)
135
+ ### getAppInfo()
191
136
 
192
- **compareItems() Return:**
137
+ This is the method that returns application with empty arrays: `field_list`, `items_list`, `file_list`, `views_list`. Such simple data needed to render App Icons, and do some simple updates in App like: updating App name icon permissions etc when full app data is not needed
193
138
 
194
- ```json
195
- {
196
- is_items_diff: false,
197
- new_src_items:[],
198
- diff_src_items:[],
199
- same_items:[]
200
- }
139
+ ```js
140
+ gudhub.getAppInfo(app_id);
201
141
  ```
202
142
 
203
- Argument Name|Type|Description
204
- ------------ | ------------- | -------------
205
- *sorceItems* | `items` | array of items that is going to be used as a sorce for comperison
206
- *destinationItems* | `items` | array of items that is gong to be compared with sorceItems
207
- *srcFieldIdToCompare* | `field_id` | field that we use to compare sorce items with destination items, if this is not specified then we compare items by item_id
143
+ Read more information about [getAppInfo on GudHub](https://gudhub.com/docs/core-api/app-processor/#getappinfo).
208
144
 
209
- ## getDate()
145
+ ### getApp()
210
146
 
211
- This method will return a date accorting to specified namespace. The name space should be in string format
147
+ This method is called to get an application by its ID specified as an argument.
212
148
 
213
149
  ```js
214
- import {GudHub} from '@gudhub/gudhub';
215
- const gudhub = new GudHub();
216
- gudhub.mergeItems(sorceItems, destinationItems);
150
+ gudhub.getApp(app_id);
217
151
  ```
218
152
 
219
- ## getDate()
153
+ Read more information about [getApp on GudHub](https://gudhub.com/docs/core-api/app-processor/#getapp).
220
154
 
221
- This method will return a date accorting to specified namespace. The name space should be in string format
155
+ ### getAppsList()
156
+
157
+ This method is called after logging in to get a list of user`s applications. It has no arguments. *getAppList* return list of applications that are shared to users.
222
158
 
223
159
  ```js
224
- import {GudHub} from '@gudhub/gudhub';
225
- const gudhub = new GudHub();
226
- gudhub.getDate('this_sunday');
160
+ gudhub.getAppsList();
227
161
  ```
228
162
 
229
- The following namespaces are available now:
163
+ Read more information about [getApp on GudHub](https://gudhub.com/docs/core-api/app-processor/#getappslist).
230
164
 
231
- Date Namespaces | Description
232
- ------------ | -------------
233
- `now` | will return current date
234
- `next_day` | should return current day + 24hours
235
- `next_week` | it adds one week(7 days) to current date
236
- `two_days_after` | it adds two days(24hours) to current date
237
- `three_days_after` | it adds three days(24hours) to current date
238
- `four_days_after` | it adds four days(24hours) to current date
239
- `two_weeks_after` | it adds two weeks(7 days) to current date
240
- `three_weeks_after` | it adds three weeks(7 days) to current date
241
- `this_sunday` | will return date for sunday, with current utc time if it's a monday then it will return sunday from the next week
242
- `this_monday` | will return date for monday, with current utc time if it's a saturday then it will return monday from the next week
243
- `this_tuesday` | will return date for tuesday, with current utc time if it's a saturday then it will return tuesday from the next week
244
- `this_wednesday` | will return date for wednesday, with current utc time if it's a saturday then it will return wednesday from the next week
245
- `this_thursday` | will return date for thursday, with current utc time if it's a saturday then it will return thursday from the next week
246
- `this_friday` | will return date for friday, with current utc time if it's a saturday then it will return friday from the next week
247
- `this_saturday` | will return date for monday, with current utc time if it's a sunday then it will return saturday from the next week
165
+ ## Authentication
248
166
 
249
- `prefilter()`
167
+ ### login()
250
168
 
251
- `filter()`
169
+ This method is used for getting access to the account. It can be called with login and password or the authentication key with or without additional parameters.
252
170
 
253
- `group()`
171
+ ```js
172
+ gudhub.login(data);
173
+ ```
174
+
175
+ Read more information about [login on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#login-with-username-and-password).
254
176
 
255
- `mergeItems(src, destn)`
177
+ ### logout()
256
178
 
257
- `compareItems()`
179
+ This method is used when the user logs out of his/her account.
258
180
 
259
- `populateWithItemRef()`
181
+ ```js
182
+ gudhub.logout(token);
183
+ ```
260
184
 
261
- `(target, source, optionsArgument)`
262
- It deeply merge two objects. We use this method two merge fields models
263
- 0 Value of properties for source object woun't be changed by target object
264
- 0 source of target hase unique properties they are going to be created in resulted object
185
+ Read more information about [logout on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#logout).
265
186
 
266
- ## makeNestedList ()
187
+ ### signup()
267
188
 
268
- This method will return a new nested array from initial array.
189
+ This method is used to register a user account in GudHub.
269
190
 
270
191
  ```js
271
- import {GudHub} from '@gudhub/gudhub';
272
- const gudhub = new GudHub();
273
- let nestedList = gudhub.makeNestedList(array, id, parent_id, children_property);
274
- ```
275
-
276
- Argument Name | Type | Description
277
- --------------|--------------|--------------
278
- array | `array` | Array from which nested list will be generated
279
- id | `string` | Parent property name
280
- parent_id | `string` | Child property name
281
- children_property | `string` | `(Optional)` Name of property, in which children items will be stored inside parent item. <br> Default is 'children'
282
-
283
- Initial array example:
284
-
285
- ```js
286
- let input = [
287
- {
288
- name: "Article 1",
289
- id: 1,
290
- parent_id: 0
291
- },
292
- {
293
- name: "Article 2",
294
- id: 2,
295
- parent_id: 1
296
- },
297
- {
298
- name: "Article 3",
299
- id: 3,
300
- parent_id: 1
301
- },
302
- {
303
- name: "Article 4",
304
- id: 4,
305
- parent_id: 0
306
- }
307
- ]
308
- ```
309
-
310
- Method call example:
311
-
312
- ```js
313
- let result = gudhub.makeNestedList(input, 'id', 'parent_id', 'custom_children_property')
314
- ```
315
-
316
- Result example:
317
-
318
- ```js
319
- [
320
- {
321
- id: 1,
322
- name: "Article 1",
323
- parent_id: 0,
324
- custom_child_property: [
325
- {
326
- id: 2,
327
- name: "Article 2",
328
- parent_id: 1
329
- },
330
- {
331
- id: 3,
332
- name: "Article 3",
333
- parent_id: 1
334
- }
335
- ]
336
- },
337
- {
338
- id: 4,
339
- name: "Article 4",
340
- parent_id: 0
341
- }
342
- ]
343
- ```
344
-
345
- # App Processor:
346
-
347
- ## getAppInfo()
348
-
349
- it returs App with Empty `field_list:[]`, `items_list:[]`, `file_list:[]`, `views_list:[]`. Such simmple data needed to render App Icons, and do some simple updates in App like: updating App name icon permisions etc when full app data is not needed
350
-
351
- ```js
352
- import {GudHub} from '@gudhub/gudhub';
353
- const gudhub = new GudHub();
354
- gudhub.getAppInfo(appId);
192
+ gudhub.signup(user);
355
193
  ```
356
194
 
357
- Argument Name|Type|Description
358
- ------------ | ------------- | -------------
359
- *appId* | `app_id` | we use app_id to generate value for item_ref
195
+ Read more information about [signup on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#signup).
360
196
 
361
- **getAppInfo() returns folowing object:**
197
+ ### getUserById()
362
198
 
363
- ```json
364
- {
365
- app_id: 13360,
366
- app_name: "Contacts"
367
- field_list: [],
368
- file_list: [],
369
- group_id: 13329,
370
- icon: {id: 12762, icon_id: "user", icon_color: "ffffff", gradient_up: "ff758c", gradient_down: "ff7eb3"}
371
- items_list: [],
372
- keys_list: [],
373
- last_update: 1608657765499,
374
- permission: 4,
375
- priority: 0,
376
- privacy: 0,
377
- show: true,
378
- trash: false,
379
- view_init: 281591,
380
- views_list: []
381
- }
199
+ This method gets user from user list who have access to the application.
200
+
201
+ ```js
202
+ gudhub.getUserById(userId);
382
203
  ```
383
204
 
384
- `getApp(app_id)` return app;
205
+ Read more information about [getUserById on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#getuserbyid).
385
206
 
386
- `To Be Done` -> `getAppList()` return List of Applications those are shared to users;
207
+ ### getUsersList()
387
208
 
388
- # App Processor:
209
+ This method is called during the search for users to share. Namely, when you enter a keyword into the search box, GudHub displays all users whose names match that word.
389
210
 
390
- ## getAppInfo()
211
+ ```js
212
+ gudhub.getUsersList(keyword);
213
+ ```
214
+
215
+ Read more information about [getUsersList on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#getuserslist).
391
216
 
392
- it returs App with Empty `field_list:[]`, `items_list:[]`, `file_list:[]`, `views_list:[]`. Such simmple data needed to render App Icons, and do some simple updates in App like: updating App name icon permisions etc when full app data is not needed
217
+ ### updateUser()
218
+
219
+ This is the method used to update user account data.
393
220
 
394
221
  ```js
395
- import {GudHub} from '@gudhub/gudhub';
396
- const gudhub = new GudHub();
397
- gudhub.getAppInfo(appId);
222
+ gudhub.updateUser(userData);
398
223
  ```
399
224
 
400
- Argument Name|Type|Description
401
- ------------ | ------------- | -------------
402
- *appId* | `app_id` | we use app_id to generate value for item_ref
225
+ Read more information about [updateUser on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#updateuser).
226
+
227
+ ### getToken()
228
+
229
+ This method is used to get the current token.
230
+
231
+ ```js
232
+ gudhub.getToken();
233
+ ```
234
+
235
+ Read more information about [getToken on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#gettoken).
236
+
237
+ ### updateToken()
403
238
 
404
- **It returns folowing object:**
239
+ This method is called when the token is updated.
405
240
 
406
- ```json
407
- {
408
- app_id: 13360,
409
- app_name: "Contacts"
410
- field_list: [],
411
- file_list: [],
412
- group_id: 13329,
413
- icon: {id: 12762, icon_id: "user", icon_color: "ffffff", gradient_up: "ff758c", gradient_down: "ff7eb3"}
414
- items_list: [],
415
- keys_list: [],
416
- last_update: 1608657765499,
417
- permission: 4,
418
- priority: 0,
419
- privacy: 0,
420
- show: true,
421
- trash: false,
422
- view_init: 281591,
423
- views_list: []
424
- }
241
+ ```js
242
+ gudhub.updateToken(auth_key)
425
243
  ```
426
244
 
427
- `getApp(app_id)` return app;
428
-
429
- `To Be Done` -> `getAppList()` return List of Applications those are shared to users;
245
+ Read more information about [updateToken on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#updatetoken).
246
+
247
+ ### updateAvatar()
430
248
 
249
+ This method is used when user changes his photo of the account.
431
250
 
432
- # User:
251
+ ```js
252
+ gudhub.updateAvatar(imageData);
253
+ ```
433
254
 
434
- `login()`;(is not needed)
255
+ Read more information about [updateAvatar on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#updateavatar).
435
256
 
436
- `logout()`;
257
+ ### getUserFromStorage()
437
258
 
438
- `signup()`;(is not needed)
259
+ This method is used for getting needed user from the user list during sharing.
439
260
 
440
- `getUser()`;
261
+ ```js
262
+ gudhub.getUserFromStorage(id);
263
+ ```
441
264
 
442
- `getUsersList()`;
265
+ Read more information about [getUserFromStorage on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#getuserfromstorage).
443
266
 
444
- `updateUser()`;
267
+ ### saveUserToStorage()
445
268
 
446
- `avatarUpload()`;
269
+ This method allows you to add new user to the user list.
447
270
 
448
- `getVersion()`;
271
+ ```js
272
+ gudhub.saveUserToStorage(saveUser);
273
+ ```
449
274
 
450
- ## Sharing
275
+ Read more information about [saveUserToStorage on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#saveusertostorage).
451
276
 
452
- `getUsersWithPermision()`;
277
+ ### getVersion()
453
278
 
454
- `sharingAdd()`;
279
+ Use this method to to find out the current version of the GudHub.
455
280
 
456
- `sharingUpdate()`;
281
+ ```js
282
+ gudhub.getVersion();
283
+ ```
457
284
 
458
- `sharingDelete()`;
285
+ Read more information about [getVersion on GudHub](https://gudhub.com/docs/core-api/auth-core-api/#getversion).
459
286
 
460
287
  ## Items Processor
461
288
 
462
- `itemsGet(app_id, items_id_array)` return items by item_id from the array;
289
+ ### getItems()
290
+
291
+ This method is used to get the items of the current application.
292
+
293
+ ```js
294
+ await gudhub.getItems(app_id, trash);
295
+ ```
296
+
297
+ Read more information about [getItems on GudHub](https://gudhub.com/docs/core-api/item-processor/#getitems).
298
+
299
+ ### addNewItems()
300
+
301
+ Use this method to add new items to the items list.
302
+
303
+ ```js
304
+ await gudhub.addNewItems(app_id, itemsList);
305
+ ```
306
+
307
+ Read more information about [addNewItems on GudHub](https://gudhub.com/docs/core-api/item-processor/#addnewitems).
308
+
309
+ ### updateItems()
463
310
 
464
- `filteredItemsGet(app_id, filter)` return items according to filter;
311
+ This method is used to update certain items.
465
312
 
466
- `itemGet(app_id, item_id)` return item;
313
+ ```js
314
+ await gudhub.updateItems(app_id, itemsList);
315
+ ```
316
+
317
+ Read more information about [updateItems on GudHub](https://gudhub.com/docs/core-api/item-processor/#updateitems).
318
+
319
+ ### deleteItems()
320
+
321
+ Due to this method you can delete one and more items from thee application.
467
322
 
468
- `itemsAdd(app_id, items)` add items to app;
323
+ ```js
324
+ await gudhub.deleteItems(app_id, itemsIds);
325
+ ```
469
326
 
470
- `itemsUpdate(app_id, items)` update items in the app;
327
+ Read more information about [deleteItems on GudHub](https://gudhub.com/docs/core-api/item-processor/#deleteitems).
471
328
 
472
329
  ## Field Processor
473
330
 
474
- `elementGet(element_id)` return element `beta`;
331
+ ### getField()
332
+
333
+ Due to this method you can get field from the relevant application.
334
+
335
+ ```js
336
+ await gudhub.getField(app_id, field_id);
337
+ ```
338
+
339
+ Read more information about [getField on GudHub](https://gudhub.com/docs/core-api/field-processor/#getfield).
475
340
 
476
- `fieldValueGet(app_id, item_id, field_id)` return field value;
341
+ ### updateField()
342
+
343
+ This method allows you to update field model of the current application.
344
+
345
+ ```js
346
+ await gudhub.updateField(app_id, fieldModel);
347
+ ```
348
+
349
+ Read more information about [updateField on GudHub](https://gudhub.com/docs/core-api/field-processor/#updatefield).
350
+
351
+ ### deleteField()
352
+
353
+ The method is created for deleting field from the application.
354
+
355
+ ```js
356
+ await gudhub.deleteField(app_id, field_id);
357
+ ```
358
+
359
+ Read more information about [deleteField on GudHub](https://gudhub.com/docs/core-api/field-processor/#deletefield).
360
+
361
+ ### getFieldModels()
362
+
363
+ This method is used for getting a list of field models.
364
+
365
+ ```js
366
+ await gudhub.getFieldModels(app_id);
367
+ ```
368
+
369
+ Read more information about [getFieldModels on GudHub](https://gudhub.com/docs/core-api/field-processor/#getfieldmodels).
370
+
371
+ ### getFieldValue()
477
372
 
478
- `valueUpdate(app_id, item_id, field_id, field_value)` update value in a field;
373
+ This method is responsible for getting the value from the desired field.
479
374
 
480
- `getModel(app_id, field_id)` return data_model of field;
375
+ ```js
376
+ await gudhub.getFieldValue(app_id, item_id, field_id);
377
+ ```
378
+
379
+ Read more information about [getFieldValue on GudHub](https://gudhub.com/docs/core-api/field-processor/#getfieldvalue).
380
+
381
+ ### setFieldValue()
382
+
383
+ This method is called to set value in the desired field.
384
+
385
+ ```js
386
+ await gudhub.setFieldValue(app_id, item_id, field_id, field_value);
387
+ ```
388
+
389
+ Read more information about [setFieldValue on GudHub](https://gudhub.com/docs/core-api/field-processor/#setfieldvalue).
481
390
 
482
391
  ## File Processor
483
392
 
484
- `uploadFile(fileData, app_id, item_id)` create a file from data;
393
+ ### getFile()
394
+
395
+ This method is called to get file from the application.
396
+
397
+ ```js
398
+ gudhub.getFile(app_id, file_id);
399
+ ```
400
+
401
+ Read more information about [getFile on GudHub](https://gudhub.com/docs/core-api/file-manager/#getfile).
402
+
403
+ ### getFiles()
404
+
405
+ This method is called for getting a list of files from current application.
406
+
407
+ ```js
408
+ gudhub.getFiles(app_id, filesId);
409
+ ```
410
+
411
+ Read more information about [getFiles on GudHub](https://gudhub.com/docs/core-api/file-manager/#getfiles).
485
412
 
486
- `uploadFileFromString(data, file_name, app_id, item_id, extension, format)` create a file from string;
413
+ ### uploadFile()
487
414
 
488
- `updateFileFromString(data, file_id, file_name, extension, format)` update file from string;
415
+ ### uploadFileFromString()
489
416
 
490
- `getFile(app_id, file_id)` get file by appId and fileId;
417
+ This is the method that allows to upload different files in base64 format to the application.
491
418
 
492
- `getFiles(app_id, [fileId, fileId])` get files by appId and arrays of filesId;
419
+ ```js
420
+ await gudhub.uploadFileFromString(fileObject);
421
+ ```
422
+
423
+ Read more information about [uploadFileFromString on GudHub](https://gudhub.com/docs/core-api/file-manager/#uploadfilefromstring).
424
+
425
+ ### isFileExists()
426
+
427
+ ### updateFile()
428
+
429
+ ### updateFileFromString()
430
+
431
+ ### duplicateFile()
432
+
433
+ ### downloadFileFromString()
434
+
435
+ ### deleteFile()
436
+
437
+ Due to this method files can be deleted from the application.
493
438
 
494
- `deleteFile(id)` delete file by fileId;
439
+ ```js
440
+ gudhub.deleteFile(app_id, file_id);
441
+ ```
442
+
443
+ Read more information about [deleteFile on GudHub](https://gudhub.com/docs/core-api/file-manager/#deletefile).
495
444
 
496
445
  ## Document Processor
497
446
 
498
- `createDocument({app_id, item_id, element_id, data: Object})` create a document;
447
+ ### createDocument()
448
+
449
+ This method is called for creating a new document in the certain application.
450
+
451
+ ```js
452
+ gudhub.createDocument(documentObject);
453
+ ```
499
454
 
500
- `getDocument({app_id, item_id, element_id})` get a document;
455
+ Read more information about [createDocument on GudHub](https://gudhub.com/docs/core-api/document-manager/#createdocument).
501
456
 
502
- `getDocuments([{app_id, item_id, element_id}, {app_id, item_id, element_id}])` get documents;
457
+ ### getDocument()
503
458
 
504
- `deleteDocument({app_id, item_id, element_id})` delete a document;
459
+ The method for getting needed document from the applications documents list.
505
460
 
506
- ## PipeService
461
+ ```js
462
+ gudhub.getDocument(documentAddress);
463
+ ```
507
464
 
508
- ### Methods
465
+ Read more information about [getDocument on GudHub](https://gudhub.com/docs/core-api/document-manager/#getdocument).
509
466
 
510
- `on(types, destination, fn)`
467
+ ### getDocuments()
511
468
 
512
- `emit(types, destination, address, params)`
469
+ This method is called to get array of documents from the application.
513
470
 
514
- `destroy(types, destination, fn)`
471
+ ```js
472
+ gudhub.getDocuments(documentsAddresses);
473
+ ```
474
+
475
+ Read more information about [getDocuments on GudHub](https://gudhub.com/docs/core-api/document-manager/#getdocuments).
476
+
477
+ ### deleteDocument()
478
+
479
+ Due to this method you can delete document from the application.
480
+
481
+ ```js
482
+ gudhub.deleteDocumentApi(documentAddress);
483
+ ```
484
+
485
+ Read more information about [deleteDocument on GudHub](https://gudhub.com/docs/core-api/document-manager/#deletedocument).
486
+
487
+ ## PipeService
488
+
489
+ ### on()
515
490
 
516
- #### _Examples_
491
+ This is the method that is called for getting subscription.
517
492
 
518
493
  ```js
519
- on("gh_items_update", {app_id: 1, item_id: 1}, function getItems(event, address, params){})
494
+ gudhub.on(event, address, myFunction);
495
+ ```
496
+
497
+ Read more information about [On on GudHub](https://gudhub.com/docs/core-api/pipe-server/#on).
498
+
499
+ ### emit()
520
500
 
521
- emit("gh_items_update", {app_id: 1, item_id: 1}, items, params)
501
+ This is the method that is used by GudHub itself. It is called for getting existing subscription.
522
502
 
523
- destroy("gh_items_update", {app_id: 1, item_id: 1}, function getItems(event, address, params){})
503
+ ```js
504
+ gudhub.on(event, address, myFunction);
524
505
  ```
525
506
 
526
- ### Events
507
+ Read more information about [Emit on GudHub](https://gudhub.com/docs/core-api/pipe-server/#emit).
508
+
509
+ ### destroy()
510
+
511
+ This method exists for ruining extra subscriptions and for optimization the process.
527
512
 
528
- Event name|Address example
529
- ------------ | -------------
530
- `gh_items_update` |{app_id: 1, item_id: 1}
531
- `gh_app_update` |{app_id: 1}
532
- `gh_item_update` |{app_id: 1, item_id: 1}
533
- `gh_value_update` |{app_id: 1, item_id: 1, field_id: 1}
513
+ ```js
514
+ gudhub.destroy('gh_app_views_update', address, myFunction);
515
+ ```
534
516
 
535
- ________
517
+ Read more information about [Destroy on GudHub](https://gudhub.com/docs/core-api/pipe-server/#destroy).