@docbrasil/api-systemmanager 1.1.11 → 1.1.13
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/api/user/my_tasks.js +141 -18
- package/dist/bundle.cjs +141 -18
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +1371 -518
- package/docs/MyTasks.html +1457 -59
- package/docs/user_my_tasks.js.html +203 -0
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -37,24 +37,12 @@
|
|
|
37
37
|
<dt><a href="#AdminUser">AdminUser</a></dt>
|
|
38
38
|
<dd><p>Admin Class for user, permission admin</p>
|
|
39
39
|
</dd>
|
|
40
|
-
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
41
|
-
<dd><p>Api dispatch manager</p>
|
|
42
|
-
</dd>
|
|
43
|
-
<dt><a href="#External">External</a></dt>
|
|
44
|
-
<dd><p>Class for documents, permission user</p>
|
|
45
|
-
</dd>
|
|
46
40
|
<dt><a href="#GeoLocation">GeoLocation</a></dt>
|
|
47
41
|
<dd><p>General Class for user, permission organization</p>
|
|
48
42
|
</dd>
|
|
49
43
|
<dt><a href="#Users">Users</a></dt>
|
|
50
44
|
<dd><p>API request, user permission level</p>
|
|
51
45
|
</dd>
|
|
52
|
-
<dt><a href="#Login">Login</a></dt>
|
|
53
|
-
<dd><p>Login manager</p>
|
|
54
|
-
</dd>
|
|
55
|
-
<dt><a href="#Session">Session</a></dt>
|
|
56
|
-
<dd><p>Session manager of the API</p>
|
|
57
|
-
</dd>
|
|
58
46
|
<dt><a href="#Application">Application</a></dt>
|
|
59
47
|
<dd><p>Class for Applications, permission user</p>
|
|
60
48
|
</dd>
|
|
@@ -91,18 +79,30 @@
|
|
|
91
79
|
<dt><a href="#Settings">Settings</a></dt>
|
|
92
80
|
<dd><p>Class for user settings</p>
|
|
93
81
|
</dd>
|
|
94
|
-
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
95
|
-
<dd><p>Class for available tasks, permission user</p>
|
|
96
|
-
</dd>
|
|
97
82
|
<dt><a href="#Task">Task</a></dt>
|
|
98
83
|
<dd><p>Class for task, permission user</p>
|
|
99
84
|
</dd>
|
|
85
|
+
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
86
|
+
<dd><p>Class for available tasks, permission user</p>
|
|
87
|
+
</dd>
|
|
100
88
|
<dt><a href="#Updates">Updates</a></dt>
|
|
101
89
|
<dd><p>Class for user registration in a user</p>
|
|
102
90
|
</dd>
|
|
103
91
|
<dt><a href="#User">User</a></dt>
|
|
104
92
|
<dd><p>Class for user, permission user</p>
|
|
105
93
|
</dd>
|
|
94
|
+
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
95
|
+
<dd><p>Api dispatch manager</p>
|
|
96
|
+
</dd>
|
|
97
|
+
<dt><a href="#External">External</a></dt>
|
|
98
|
+
<dd><p>Class for documents, permission user</p>
|
|
99
|
+
</dd>
|
|
100
|
+
<dt><a href="#Login">Login</a></dt>
|
|
101
|
+
<dd><p>Login manager</p>
|
|
102
|
+
</dd>
|
|
103
|
+
<dt><a href="#Session">Session</a></dt>
|
|
104
|
+
<dd><p>Session manager of the API</p>
|
|
105
|
+
</dd>
|
|
106
106
|
</dl>
|
|
107
107
|
|
|
108
108
|
<a name="AdminDocuments"></a>
|
|
@@ -138,7 +138,33 @@ Advanced search of document in elastic search ussing system manager
|
|
|
138
138
|
|
|
139
139
|
**Example**
|
|
140
140
|
```js
|
|
141
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
142
141
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
143
142
|
query: {
|
|
144
143
|
"query": {
|
|
145
144
|
"bool": {
|
|
146
145
|
"minimum_should_match": 1,
|
|
147
146
|
"should": [
|
|
148
147
|
{
|
|
149
148
|
"match": {
|
|
150
149
|
"locationText.keyword": {
|
|
151
150
|
"query": "sao pau"
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
},
|
|
155
154
|
{
|
|
156
155
|
"wildcard": {
|
|
157
156
|
"locationText.normalized": "*sao pau*"
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
]
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
}
|
|
163
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
164
|
+
const api = new API();
|
|
165
|
+
const params = {
|
|
166
|
+
docId: '5edd11c46b6ce9729c2c297c',
|
|
167
|
+
query: {
|
|
168
|
+
"query": {
|
|
169
|
+
"bool": {
|
|
170
|
+
"minimum_should_match": 1,
|
|
171
|
+
"should": [
|
|
172
|
+
{
|
|
173
|
+
"match": {
|
|
174
|
+
"locationText.keyword": {
|
|
175
|
+
"query": "sao pau"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"wildcard": {
|
|
181
|
+
"locationText.normalized": "*sao pau*"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
189
|
+
await api.admin.document.advancedSearch(params, session);
|
|
164
190
|
```
|
|
165
191
|
<a name="AdminDocuments+findById"></a>
|
|
166
192
|
|
|
@@ -158,7 +184,14 @@ Get document by id
|
|
|
158
184
|
|
|
159
185
|
**Example**
|
|
160
186
|
```js
|
|
161
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
162
187
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
163
188
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
189
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
190
|
+
const api = new API();
|
|
191
|
+
const params = {
|
|
192
|
+
docId: '5edd11c46b6ce9729c2c297c',
|
|
193
|
+
orgId: '55e4a3bd6be6b45210833fae'
|
|
194
|
+
};
|
|
195
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
196
|
+
await api.admin.document.findById(params, session);
|
|
164
197
|
```
|
|
165
198
|
<a name="AdminDocuments+signedUrl"></a>
|
|
166
199
|
|
|
@@ -179,11 +212,25 @@ Request signed url url to put or get
|
|
|
179
212
|
|
|
180
213
|
**Example**
|
|
181
214
|
```js
|
|
182
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
183
215
|
methodType: 'put',
|
|
184
216
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
217
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
218
|
+
const api = new API();
|
|
219
|
+
const params - {
|
|
220
|
+
methodType: 'put',
|
|
221
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
222
|
+
};
|
|
223
|
+
const apiKey: '...';
|
|
224
|
+
const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
|
|
185
225
|
```
|
|
186
226
|
**Example**
|
|
187
227
|
```js
|
|
188
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
189
228
|
methodType: 'get',
|
|
190
229
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
230
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
231
|
+
const api = new API();
|
|
232
|
+
const params - {
|
|
233
|
+
methodType: 'get',
|
|
234
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
235
|
+
};
|
|
236
|
+
const apiKey: '...';
|
|
237
|
+
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
191
238
|
```
|
|
192
239
|
<a name="AdminDocuments+updateContent"></a>
|
|
193
240
|
|
|
@@ -204,7 +251,14 @@ Update a document content
|
|
|
204
251
|
|
|
205
252
|
**Example**
|
|
206
253
|
```js
|
|
207
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
208
254
|
content: 'some text...',
|
|
209
255
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
256
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
257
|
+
const api = new API();
|
|
258
|
+
const params - {
|
|
259
|
+
content: 'some text...',
|
|
260
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
261
|
+
};
|
|
262
|
+
const apiKey: '...';
|
|
263
|
+
await api.admin.document.updateContent(params, apiKey);
|
|
210
264
|
```
|
|
211
265
|
<a name="AdminDocuments+updateAI"></a>
|
|
212
266
|
|
|
@@ -231,7 +285,14 @@ Update a document content
|
|
|
231
285
|
|
|
232
286
|
**Example**
|
|
233
287
|
```js
|
|
234
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
235
288
|
content: 'some text...',
|
|
236
289
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
290
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
291
|
+
const api = new API();
|
|
292
|
+
const params - {
|
|
293
|
+
content: 'some text...',
|
|
294
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
295
|
+
};
|
|
296
|
+
const apiKey: '...';
|
|
297
|
+
await api.admin.document.updateContent(params, apiKey);
|
|
237
298
|
```
|
|
238
299
|
<a name="AdminDocuments+getContent"></a>
|
|
239
300
|
|
|
@@ -252,7 +313,14 @@ Get the content of a document
|
|
|
252
313
|
|
|
253
314
|
**Example**
|
|
254
315
|
```js
|
|
255
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
256
316
|
page: '0',
|
|
257
317
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
318
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
319
|
+
const api = new API();
|
|
320
|
+
const params - {
|
|
321
|
+
page: '0',
|
|
322
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
323
|
+
};
|
|
324
|
+
const apiKey: '...';
|
|
325
|
+
await api.admin.document.getContent(params, apiKey);
|
|
258
326
|
```
|
|
259
327
|
<a name="AdminForm"></a>
|
|
260
328
|
|
|
@@ -283,7 +351,14 @@ Get advance form by ID
|
|
|
283
351
|
|
|
284
352
|
**Example**
|
|
285
353
|
```js
|
|
286
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
287
354
|
id: '55e4a3bd6be6b45210833fae',
|
|
288
355
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
356
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
357
|
+
const api = new API();
|
|
358
|
+
const params = {
|
|
359
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
360
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
361
|
+
};
|
|
362
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
363
|
+
await api.admin.form.findById(params, session);
|
|
289
364
|
```
|
|
290
365
|
<a name="AdminForm+getFormList"></a>
|
|
291
366
|
|
|
@@ -307,7 +382,13 @@ Request signed url url to put or get
|
|
|
307
382
|
|
|
308
383
|
**Example**
|
|
309
384
|
```js
|
|
310
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
311
385
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
386
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
387
|
+
const api = new API();
|
|
388
|
+
const params - {
|
|
389
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
390
|
+
};
|
|
391
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
392
|
+
await api.user.form.getFormList(params, session);
|
|
312
393
|
```
|
|
313
394
|
<a name="Admin"></a>
|
|
314
395
|
|
|
@@ -354,7 +435,14 @@ Get list by ID
|
|
|
354
435
|
|
|
355
436
|
**Example**
|
|
356
437
|
```js
|
|
357
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
358
438
|
id: '55e4a3bd6be6b45210833fae',
|
|
359
439
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
440
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
441
|
+
const api = new API();
|
|
442
|
+
const params = {
|
|
443
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
444
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
445
|
+
};
|
|
446
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
447
|
+
await api.admin.list.findById(params, session);
|
|
360
448
|
```
|
|
361
449
|
<a name="AdminLists+find"></a>
|
|
362
450
|
|
|
@@ -375,7 +463,13 @@ Get all lists
|
|
|
375
463
|
|
|
376
464
|
**Example**
|
|
377
465
|
```js
|
|
378
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
379
466
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
467
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
468
|
+
const api = new API();
|
|
469
|
+
const params = {
|
|
470
|
+
orgId: '55e4a3bd6be6b45210833fae'
|
|
471
|
+
};
|
|
472
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
473
|
+
await api.admin.list.find(params, session);
|
|
380
474
|
```
|
|
381
475
|
<a name="AdminMessage"></a>
|
|
382
476
|
|
|
@@ -453,7 +547,15 @@ Send email, array with email list or send one email
|
|
|
453
547
|
|
|
454
548
|
**Example**
|
|
455
549
|
```js
|
|
456
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
457
550
|
subject: 'Test email',
|
|
458
551
|
message: '<h1>Hi!</h1>',
|
|
459
552
|
to: 'destination@gmail.com'
|
|
553
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
554
|
+
const api = new API();
|
|
555
|
+
const params = {
|
|
556
|
+
subject: 'Test email',
|
|
557
|
+
message: '<h1>Hi!</h1>',
|
|
558
|
+
to: 'destination@gmail.com'
|
|
559
|
+
};
|
|
560
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
561
|
+
await api.admin.message.sendEmail(params, session);
|
|
460
562
|
```
|
|
461
563
|
<a name="AdminNotification"></a>
|
|
462
564
|
|
|
@@ -502,7 +604,15 @@ Create notification
|
|
|
502
604
|
|
|
503
605
|
**Example**
|
|
504
606
|
```js
|
|
505
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
506
607
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
507
608
|
userId: '55e4a3bd6be6b45210833fae',
|
|
508
609
|
message: 'Olá como vai tudo bem?'
|
|
610
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
611
|
+
const api = new API();
|
|
612
|
+
const params = {
|
|
613
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
614
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
615
|
+
message: 'Olá como vai tudo bem?'
|
|
616
|
+
};
|
|
617
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
618
|
+
await api.admin.notifications.add(params, session);
|
|
509
619
|
```
|
|
510
620
|
<a name="AdminNotification+findById"></a>
|
|
511
621
|
|
|
@@ -522,7 +632,14 @@ Search notification using (notificationId or userId)
|
|
|
522
632
|
|
|
523
633
|
**Example**
|
|
524
634
|
```js
|
|
525
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
526
635
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
527
636
|
id: '55e4a3bd6be6b45210833fae',
|
|
637
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
638
|
+
const api = new API();
|
|
639
|
+
const params = {
|
|
640
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
641
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
642
|
+
};
|
|
643
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
644
|
+
await api.admin.notifications.findById(params, session);
|
|
528
645
|
```
|
|
529
646
|
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
530
647
|
|
|
@@ -543,7 +660,15 @@ Update notification using (notificationId or userId)
|
|
|
543
660
|
|
|
544
661
|
**Example**
|
|
545
662
|
```js
|
|
546
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
547
663
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
548
664
|
id: '55e4a3bd6be6b45210833fae',
|
|
549
665
|
read: true
|
|
666
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
667
|
+
const api = new API();
|
|
668
|
+
const params = {
|
|
669
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
670
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
671
|
+
read: true
|
|
672
|
+
};
|
|
673
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
674
|
+
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
550
675
|
```
|
|
551
676
|
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
552
677
|
|
|
@@ -563,7 +688,14 @@ Delete notification using (notificationId or userId)
|
|
|
563
688
|
|
|
564
689
|
**Example**
|
|
565
690
|
```js
|
|
566
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
567
691
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
568
692
|
id: '55e4a3bd6be6b45210833fae',
|
|
693
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
694
|
+
const api = new API();
|
|
695
|
+
const params = {
|
|
696
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
697
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
698
|
+
};
|
|
699
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
700
|
+
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
569
701
|
```
|
|
570
702
|
<a name="Organization"></a>
|
|
571
703
|
|
|
@@ -600,7 +732,15 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
600
732
|
|
|
601
733
|
**Example**
|
|
602
734
|
```js
|
|
603
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
604
735
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
605
736
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
606
737
|
type: 'image/png',
|
|
738
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
739
|
+
const api = new API();
|
|
740
|
+
const params = {
|
|
741
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
742
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
743
|
+
type: 'image/png',
|
|
744
|
+
};
|
|
745
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
746
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
607
747
|
```
|
|
608
748
|
<a name="Organization+removeAvatar"></a>
|
|
609
749
|
|
|
@@ -618,7 +758,11 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
618
758
|
|
|
619
759
|
**Example**
|
|
620
760
|
```js
|
|
621
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
761
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
762
|
+
const api = new API();
|
|
763
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
764
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
765
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
622
766
|
```
|
|
623
767
|
<a name="Organization+findById"></a>
|
|
624
768
|
|
|
@@ -636,7 +780,11 @@ Find organization by id
|
|
|
636
780
|
|
|
637
781
|
**Example**
|
|
638
782
|
```js
|
|
639
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
783
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
784
|
+
const api = new API();
|
|
785
|
+
const orgId = '80443245000122';
|
|
786
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
787
|
+
await api.user.organization.findById(idCard, session);
|
|
640
788
|
```
|
|
641
789
|
<a name="Organization+idCardExist"></a>
|
|
642
790
|
|
|
@@ -654,7 +802,11 @@ Check if id card exist
|
|
|
654
802
|
|
|
655
803
|
**Example**
|
|
656
804
|
```js
|
|
657
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
805
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
806
|
+
const api = new API();
|
|
807
|
+
const idCard = '80443245000122';
|
|
808
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
809
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
658
810
|
```
|
|
659
811
|
<a name="Organization+upsertAvatar"></a>
|
|
660
812
|
|
|
@@ -674,7 +826,14 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
674
826
|
|
|
675
827
|
**Example**
|
|
676
828
|
```js
|
|
677
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
678
829
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
679
830
|
type: 'image/png',
|
|
831
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
832
|
+
const api = new API();
|
|
833
|
+
const params = {
|
|
834
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
835
|
+
type: 'image/png',
|
|
836
|
+
};
|
|
837
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
838
|
+
await api.user.profile.updateAvatar(params, session);
|
|
680
839
|
```
|
|
681
840
|
<a name="Organization+removeAvatar"></a>
|
|
682
841
|
|
|
@@ -691,7 +850,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
691
850
|
|
|
692
851
|
**Example**
|
|
693
852
|
```js
|
|
694
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
853
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
854
|
+
const api = new API();
|
|
855
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
856
|
+
await api.user.profile.removeAvatar(session);
|
|
695
857
|
```
|
|
696
858
|
<a name="Organization+callFetch"></a>
|
|
697
859
|
|
|
@@ -711,7 +873,14 @@ Call URL internal, need auth JWT (session)
|
|
|
711
873
|
|
|
712
874
|
**Example**
|
|
713
875
|
```js
|
|
714
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
715
876
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
716
877
|
method: 'POST'
|
|
878
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
879
|
+
const api = new API();
|
|
880
|
+
|
|
881
|
+
const params = {
|
|
882
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
883
|
+
method: 'POST'
|
|
884
|
+
}
|
|
885
|
+
await api.user.organization.callFetchs(params, session);
|
|
717
886
|
```
|
|
718
887
|
<a name="AdminPlugin"></a>
|
|
719
888
|
|
|
@@ -741,7 +910,11 @@ Find plugins
|
|
|
741
910
|
|
|
742
911
|
**Example**
|
|
743
912
|
```js
|
|
744
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
913
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
914
|
+
const api = new API();
|
|
915
|
+
const params = {page: 1, perPage: 200};
|
|
916
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
917
|
+
await api.user.organization.findById(params, session);
|
|
745
918
|
```
|
|
746
919
|
<a name="AdminPlugin+findById"></a>
|
|
747
920
|
|
|
@@ -759,7 +932,11 @@ Get plugin by ID
|
|
|
759
932
|
|
|
760
933
|
**Example**
|
|
761
934
|
```js
|
|
762
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
935
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
936
|
+
const api = new API();
|
|
937
|
+
const id ='55e4a3bd6be6b45210833fae',
|
|
938
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
939
|
+
await api.admin.plugin.findById(id, session);
|
|
763
940
|
```
|
|
764
941
|
<a name="AdminPolicy"></a>
|
|
765
942
|
|
|
@@ -782,7 +959,10 @@ Find all policies
|
|
|
782
959
|
|
|
783
960
|
**Example**
|
|
784
961
|
```js
|
|
785
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
962
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
963
|
+
const api = new API();
|
|
964
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
965
|
+
await api.admin.policy.find(session);
|
|
786
966
|
```
|
|
787
967
|
<a name="AdminProcesses"></a>
|
|
788
968
|
|
|
@@ -806,7 +986,16 @@ Advanced search of processes, check documentation, to verify all params, pass to
|
|
|
806
986
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
807
987
|
**Example**
|
|
808
988
|
```js
|
|
809
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
810
989
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
811
990
|
...
|
|
812
991
|
...
|
|
813
992
|
...
|
|
993
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
994
|
+
const api = new API();
|
|
995
|
+
const params = {
|
|
996
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
997
|
+
...
|
|
998
|
+
...
|
|
999
|
+
...
|
|
1000
|
+
};
|
|
1001
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1002
|
+
await api.admin.processes.search(params, session);
|
|
814
1003
|
```
|
|
815
1004
|
<a name="AdminProcesses+advancedSearch"></a>
|
|
816
1005
|
|
|
@@ -826,7 +1015,23 @@ Advanced search of process in elastic search ussing system manager
|
|
|
826
1015
|
|
|
827
1016
|
**Example**
|
|
828
1017
|
```js
|
|
829
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
830
1018
|
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
831
1019
|
query: {
|
|
832
1020
|
"_source": "processData.properties.processProperties",
|
|
833
1021
|
"query": {
|
|
834
1022
|
"term": {
|
|
835
1023
|
"initParams.email.keyword": {
|
|
836
1024
|
"value": "clintes001@gmail.com"
|
|
837
1025
|
}
|
|
838
1026
|
}
|
|
839
1027
|
}
|
|
840
1028
|
}
|
|
1029
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1030
|
+
const api = new API();
|
|
1031
|
+
const params = {
|
|
1032
|
+
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1033
|
+
query: {
|
|
1034
|
+
"_source": "processData.properties.processProperties",
|
|
1035
|
+
"query": {
|
|
1036
|
+
"term": {
|
|
1037
|
+
"initParams.email.keyword": {
|
|
1038
|
+
"value": "clintes001@gmail.com"
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1045
|
+
await api.admin.processes.advancedSearch(params, session);
|
|
841
1046
|
```
|
|
842
1047
|
<a name="AdminTask"></a>
|
|
843
1048
|
|
|
@@ -857,7 +1062,13 @@ Get task by user Id
|
|
|
857
1062
|
|
|
858
1063
|
**Example**
|
|
859
1064
|
```js
|
|
860
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
861
1065
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1066
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1067
|
+
const api = new API();
|
|
1068
|
+
const params = {
|
|
1069
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1070
|
+
};
|
|
1071
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1072
|
+
await api.admin.task.find(params, session);
|
|
862
1073
|
```
|
|
863
1074
|
<a name="AdminUser"></a>
|
|
864
1075
|
|
|
@@ -891,7 +1102,11 @@ Request profile by userId
|
|
|
891
1102
|
|
|
892
1103
|
**Example**
|
|
893
1104
|
```js
|
|
894
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1105
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1106
|
+
const api = new API();
|
|
1107
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1108
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1109
|
+
await api.admin.user.findById(userId, session);
|
|
895
1110
|
```
|
|
896
1111
|
<a name="AdminUser+findByIds"></a>
|
|
897
1112
|
|
|
@@ -909,7 +1124,11 @@ Request profile by userId
|
|
|
909
1124
|
|
|
910
1125
|
**Example**
|
|
911
1126
|
```js
|
|
912
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1127
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1128
|
+
const api = new API();
|
|
1129
|
+
const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
1130
|
+
const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
1131
|
+
await api.admin.user.findByIds(userIds, apiKey);
|
|
913
1132
|
```
|
|
914
1133
|
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
915
1134
|
|
|
@@ -930,7 +1149,15 @@ Update password by userId
|
|
|
930
1149
|
|
|
931
1150
|
**Example**
|
|
932
1151
|
```js
|
|
933
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
934
1152
|
userId: '55e4a3bd6be6b45210833fae',
|
|
935
1153
|
oldPassword: '123456',
|
|
936
1154
|
newPassword: '123456789'
|
|
1155
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1156
|
+
const api = new API();
|
|
1157
|
+
const params = {
|
|
1158
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1159
|
+
oldPassword: '123456',
|
|
1160
|
+
newPassword: '123456789'
|
|
1161
|
+
};
|
|
1162
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1163
|
+
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
937
1164
|
```
|
|
938
1165
|
<a name="AdminUser+emailExist"></a>
|
|
939
1166
|
|
|
@@ -948,7 +1175,11 @@ Check if email is unique
|
|
|
948
1175
|
|
|
949
1176
|
**Example**
|
|
950
1177
|
```js
|
|
951
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1178
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1179
|
+
const api = new API();
|
|
1180
|
+
const email = 'ana.silva@gmail.com';
|
|
1181
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1182
|
+
await api.admin.user.emailExist(email, session);
|
|
952
1183
|
```
|
|
953
1184
|
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
954
1185
|
|
|
@@ -966,7 +1197,12 @@ update userData by userSMId
|
|
|
966
1197
|
|
|
967
1198
|
**Example**
|
|
968
1199
|
```js
|
|
969
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
970
1200
|
name: 'Maria joaquina',
|
|
971
1201
|
email: 'maria@gmail.com'
|
|
1202
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1203
|
+
const payload = {
|
|
1204
|
+
name: 'Maria joaquina',
|
|
1205
|
+
email: 'maria@gmail.com'
|
|
1206
|
+
};
|
|
1207
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
972
1208
|
```
|
|
973
1209
|
<a name="AdminUser+getChangePasswordGuid"></a>
|
|
974
1210
|
|
|
@@ -982,7 +1218,10 @@ Request GUID to change the password
|
|
|
982
1218
|
|
|
983
1219
|
**Example**
|
|
984
1220
|
```js
|
|
985
|
-
const payload = {
|
|
986
1221
|
email: 'maria@gmail.com'
|
|
1222
|
+
const payload = {
|
|
1223
|
+
email: 'maria@gmail.com'
|
|
1224
|
+
};
|
|
1225
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
987
1226
|
```
|
|
988
1227
|
<a name="AdminUser+changePasswordGuid"></a>
|
|
989
1228
|
|
|
@@ -1000,143 +1239,11 @@ Change password guid
|
|
|
1000
1239
|
|
|
1001
1240
|
**Example**
|
|
1002
1241
|
```js
|
|
1003
|
-
const payload = {
|
|
1004
1242
|
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1005
1243
|
newPassword: '123456789'
|
|
1006
|
-
```
|
|
1007
|
-
<a name="Dispatch"></a>
|
|
1008
|
-
|
|
1009
|
-
## Dispatch
|
|
1010
|
-
Api dispatch manager
|
|
1011
|
-
|
|
1012
|
-
**Kind**: global class
|
|
1013
|
-
|
|
1014
|
-
* [Dispatch](#Dispatch)
|
|
1015
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
1016
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
1017
|
-
|
|
1018
|
-
<a name="Dispatch+getContext"></a>
|
|
1019
|
-
|
|
1020
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
1021
|
-
Get the URL context
|
|
1022
|
-
|
|
1023
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1024
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
1025
|
-
**Access**: public
|
|
1026
|
-
|
|
1027
|
-
| Param | Type | Default | Description |
|
|
1028
|
-
| --- | --- | --- | --- |
|
|
1029
|
-
| url | <code>string</code> | | Full url |
|
|
1030
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
1031
|
-
|
|
1032
|
-
**Example**
|
|
1033
|
-
```js
|
|
1034
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1035
|
-
```
|
|
1036
|
-
<a name="Dispatch+getClient"></a>
|
|
1037
|
-
|
|
1038
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
1039
|
-
Get client Axios
|
|
1040
|
-
|
|
1041
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1042
|
-
**Returns**: <code>promise</code> - return client axios
|
|
1043
|
-
**Access**: public
|
|
1044
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1045
|
-
**Example**
|
|
1046
|
-
```js
|
|
1047
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1048
|
-
```
|
|
1049
|
-
<a name="External"></a>
|
|
1050
|
-
|
|
1051
|
-
## External
|
|
1052
|
-
Class for documents, permission user
|
|
1053
|
-
|
|
1054
|
-
**Kind**: global class
|
|
1055
|
-
|
|
1056
|
-
* [External](#External)
|
|
1057
|
-
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1058
|
-
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1059
|
-
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1060
|
-
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
1061
|
-
|
|
1062
|
-
<a name="External+context"></a>
|
|
1063
|
-
|
|
1064
|
-
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1065
|
-
Create new document
|
|
1066
|
-
|
|
1067
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1068
|
-
**Returns**: <code>Promise.<object></code> - data<code>string</code> - _id the id of the form<code>string</code> - orgId the organization id of the form<code>string</code> - authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
1069
1244
|
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
1070
|
-
**Access**: public
|
|
1071
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1072
|
-
|
|
1073
|
-
| Param | Type | Description |
|
|
1074
|
-
| --- | --- | --- |
|
|
1075
|
-
| params | <code>object</code> | Object for add new document |
|
|
1076
|
-
| params.id | <code>string</code> | Organization form id |
|
|
1077
|
-
|
|
1078
|
-
**Example**
|
|
1079
|
-
```js
|
|
1080
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1081
1245
|
id: '611e679741cc63168c26d7ee'
|
|
1082
|
-
```
|
|
1083
|
-
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
1084
|
-
|
|
1085
|
-
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1086
|
-
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
1087
|
-
|
|
1088
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1089
|
-
**Returns**: <code>Promise.<object></code> - doc<code>string</code> - doc.mime the original mime type of the document<code>string</code> - doc.signedUrl the signed url to upload the document<code>string</code> - doc.filename the filename of the uploaded file<code>string</code> - doc.extension the extension of the filename, obtained from the mime type
|
|
1090
|
-
**Access**: public
|
|
1091
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1092
|
-
|
|
1093
|
-
| Param | Type | Description |
|
|
1094
|
-
| --- | --- | --- |
|
|
1095
|
-
| mime | <code>string</code> | the mime type of the document |
|
|
1096
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1097
|
-
|
|
1098
|
-
**Example**
|
|
1099
|
-
```js
|
|
1100
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1101
1246
|
mime: 'application/pdf'
|
|
1102
|
-
```
|
|
1103
|
-
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
1104
|
-
|
|
1105
|
-
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1106
|
-
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
1107
|
-
|
|
1108
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1109
|
-
**Returns**: <code>Promise.<array></code> - docs<code>string</code> - docs.mime the original mime type of the document<code>string</code> - docs.signedUrl the signed url to upload the document<code>string</code> - docs.filename the filename of the uploaded file<code>string</code> - docs.extension the extension of the filename, obtained from the mime type
|
|
1110
|
-
**Access**: public
|
|
1111
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1112
|
-
|
|
1113
|
-
| Param | Type | Description |
|
|
1114
|
-
| --- | --- | --- |
|
|
1115
|
-
| docs | <code>array.<object></code> | the list of documents |
|
|
1116
|
-
| docs.mime | <code>string</code> | the mime type of the document |
|
|
1117
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1118
|
-
|
|
1119
|
-
**Example**
|
|
1120
|
-
```js
|
|
1121
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1122
1247
|
{
|
|
1123
1248
|
mime: 'application/pdf'
|
|
1124
1249
|
}
|
|
1125
|
-
```
|
|
1126
|
-
<a name="External+handle"></a>
|
|
1127
|
-
|
|
1128
|
-
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
1129
|
-
Handles the execution of an external form
|
|
1130
|
-
|
|
1131
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1132
|
-
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
1133
|
-
**Access**: public
|
|
1134
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1135
|
-
|
|
1136
|
-
| Param | Type | Description |
|
|
1137
|
-
| --- | --- | --- |
|
|
1138
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1139
|
-
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
1140
|
-
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
1141
|
-
| params.payload.name | <code>string</code> | the name of the group |
|
|
1142
|
-
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
1143
|
-
| params.payload.fields.value | <code>\*</code> \| <code>Object</code> | besides all the data inside a field, it should have the value of the the field |
|
|
1144
|
-
|
|
1145
|
-
**Example**
|
|
1146
|
-
```js
|
|
1147
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1148
1250
|
payload: [
|
|
1149
1251
|
{
|
|
1150
1252
|
name: 'My Group One',
|
|
1151
1253
|
fields: [
|
|
1152
1254
|
{}
|
|
1153
1255
|
]
|
|
1154
1256
|
}
|
|
1155
1257
|
]
|
|
1258
|
+
const payload = {
|
|
1259
|
+
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1260
|
+
newPassword: '123456789'
|
|
1261
|
+
};
|
|
1262
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1156
1263
|
```
|
|
1157
1264
|
<a name="GeoLocation"></a>
|
|
1158
1265
|
|
|
@@ -1161,7 +1268,13 @@ Get geo location of the address
|
|
|
1161
1268
|
|
|
1162
1269
|
**Example**
|
|
1163
1270
|
```js
|
|
1164
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1165
1271
|
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1166
1272
|
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1273
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1274
|
+
const api = new API();
|
|
1275
|
+
const params = {
|
|
1276
|
+
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1277
|
+
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1278
|
+
};
|
|
1279
|
+
await api.general.geo.location(params);
|
|
1167
1280
|
```
|
|
1168
1281
|
<a name="Users"></a>
|
|
1169
1282
|
|
|
@@ -1193,241 +1306,100 @@ API request, user permission level
|
|
|
1193
1306
|
| options | <code>object</code> | Params of the constructor |
|
|
1194
1307
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1195
1308
|
|
|
1196
|
-
<a name="
|
|
1309
|
+
<a name="Application"></a>
|
|
1197
1310
|
|
|
1198
|
-
##
|
|
1199
|
-
|
|
1311
|
+
## Application
|
|
1312
|
+
Class for Applications, permission user
|
|
1200
1313
|
|
|
1201
1314
|
**Kind**: global class
|
|
1315
|
+
<a name="Application+list"></a>
|
|
1202
1316
|
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1206
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1207
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1208
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1209
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1210
|
-
|
|
1211
|
-
<a name="Login+facebook"></a>
|
|
1212
|
-
|
|
1213
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1214
|
-
Login with social login Facebook
|
|
1317
|
+
### application.list(params, session) ⇒ <code>promise</code>
|
|
1318
|
+
Get the available applications for this user in this organizations
|
|
1215
1319
|
|
|
1216
|
-
**Kind**: instance method of [<code>
|
|
1217
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1320
|
+
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1218
1321
|
**Access**: public
|
|
1219
1322
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1220
1323
|
|
|
1221
1324
|
| Param | Type | Description |
|
|
1222
1325
|
| --- | --- | --- |
|
|
1223
|
-
| params | <code>object</code> | Params to
|
|
1224
|
-
| params.
|
|
1225
|
-
|
|
|
1226
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1326
|
+
| params | <code>object</code> | Params to get task |
|
|
1327
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1328
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1227
1329
|
|
|
1228
1330
|
**Example**
|
|
1229
1331
|
```js
|
|
1230
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1332
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1333
|
+
const api = new API();
|
|
1334
|
+
const params = {
|
|
1335
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1336
|
+
};
|
|
1337
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1338
|
+
await api.user.application.list(params, session);
|
|
1231
1339
|
```
|
|
1232
|
-
<a name="
|
|
1340
|
+
<a name="Datasource"></a>
|
|
1233
1341
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1342
|
+
## Datasource
|
|
1343
|
+
Class for user datasource access, to be used with when creating new documents
|
|
1236
1344
|
|
|
1237
|
-
**Kind**:
|
|
1238
|
-
|
|
1345
|
+
**Kind**: global class
|
|
1346
|
+
<a name="Datasource+autocomplete"></a>
|
|
1347
|
+
|
|
1348
|
+
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1349
|
+
Method to get autocomplete data from a datasource
|
|
1350
|
+
|
|
1351
|
+
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1352
|
+
**Returns**: <code>promise.<array></code> - docs The returned documents field with autocomplete<code>string</code> - docs._id the _id of the document<code>object</code> - data.docTypeFieldsData the field values
|
|
1239
1353
|
**Access**: public
|
|
1240
1354
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1241
1355
|
|
|
1242
1356
|
| Param | Type | Description |
|
|
1243
1357
|
| --- | --- | --- |
|
|
1244
|
-
| params | <code>object</code> | Params to
|
|
1245
|
-
| params.
|
|
1246
|
-
| params.
|
|
1247
|
-
| params.
|
|
1358
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1359
|
+
| params.orgId | <code>string</code> | The user organization _id |
|
|
1360
|
+
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1361
|
+
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1362
|
+
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1363
|
+
| params.documents | <code>array.<object></code> | The document list |
|
|
1364
|
+
| params.documents._id | <code>string</code> | The document _id |
|
|
1365
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1248
1366
|
|
|
1249
1367
|
**Example**
|
|
1250
1368
|
```js
|
|
1251
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1369
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1370
|
+
const api = new API();
|
|
1371
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1372
|
+
const params = {
|
|
1373
|
+
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1374
|
+
dataSources: [{}],
|
|
1375
|
+
documents: [{}]
|
|
1376
|
+
};
|
|
1377
|
+
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1252
1378
|
```
|
|
1253
|
-
<a name="
|
|
1379
|
+
<a name="Documents"></a>
|
|
1254
1380
|
|
|
1255
|
-
|
|
1256
|
-
|
|
1381
|
+
## Documents
|
|
1382
|
+
Class for documents, permission user
|
|
1257
1383
|
|
|
1258
|
-
**Kind**:
|
|
1259
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1260
|
-
**Access**: public
|
|
1261
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1384
|
+
**Kind**: global class
|
|
1262
1385
|
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1386
|
+
* [Documents](#Documents)
|
|
1387
|
+
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1388
|
+
* [.findByIdAndUpdate(id, params, session)](#Documents+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
1389
|
+
* [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
|
|
1390
|
+
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1391
|
+
* [.findByIdAndRemove(params, session)](#Documents+findByIdAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1392
|
+
* [.findByIdsAndRemove(params, session)](#Documents+findByIdsAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1393
|
+
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1394
|
+
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1395
|
+
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1396
|
+
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1397
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1266
1398
|
|
|
1267
|
-
|
|
1268
|
-
```js
|
|
1269
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1270
|
-
```
|
|
1271
|
-
<a name="Login+userPass"></a>
|
|
1399
|
+
<a name="Documents+add"></a>
|
|
1272
1400
|
|
|
1273
|
-
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1274
|
-
Login with user and password
|
|
1275
|
-
|
|
1276
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1277
|
-
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
1278
|
-
**Access**: public
|
|
1279
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1280
|
-
|
|
1281
|
-
| Param | Type | Description |
|
|
1282
|
-
| --- | --- | --- |
|
|
1283
|
-
| params | <code>object</code> | Object with user and password |
|
|
1284
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
1285
|
-
| params.password | <code>string</code> | Password of the user |
|
|
1286
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
1287
|
-
|
|
1288
|
-
**Example**
|
|
1289
|
-
```js
|
|
1290
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1291
1401
|
username: 'ana.silva@gmail.com',
|
|
1292
1402
|
password: '123456'
|
|
1293
|
-
```
|
|
1294
|
-
<a name="Login+logout"></a>
|
|
1295
|
-
|
|
1296
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1297
|
-
Logout user system manager
|
|
1298
|
-
|
|
1299
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1300
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1301
|
-
**Access**: public
|
|
1302
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1303
|
-
|
|
1304
|
-
| Param | Type | Description |
|
|
1305
|
-
| --- | --- | --- |
|
|
1306
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1307
|
-
|
|
1308
|
-
**Example**
|
|
1309
|
-
```js
|
|
1310
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1311
|
-
```
|
|
1312
|
-
<a name="Login+recover"></a>
|
|
1313
|
-
|
|
1314
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1315
|
-
Recover the password
|
|
1316
|
-
|
|
1317
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1318
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1319
|
-
**Access**: public
|
|
1320
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1321
|
-
|
|
1322
|
-
| Param | Type | Description |
|
|
1323
|
-
| --- | --- | --- |
|
|
1324
|
-
| username | <code>string</code> | The username or email |
|
|
1325
|
-
|
|
1326
|
-
**Example**
|
|
1327
|
-
```js
|
|
1328
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1329
|
-
```
|
|
1330
|
-
<a name="Session"></a>
|
|
1331
|
-
|
|
1332
|
-
## Session
|
|
1333
|
-
Session manager of the API
|
|
1334
|
-
|
|
1335
|
-
**Kind**: global class
|
|
1336
|
-
<a name="Session+information"></a>
|
|
1337
|
-
|
|
1338
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1339
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
1340
|
-
|
|
1341
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1342
|
-
**Access**: public
|
|
1343
|
-
|
|
1344
|
-
| Param | Type | Default | Description |
|
|
1345
|
-
| --- | --- | --- | --- |
|
|
1346
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1347
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1348
|
-
|
|
1349
|
-
**Example**
|
|
1350
|
-
```js
|
|
1351
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1352
|
-
```
|
|
1353
|
-
<a name="Application"></a>
|
|
1354
|
-
|
|
1355
|
-
## Application
|
|
1356
|
-
Class for Applications, permission user
|
|
1357
|
-
|
|
1358
|
-
**Kind**: global class
|
|
1359
|
-
<a name="Application+list"></a>
|
|
1360
|
-
|
|
1361
|
-
### application.list(params, session) ⇒ <code>promise</code>
|
|
1362
|
-
Get the available applications for this user in this organizations
|
|
1363
|
-
|
|
1364
|
-
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1365
|
-
**Access**: public
|
|
1366
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1367
|
-
|
|
1368
|
-
| Param | Type | Description |
|
|
1369
|
-
| --- | --- | --- |
|
|
1370
|
-
| params | <code>object</code> | Params to get task |
|
|
1371
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1372
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1373
|
-
|
|
1374
|
-
**Example**
|
|
1375
|
-
```js
|
|
1376
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1377
1403
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1378
|
-
```
|
|
1379
|
-
<a name="Datasource"></a>
|
|
1380
|
-
|
|
1381
|
-
## Datasource
|
|
1382
|
-
Class for user datasource access, to be used with when creating new documents
|
|
1383
|
-
|
|
1384
|
-
**Kind**: global class
|
|
1385
|
-
<a name="Datasource+autocomplete"></a>
|
|
1386
|
-
|
|
1387
|
-
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1388
|
-
Method to get autocomplete data from a datasource
|
|
1389
|
-
|
|
1390
|
-
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1391
|
-
**Returns**: <code>promise.<array></code> - docs The returned documents field with autocomplete<code>string</code> - docs._id the _id of the document<code>object</code> - data.docTypeFieldsData the field values
|
|
1392
|
-
**Access**: public
|
|
1393
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1394
|
-
|
|
1395
|
-
| Param | Type | Description |
|
|
1396
|
-
| --- | --- | --- |
|
|
1397
|
-
| params | <code>object</code> | Params to add notification token |
|
|
1398
|
-
| params.orgId | <code>string</code> | The user organization _id |
|
|
1399
|
-
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1400
|
-
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1401
|
-
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1402
|
-
| params.documents | <code>array.<object></code> | The document list |
|
|
1403
|
-
| params.documents._id | <code>string</code> | The document _id |
|
|
1404
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1405
|
-
|
|
1406
|
-
**Example**
|
|
1407
|
-
```js
|
|
1408
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1409
1404
|
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1410
1405
|
dataSources: [{}],
|
|
1411
1406
|
documents: [{}]
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
## Documents
|
|
1416
|
-
Class for documents, permission user
|
|
1417
|
-
|
|
1418
|
-
**Kind**: global class
|
|
1419
|
-
|
|
1420
|
-
* [Documents](#Documents)
|
|
1421
|
-
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1422
|
-
* [.findByIdAndUpdate(id, params, session)](#Documents+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
1423
|
-
* [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
|
|
1424
|
-
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1425
|
-
* [.findByIdAndRemove(params, session)](#Documents+findByIdAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1426
|
-
* [.findByIdsAndRemove(params, session)](#Documents+findByIdsAndRemove) ⇒ <code>Promise.<object></code> \| <code>number</code> \| <code>array.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1427
|
-
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1428
|
-
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1429
|
-
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1430
|
-
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1431
|
-
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1432
|
-
|
|
1433
|
-
<a name="Documents+add"></a>
|
|
1434
|
-
|
|
1435
|
-
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1436
|
-
Create new document
|
|
1407
|
+
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1408
|
+
Create new document
|
|
1437
1409
|
|
|
1438
1410
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1439
1411
|
**Access**: public
|
|
@@ -1464,7 +1436,23 @@ Create new document
|
|
|
1464
1436
|
|
|
1465
1437
|
**Example**
|
|
1466
1438
|
```js
|
|
1467
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1468
1439
|
orgname: 'cloundbrasil',
|
|
1469
1440
|
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1470
1441
|
docId: '5edf86fbe896b817e45b8da6',
|
|
1471
1442
|
fileName: 'foto',
|
|
1472
1443
|
type: 'image/png',
|
|
1473
1444
|
name: 'Fotografia',
|
|
1474
1445
|
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1475
1446
|
bytes: 12345,
|
|
1476
1447
|
signedUrl: 'https://s3.amazonaws.com...'
|
|
1477
1448
|
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1478
1449
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1450
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1451
|
+
const api = new API();
|
|
1452
|
+
const params = {
|
|
1453
|
+
orgname: 'cloundbrasil',
|
|
1454
|
+
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1455
|
+
docId: '5edf86fbe896b817e45b8da6',
|
|
1456
|
+
fileName: 'foto',
|
|
1457
|
+
type: 'image/png',
|
|
1458
|
+
name: 'Fotografia',
|
|
1459
|
+
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1460
|
+
bytes: 12345,
|
|
1461
|
+
signedUrl: 'https://s3.amazonaws.com...'
|
|
1462
|
+
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1463
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1464
|
+
};
|
|
1465
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1466
|
+
await api.user.document.add(params, session);
|
|
1479
1467
|
```
|
|
1480
1468
|
<a name="Documents+findByIdAndUpdate"></a>
|
|
1481
1469
|
|
|
@@ -1483,12 +1471,17 @@ Updates a document
|
|
|
1483
1471
|
|
|
1484
1472
|
**Example**
|
|
1485
1473
|
```js
|
|
1486
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1474
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1475
|
+
const api = new API();
|
|
1476
|
+
const params = { ... };
|
|
1477
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1478
|
+
await api.user.document.findByIdAndUpdate('5edf9f8ee896b817e45b8dad', params, session);
|
|
1487
1479
|
```
|
|
1488
1480
|
<a name="Documents+findById"></a>
|
|
1489
1481
|
|
|
1490
1482
|
### documents.findById(id, session) ⇒ <code>Promise</code>
|
|
1491
|
-
Updates a document.
|
|
1492
1483
|
IMPORTANT: if your document has a content, it will NOT bring the content.
|
|
1484
|
+
Updates a document.
|
|
1485
|
+
IMPORTANT: if your document has a content, it will NOT bring the content.
|
|
1493
1486
|
|
|
1494
1487
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1495
1488
|
**Access**: public
|
|
@@ -1501,7 +1494,10 @@ Updates a document.
|
|
|
1501
1494
|
IMPORTANT: if your document has a content, it will NOT brin
|
|
1502
1495
|
|
|
1503
1496
|
**Example**
|
|
1504
1497
|
```js
|
|
1505
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1498
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1499
|
+
const api = new API();
|
|
1500
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1501
|
+
await api.user.document.findById('5edf9f8ee896b817e45b8dad', session);
|
|
1506
1502
|
```
|
|
1507
1503
|
<a name="Documents+find"></a>
|
|
1508
1504
|
|
|
@@ -1529,7 +1525,18 @@ const API = require('@docbrasil/api-systemmanager');
|
|
|
1529
1525
|
|
|
1530
1526
|
**Example**
|
|
1531
1527
|
```js
|
|
1532
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1533
1528
|
index: 'extraCity',
|
|
1534
1529
|
txtToSearch: 'São',
|
|
1535
1530
|
docId: '5df7f19618430c89a41a19d2',
|
|
1536
1531
|
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1537
1532
|
tag: 'Nome da cidade',
|
|
1538
1533
|
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1534
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1535
|
+
const api = new API();
|
|
1536
|
+
const params - {
|
|
1537
|
+
index: 'extraCity',
|
|
1538
|
+
txtToSearch: 'São',
|
|
1539
|
+
docId: '5df7f19618430c89a41a19d2',
|
|
1540
|
+
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1541
|
+
tag: 'Nome da cidade',
|
|
1542
|
+
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1543
|
+
};
|
|
1544
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1545
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1539
1546
|
```
|
|
1540
1547
|
<a name="Documents+findByIdAndRemove"></a>
|
|
1541
1548
|
|
|
@@ -1550,7 +1557,14 @@ Remove document by id
|
|
|
1550
1557
|
|
|
1551
1558
|
**Example**
|
|
1552
1559
|
```js
|
|
1553
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1554
1560
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1555
1561
|
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1562
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1563
|
+
const api = new API();
|
|
1564
|
+
const params - {
|
|
1565
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1566
|
+
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1567
|
+
};
|
|
1568
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1569
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1556
1570
|
```
|
|
1557
1571
|
<a name="Documents+findByIdsAndRemove"></a>
|
|
1558
1572
|
|
|
@@ -1572,7 +1586,14 @@ Remove documents
|
|
|
1572
1586
|
|
|
1573
1587
|
**Example**
|
|
1574
1588
|
```js
|
|
1575
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1576
1589
|
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1577
1590
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1591
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1592
|
+
const api = new API();
|
|
1593
|
+
const params - {
|
|
1594
|
+
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1595
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1596
|
+
};
|
|
1597
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1598
|
+
await api.user.document.findByIdsAndRemove(params, session);
|
|
1578
1599
|
```
|
|
1579
1600
|
<a name="Documents+signedUrl"></a>
|
|
1580
1601
|
|
|
@@ -1598,11 +1619,30 @@ Request signed url url to put or get
|
|
|
1598
1619
|
|
|
1599
1620
|
**Example**
|
|
1600
1621
|
```js
|
|
1601
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1602
1622
|
methodType: 'put',
|
|
1603
1623
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1604
1624
|
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1605
1625
|
fileName: 'Foto',
|
|
1606
1626
|
type: 'image/png'
|
|
1607
1627
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1628
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1629
|
+
const api = new API();
|
|
1630
|
+
const params - {
|
|
1631
|
+
methodType: 'put',
|
|
1632
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1633
|
+
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1634
|
+
fileName: 'Foto',
|
|
1635
|
+
type: 'image/png'
|
|
1636
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1637
|
+
};
|
|
1638
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1639
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1640
|
+
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1608
1641
|
```
|
|
1609
1642
|
**Example**
|
|
1610
1643
|
```js
|
|
1611
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1612
1644
|
methodType: 'get',
|
|
1613
1645
|
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1646
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1647
|
+
const api = new API();
|
|
1648
|
+
const params - {
|
|
1649
|
+
methodType: 'get',
|
|
1650
|
+
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1651
|
+
};
|
|
1652
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1653
|
+
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1614
1654
|
```
|
|
1615
1655
|
<a name="Documents+signedUrls"></a>
|
|
1616
1656
|
|
|
@@ -1629,11 +1669,36 @@ Request signed url url to put or get
|
|
|
1629
1669
|
|
|
1630
1670
|
**Example**
|
|
1631
1671
|
```js
|
|
1632
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1633
1672
|
methodType: 'put',
|
|
1634
1673
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1635
1674
|
docs: [
|
|
1636
1675
|
{
|
|
1637
1676
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1638
1677
|
areaId: '5df7f19618430c89a41a19d2',
|
|
1639
1678
|
name: 'Foto.png',
|
|
1640
1679
|
type: 'image/png'
|
|
1641
1680
|
}
|
|
1642
1681
|
]
|
|
1643
|
-
```
|
|
1644
|
-
**Example**
|
|
1645
|
-
```js
|
|
1646
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1647
1682
|
methodType: 'get',
|
|
1648
1683
|
docs: [
|
|
1649
1684
|
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1650
1685
|
],
|
|
1686
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1687
|
+
const api = new API();
|
|
1688
|
+
const params - {
|
|
1689
|
+
methodType: 'put',
|
|
1690
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1691
|
+
docs: [
|
|
1692
|
+
{
|
|
1693
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1694
|
+
areaId: '5df7f19618430c89a41a19d2',
|
|
1695
|
+
name: 'Foto.png',
|
|
1696
|
+
type: 'image/png'
|
|
1697
|
+
}
|
|
1698
|
+
]
|
|
1699
|
+
};
|
|
1700
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1701
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1702
|
+
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1703
|
+
```
|
|
1704
|
+
**Example**
|
|
1705
|
+
```js
|
|
1706
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1707
|
+
const api = new API();
|
|
1708
|
+
const params - {
|
|
1709
|
+
methodType: 'get',
|
|
1710
|
+
docs: [
|
|
1711
|
+
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1712
|
+
],
|
|
1713
|
+
};
|
|
1714
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1715
|
+
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1651
1716
|
```
|
|
1652
1717
|
<a name="Documents+uploadSignedDocument"></a>
|
|
1653
1718
|
|
|
@@ -1654,7 +1719,21 @@ Uploads the file
|
|
|
1654
1719
|
|
|
1655
1720
|
**Example**
|
|
1656
1721
|
```js
|
|
1657
|
-
const FS = require('fs');
|
|
1658
1722
|
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1659
1723
|
signedUrl: 'https://signedurl.com/token...',
|
|
1660
1724
|
type: 'application/pdf'
|
|
1661
1725
|
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1662
1726
|
- loaded: The number of bytes of the file that have been uploaded.
|
|
1663
1727
|
- total: The total number of bytes in the file.
|
|
1728
|
+
const FS = require('fs');
|
|
1729
|
+
const Path = require('path');
|
|
1730
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1731
|
+
const api = new API();
|
|
1732
|
+
const params - {
|
|
1733
|
+
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1734
|
+
signedUrl: 'https://signedurl.com/token...',
|
|
1735
|
+
type: 'application/pdf'
|
|
1736
|
+
};
|
|
1737
|
+
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1738
|
+
|
|
1739
|
+
onUploadProgress return the progressEvent
|
|
1740
|
+
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1741
|
+
- loaded: The number of bytes of the file that have been uploaded.
|
|
1742
|
+
- total: The total number of bytes in the file.
|
|
1664
1743
|
```
|
|
1665
1744
|
<a name="Documents+checkPrimaryKeys"></a>
|
|
1666
1745
|
|
|
@@ -1662,7 +1741,8 @@ const FS = require('fs');
|
|
|
1662
1741
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1663
1742
|
**Returns**: <code>Promise.<array></code> - Return the array of the documents that are repeated. If not document is repeaded, then if returns an empty array.<code>array.<string></code> - id the id of the repeated document
|
|
1664
1743
|
**Access**: public
|
|
1665
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1744
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1745
|
+
Checks if a document can be added and it does not repeat its primary key
|
|
1666
1746
|
|
|
1667
1747
|
| Param | Type | Description |
|
|
1668
1748
|
| --- | --- | --- |
|
|
@@ -1677,7 +1757,17 @@ const FS = require('fs');
|
|
|
1677
1757
|
|
|
1678
1758
|
**Example**
|
|
1679
1759
|
```js
|
|
1680
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1681
1760
|
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1682
1761
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1683
1762
|
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1763
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1764
|
+
const api = new API();
|
|
1765
|
+
const docTypeFields = [...]; // the doc type fields array
|
|
1766
|
+
const docTypeFieldsData = {...}; // the data of this fields
|
|
1767
|
+
const params - {
|
|
1768
|
+
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1769
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1770
|
+
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1771
|
+
};
|
|
1772
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1773
|
+
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1684
1774
|
```
|
|
1685
1775
|
<a name="Documents+searchDocuments"></a>
|
|
1686
1776
|
|
|
@@ -1698,7 +1788,14 @@ Method to search documents for
|
|
|
1698
1788
|
|
|
1699
1789
|
**Example**
|
|
1700
1790
|
```js
|
|
1701
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1702
1791
|
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1703
1792
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1793
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1794
|
+
const api = new API();
|
|
1795
|
+
const params = {
|
|
1796
|
+
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1797
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1798
|
+
};
|
|
1799
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1800
|
+
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1704
1801
|
```
|
|
1705
1802
|
<a name="Help"></a>
|
|
1706
1803
|
|
|
@@ -1726,7 +1823,10 @@ get heps topics
|
|
|
1726
1823
|
|
|
1727
1824
|
**Example**
|
|
1728
1825
|
```js
|
|
1729
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1826
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1827
|
+
const api = new API();
|
|
1828
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1829
|
+
await api.user.help.getTopics(session);
|
|
1730
1830
|
```
|
|
1731
1831
|
<a name="Help+get"></a>
|
|
1732
1832
|
|
|
@@ -1745,7 +1845,13 @@ Method to find helps from a topic
|
|
|
1745
1845
|
|
|
1746
1846
|
**Example**
|
|
1747
1847
|
```js
|
|
1748
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1749
1848
|
id: '5dadd01dc4af3941d42f8c5c'
|
|
1849
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1850
|
+
const api = new API();
|
|
1851
|
+
const params = {
|
|
1852
|
+
id: '5dadd01dc4af3941d42f8c5c'
|
|
1853
|
+
};
|
|
1854
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1855
|
+
await api.user.help.get(params, session);
|
|
1750
1856
|
```
|
|
1751
1857
|
<a name="Users"></a>
|
|
1752
1858
|
|
|
@@ -1786,8 +1892,11 @@ Class for my tasks, permission user
|
|
|
1786
1892
|
|
|
1787
1893
|
* [MyTasks](#MyTasks)
|
|
1788
1894
|
* [.find(params, session)](#MyTasks+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1789
|
-
* [.saveDueDate(
|
|
1895
|
+
* [.saveDueDate(params, session)](#MyTasks+saveDueDate) ⇒ <code>Promise</code>
|
|
1790
1896
|
* [.removeDueDate(session)](#MyTasks+removeDueDate) ⇒ <code>Promise</code>
|
|
1897
|
+
* [.getTaskMultiUsers(params, session)](#MyTasks+getTaskMultiUsers) ⇒ <code>promise</code>
|
|
1898
|
+
* [.removeMultiTaskUser(params, session)](#MyTasks+removeMultiTaskUser) ⇒ <code>Promise</code>
|
|
1899
|
+
* [.addMultiTaskUser(params, session)](#MyTasks+addMultiTaskUser) ⇒ <code>Promise</code>
|
|
1791
1900
|
|
|
1792
1901
|
<a name="MyTasks+find"></a>
|
|
1793
1902
|
|
|
@@ -1808,11 +1917,18 @@ Method to find my tasks for a user
|
|
|
1808
1917
|
|
|
1809
1918
|
**Example**
|
|
1810
1919
|
```js
|
|
1811
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1812
1920
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1813
1921
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1922
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1923
|
+
const api = new API();
|
|
1924
|
+
const params = {
|
|
1925
|
+
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1926
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1927
|
+
};
|
|
1928
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1929
|
+
const retSearch = await api.user.task.mytasks.find(params, session);
|
|
1814
1930
|
```
|
|
1815
1931
|
<a name="MyTasks+saveDueDate"></a>
|
|
1816
1932
|
|
|
1817
|
-
### myTasks.saveDueDate(
|
|
1933
|
+
### myTasks.saveDueDate(params, session) ⇒ <code>Promise</code>
|
|
1818
1934
|
Update task dueDate
|
|
1819
1935
|
|
|
1820
1936
|
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
@@ -1821,15 +1937,23 @@ Update task dueDate
|
|
|
1821
1937
|
|
|
1822
1938
|
| Param | Type | Description |
|
|
1823
1939
|
| --- | --- | --- |
|
|
1824
|
-
|
|
|
1825
|
-
|
|
|
1826
|
-
|
|
|
1827
|
-
|
|
|
1940
|
+
| params | <code>object</code> | The Date to save |
|
|
1941
|
+
| params.dueDate | <code>string</code> | DueDate |
|
|
1942
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
1943
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
1828
1944
|
| session | <code>string</code> | Is token JWT of user |
|
|
1829
1945
|
|
|
1830
1946
|
**Example**
|
|
1831
1947
|
```js
|
|
1832
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1833
1948
|
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1834
1949
|
orgId: '646386c9583e04a131adc894',
|
|
1835
1950
|
taskId: '646386c9583e04a131adc895'
|
|
1951
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1952
|
+
const api = new API();
|
|
1953
|
+
const params = {
|
|
1954
|
+
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1955
|
+
orgId: '646386c9583e04a131adc894',
|
|
1956
|
+
taskId: '646386c9583e04a131adc895'
|
|
1957
|
+
};
|
|
1958
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1959
|
+
await api.user.task.mytasks.saveDueDate(params, session);
|
|
1836
1960
|
```
|
|
1837
1961
|
<a name="MyTasks+removeDueDate"></a>
|
|
1838
1962
|
|
|
@@ -1848,7 +1972,99 @@ Update task dueDate
|
|
|
1848
1972
|
|
|
1849
1973
|
**Example**
|
|
1850
1974
|
```js
|
|
1851
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1852
1975
|
orgId: '646386c9583e04a131adc894',
|
|
1853
1976
|
taskId: '646386c9583e04a131adc895'
|
|
1977
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1978
|
+
const api = new API();
|
|
1979
|
+
const params = {
|
|
1980
|
+
orgId: '646386c9583e04a131adc894',
|
|
1981
|
+
taskId: '646386c9583e04a131adc895'
|
|
1982
|
+
};
|
|
1983
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1984
|
+
await api.user.task.mytasks.removeDueDate(params, session);
|
|
1985
|
+
```
|
|
1986
|
+
<a name="MyTasks+getTaskMultiUsers"></a>
|
|
1987
|
+
|
|
1988
|
+
### myTasks.getTaskMultiUsers(params, session) ⇒ <code>promise</code>
|
|
1989
|
+
Method to get task multi users
|
|
1990
|
+
|
|
1991
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
1992
|
+
**Access**: public
|
|
1993
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1994
|
+
|
|
1995
|
+
| Param | Type | Description |
|
|
1996
|
+
| --- | --- | --- |
|
|
1997
|
+
| params | <code>object</code> | Params to get task |
|
|
1998
|
+
| params.taskId | <code>object</code> | Task id (_id database) |
|
|
1999
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2000
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2001
|
+
|
|
2002
|
+
**Example**
|
|
2003
|
+
```js
|
|
2004
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2005
|
+
const api = new API();
|
|
2006
|
+
const params = {
|
|
2007
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2008
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2009
|
+
};
|
|
2010
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2011
|
+
await api.user.task.mytasks.getTaskMultiUsers(params, session);
|
|
2012
|
+
```
|
|
2013
|
+
<a name="MyTasks+removeMultiTaskUser"></a>
|
|
2014
|
+
|
|
2015
|
+
### myTasks.removeMultiTaskUser(params, session) ⇒ <code>Promise</code>
|
|
2016
|
+
remove multi task user
|
|
2017
|
+
|
|
2018
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
2019
|
+
**Access**: public
|
|
2020
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2021
|
+
|
|
2022
|
+
| Param | Type | Description |
|
|
2023
|
+
| --- | --- | --- |
|
|
2024
|
+
| params | <code>object</code> | Params of the user to be removed |
|
|
2025
|
+
| params.userId | <code>string</code> | User id |
|
|
2026
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
2027
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
2028
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
2029
|
+
|
|
2030
|
+
**Example**
|
|
2031
|
+
```js
|
|
2032
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2033
|
+
const api = new API();
|
|
2034
|
+
const params = {
|
|
2035
|
+
userId: '646386c9583e04a131adc896',
|
|
2036
|
+
orgId: '646386c9583e04a131adc894',
|
|
2037
|
+
taskId: '646386c9583e04a131adc895'
|
|
2038
|
+
};
|
|
2039
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2040
|
+
await api.user.task.mytasks.removeMultiTaskUser(params, session);
|
|
2041
|
+
```
|
|
2042
|
+
<a name="MyTasks+addMultiTaskUser"></a>
|
|
2043
|
+
|
|
2044
|
+
### myTasks.addMultiTaskUser(params, session) ⇒ <code>Promise</code>
|
|
2045
|
+
Add Multi Task User
|
|
2046
|
+
|
|
2047
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
2048
|
+
**Access**: public
|
|
2049
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2050
|
+
|
|
2051
|
+
| Param | Type | Description |
|
|
2052
|
+
| --- | --- | --- |
|
|
2053
|
+
| params | <code>object</code> | Params for adding multi task user |
|
|
2054
|
+
| params.userId | <code>string</code> | User id |
|
|
2055
|
+
| params.orgId | <code>string</code> | Organization id |
|
|
2056
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
2057
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
2058
|
+
|
|
2059
|
+
**Example**
|
|
2060
|
+
```js
|
|
2061
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2062
|
+
const api = new API();
|
|
2063
|
+
const params = {
|
|
2064
|
+
userId: '646386c9583e04a131adc8946',
|
|
2065
|
+
orgId: '646386c9583e04a131adc894',
|
|
2066
|
+
taskId: '646386c9583e04a131adc895'
|
|
2067
|
+
};
|
|
2068
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2069
|
+
await api.user.task.mytasks.addMultiTaskUser(params, session);
|
|
1854
2070
|
```
|
|
1855
2071
|
<a name="Notification"></a>
|
|
1856
2072
|
|
|
@@ -1890,7 +2106,14 @@ Method to add a notification token
|
|
|
1890
2106
|
|
|
1891
2107
|
**Example**
|
|
1892
2108
|
```js
|
|
1893
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1894
2109
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1895
2110
|
type: 'FCM_WEB'
|
|
2111
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2112
|
+
const api = new API();
|
|
2113
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2114
|
+
const params = {
|
|
2115
|
+
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
2116
|
+
type: 'FCM_WEB'
|
|
2117
|
+
};
|
|
2118
|
+
const retData = await api.user.notification.addToken(params, session);
|
|
1896
2119
|
```
|
|
1897
2120
|
<a name="Notification+getNew"></a>
|
|
1898
2121
|
|
|
@@ -1907,7 +2130,10 @@ get new notifications
|
|
|
1907
2130
|
|
|
1908
2131
|
**Example**
|
|
1909
2132
|
```js
|
|
1910
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2133
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2134
|
+
const api = new API();
|
|
2135
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2136
|
+
await api.user.notification.getNew(session);
|
|
1911
2137
|
```
|
|
1912
2138
|
<a name="Notification+getOld"></a>
|
|
1913
2139
|
|
|
@@ -1924,7 +2150,10 @@ get old notifications
|
|
|
1924
2150
|
|
|
1925
2151
|
**Example**
|
|
1926
2152
|
```js
|
|
1927
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2153
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2154
|
+
const api = new API();
|
|
2155
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2156
|
+
await api.user.notification.getOld(session);
|
|
1928
2157
|
```
|
|
1929
2158
|
<a name="Notification+setRead"></a>
|
|
1930
2159
|
|
|
@@ -1943,7 +2172,13 @@ Set notification as readed
|
|
|
1943
2172
|
|
|
1944
2173
|
**Example**
|
|
1945
2174
|
```js
|
|
1946
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1947
2175
|
id: '34c344c43c34c344c43c'
|
|
2176
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2177
|
+
const api = new API();
|
|
2178
|
+
const params = {
|
|
2179
|
+
id: '34c344c43c34c344c43c'
|
|
2180
|
+
};
|
|
2181
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2182
|
+
await api.user.notification.setRead(params, session);
|
|
1948
2183
|
```
|
|
1949
2184
|
<a name="Notification+setUnread"></a>
|
|
1950
2185
|
|
|
@@ -1962,7 +2197,13 @@ Set notification as unreaded
|
|
|
1962
2197
|
|
|
1963
2198
|
**Example**
|
|
1964
2199
|
```js
|
|
1965
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1966
2200
|
id: '34c344c43c34c344c43c'
|
|
2201
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2202
|
+
const api = new API();
|
|
2203
|
+
const params = {
|
|
2204
|
+
id: '34c344c43c34c344c43c'
|
|
2205
|
+
};
|
|
2206
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2207
|
+
await api.user.notification.setUnread(params, session);
|
|
1967
2208
|
```
|
|
1968
2209
|
<a name="Organization"></a>
|
|
1969
2210
|
|
|
@@ -1999,7 +2240,15 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
1999
2240
|
|
|
2000
2241
|
**Example**
|
|
2001
2242
|
```js
|
|
2002
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2003
2243
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2004
2244
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2005
2245
|
type: 'image/png',
|
|
2246
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2247
|
+
const api = new API();
|
|
2248
|
+
const params = {
|
|
2249
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2250
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2251
|
+
type: 'image/png',
|
|
2252
|
+
};
|
|
2253
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2254
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
2006
2255
|
```
|
|
2007
2256
|
<a name="Organization+removeAvatar"></a>
|
|
2008
2257
|
|
|
@@ -2017,7 +2266,11 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2017
2266
|
|
|
2018
2267
|
**Example**
|
|
2019
2268
|
```js
|
|
2020
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2269
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2270
|
+
const api = new API();
|
|
2271
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2272
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2273
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
2021
2274
|
```
|
|
2022
2275
|
<a name="Organization+findById"></a>
|
|
2023
2276
|
|
|
@@ -2035,7 +2288,11 @@ Find organization by id
|
|
|
2035
2288
|
|
|
2036
2289
|
**Example**
|
|
2037
2290
|
```js
|
|
2038
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2291
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2292
|
+
const api = new API();
|
|
2293
|
+
const orgId = '80443245000122';
|
|
2294
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2295
|
+
await api.user.organization.findById(idCard, session);
|
|
2039
2296
|
```
|
|
2040
2297
|
<a name="Organization+idCardExist"></a>
|
|
2041
2298
|
|
|
@@ -2053,7 +2310,11 @@ Check if id card exist
|
|
|
2053
2310
|
|
|
2054
2311
|
**Example**
|
|
2055
2312
|
```js
|
|
2056
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2313
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2314
|
+
const api = new API();
|
|
2315
|
+
const idCard = '80443245000122';
|
|
2316
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2317
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
2057
2318
|
```
|
|
2058
2319
|
<a name="Organization+upsertAvatar"></a>
|
|
2059
2320
|
|
|
@@ -2073,7 +2334,14 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2073
2334
|
|
|
2074
2335
|
**Example**
|
|
2075
2336
|
```js
|
|
2076
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2077
2337
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2078
2338
|
type: 'image/png',
|
|
2339
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2340
|
+
const api = new API();
|
|
2341
|
+
const params = {
|
|
2342
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2343
|
+
type: 'image/png',
|
|
2344
|
+
};
|
|
2345
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2346
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2079
2347
|
```
|
|
2080
2348
|
<a name="Organization+removeAvatar"></a>
|
|
2081
2349
|
|
|
@@ -2090,7 +2358,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2090
2358
|
|
|
2091
2359
|
**Example**
|
|
2092
2360
|
```js
|
|
2093
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2361
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2362
|
+
const api = new API();
|
|
2363
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2364
|
+
await api.user.profile.removeAvatar(session);
|
|
2094
2365
|
```
|
|
2095
2366
|
<a name="Organization+callFetch"></a>
|
|
2096
2367
|
|
|
@@ -2110,7 +2381,14 @@ Call URL internal, need auth JWT (session)
|
|
|
2110
2381
|
|
|
2111
2382
|
**Example**
|
|
2112
2383
|
```js
|
|
2113
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2114
2384
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2115
2385
|
method: 'POST'
|
|
2386
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2387
|
+
const api = new API();
|
|
2388
|
+
|
|
2389
|
+
const params = {
|
|
2390
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2391
|
+
method: 'POST'
|
|
2392
|
+
}
|
|
2393
|
+
await api.user.organization.callFetchs(params, session);
|
|
2116
2394
|
```
|
|
2117
2395
|
<a name="Page"></a>
|
|
2118
2396
|
|
|
@@ -2137,7 +2415,15 @@ Get the available page for an application inside an organization
|
|
|
2137
2415
|
|
|
2138
2416
|
**Example**
|
|
2139
2417
|
```js
|
|
2140
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2141
2418
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2142
2419
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2143
2420
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2421
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2422
|
+
const api = new API();
|
|
2423
|
+
const params = {
|
|
2424
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2425
|
+
appId: '57e4a3bd6be6b45210833fa7',
|
|
2426
|
+
pageId: '57e4a3bd6be6b45210833fab'
|
|
2427
|
+
};
|
|
2428
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2429
|
+
await api.user.application.page.get(params, session);
|
|
2144
2430
|
```
|
|
2145
2431
|
<a name="Process"></a>
|
|
2146
2432
|
|
|
@@ -2176,7 +2462,15 @@ Start process
|
|
|
2176
2462
|
|
|
2177
2463
|
**Example**
|
|
2178
2464
|
```js
|
|
2179
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2180
2465
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2181
2466
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2182
2467
|
payload: {}
|
|
2468
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2469
|
+
const api = new API();
|
|
2470
|
+
const params = {
|
|
2471
|
+
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2472
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2473
|
+
payload: {}
|
|
2474
|
+
}
|
|
2475
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2476
|
+
await api.user.process.start(params, session);
|
|
2183
2477
|
```
|
|
2184
2478
|
<a name="Process+getProcessProperties"></a>
|
|
2185
2479
|
|
|
@@ -2196,7 +2490,14 @@ Get process properties of process
|
|
|
2196
2490
|
|
|
2197
2491
|
**Example**
|
|
2198
2492
|
```js
|
|
2199
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2200
2493
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2201
2494
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2495
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2496
|
+
const api = new API();
|
|
2497
|
+
const params = {
|
|
2498
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2499
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2500
|
+
}
|
|
2501
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2502
|
+
await api.user.process.getProcessProperties(params, session);
|
|
2202
2503
|
```
|
|
2203
2504
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2204
2505
|
|
|
@@ -2204,7 +2505,8 @@ const API = require('@docbrasil/api-systemmanager');
|
|
|
2204
2505
|
Get the search info of a organization process
|
|
2205
2506
|
|
|
2206
2507
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2207
|
-
**Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
|
|
2508
|
+
**Returns**: <code>Promise</code> - the search info result<code>string</code> - name the name of the organization process<code>object</code> - processIndexFields the list of fields to index<code>object</code> - processParticipantsGroup the permissions in this organization process<code>object</code> - stepsProperties the organization process steps properties<code>string</code> - _id the same organization id
|
|
2509
|
+
@
|
|
2208
2510
|
**Access**: public
|
|
2209
2511
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2210
2512
|
|
|
@@ -2217,7 +2519,14 @@ Get the search info of a organization process
|
|
|
2217
2519
|
|
|
2218
2520
|
**Example**
|
|
2219
2521
|
```js
|
|
2220
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2221
2522
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2222
2523
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2524
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2525
|
+
const api = new API();
|
|
2526
|
+
const params = {
|
|
2527
|
+
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2528
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2529
|
+
}
|
|
2530
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2531
|
+
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2223
2532
|
```
|
|
2224
2533
|
<a name="Process+find"></a>
|
|
2225
2534
|
|
|
@@ -2238,7 +2547,14 @@ Method to search processes
|
|
|
2238
2547
|
|
|
2239
2548
|
**Example**
|
|
2240
2549
|
```js
|
|
2241
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2242
2550
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2243
2551
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2552
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2553
|
+
const api = new API();
|
|
2554
|
+
const params = {
|
|
2555
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2556
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2557
|
+
};
|
|
2558
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2559
|
+
const retSearch = await api.user.process.find(params, session);
|
|
2244
2560
|
```
|
|
2245
2561
|
<a name="Process+remove"></a>
|
|
2246
2562
|
|
|
@@ -2258,7 +2574,14 @@ Method to remove process
|
|
|
2258
2574
|
|
|
2259
2575
|
**Example**
|
|
2260
2576
|
```js
|
|
2261
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2262
2577
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2263
2578
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2579
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2580
|
+
const api = new API();
|
|
2581
|
+
const params = {
|
|
2582
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2583
|
+
processId: '55e4a3bd6be6b45210833fae'
|
|
2584
|
+
};
|
|
2585
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2586
|
+
const retSearch = await api.user.process.remove(params, session);
|
|
2264
2587
|
```
|
|
2265
2588
|
<a name="Process+exportStatusData"></a>
|
|
2266
2589
|
|
|
@@ -2278,7 +2601,14 @@ Method to export status data
|
|
|
2278
2601
|
|
|
2279
2602
|
**Example**
|
|
2280
2603
|
```js
|
|
2281
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2282
2604
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2283
2605
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2606
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2607
|
+
const api = new API();
|
|
2608
|
+
const params = {
|
|
2609
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2610
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2611
|
+
};
|
|
2612
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2613
|
+
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2284
2614
|
```
|
|
2285
2615
|
<a name="Process+exportProcessData"></a>
|
|
2286
2616
|
|
|
@@ -2298,7 +2628,14 @@ Method to export process data
|
|
|
2298
2628
|
|
|
2299
2629
|
**Example**
|
|
2300
2630
|
```js
|
|
2301
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2302
2631
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2303
2632
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2633
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2634
|
+
const api = new API();
|
|
2635
|
+
const params = {
|
|
2636
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2637
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2638
|
+
};
|
|
2639
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2640
|
+
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2304
2641
|
```
|
|
2305
2642
|
<a name="Process+processDocs"></a>
|
|
2306
2643
|
|
|
@@ -2320,7 +2657,15 @@ Method to get Process Docs
|
|
|
2320
2657
|
|
|
2321
2658
|
**Example**
|
|
2322
2659
|
```js
|
|
2323
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2324
2660
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2325
2661
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2326
2662
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2663
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2664
|
+
const api = new API();
|
|
2665
|
+
const params = {
|
|
2666
|
+
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2667
|
+
processId: '55e4a3bd6be6b45210833fae',
|
|
2668
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2669
|
+
};
|
|
2670
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2671
|
+
const retSearch = await api.user.process.processDocs(params, session);
|
|
2327
2672
|
```
|
|
2328
2673
|
<a name="Process+downloadDocs"></a>
|
|
2329
2674
|
|
|
@@ -2343,7 +2688,16 @@ Method to download the process documents
|
|
|
2343
2688
|
|
|
2344
2689
|
**Example**
|
|
2345
2690
|
```js
|
|
2346
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2347
2691
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2348
2692
|
type: 'Docs',
|
|
2349
2693
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2350
2694
|
footer: 'Documento - {page} de {pages}'
|
|
2695
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2696
|
+
const api = new API();
|
|
2697
|
+
const params = {
|
|
2698
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2699
|
+
type: 'Docs',
|
|
2700
|
+
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2701
|
+
footer: 'Documento - {page} de {pages}'
|
|
2702
|
+
};
|
|
2703
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2704
|
+
const result = await api.user.process.downloadDocs(params, session);
|
|
2351
2705
|
```
|
|
2352
2706
|
<a name="Register"></a>
|
|
2353
2707
|
|
|
@@ -2371,7 +2725,12 @@ Class for user registration in a user
|
|
|
2371
2725
|
|
|
2372
2726
|
**Example**
|
|
2373
2727
|
```js
|
|
2374
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2375
2728
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2729
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2730
|
+
const api = new API();
|
|
2731
|
+
const params = {
|
|
2732
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2733
|
+
};
|
|
2734
|
+
const orgname = await api.user.register.getOrgname(params);
|
|
2376
2735
|
```
|
|
2377
2736
|
<a name="Register+validateEmail"></a>
|
|
2378
2737
|
|
|
@@ -2391,7 +2750,13 @@ Method to find task by id
|
|
|
2391
2750
|
|
|
2392
2751
|
**Example**
|
|
2393
2752
|
```js
|
|
2394
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2395
2753
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2396
2754
|
email: 'myemail@company.com'
|
|
2755
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2756
|
+
const api = new API();
|
|
2757
|
+
const params = {
|
|
2758
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2759
|
+
email: 'myemail@company.com'
|
|
2760
|
+
};
|
|
2761
|
+
const retData = await api.user.register.validateEmail(params);
|
|
2397
2762
|
```
|
|
2398
2763
|
<a name="Register+execute"></a>
|
|
2399
2764
|
|
|
@@ -2425,7 +2790,30 @@ Method to register a user
|
|
|
2425
2790
|
|
|
2426
2791
|
**Example**
|
|
2427
2792
|
```js
|
|
2428
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2429
2793
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2430
2794
|
"type": 'sign',
|
|
2431
2795
|
"login": false,
|
|
2432
2796
|
"emailInfo": {
|
|
2433
2797
|
"code": "5974",
|
|
2434
2798
|
"email": "cbtoto_1@mailinator.com"
|
|
2435
2799
|
},
|
|
2436
2800
|
"registerData": {
|
|
2437
2801
|
"name": "Augusto Totlo",
|
|
2438
2802
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2439
2803
|
"phone": "",
|
|
2440
2804
|
"idcard": "",
|
|
2441
2805
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2442
2806
|
"registerPassword": "123456",
|
|
2443
2807
|
"emailValidationCode": "5974",
|
|
2444
2808
|
"phoneValidationCode": "",
|
|
2445
2809
|
"language": "en-US",
|
|
2446
2810
|
"timezone": "Europe/Dublin"
|
|
2447
2811
|
}
|
|
2448
2812
|
};
|
|
2813
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2814
|
+
const api = new API();
|
|
2815
|
+
const params ={
|
|
2816
|
+
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2817
|
+
"type": 'sign',
|
|
2818
|
+
"login": false,
|
|
2819
|
+
"emailInfo": {
|
|
2820
|
+
"code": "5974",
|
|
2821
|
+
"email": "cbtoto_1@mailinator.com"
|
|
2822
|
+
},
|
|
2823
|
+
"registerData": {
|
|
2824
|
+
"name": "Augusto Totlo",
|
|
2825
|
+
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2826
|
+
"phone": "",
|
|
2827
|
+
"idcard": "",
|
|
2828
|
+
"dob": "1978-01-12T03:00:00.000Z",
|
|
2829
|
+
"registerPassword": "123456",
|
|
2830
|
+
"emailValidationCode": "5974",
|
|
2831
|
+
"phoneValidationCode": "",
|
|
2832
|
+
"language": "en-US",
|
|
2833
|
+
"timezone": "Europe/Dublin"
|
|
2834
|
+
}
|
|
2835
|
+
};
|
|
2836
|
+
const retData = await api.user.register.execute(params);
|
|
2449
2837
|
```
|
|
2450
2838
|
<a name="Settings"></a>
|
|
2451
2839
|
|
|
@@ -2455,7 +2843,13 @@ Adds/updates a user settings
|
|
|
2455
2843
|
|
|
2456
2844
|
**Example**
|
|
2457
2845
|
```js
|
|
2458
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2459
2846
|
areaId: '55e4a3bd6be6b45210833fae'
|
|
2847
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2848
|
+
const api = new API();
|
|
2849
|
+
const settings = {
|
|
2850
|
+
areaId: '55e4a3bd6be6b45210833fae'
|
|
2851
|
+
};
|
|
2852
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2853
|
+
await api.user.settings.upsert(settings, session);
|
|
2460
2854
|
```
|
|
2461
2855
|
<a name="Settings+get"></a>
|
|
2462
2856
|
|
|
@@ -2472,7 +2866,10 @@ Gets the user settings. Returns an array of settings.
|
|
|
2472
2866
|
|
|
2473
2867
|
**Example**
|
|
2474
2868
|
```js
|
|
2475
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2869
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2870
|
+
const api = new API();
|
|
2871
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2872
|
+
ret settings = await api.user.settings.get(session);
|
|
2476
2873
|
```
|
|
2477
2874
|
<a name="Settings+remove"></a>
|
|
2478
2875
|
|
|
@@ -2489,60 +2886,10 @@ Removes the user settings
|
|
|
2489
2886
|
|
|
2490
2887
|
**Example**
|
|
2491
2888
|
```js
|
|
2492
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2493
|
-
```
|
|
2494
|
-
<a name="TaskAvailable"></a>
|
|
2495
|
-
|
|
2496
|
-
## TaskAvailable
|
|
2497
|
-
Class for available tasks, permission user
|
|
2498
|
-
|
|
2499
|
-
**Kind**: global class
|
|
2500
|
-
|
|
2501
|
-
* [TaskAvailable](#TaskAvailable)
|
|
2502
|
-
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2503
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2504
|
-
|
|
2505
|
-
<a name="TaskAvailable+find"></a>
|
|
2506
|
-
|
|
2507
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2508
|
-
Method to find available tasks for a user
|
|
2509
|
-
|
|
2510
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2511
|
-
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<object></code> - items the items returned from search<code>number</code> - page the page of the search (on pagination), zero indexed<code>number</code> - perPage how many items per page
|
|
2512
|
-
**Access**: public
|
|
2513
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2514
|
-
|
|
2515
|
-
| Param | Type | Description |
|
|
2516
|
-
| --- | --- | --- |
|
|
2517
|
-
| params | <code>object</code> | Params to get task |
|
|
2518
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
2519
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2520
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2521
|
-
|
|
2522
|
-
**Example**
|
|
2523
|
-
```js
|
|
2524
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2525
2889
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2526
2890
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2527
|
-
```
|
|
2528
|
-
<a name="TaskAvailable+claim"></a>
|
|
2529
|
-
|
|
2530
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2531
|
-
Method for a user to claim an available task
|
|
2532
|
-
|
|
2533
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2534
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2535
|
-
**Access**: public
|
|
2536
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2537
|
-
|
|
2538
|
-
| Param | Type | Description |
|
|
2539
|
-
| --- | --- | --- |
|
|
2540
|
-
| params | <code>object</code> | Params to get task |
|
|
2541
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2542
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2543
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2544
|
-
|
|
2545
|
-
**Example**
|
|
2546
|
-
```js
|
|
2547
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2548
2891
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2549
2892
|
orgname: 'acme',
|
|
2893
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2894
|
+
const api = new API();
|
|
2895
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2896
|
+
await api.user.settings.remove(session);
|
|
2550
2897
|
```
|
|
2551
2898
|
<a name="Task"></a>
|
|
2552
2899
|
|
|
@@ -2575,7 +2922,15 @@ Method to find task by id
|
|
|
2575
2922
|
|
|
2576
2923
|
**Example**
|
|
2577
2924
|
```js
|
|
2578
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2579
2925
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2580
2926
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2581
2927
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2928
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2929
|
+
const api = new API();
|
|
2930
|
+
const params = {
|
|
2931
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2932
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2933
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2934
|
+
};
|
|
2935
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2936
|
+
await api.user.task.findById(params, session);
|
|
2582
2937
|
```
|
|
2583
2938
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2584
2939
|
|
|
@@ -2601,7 +2956,17 @@ Find task by id and update
|
|
|
2601
2956
|
|
|
2602
2957
|
**Example**
|
|
2603
2958
|
```js
|
|
2604
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2605
2959
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2606
2960
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2607
2961
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2608
2962
|
action: 1,
|
|
2609
2963
|
formData: {name: 'CloudBrasil'},
|
|
2964
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2965
|
+
const api = new API();
|
|
2966
|
+
const params = {
|
|
2967
|
+
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2968
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2969
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2970
|
+
action: 1,
|
|
2971
|
+
formData: {name: 'CloudBrasil'},
|
|
2972
|
+
};
|
|
2973
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2974
|
+
await api.user.task.findByIdAndUpdate(params, session);
|
|
2610
2975
|
```
|
|
2611
2976
|
<a name="Task+executeActionFinalize"></a>
|
|
2612
2977
|
|
|
@@ -2623,12 +2988,88 @@ Find task by id and update
|
|
|
2623
2988
|
|
|
2624
2989
|
**Example**
|
|
2625
2990
|
```js
|
|
2626
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2627
2991
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2628
2992
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2629
2993
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2630
2994
|
payload: {}',
|
|
2995
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2996
|
+
const api = new API();
|
|
2997
|
+
const params = {
|
|
2998
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2999
|
+
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
3000
|
+
orgId: '5df7f19618430c89a41a1bc3',
|
|
3001
|
+
payload: {}',
|
|
3002
|
+
};
|
|
3003
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3004
|
+
await api.user.task.executeActionFinalize(params, session);
|
|
2631
3005
|
```
|
|
2632
|
-
<a name="
|
|
2633
|
-
|
|
2634
|
-
##
|
|
2635
|
-
Class for
|
|
3006
|
+
<a name="TaskAvailable"></a>
|
|
3007
|
+
|
|
3008
|
+
## TaskAvailable
|
|
3009
|
+
Class for available tasks, permission user
|
|
3010
|
+
|
|
3011
|
+
**Kind**: global class
|
|
3012
|
+
|
|
3013
|
+
* [TaskAvailable](#TaskAvailable)
|
|
3014
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
3015
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
3016
|
+
|
|
3017
|
+
<a name="TaskAvailable+find"></a>
|
|
3018
|
+
|
|
3019
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
3020
|
+
Method to find available tasks for a user
|
|
3021
|
+
|
|
3022
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3023
|
+
**Returns**: <code>promise</code> - returned data from the search<code>number</code> - count the count of items searched<code>array.<object></code> - items the items returned from search<code>number</code> - page the page of the search (on pagination), zero indexed<code>number</code> - perPage how many items per page
|
|
3024
|
+
**Access**: public
|
|
3025
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3026
|
+
|
|
3027
|
+
| Param | Type | Description |
|
|
3028
|
+
| --- | --- | --- |
|
|
3029
|
+
| params | <code>object</code> | Params to get task |
|
|
3030
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
3031
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
3032
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3033
|
+
|
|
3034
|
+
**Example**
|
|
3035
|
+
```js
|
|
3036
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3037
|
+
const api = new API();
|
|
3038
|
+
const params = {
|
|
3039
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
3040
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
3041
|
+
};
|
|
3042
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3043
|
+
const retSearch = await api.user.task.available.find(params, session);
|
|
3044
|
+
```
|
|
3045
|
+
<a name="TaskAvailable+claim"></a>
|
|
3046
|
+
|
|
3047
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
3048
|
+
Method for a user to claim an available task
|
|
3049
|
+
|
|
3050
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3051
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
3052
|
+
**Access**: public
|
|
3053
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3054
|
+
|
|
3055
|
+
| Param | Type | Description |
|
|
3056
|
+
| --- | --- | --- |
|
|
3057
|
+
| params | <code>object</code> | Params to get task |
|
|
3058
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
3059
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
3060
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3061
|
+
|
|
3062
|
+
**Example**
|
|
3063
|
+
```js
|
|
3064
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3065
|
+
const api = new API();
|
|
3066
|
+
const params = {
|
|
3067
|
+
taskId: '55e4a3bd6be6b45210833f67',
|
|
3068
|
+
orgname: 'acme',
|
|
3069
|
+
};
|
|
3070
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3071
|
+
const success = await api.user.task.available.claim(params, session);
|
|
3072
|
+
```
|
|
3073
|
+
<a name="Updates"></a>
|
|
3074
|
+
|
|
3075
|
+
## Updates
|
|
3076
|
+
Class for user registration in a user
|
|
2636
3077
|
|
|
2637
3078
|
**Kind**: global class
|
|
2638
3079
|
<a name="Updates+get"></a>
|
|
@@ -2646,7 +3087,10 @@ get updates
|
|
|
2646
3087
|
|
|
2647
3088
|
**Example**
|
|
2648
3089
|
```js
|
|
2649
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3090
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3091
|
+
const api = new API();
|
|
3092
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3093
|
+
await api.user.updates.get(session);
|
|
2650
3094
|
```
|
|
2651
3095
|
<a name="User"></a>
|
|
2652
3096
|
|
|
@@ -2681,7 +3125,14 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2681
3125
|
|
|
2682
3126
|
**Example**
|
|
2683
3127
|
```js
|
|
2684
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2685
3128
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2686
3129
|
type: '123456',
|
|
3130
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3131
|
+
const api = new API();
|
|
3132
|
+
const params = {
|
|
3133
|
+
avatar: '55e4a3bd6be6b45210833fae',
|
|
3134
|
+
type: '123456',
|
|
3135
|
+
};
|
|
3136
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3137
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2687
3138
|
```
|
|
2688
3139
|
<a name="User+removeAvatar"></a>
|
|
2689
3140
|
|
|
@@ -2698,7 +3149,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2698
3149
|
|
|
2699
3150
|
**Example**
|
|
2700
3151
|
```js
|
|
2701
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3152
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3153
|
+
const api = new API();
|
|
3154
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3155
|
+
await api.user.profile.removeAvatar(session);
|
|
2702
3156
|
```
|
|
2703
3157
|
<a name="User+removeSignature"></a>
|
|
2704
3158
|
|
|
@@ -2715,7 +3169,10 @@ Remove the signature of user by session
|
|
|
2715
3169
|
|
|
2716
3170
|
**Example**
|
|
2717
3171
|
```js
|
|
2718
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3172
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3173
|
+
const api = new API();
|
|
3174
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3175
|
+
await api.user.profile.removeSignature(session);
|
|
2719
3176
|
```
|
|
2720
3177
|
<a name="User+saveSignature"></a>
|
|
2721
3178
|
|
|
@@ -2735,7 +3192,23 @@ Sava a new signature of user by session
|
|
|
2735
3192
|
|
|
2736
3193
|
**Example**
|
|
2737
3194
|
```js
|
|
2738
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2739
3195
|
type: 'CURSIVE',
|
|
2740
3196
|
file: 'allura:Mary John Heart'
|
|
2741
3197
|
type: 'HANDWRITE',
|
|
2742
3198
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3199
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3200
|
+
const api = new API();
|
|
3201
|
+
const data = {
|
|
3202
|
+
type: 'CURSIVE',
|
|
3203
|
+
file: 'allura:Mary John Heart'
|
|
3204
|
+
};
|
|
3205
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3206
|
+
await api.user.profile.saveSignature(data, session);
|
|
3207
|
+
|
|
3208
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3209
|
+
const api = new API();
|
|
3210
|
+
const data = {
|
|
3211
|
+
type: 'HANDWRITE',
|
|
3212
|
+
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3213
|
+
};
|
|
3214
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3215
|
+
await api.user.profile.saveSignature(session);
|
|
2743
3216
|
```
|
|
2744
3217
|
<a name="User+findByIdAndUpdate"></a>
|
|
2745
3218
|
|
|
@@ -2769,7 +3242,13 @@ Update a user profile by id
|
|
|
2769
3242
|
|
|
2770
3243
|
**Example**
|
|
2771
3244
|
```js
|
|
2772
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2773
3245
|
name: 'New Name'
|
|
3246
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3247
|
+
const api = new API();
|
|
3248
|
+
const params = {
|
|
3249
|
+
name: 'New Name'
|
|
3250
|
+
};
|
|
3251
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3252
|
+
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2774
3253
|
```
|
|
2775
3254
|
<a name="User+changeOrganization"></a>
|
|
2776
3255
|
|
|
@@ -2787,5 +3266,379 @@ Change a user's organization
|
|
|
2787
3266
|
|
|
2788
3267
|
**Example**
|
|
2789
3268
|
```js
|
|
2790
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3269
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3270
|
+
const api = new API();
|
|
3271
|
+
const id = '616eccaaa9360a05293b10fe';
|
|
3272
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3273
|
+
await api.user.changeOrganization.updateAvatar(id, session);
|
|
3274
|
+
```
|
|
3275
|
+
<a name="Dispatch"></a>
|
|
3276
|
+
|
|
3277
|
+
## Dispatch
|
|
3278
|
+
Api dispatch manager
|
|
3279
|
+
|
|
3280
|
+
**Kind**: global class
|
|
3281
|
+
|
|
3282
|
+
* [Dispatch](#Dispatch)
|
|
3283
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
3284
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
3285
|
+
|
|
3286
|
+
<a name="Dispatch+getContext"></a>
|
|
3287
|
+
|
|
3288
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
3289
|
+
Get the URL context
|
|
3290
|
+
|
|
3291
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3292
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
3293
|
+
**Access**: public
|
|
3294
|
+
|
|
3295
|
+
| Param | Type | Default | Description |
|
|
3296
|
+
| --- | --- | --- | --- |
|
|
3297
|
+
| url | <code>string</code> | | Full url |
|
|
3298
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
3299
|
+
|
|
3300
|
+
**Example**
|
|
3301
|
+
```js
|
|
3302
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3303
|
+
const api = new API();
|
|
3304
|
+
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
3305
|
+
```
|
|
3306
|
+
<a name="Dispatch+getClient"></a>
|
|
3307
|
+
|
|
3308
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
3309
|
+
Get client Axios
|
|
3310
|
+
|
|
3311
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3312
|
+
**Returns**: <code>promise</code> - return client axios
|
|
3313
|
+
**Access**: public
|
|
3314
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3315
|
+
**Example**
|
|
3316
|
+
```js
|
|
3317
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3318
|
+
const api = new API();
|
|
3319
|
+
await api.dispatch.getClient();
|
|
3320
|
+
```
|
|
3321
|
+
<a name="External"></a>
|
|
3322
|
+
|
|
3323
|
+
## External
|
|
3324
|
+
Class for documents, permission user
|
|
3325
|
+
|
|
3326
|
+
**Kind**: global class
|
|
3327
|
+
|
|
3328
|
+
* [External](#External)
|
|
3329
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3330
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3331
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3332
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3333
|
+
|
|
3334
|
+
<a name="External+context"></a>
|
|
3335
|
+
|
|
3336
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3337
|
+
Create new document
|
|
3338
|
+
|
|
3339
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3340
|
+
**Returns**: <code>Promise.<object></code> - data<code>string</code> - _id the id of the form<code>string</code> - orgId the organization id of the form<code>string</code> - authorization the unique token registered internally by the system for all the next calls to the external form APIs
|
|
3341
|
+
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3342
|
+
**Access**: public
|
|
3343
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3344
|
+
|
|
3345
|
+
| Param | Type | Description |
|
|
3346
|
+
| --- | --- | --- |
|
|
3347
|
+
| params | <code>object</code> | Object for add new document |
|
|
3348
|
+
| params.id | <code>string</code> | Organization form id |
|
|
3349
|
+
|
|
3350
|
+
**Example**
|
|
3351
|
+
```js
|
|
3352
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3353
|
+
const api = new API();
|
|
3354
|
+
const params = {
|
|
3355
|
+
id: '611e679741cc63168c26d7ee'
|
|
3356
|
+
};
|
|
3357
|
+
const retForm = await api.external.context(params);
|
|
3358
|
+
```
|
|
3359
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3360
|
+
|
|
3361
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3362
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3363
|
+
|
|
3364
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3365
|
+
**Returns**: <code>Promise.<object></code> - doc<code>string</code> - doc.mime the original mime type of the document<code>string</code> - doc.signedUrl the signed url to upload the document<code>string</code> - doc.filename the filename of the uploaded file<code>string</code> - doc.extension the extension of the filename, obtained from the mime type
|
|
3366
|
+
**Access**: public
|
|
3367
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3368
|
+
|
|
3369
|
+
| Param | Type | Description |
|
|
3370
|
+
| --- | --- | --- |
|
|
3371
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
3372
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3373
|
+
|
|
3374
|
+
**Example**
|
|
3375
|
+
```js
|
|
3376
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3377
|
+
const api = new API();
|
|
3378
|
+
const authorization = '...';
|
|
3379
|
+
const doc = {
|
|
3380
|
+
mime: 'application/pdf'
|
|
3381
|
+
};
|
|
3382
|
+
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3383
|
+
```
|
|
3384
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3385
|
+
|
|
3386
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3387
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3388
|
+
|
|
3389
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3390
|
+
**Returns**: <code>Promise.<array></code> - docs<code>string</code> - docs.mime the original mime type of the document<code>string</code> - docs.signedUrl the signed url to upload the document<code>string</code> - docs.filename the filename of the uploaded file<code>string</code> - docs.extension the extension of the filename, obtained from the mime type
|
|
3391
|
+
**Access**: public
|
|
3392
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3393
|
+
|
|
3394
|
+
| Param | Type | Description |
|
|
3395
|
+
| --- | --- | --- |
|
|
3396
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
3397
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3398
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3399
|
+
|
|
3400
|
+
**Example**
|
|
3401
|
+
```js
|
|
3402
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3403
|
+
const api = new API();
|
|
3404
|
+
const authorization = '...';
|
|
3405
|
+
const docs = [
|
|
3406
|
+
{
|
|
3407
|
+
mime: 'application/pdf'
|
|
3408
|
+
}
|
|
3409
|
+
];
|
|
3410
|
+
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3411
|
+
```
|
|
3412
|
+
<a name="External+handle"></a>
|
|
3413
|
+
|
|
3414
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3415
|
+
Handles the execution of an external form
|
|
3416
|
+
|
|
3417
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3418
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3419
|
+
**Access**: public
|
|
3420
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3421
|
+
|
|
3422
|
+
| Param | Type | Description |
|
|
3423
|
+
| --- | --- | --- |
|
|
3424
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3425
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3426
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3427
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
3428
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3429
|
+
| params.payload.fields.value | <code>\*</code> \| <code>Object</code> | besides all the data inside a field, it should have the value of the the field |
|
|
3430
|
+
|
|
3431
|
+
**Example**
|
|
3432
|
+
```js
|
|
3433
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3434
|
+
const api = new API();
|
|
3435
|
+
const authorization = '...';
|
|
3436
|
+
const params = {
|
|
3437
|
+
payload: [
|
|
3438
|
+
{
|
|
3439
|
+
name: 'My Group One',
|
|
3440
|
+
fields: [
|
|
3441
|
+
{}
|
|
3442
|
+
]
|
|
3443
|
+
}
|
|
3444
|
+
]
|
|
3445
|
+
};
|
|
3446
|
+
const success = await api.external.handle(params, authorization);
|
|
3447
|
+
```
|
|
3448
|
+
<a name="Login"></a>
|
|
3449
|
+
|
|
3450
|
+
## Login
|
|
3451
|
+
Login manager
|
|
3452
|
+
|
|
3453
|
+
**Kind**: global class
|
|
3454
|
+
|
|
3455
|
+
* [Login](#Login)
|
|
3456
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3457
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3458
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3459
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3460
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3461
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3462
|
+
|
|
3463
|
+
<a name="Login+facebook"></a>
|
|
3464
|
+
|
|
3465
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3466
|
+
Login with social login Facebook
|
|
3467
|
+
|
|
3468
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3469
|
+
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
3470
|
+
**Access**: public
|
|
3471
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3472
|
+
|
|
3473
|
+
| Param | Type | Description |
|
|
3474
|
+
| --- | --- | --- |
|
|
3475
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
3476
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3477
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3478
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3479
|
+
|
|
3480
|
+
**Example**
|
|
3481
|
+
```js
|
|
3482
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3483
|
+
|
|
3484
|
+
// Params of the instance
|
|
3485
|
+
const params = {...}
|
|
3486
|
+
const api = new API(params);
|
|
3487
|
+
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3488
|
+
const { auth, user } = await api.login.facebook(params);
|
|
3489
|
+
```
|
|
3490
|
+
<a name="Login+google"></a>
|
|
3491
|
+
|
|
3492
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3493
|
+
Login with social login Google
|
|
3494
|
+
|
|
3495
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3496
|
+
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
3497
|
+
**Access**: public
|
|
3498
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3499
|
+
|
|
3500
|
+
| Param | Type | Description |
|
|
3501
|
+
| --- | --- | --- |
|
|
3502
|
+
| params | <code>object</code> | Params to login Google |
|
|
3503
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3504
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3505
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3506
|
+
|
|
3507
|
+
**Example**
|
|
3508
|
+
```js
|
|
3509
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3510
|
+
|
|
3511
|
+
// Params of the instance
|
|
3512
|
+
const params = {...}
|
|
3513
|
+
const api = new API(params);
|
|
3514
|
+
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3515
|
+
const { auth, user } = await api.login.google(accessToken);
|
|
3516
|
+
```
|
|
3517
|
+
<a name="Login+apiKey"></a>
|
|
3518
|
+
|
|
3519
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3520
|
+
Login with apikey
|
|
3521
|
+
|
|
3522
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3523
|
+
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
3524
|
+
**Access**: public
|
|
3525
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3526
|
+
|
|
3527
|
+
| Param | Type | Description |
|
|
3528
|
+
| --- | --- | --- |
|
|
3529
|
+
| apikey | <code>string</code> | Access key |
|
|
3530
|
+
|
|
3531
|
+
**Example**
|
|
3532
|
+
```js
|
|
3533
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3534
|
+
|
|
3535
|
+
// Params of the instance
|
|
3536
|
+
const params = {...}
|
|
3537
|
+
const api = new API(params);
|
|
3538
|
+
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3539
|
+
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3540
|
+
```
|
|
3541
|
+
<a name="Login+userPass"></a>
|
|
3542
|
+
|
|
3543
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3544
|
+
Login with user and password
|
|
3545
|
+
|
|
3546
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3547
|
+
**Returns**: <code>promise.<object></code> - data<code>object</code> - data.auth true or false if we have the user authenticaited correctly<code>object</code> - data.user the logged user
|
|
3548
|
+
**Access**: public
|
|
3549
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3550
|
+
|
|
3551
|
+
| Param | Type | Description |
|
|
3552
|
+
| --- | --- | --- |
|
|
3553
|
+
| params | <code>object</code> | Object with user and password |
|
|
3554
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
3555
|
+
| params.password | <code>string</code> | Password of the user |
|
|
3556
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
3557
|
+
|
|
3558
|
+
**Example**
|
|
3559
|
+
```js
|
|
3560
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3561
|
+
|
|
3562
|
+
// Params of the instance
|
|
3563
|
+
const params = {...}
|
|
3564
|
+
const api = new API(params);
|
|
3565
|
+
const params = {
|
|
3566
|
+
username: 'ana.silva@gmail.com',
|
|
3567
|
+
password: '123456'
|
|
3568
|
+
};
|
|
3569
|
+
const { auth, user } = await api.login.userPass(params);
|
|
3570
|
+
```
|
|
3571
|
+
<a name="Login+logout"></a>
|
|
3572
|
+
|
|
3573
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3574
|
+
Logout user system manager
|
|
3575
|
+
|
|
3576
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3577
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3578
|
+
**Access**: public
|
|
3579
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3580
|
+
|
|
3581
|
+
| Param | Type | Description |
|
|
3582
|
+
| --- | --- | --- |
|
|
3583
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3584
|
+
|
|
3585
|
+
**Example**
|
|
3586
|
+
```js
|
|
3587
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3588
|
+
|
|
3589
|
+
// Params of the instance
|
|
3590
|
+
const params = {...}
|
|
3591
|
+
const api = new API(params);
|
|
3592
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3593
|
+
const { success } = await api.login.logout(session);
|
|
3594
|
+
```
|
|
3595
|
+
<a name="Login+recover"></a>
|
|
3596
|
+
|
|
3597
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3598
|
+
Recover the password
|
|
3599
|
+
|
|
3600
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3601
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3602
|
+
**Access**: public
|
|
3603
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3604
|
+
|
|
3605
|
+
| Param | Type | Description |
|
|
3606
|
+
| --- | --- | --- |
|
|
3607
|
+
| username | <code>string</code> | The username or email |
|
|
3608
|
+
|
|
3609
|
+
**Example**
|
|
3610
|
+
```js
|
|
3611
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3612
|
+
|
|
3613
|
+
// Params of the instance
|
|
3614
|
+
const params = {...}
|
|
3615
|
+
const api = new API(params);
|
|
3616
|
+
const { success } = await api.login.recover('myusername');
|
|
3617
|
+
```
|
|
3618
|
+
<a name="Session"></a>
|
|
3619
|
+
|
|
3620
|
+
## Session
|
|
3621
|
+
Session manager of the API
|
|
3622
|
+
|
|
3623
|
+
**Kind**: global class
|
|
3624
|
+
<a name="Session+information"></a>
|
|
3625
|
+
|
|
3626
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3627
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
3628
|
+
|
|
3629
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3630
|
+
**Access**: public
|
|
3631
|
+
|
|
3632
|
+
| Param | Type | Default | Description |
|
|
3633
|
+
| --- | --- | --- | --- |
|
|
3634
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3635
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3636
|
+
|
|
3637
|
+
**Example**
|
|
3638
|
+
```js
|
|
3639
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3640
|
+
const api = new API();
|
|
3641
|
+
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3642
|
+
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3643
|
+
await api.session.information(sessionId, suSessionId);
|
|
2791
3644
|
```
|