@docbrasil/api-systemmanager 1.1.14 → 1.1.15
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/.project +11 -0
- package/api/user/my_tasks.js +78 -0
- package/dist/bundle.cjs +78 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +1380 -521
- package/package.json +1 -1
- package/.vscode/settings.json +0 -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
|
|
|
@@ -1793,6 +1899,8 @@ Class for my tasks, permission user
|
|
|
1793
1899
|
* [.addMultiTaskUser(params, session)](#MyTasks+addMultiTaskUser) ⇒ <code>Promise</code>
|
|
1794
1900
|
* [.getAssignTaskUsers(params, session)](#MyTasks+getAssignTaskUsers) ⇒ <code>promise</code>
|
|
1795
1901
|
* [.assignTaskUsers(params, session)](#MyTasks+assignTaskUsers) ⇒ <code>Promise</code>
|
|
1902
|
+
* [.unclaim(params, session)](#MyTasks+unclaim) ⇒ <code>Promise</code>
|
|
1903
|
+
* [.escalate(params, session)](#MyTasks+escalate) ⇒ <code>Promise</code>
|
|
1796
1904
|
|
|
1797
1905
|
<a name="MyTasks+find"></a>
|
|
1798
1906
|
|
|
@@ -1813,7 +1921,14 @@ Method to find my tasks for a user
|
|
|
1813
1921
|
|
|
1814
1922
|
**Example**
|
|
1815
1923
|
```js
|
|
1816
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1817
1924
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1818
1925
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1926
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1927
|
+
const api = new API();
|
|
1928
|
+
const params = {
|
|
1929
|
+
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1930
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1931
|
+
};
|
|
1932
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1933
|
+
const retSearch = await api.user.task.mytasks.find(params, session);
|
|
1819
1934
|
```
|
|
1820
1935
|
<a name="MyTasks+saveDueDate"></a>
|
|
1821
1936
|
|
|
@@ -1834,7 +1949,15 @@ Update task dueDate
|
|
|
1834
1949
|
|
|
1835
1950
|
**Example**
|
|
1836
1951
|
```js
|
|
1837
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1838
1952
|
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1839
1953
|
orgId: '646386c9583e04a131adc894',
|
|
1840
1954
|
taskId: '646386c9583e04a131adc895'
|
|
1955
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1956
|
+
const api = new API();
|
|
1957
|
+
const params = {
|
|
1958
|
+
dueDate: '2011-10-05T14:48:00.000Z',
|
|
1959
|
+
orgId: '646386c9583e04a131adc894',
|
|
1960
|
+
taskId: '646386c9583e04a131adc895'
|
|
1961
|
+
};
|
|
1962
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1963
|
+
await api.user.task.mytasks.saveDueDate(params, session);
|
|
1841
1964
|
```
|
|
1842
1965
|
<a name="MyTasks+removeDueDate"></a>
|
|
1843
1966
|
|
|
@@ -1853,7 +1976,14 @@ Update task dueDate
|
|
|
1853
1976
|
|
|
1854
1977
|
**Example**
|
|
1855
1978
|
```js
|
|
1856
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1857
1979
|
orgId: '646386c9583e04a131adc894',
|
|
1858
1980
|
taskId: '646386c9583e04a131adc895'
|
|
1981
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1982
|
+
const api = new API();
|
|
1983
|
+
const params = {
|
|
1984
|
+
orgId: '646386c9583e04a131adc894',
|
|
1985
|
+
taskId: '646386c9583e04a131adc895'
|
|
1986
|
+
};
|
|
1987
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1988
|
+
await api.user.task.mytasks.removeDueDate(params, session);
|
|
1859
1989
|
```
|
|
1860
1990
|
<a name="MyTasks+getTaskMultiUsers"></a>
|
|
1861
1991
|
|
|
@@ -1873,7 +2003,14 @@ Method to get task multi users
|
|
|
1873
2003
|
|
|
1874
2004
|
**Example**
|
|
1875
2005
|
```js
|
|
1876
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1877
2006
|
taskId: '5df7f19618430c89a41a19d2',
|
|
1878
2007
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2008
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2009
|
+
const api = new API();
|
|
2010
|
+
const params = {
|
|
2011
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2012
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2013
|
+
};
|
|
2014
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2015
|
+
await api.user.task.mytasks.getTaskMultiUsers(params, session);
|
|
1879
2016
|
```
|
|
1880
2017
|
<a name="MyTasks+removeMultiTaskUser"></a>
|
|
1881
2018
|
|
|
@@ -1894,7 +2031,15 @@ remove multi task user
|
|
|
1894
2031
|
|
|
1895
2032
|
**Example**
|
|
1896
2033
|
```js
|
|
1897
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1898
2034
|
userId: '646386c9583e04a131adc896',
|
|
1899
2035
|
orgId: '646386c9583e04a131adc894',
|
|
1900
2036
|
taskId: '646386c9583e04a131adc895'
|
|
2037
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2038
|
+
const api = new API();
|
|
2039
|
+
const params = {
|
|
2040
|
+
userId: '646386c9583e04a131adc896',
|
|
2041
|
+
orgId: '646386c9583e04a131adc894',
|
|
2042
|
+
taskId: '646386c9583e04a131adc895'
|
|
2043
|
+
};
|
|
2044
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2045
|
+
await api.user.task.mytasks.removeMultiTaskUser(params, session);
|
|
1901
2046
|
```
|
|
1902
2047
|
<a name="MyTasks+addMultiTaskUser"></a>
|
|
1903
2048
|
|
|
@@ -1915,7 +2060,15 @@ Add Multi Task User
|
|
|
1915
2060
|
|
|
1916
2061
|
**Example**
|
|
1917
2062
|
```js
|
|
1918
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1919
2063
|
userId: '646386c9583e04a131adc8946',
|
|
1920
2064
|
orgId: '646386c9583e04a131adc894',
|
|
1921
2065
|
taskId: '646386c9583e04a131adc895'
|
|
2066
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2067
|
+
const api = new API();
|
|
2068
|
+
const params = {
|
|
2069
|
+
userId: '646386c9583e04a131adc8946',
|
|
2070
|
+
orgId: '646386c9583e04a131adc894',
|
|
2071
|
+
taskId: '646386c9583e04a131adc895'
|
|
2072
|
+
};
|
|
2073
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2074
|
+
await api.user.task.mytasks.addMultiTaskUser(params, session);
|
|
1922
2075
|
```
|
|
1923
2076
|
<a name="MyTasks+getAssignTaskUsers"></a>
|
|
1924
2077
|
|
|
@@ -1935,7 +2088,14 @@ Method to get assign task users
|
|
|
1935
2088
|
|
|
1936
2089
|
**Example**
|
|
1937
2090
|
```js
|
|
1938
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1939
2091
|
taskId: '5df7f19618430c89a41a19d2',
|
|
1940
2092
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2093
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2094
|
+
const api = new API();
|
|
2095
|
+
const params = {
|
|
2096
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2097
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2098
|
+
};
|
|
2099
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2100
|
+
await api.user.task.mytasks.getAssignTaskUsers(params, session);
|
|
1941
2101
|
```
|
|
1942
2102
|
<a name="MyTasks+assignTaskUsers"></a>
|
|
1943
2103
|
|
|
@@ -1956,7 +2116,69 @@ Assign Task user
|
|
|
1956
2116
|
|
|
1957
2117
|
**Example**
|
|
1958
2118
|
```js
|
|
1959
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1960
2119
|
orgName: 'pinkbrain',
|
|
1961
2120
|
userId: '646386c9583e04a131adc894',
|
|
1962
2121
|
taskId: '646386c9583e04a131adc895'
|
|
2122
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2123
|
+
const api = new API();
|
|
2124
|
+
const params = {
|
|
2125
|
+
orgName: 'pinkbrain',
|
|
2126
|
+
userId: '646386c9583e04a131adc894',
|
|
2127
|
+
taskId: '646386c9583e04a131adc895'
|
|
2128
|
+
};
|
|
2129
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2130
|
+
await api.user.task.mytasks.assignTaskUser(params, session);
|
|
2131
|
+
```
|
|
2132
|
+
<a name="MyTasks+unclaim"></a>
|
|
2133
|
+
|
|
2134
|
+
### myTasks.unclaim(params, session) ⇒ <code>Promise</code>
|
|
2135
|
+
Unclaim task
|
|
2136
|
+
|
|
2137
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
2138
|
+
**Access**: public
|
|
2139
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2140
|
+
|
|
2141
|
+
| Param | Type | Description |
|
|
2142
|
+
| --- | --- | --- |
|
|
2143
|
+
| params | <code>object</code> | The params to unclaim task |
|
|
2144
|
+
| params.orgName | <code>string</code> | Organization Name |
|
|
2145
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
2146
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
2147
|
+
|
|
2148
|
+
**Example**
|
|
2149
|
+
```js
|
|
2150
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2151
|
+
const api = new API();
|
|
2152
|
+
const params = {
|
|
2153
|
+
orgName: 'pinkbrain',
|
|
2154
|
+
taskId: '646386c9583e04a131adc895'
|
|
2155
|
+
};
|
|
2156
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2157
|
+
await api.user.task.mytasks.unclaim(params, session);
|
|
2158
|
+
```
|
|
2159
|
+
<a name="MyTasks+escalate"></a>
|
|
2160
|
+
|
|
2161
|
+
### myTasks.escalate(params, session) ⇒ <code>Promise</code>
|
|
2162
|
+
Escalate task
|
|
2163
|
+
|
|
2164
|
+
**Kind**: instance method of [<code>MyTasks</code>](#MyTasks)
|
|
2165
|
+
**Access**: public
|
|
2166
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2167
|
+
|
|
2168
|
+
| Param | Type | Description |
|
|
2169
|
+
| --- | --- | --- |
|
|
2170
|
+
| params | <code>object</code> | The params to escalate task |
|
|
2171
|
+
| params.orgName | <code>string</code> | Organization Name |
|
|
2172
|
+
| params.taskId | <code>string</code> | Task Id |
|
|
2173
|
+
| session | <code>string</code> | Is token JWT of user |
|
|
2174
|
+
|
|
2175
|
+
**Example**
|
|
2176
|
+
```js
|
|
2177
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2178
|
+
const api = new API();
|
|
2179
|
+
const params = {
|
|
2180
|
+
orgName: 'pinkbrain',
|
|
2181
|
+
taskId: '646386c9583e04a131adc895'
|
|
2182
|
+
};
|
|
2183
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2184
|
+
await api.user.task.mytasks.escalate(params, session);
|
|
1963
2185
|
```
|
|
1964
2186
|
<a name="Notification"></a>
|
|
1965
2187
|
|
|
@@ -1998,7 +2220,14 @@ Method to add a notification token
|
|
|
1998
2220
|
|
|
1999
2221
|
**Example**
|
|
2000
2222
|
```js
|
|
2001
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2002
2223
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
2003
2224
|
type: 'FCM_WEB'
|
|
2225
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2226
|
+
const api = new API();
|
|
2227
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2228
|
+
const params = {
|
|
2229
|
+
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
2230
|
+
type: 'FCM_WEB'
|
|
2231
|
+
};
|
|
2232
|
+
const retData = await api.user.notification.addToken(params, session);
|
|
2004
2233
|
```
|
|
2005
2234
|
<a name="Notification+getNew"></a>
|
|
2006
2235
|
|
|
@@ -2015,7 +2244,10 @@ get new notifications
|
|
|
2015
2244
|
|
|
2016
2245
|
**Example**
|
|
2017
2246
|
```js
|
|
2018
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2247
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2248
|
+
const api = new API();
|
|
2249
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2250
|
+
await api.user.notification.getNew(session);
|
|
2019
2251
|
```
|
|
2020
2252
|
<a name="Notification+getOld"></a>
|
|
2021
2253
|
|
|
@@ -2032,7 +2264,10 @@ get old notifications
|
|
|
2032
2264
|
|
|
2033
2265
|
**Example**
|
|
2034
2266
|
```js
|
|
2035
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2267
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2268
|
+
const api = new API();
|
|
2269
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2270
|
+
await api.user.notification.getOld(session);
|
|
2036
2271
|
```
|
|
2037
2272
|
<a name="Notification+setRead"></a>
|
|
2038
2273
|
|
|
@@ -2051,7 +2286,13 @@ Set notification as readed
|
|
|
2051
2286
|
|
|
2052
2287
|
**Example**
|
|
2053
2288
|
```js
|
|
2054
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2055
2289
|
id: '34c344c43c34c344c43c'
|
|
2290
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2291
|
+
const api = new API();
|
|
2292
|
+
const params = {
|
|
2293
|
+
id: '34c344c43c34c344c43c'
|
|
2294
|
+
};
|
|
2295
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2296
|
+
await api.user.notification.setRead(params, session);
|
|
2056
2297
|
```
|
|
2057
2298
|
<a name="Notification+setUnread"></a>
|
|
2058
2299
|
|
|
@@ -2070,7 +2311,13 @@ Set notification as unreaded
|
|
|
2070
2311
|
|
|
2071
2312
|
**Example**
|
|
2072
2313
|
```js
|
|
2073
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2074
2314
|
id: '34c344c43c34c344c43c'
|
|
2315
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2316
|
+
const api = new API();
|
|
2317
|
+
const params = {
|
|
2318
|
+
id: '34c344c43c34c344c43c'
|
|
2319
|
+
};
|
|
2320
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2321
|
+
await api.user.notification.setUnread(params, session);
|
|
2075
2322
|
```
|
|
2076
2323
|
<a name="Organization"></a>
|
|
2077
2324
|
|
|
@@ -2107,7 +2354,15 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2107
2354
|
|
|
2108
2355
|
**Example**
|
|
2109
2356
|
```js
|
|
2110
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2111
2357
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2112
2358
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2113
2359
|
type: 'image/png',
|
|
2360
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2361
|
+
const api = new API();
|
|
2362
|
+
const params = {
|
|
2363
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2364
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2365
|
+
type: 'image/png',
|
|
2366
|
+
};
|
|
2367
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2368
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
2114
2369
|
```
|
|
2115
2370
|
<a name="Organization+removeAvatar"></a>
|
|
2116
2371
|
|
|
@@ -2125,7 +2380,11 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2125
2380
|
|
|
2126
2381
|
**Example**
|
|
2127
2382
|
```js
|
|
2128
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2383
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2384
|
+
const api = new API();
|
|
2385
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2386
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2387
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
2129
2388
|
```
|
|
2130
2389
|
<a name="Organization+findById"></a>
|
|
2131
2390
|
|
|
@@ -2143,7 +2402,11 @@ Find organization by id
|
|
|
2143
2402
|
|
|
2144
2403
|
**Example**
|
|
2145
2404
|
```js
|
|
2146
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2405
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2406
|
+
const api = new API();
|
|
2407
|
+
const orgId = '80443245000122';
|
|
2408
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2409
|
+
await api.user.organization.findById(idCard, session);
|
|
2147
2410
|
```
|
|
2148
2411
|
<a name="Organization+idCardExist"></a>
|
|
2149
2412
|
|
|
@@ -2161,7 +2424,11 @@ Check if id card exist
|
|
|
2161
2424
|
|
|
2162
2425
|
**Example**
|
|
2163
2426
|
```js
|
|
2164
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2427
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2428
|
+
const api = new API();
|
|
2429
|
+
const idCard = '80443245000122';
|
|
2430
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2431
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
2165
2432
|
```
|
|
2166
2433
|
<a name="Organization+upsertAvatar"></a>
|
|
2167
2434
|
|
|
@@ -2181,7 +2448,14 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
2181
2448
|
|
|
2182
2449
|
**Example**
|
|
2183
2450
|
```js
|
|
2184
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2185
2451
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2186
2452
|
type: 'image/png',
|
|
2453
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2454
|
+
const api = new API();
|
|
2455
|
+
const params = {
|
|
2456
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2457
|
+
type: 'image/png',
|
|
2458
|
+
};
|
|
2459
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2460
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2187
2461
|
```
|
|
2188
2462
|
<a name="Organization+removeAvatar"></a>
|
|
2189
2463
|
|
|
@@ -2198,7 +2472,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2198
2472
|
|
|
2199
2473
|
**Example**
|
|
2200
2474
|
```js
|
|
2201
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2475
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2476
|
+
const api = new API();
|
|
2477
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2478
|
+
await api.user.profile.removeAvatar(session);
|
|
2202
2479
|
```
|
|
2203
2480
|
<a name="Organization+callFetch"></a>
|
|
2204
2481
|
|
|
@@ -2218,7 +2495,14 @@ Call URL internal, need auth JWT (session)
|
|
|
2218
2495
|
|
|
2219
2496
|
**Example**
|
|
2220
2497
|
```js
|
|
2221
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2222
2498
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2223
2499
|
method: 'POST'
|
|
2500
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2501
|
+
const api = new API();
|
|
2502
|
+
|
|
2503
|
+
const params = {
|
|
2504
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2505
|
+
method: 'POST'
|
|
2506
|
+
}
|
|
2507
|
+
await api.user.organization.callFetchs(params, session);
|
|
2224
2508
|
```
|
|
2225
2509
|
<a name="Page"></a>
|
|
2226
2510
|
|
|
@@ -2245,7 +2529,15 @@ Get the available page for an application inside an organization
|
|
|
2245
2529
|
|
|
2246
2530
|
**Example**
|
|
2247
2531
|
```js
|
|
2248
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2249
2532
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2250
2533
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2251
2534
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2535
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2536
|
+
const api = new API();
|
|
2537
|
+
const params = {
|
|
2538
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2539
|
+
appId: '57e4a3bd6be6b45210833fa7',
|
|
2540
|
+
pageId: '57e4a3bd6be6b45210833fab'
|
|
2541
|
+
};
|
|
2542
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2543
|
+
await api.user.application.page.get(params, session);
|
|
2252
2544
|
```
|
|
2253
2545
|
<a name="Process"></a>
|
|
2254
2546
|
|
|
@@ -2284,7 +2576,15 @@ Start process
|
|
|
2284
2576
|
|
|
2285
2577
|
**Example**
|
|
2286
2578
|
```js
|
|
2287
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2288
2579
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2289
2580
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2290
2581
|
payload: {}
|
|
2582
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2583
|
+
const api = new API();
|
|
2584
|
+
const params = {
|
|
2585
|
+
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2586
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2587
|
+
payload: {}
|
|
2588
|
+
}
|
|
2589
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2590
|
+
await api.user.process.start(params, session);
|
|
2291
2591
|
```
|
|
2292
2592
|
<a name="Process+getProcessProperties"></a>
|
|
2293
2593
|
|
|
@@ -2304,7 +2604,14 @@ Get process properties of process
|
|
|
2304
2604
|
|
|
2305
2605
|
**Example**
|
|
2306
2606
|
```js
|
|
2307
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2308
2607
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2309
2608
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2609
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2610
|
+
const api = new API();
|
|
2611
|
+
const params = {
|
|
2612
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2613
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2614
|
+
}
|
|
2615
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2616
|
+
await api.user.process.getProcessProperties(params, session);
|
|
2310
2617
|
```
|
|
2311
2618
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2312
2619
|
|
|
@@ -2312,7 +2619,8 @@ const API = require('@docbrasil/api-systemmanager');
|
|
|
2312
2619
|
Get the search info of a organization process
|
|
2313
2620
|
|
|
2314
2621
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2315
|
-
**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
|
|
2622
|
+
**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
|
|
2623
|
+
@
|
|
2316
2624
|
**Access**: public
|
|
2317
2625
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2318
2626
|
|
|
@@ -2325,7 +2633,14 @@ Get the search info of a organization process
|
|
|
2325
2633
|
|
|
2326
2634
|
**Example**
|
|
2327
2635
|
```js
|
|
2328
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2329
2636
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2330
2637
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2638
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2639
|
+
const api = new API();
|
|
2640
|
+
const params = {
|
|
2641
|
+
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2642
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2643
|
+
}
|
|
2644
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2645
|
+
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2331
2646
|
```
|
|
2332
2647
|
<a name="Process+find"></a>
|
|
2333
2648
|
|
|
@@ -2346,7 +2661,14 @@ Method to search processes
|
|
|
2346
2661
|
|
|
2347
2662
|
**Example**
|
|
2348
2663
|
```js
|
|
2349
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2350
2664
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2351
2665
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2666
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2667
|
+
const api = new API();
|
|
2668
|
+
const params = {
|
|
2669
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2670
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2671
|
+
};
|
|
2672
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2673
|
+
const retSearch = await api.user.process.find(params, session);
|
|
2352
2674
|
```
|
|
2353
2675
|
<a name="Process+remove"></a>
|
|
2354
2676
|
|
|
@@ -2366,7 +2688,14 @@ Method to remove process
|
|
|
2366
2688
|
|
|
2367
2689
|
**Example**
|
|
2368
2690
|
```js
|
|
2369
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2370
2691
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2371
2692
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2693
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2694
|
+
const api = new API();
|
|
2695
|
+
const params = {
|
|
2696
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2697
|
+
processId: '55e4a3bd6be6b45210833fae'
|
|
2698
|
+
};
|
|
2699
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2700
|
+
const retSearch = await api.user.process.remove(params, session);
|
|
2372
2701
|
```
|
|
2373
2702
|
<a name="Process+exportStatusData"></a>
|
|
2374
2703
|
|
|
@@ -2386,7 +2715,14 @@ Method to export status data
|
|
|
2386
2715
|
|
|
2387
2716
|
**Example**
|
|
2388
2717
|
```js
|
|
2389
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2390
2718
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2391
2719
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2720
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2721
|
+
const api = new API();
|
|
2722
|
+
const params = {
|
|
2723
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2724
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2725
|
+
};
|
|
2726
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2727
|
+
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2392
2728
|
```
|
|
2393
2729
|
<a name="Process+exportProcessData"></a>
|
|
2394
2730
|
|
|
@@ -2406,7 +2742,14 @@ Method to export process data
|
|
|
2406
2742
|
|
|
2407
2743
|
**Example**
|
|
2408
2744
|
```js
|
|
2409
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2410
2745
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2411
2746
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2747
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2748
|
+
const api = new API();
|
|
2749
|
+
const params = {
|
|
2750
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2751
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2752
|
+
};
|
|
2753
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2754
|
+
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2412
2755
|
```
|
|
2413
2756
|
<a name="Process+processDocs"></a>
|
|
2414
2757
|
|
|
@@ -2428,7 +2771,15 @@ Method to get Process Docs
|
|
|
2428
2771
|
|
|
2429
2772
|
**Example**
|
|
2430
2773
|
```js
|
|
2431
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2432
2774
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2433
2775
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2434
2776
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2777
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2778
|
+
const api = new API();
|
|
2779
|
+
const params = {
|
|
2780
|
+
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2781
|
+
processId: '55e4a3bd6be6b45210833fae',
|
|
2782
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2783
|
+
};
|
|
2784
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2785
|
+
const retSearch = await api.user.process.processDocs(params, session);
|
|
2435
2786
|
```
|
|
2436
2787
|
<a name="Process+downloadDocs"></a>
|
|
2437
2788
|
|
|
@@ -2451,7 +2802,16 @@ Method to download the process documents
|
|
|
2451
2802
|
|
|
2452
2803
|
**Example**
|
|
2453
2804
|
```js
|
|
2454
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2455
2805
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2456
2806
|
type: 'Docs',
|
|
2457
2807
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2458
2808
|
footer: 'Documento - {page} de {pages}'
|
|
2809
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2810
|
+
const api = new API();
|
|
2811
|
+
const params = {
|
|
2812
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2813
|
+
type: 'Docs',
|
|
2814
|
+
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2815
|
+
footer: 'Documento - {page} de {pages}'
|
|
2816
|
+
};
|
|
2817
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2818
|
+
const result = await api.user.process.downloadDocs(params, session);
|
|
2459
2819
|
```
|
|
2460
2820
|
<a name="Register"></a>
|
|
2461
2821
|
|
|
@@ -2479,7 +2839,12 @@ Class for user registration in a user
|
|
|
2479
2839
|
|
|
2480
2840
|
**Example**
|
|
2481
2841
|
```js
|
|
2482
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2483
2842
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2843
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2844
|
+
const api = new API();
|
|
2845
|
+
const params = {
|
|
2846
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2847
|
+
};
|
|
2848
|
+
const orgname = await api.user.register.getOrgname(params);
|
|
2484
2849
|
```
|
|
2485
2850
|
<a name="Register+validateEmail"></a>
|
|
2486
2851
|
|
|
@@ -2499,7 +2864,13 @@ Method to find task by id
|
|
|
2499
2864
|
|
|
2500
2865
|
**Example**
|
|
2501
2866
|
```js
|
|
2502
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2503
2867
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2504
2868
|
email: 'myemail@company.com'
|
|
2869
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2870
|
+
const api = new API();
|
|
2871
|
+
const params = {
|
|
2872
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2873
|
+
email: 'myemail@company.com'
|
|
2874
|
+
};
|
|
2875
|
+
const retData = await api.user.register.validateEmail(params);
|
|
2505
2876
|
```
|
|
2506
2877
|
<a name="Register+execute"></a>
|
|
2507
2878
|
|
|
@@ -2533,7 +2904,30 @@ Method to register a user
|
|
|
2533
2904
|
|
|
2534
2905
|
**Example**
|
|
2535
2906
|
```js
|
|
2536
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2537
2907
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2538
2908
|
"type": 'sign',
|
|
2539
2909
|
"login": false,
|
|
2540
2910
|
"emailInfo": {
|
|
2541
2911
|
"code": "5974",
|
|
2542
2912
|
"email": "cbtoto_1@mailinator.com"
|
|
2543
2913
|
},
|
|
2544
2914
|
"registerData": {
|
|
2545
2915
|
"name": "Augusto Totlo",
|
|
2546
2916
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2547
2917
|
"phone": "",
|
|
2548
2918
|
"idcard": "",
|
|
2549
2919
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2550
2920
|
"registerPassword": "123456",
|
|
2551
2921
|
"emailValidationCode": "5974",
|
|
2552
2922
|
"phoneValidationCode": "",
|
|
2553
2923
|
"language": "en-US",
|
|
2554
2924
|
"timezone": "Europe/Dublin"
|
|
2555
2925
|
}
|
|
2556
2926
|
};
|
|
2927
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2928
|
+
const api = new API();
|
|
2929
|
+
const params ={
|
|
2930
|
+
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2931
|
+
"type": 'sign',
|
|
2932
|
+
"login": false,
|
|
2933
|
+
"emailInfo": {
|
|
2934
|
+
"code": "5974",
|
|
2935
|
+
"email": "cbtoto_1@mailinator.com"
|
|
2936
|
+
},
|
|
2937
|
+
"registerData": {
|
|
2938
|
+
"name": "Augusto Totlo",
|
|
2939
|
+
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2940
|
+
"phone": "",
|
|
2941
|
+
"idcard": "",
|
|
2942
|
+
"dob": "1978-01-12T03:00:00.000Z",
|
|
2943
|
+
"registerPassword": "123456",
|
|
2944
|
+
"emailValidationCode": "5974",
|
|
2945
|
+
"phoneValidationCode": "",
|
|
2946
|
+
"language": "en-US",
|
|
2947
|
+
"timezone": "Europe/Dublin"
|
|
2948
|
+
}
|
|
2949
|
+
};
|
|
2950
|
+
const retData = await api.user.register.execute(params);
|
|
2557
2951
|
```
|
|
2558
2952
|
<a name="Settings"></a>
|
|
2559
2953
|
|
|
@@ -2563,7 +2957,13 @@ Adds/updates a user settings
|
|
|
2563
2957
|
|
|
2564
2958
|
**Example**
|
|
2565
2959
|
```js
|
|
2566
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2567
2960
|
areaId: '55e4a3bd6be6b45210833fae'
|
|
2961
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2962
|
+
const api = new API();
|
|
2963
|
+
const settings = {
|
|
2964
|
+
areaId: '55e4a3bd6be6b45210833fae'
|
|
2965
|
+
};
|
|
2966
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2967
|
+
await api.user.settings.upsert(settings, session);
|
|
2568
2968
|
```
|
|
2569
2969
|
<a name="Settings+get"></a>
|
|
2570
2970
|
|
|
@@ -2580,7 +2980,10 @@ Gets the user settings. Returns an array of settings.
|
|
|
2580
2980
|
|
|
2581
2981
|
**Example**
|
|
2582
2982
|
```js
|
|
2583
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2983
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2984
|
+
const api = new API();
|
|
2985
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2986
|
+
ret settings = await api.user.settings.get(session);
|
|
2584
2987
|
```
|
|
2585
2988
|
<a name="Settings+remove"></a>
|
|
2586
2989
|
|
|
@@ -2597,60 +3000,10 @@ Removes the user settings
|
|
|
2597
3000
|
|
|
2598
3001
|
**Example**
|
|
2599
3002
|
```js
|
|
2600
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2601
|
-
```
|
|
2602
|
-
<a name="TaskAvailable"></a>
|
|
2603
|
-
|
|
2604
|
-
## TaskAvailable
|
|
2605
|
-
Class for available tasks, permission user
|
|
2606
|
-
|
|
2607
|
-
**Kind**: global class
|
|
2608
|
-
|
|
2609
|
-
* [TaskAvailable](#TaskAvailable)
|
|
2610
|
-
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2611
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2612
|
-
|
|
2613
|
-
<a name="TaskAvailable+find"></a>
|
|
2614
|
-
|
|
2615
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2616
|
-
Method to find available tasks for a user
|
|
2617
|
-
|
|
2618
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2619
|
-
**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
|
|
2620
|
-
**Access**: public
|
|
2621
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2622
|
-
|
|
2623
|
-
| Param | Type | Description |
|
|
2624
|
-
| --- | --- | --- |
|
|
2625
|
-
| params | <code>object</code> | Params to get task |
|
|
2626
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
2627
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2628
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2629
|
-
|
|
2630
|
-
**Example**
|
|
2631
|
-
```js
|
|
2632
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2633
3003
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2634
3004
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2635
|
-
```
|
|
2636
|
-
<a name="TaskAvailable+claim"></a>
|
|
2637
|
-
|
|
2638
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2639
|
-
Method for a user to claim an available task
|
|
2640
|
-
|
|
2641
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2642
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2643
|
-
**Access**: public
|
|
2644
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2645
|
-
|
|
2646
|
-
| Param | Type | Description |
|
|
2647
|
-
| --- | --- | --- |
|
|
2648
|
-
| params | <code>object</code> | Params to get task |
|
|
2649
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2650
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2651
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2652
|
-
|
|
2653
|
-
**Example**
|
|
2654
|
-
```js
|
|
2655
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2656
3005
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2657
3006
|
orgname: 'acme',
|
|
3007
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3008
|
+
const api = new API();
|
|
3009
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3010
|
+
await api.user.settings.remove(session);
|
|
2658
3011
|
```
|
|
2659
3012
|
<a name="Task"></a>
|
|
2660
3013
|
|
|
@@ -2683,7 +3036,15 @@ Method to find task by id
|
|
|
2683
3036
|
|
|
2684
3037
|
**Example**
|
|
2685
3038
|
```js
|
|
2686
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2687
3039
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2688
3040
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2689
3041
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
3042
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3043
|
+
const api = new API();
|
|
3044
|
+
const params = {
|
|
3045
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
3046
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
3047
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
3048
|
+
};
|
|
3049
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3050
|
+
await api.user.task.findById(params, session);
|
|
2690
3051
|
```
|
|
2691
3052
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2692
3053
|
|
|
@@ -2709,7 +3070,17 @@ Find task by id and update
|
|
|
2709
3070
|
|
|
2710
3071
|
**Example**
|
|
2711
3072
|
```js
|
|
2712
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2713
3073
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2714
3074
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2715
3075
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2716
3076
|
action: 1,
|
|
2717
3077
|
formData: {name: 'CloudBrasil'},
|
|
3078
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3079
|
+
const api = new API();
|
|
3080
|
+
const params = {
|
|
3081
|
+
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
3082
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
3083
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
3084
|
+
action: 1,
|
|
3085
|
+
formData: {name: 'CloudBrasil'},
|
|
3086
|
+
};
|
|
3087
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3088
|
+
await api.user.task.findByIdAndUpdate(params, session);
|
|
2718
3089
|
```
|
|
2719
3090
|
<a name="Task+executeActionFinalize"></a>
|
|
2720
3091
|
|
|
@@ -2731,22 +3102,98 @@ Find task by id and update
|
|
|
2731
3102
|
|
|
2732
3103
|
**Example**
|
|
2733
3104
|
```js
|
|
2734
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2735
3105
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2736
3106
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2737
3107
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2738
3108
|
payload: {}',
|
|
3109
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3110
|
+
const api = new API();
|
|
3111
|
+
const params = {
|
|
3112
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
3113
|
+
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
3114
|
+
orgId: '5df7f19618430c89a41a1bc3',
|
|
3115
|
+
payload: {}',
|
|
3116
|
+
};
|
|
3117
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3118
|
+
await api.user.task.executeActionFinalize(params, session);
|
|
2739
3119
|
```
|
|
2740
|
-
<a name="
|
|
3120
|
+
<a name="TaskAvailable"></a>
|
|
2741
3121
|
|
|
2742
|
-
##
|
|
2743
|
-
Class for
|
|
3122
|
+
## TaskAvailable
|
|
3123
|
+
Class for available tasks, permission user
|
|
2744
3124
|
|
|
2745
3125
|
**Kind**: global class
|
|
2746
|
-
<a name="Updates+get"></a>
|
|
2747
3126
|
|
|
2748
|
-
|
|
2749
|
-
|
|
3127
|
+
* [TaskAvailable](#TaskAvailable)
|
|
3128
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
3129
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2750
3130
|
|
|
2751
|
-
|
|
3131
|
+
<a name="TaskAvailable+find"></a>
|
|
3132
|
+
|
|
3133
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
3134
|
+
Method to find available tasks for a user
|
|
3135
|
+
|
|
3136
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3137
|
+
**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
|
|
2752
3138
|
**Access**: public
|
|
2753
|
-
**Author**:
|
|
3139
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3140
|
+
|
|
3141
|
+
| Param | Type | Description |
|
|
3142
|
+
| --- | --- | --- |
|
|
3143
|
+
| params | <code>object</code> | Params to get task |
|
|
3144
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
3145
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
3146
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3147
|
+
|
|
3148
|
+
**Example**
|
|
3149
|
+
```js
|
|
3150
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3151
|
+
const api = new API();
|
|
3152
|
+
const params = {
|
|
3153
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
3154
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
3155
|
+
};
|
|
3156
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3157
|
+
const retSearch = await api.user.task.available.find(params, session);
|
|
3158
|
+
```
|
|
3159
|
+
<a name="TaskAvailable+claim"></a>
|
|
3160
|
+
|
|
3161
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
3162
|
+
Method for a user to claim an available task
|
|
3163
|
+
|
|
3164
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
3165
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
3166
|
+
**Access**: public
|
|
3167
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3168
|
+
|
|
3169
|
+
| Param | Type | Description |
|
|
3170
|
+
| --- | --- | --- |
|
|
3171
|
+
| params | <code>object</code> | Params to get task |
|
|
3172
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
3173
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
3174
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3175
|
+
|
|
3176
|
+
**Example**
|
|
3177
|
+
```js
|
|
3178
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3179
|
+
const api = new API();
|
|
3180
|
+
const params = {
|
|
3181
|
+
taskId: '55e4a3bd6be6b45210833f67',
|
|
3182
|
+
orgname: 'acme',
|
|
3183
|
+
};
|
|
3184
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3185
|
+
const success = await api.user.task.available.claim(params, session);
|
|
3186
|
+
```
|
|
3187
|
+
<a name="Updates"></a>
|
|
3188
|
+
|
|
3189
|
+
## Updates
|
|
3190
|
+
Class for user registration in a user
|
|
3191
|
+
|
|
3192
|
+
**Kind**: global class
|
|
3193
|
+
<a name="Updates+get"></a>
|
|
3194
|
+
|
|
3195
|
+
### updates.get(session)
|
|
3196
|
+
get updates
|
|
3197
|
+
|
|
3198
|
+
**Kind**: instance method of [<code>Updates</code>](#Updates)
|
|
3199
|
+
**Access**: public
|
|
3200
|
+
**Author**: Augusto Pissarra <abernardo.br@gmail.com>
|
|
2754
3201
|
|
|
2755
3202
|
| Param | Type | Description |
|
|
2756
3203
|
| --- | --- | --- |
|
|
@@ -2754,7 +3201,10 @@ get updates
|
|
|
2754
3201
|
|
|
2755
3202
|
**Example**
|
|
2756
3203
|
```js
|
|
2757
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3204
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3205
|
+
const api = new API();
|
|
3206
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3207
|
+
await api.user.updates.get(session);
|
|
2758
3208
|
```
|
|
2759
3209
|
<a name="User"></a>
|
|
2760
3210
|
|
|
@@ -2789,7 +3239,14 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2789
3239
|
|
|
2790
3240
|
**Example**
|
|
2791
3241
|
```js
|
|
2792
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2793
3242
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2794
3243
|
type: '123456',
|
|
3244
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3245
|
+
const api = new API();
|
|
3246
|
+
const params = {
|
|
3247
|
+
avatar: '55e4a3bd6be6b45210833fae',
|
|
3248
|
+
type: '123456',
|
|
3249
|
+
};
|
|
3250
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3251
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2795
3252
|
```
|
|
2796
3253
|
<a name="User+removeAvatar"></a>
|
|
2797
3254
|
|
|
@@ -2806,7 +3263,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2806
3263
|
|
|
2807
3264
|
**Example**
|
|
2808
3265
|
```js
|
|
2809
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3266
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3267
|
+
const api = new API();
|
|
3268
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3269
|
+
await api.user.profile.removeAvatar(session);
|
|
2810
3270
|
```
|
|
2811
3271
|
<a name="User+removeSignature"></a>
|
|
2812
3272
|
|
|
@@ -2823,7 +3283,10 @@ Remove the signature of user by session
|
|
|
2823
3283
|
|
|
2824
3284
|
**Example**
|
|
2825
3285
|
```js
|
|
2826
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3286
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3287
|
+
const api = new API();
|
|
3288
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3289
|
+
await api.user.profile.removeSignature(session);
|
|
2827
3290
|
```
|
|
2828
3291
|
<a name="User+saveSignature"></a>
|
|
2829
3292
|
|
|
@@ -2843,7 +3306,23 @@ Sava a new signature of user by session
|
|
|
2843
3306
|
|
|
2844
3307
|
**Example**
|
|
2845
3308
|
```js
|
|
2846
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2847
3309
|
type: 'CURSIVE',
|
|
2848
3310
|
file: 'allura:Mary John Heart'
|
|
2849
3311
|
type: 'HANDWRITE',
|
|
2850
3312
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3313
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3314
|
+
const api = new API();
|
|
3315
|
+
const data = {
|
|
3316
|
+
type: 'CURSIVE',
|
|
3317
|
+
file: 'allura:Mary John Heart'
|
|
3318
|
+
};
|
|
3319
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3320
|
+
await api.user.profile.saveSignature(data, session);
|
|
3321
|
+
|
|
3322
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3323
|
+
const api = new API();
|
|
3324
|
+
const data = {
|
|
3325
|
+
type: 'HANDWRITE',
|
|
3326
|
+
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
3327
|
+
};
|
|
3328
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3329
|
+
await api.user.profile.saveSignature(session);
|
|
2851
3330
|
```
|
|
2852
3331
|
<a name="User+findByIdAndUpdate"></a>
|
|
2853
3332
|
|
|
@@ -2877,7 +3356,13 @@ Update a user profile by id
|
|
|
2877
3356
|
|
|
2878
3357
|
**Example**
|
|
2879
3358
|
```js
|
|
2880
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2881
3359
|
name: 'New Name'
|
|
3360
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3361
|
+
const api = new API();
|
|
3362
|
+
const params = {
|
|
3363
|
+
name: 'New Name'
|
|
3364
|
+
};
|
|
3365
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3366
|
+
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2882
3367
|
```
|
|
2883
3368
|
<a name="User+changeOrganization"></a>
|
|
2884
3369
|
|
|
@@ -2895,5 +3380,379 @@ Change a user's organization
|
|
|
2895
3380
|
|
|
2896
3381
|
**Example**
|
|
2897
3382
|
```js
|
|
2898
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
3383
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3384
|
+
const api = new API();
|
|
3385
|
+
const id = '616eccaaa9360a05293b10fe';
|
|
3386
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3387
|
+
await api.user.changeOrganization.updateAvatar(id, session);
|
|
3388
|
+
```
|
|
3389
|
+
<a name="Dispatch"></a>
|
|
3390
|
+
|
|
3391
|
+
## Dispatch
|
|
3392
|
+
Api dispatch manager
|
|
3393
|
+
|
|
3394
|
+
**Kind**: global class
|
|
3395
|
+
|
|
3396
|
+
* [Dispatch](#Dispatch)
|
|
3397
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
3398
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
3399
|
+
|
|
3400
|
+
<a name="Dispatch+getContext"></a>
|
|
3401
|
+
|
|
3402
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
3403
|
+
Get the URL context
|
|
3404
|
+
|
|
3405
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3406
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
3407
|
+
**Access**: public
|
|
3408
|
+
|
|
3409
|
+
| Param | Type | Default | Description |
|
|
3410
|
+
| --- | --- | --- | --- |
|
|
3411
|
+
| url | <code>string</code> | | Full url |
|
|
3412
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
3413
|
+
|
|
3414
|
+
**Example**
|
|
3415
|
+
```js
|
|
3416
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3417
|
+
const api = new API();
|
|
3418
|
+
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
3419
|
+
```
|
|
3420
|
+
<a name="Dispatch+getClient"></a>
|
|
3421
|
+
|
|
3422
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
3423
|
+
Get client Axios
|
|
3424
|
+
|
|
3425
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3426
|
+
**Returns**: <code>promise</code> - return client axios
|
|
3427
|
+
**Access**: public
|
|
3428
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3429
|
+
**Example**
|
|
3430
|
+
```js
|
|
3431
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3432
|
+
const api = new API();
|
|
3433
|
+
await api.dispatch.getClient();
|
|
3434
|
+
```
|
|
3435
|
+
<a name="External"></a>
|
|
3436
|
+
|
|
3437
|
+
## External
|
|
3438
|
+
Class for documents, permission user
|
|
3439
|
+
|
|
3440
|
+
**Kind**: global class
|
|
3441
|
+
|
|
3442
|
+
* [External](#External)
|
|
3443
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3444
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3445
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3446
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3447
|
+
|
|
3448
|
+
<a name="External+context"></a>
|
|
3449
|
+
|
|
3450
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3451
|
+
Create new document
|
|
3452
|
+
|
|
3453
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3454
|
+
**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
|
|
3455
|
+
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3456
|
+
**Access**: public
|
|
3457
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3458
|
+
|
|
3459
|
+
| Param | Type | Description |
|
|
3460
|
+
| --- | --- | --- |
|
|
3461
|
+
| params | <code>object</code> | Object for add new document |
|
|
3462
|
+
| params.id | <code>string</code> | Organization form id |
|
|
3463
|
+
|
|
3464
|
+
**Example**
|
|
3465
|
+
```js
|
|
3466
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3467
|
+
const api = new API();
|
|
3468
|
+
const params = {
|
|
3469
|
+
id: '611e679741cc63168c26d7ee'
|
|
3470
|
+
};
|
|
3471
|
+
const retForm = await api.external.context(params);
|
|
3472
|
+
```
|
|
3473
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3474
|
+
|
|
3475
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3476
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3477
|
+
|
|
3478
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3479
|
+
**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
|
|
3480
|
+
**Access**: public
|
|
3481
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3482
|
+
|
|
3483
|
+
| Param | Type | Description |
|
|
3484
|
+
| --- | --- | --- |
|
|
3485
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
3486
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3487
|
+
|
|
3488
|
+
**Example**
|
|
3489
|
+
```js
|
|
3490
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3491
|
+
const api = new API();
|
|
3492
|
+
const authorization = '...';
|
|
3493
|
+
const doc = {
|
|
3494
|
+
mime: 'application/pdf'
|
|
3495
|
+
};
|
|
3496
|
+
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3497
|
+
```
|
|
3498
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3499
|
+
|
|
3500
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3501
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3502
|
+
|
|
3503
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3504
|
+
**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
|
|
3505
|
+
**Access**: public
|
|
3506
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3507
|
+
|
|
3508
|
+
| Param | Type | Description |
|
|
3509
|
+
| --- | --- | --- |
|
|
3510
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
3511
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3512
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3513
|
+
|
|
3514
|
+
**Example**
|
|
3515
|
+
```js
|
|
3516
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3517
|
+
const api = new API();
|
|
3518
|
+
const authorization = '...';
|
|
3519
|
+
const docs = [
|
|
3520
|
+
{
|
|
3521
|
+
mime: 'application/pdf'
|
|
3522
|
+
}
|
|
3523
|
+
];
|
|
3524
|
+
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3525
|
+
```
|
|
3526
|
+
<a name="External+handle"></a>
|
|
3527
|
+
|
|
3528
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3529
|
+
Handles the execution of an external form
|
|
3530
|
+
|
|
3531
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3532
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3533
|
+
**Access**: public
|
|
3534
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3535
|
+
|
|
3536
|
+
| Param | Type | Description |
|
|
3537
|
+
| --- | --- | --- |
|
|
3538
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3539
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3540
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3541
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
3542
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3543
|
+
| 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 |
|
|
3544
|
+
|
|
3545
|
+
**Example**
|
|
3546
|
+
```js
|
|
3547
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3548
|
+
const api = new API();
|
|
3549
|
+
const authorization = '...';
|
|
3550
|
+
const params = {
|
|
3551
|
+
payload: [
|
|
3552
|
+
{
|
|
3553
|
+
name: 'My Group One',
|
|
3554
|
+
fields: [
|
|
3555
|
+
{}
|
|
3556
|
+
]
|
|
3557
|
+
}
|
|
3558
|
+
]
|
|
3559
|
+
};
|
|
3560
|
+
const success = await api.external.handle(params, authorization);
|
|
3561
|
+
```
|
|
3562
|
+
<a name="Login"></a>
|
|
3563
|
+
|
|
3564
|
+
## Login
|
|
3565
|
+
Login manager
|
|
3566
|
+
|
|
3567
|
+
**Kind**: global class
|
|
3568
|
+
|
|
3569
|
+
* [Login](#Login)
|
|
3570
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3571
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3572
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3573
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3574
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3575
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3576
|
+
|
|
3577
|
+
<a name="Login+facebook"></a>
|
|
3578
|
+
|
|
3579
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3580
|
+
Login with social login Facebook
|
|
3581
|
+
|
|
3582
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3583
|
+
**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
|
|
3584
|
+
**Access**: public
|
|
3585
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3586
|
+
|
|
3587
|
+
| Param | Type | Description |
|
|
3588
|
+
| --- | --- | --- |
|
|
3589
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
3590
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3591
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3592
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3593
|
+
|
|
3594
|
+
**Example**
|
|
3595
|
+
```js
|
|
3596
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3597
|
+
|
|
3598
|
+
// Params of the instance
|
|
3599
|
+
const params = {...}
|
|
3600
|
+
const api = new API(params);
|
|
3601
|
+
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3602
|
+
const { auth, user } = await api.login.facebook(params);
|
|
3603
|
+
```
|
|
3604
|
+
<a name="Login+google"></a>
|
|
3605
|
+
|
|
3606
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3607
|
+
Login with social login Google
|
|
3608
|
+
|
|
3609
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3610
|
+
**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
|
|
3611
|
+
**Access**: public
|
|
3612
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3613
|
+
|
|
3614
|
+
| Param | Type | Description |
|
|
3615
|
+
| --- | --- | --- |
|
|
3616
|
+
| params | <code>object</code> | Params to login Google |
|
|
3617
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3618
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3619
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3620
|
+
|
|
3621
|
+
**Example**
|
|
3622
|
+
```js
|
|
3623
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3624
|
+
|
|
3625
|
+
// Params of the instance
|
|
3626
|
+
const params = {...}
|
|
3627
|
+
const api = new API(params);
|
|
3628
|
+
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3629
|
+
const { auth, user } = await api.login.google(accessToken);
|
|
3630
|
+
```
|
|
3631
|
+
<a name="Login+apiKey"></a>
|
|
3632
|
+
|
|
3633
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3634
|
+
Login with apikey
|
|
3635
|
+
|
|
3636
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3637
|
+
**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
|
|
3638
|
+
**Access**: public
|
|
3639
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3640
|
+
|
|
3641
|
+
| Param | Type | Description |
|
|
3642
|
+
| --- | --- | --- |
|
|
3643
|
+
| apikey | <code>string</code> | Access key |
|
|
3644
|
+
|
|
3645
|
+
**Example**
|
|
3646
|
+
```js
|
|
3647
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3648
|
+
|
|
3649
|
+
// Params of the instance
|
|
3650
|
+
const params = {...}
|
|
3651
|
+
const api = new API(params);
|
|
3652
|
+
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3653
|
+
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3654
|
+
```
|
|
3655
|
+
<a name="Login+userPass"></a>
|
|
3656
|
+
|
|
3657
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3658
|
+
Login with user and password
|
|
3659
|
+
|
|
3660
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3661
|
+
**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
|
|
3662
|
+
**Access**: public
|
|
3663
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3664
|
+
|
|
3665
|
+
| Param | Type | Description |
|
|
3666
|
+
| --- | --- | --- |
|
|
3667
|
+
| params | <code>object</code> | Object with user and password |
|
|
3668
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
3669
|
+
| params.password | <code>string</code> | Password of the user |
|
|
3670
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
3671
|
+
|
|
3672
|
+
**Example**
|
|
3673
|
+
```js
|
|
3674
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3675
|
+
|
|
3676
|
+
// Params of the instance
|
|
3677
|
+
const params = {...}
|
|
3678
|
+
const api = new API(params);
|
|
3679
|
+
const params = {
|
|
3680
|
+
username: 'ana.silva@gmail.com',
|
|
3681
|
+
password: '123456'
|
|
3682
|
+
};
|
|
3683
|
+
const { auth, user } = await api.login.userPass(params);
|
|
3684
|
+
```
|
|
3685
|
+
<a name="Login+logout"></a>
|
|
3686
|
+
|
|
3687
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3688
|
+
Logout user system manager
|
|
3689
|
+
|
|
3690
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3691
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3692
|
+
**Access**: public
|
|
3693
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3694
|
+
|
|
3695
|
+
| Param | Type | Description |
|
|
3696
|
+
| --- | --- | --- |
|
|
3697
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3698
|
+
|
|
3699
|
+
**Example**
|
|
3700
|
+
```js
|
|
3701
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3702
|
+
|
|
3703
|
+
// Params of the instance
|
|
3704
|
+
const params = {...}
|
|
3705
|
+
const api = new API(params);
|
|
3706
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3707
|
+
const { success } = await api.login.logout(session);
|
|
3708
|
+
```
|
|
3709
|
+
<a name="Login+recover"></a>
|
|
3710
|
+
|
|
3711
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3712
|
+
Recover the password
|
|
3713
|
+
|
|
3714
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3715
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3716
|
+
**Access**: public
|
|
3717
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3718
|
+
|
|
3719
|
+
| Param | Type | Description |
|
|
3720
|
+
| --- | --- | --- |
|
|
3721
|
+
| username | <code>string</code> | The username or email |
|
|
3722
|
+
|
|
3723
|
+
**Example**
|
|
3724
|
+
```js
|
|
3725
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3726
|
+
|
|
3727
|
+
// Params of the instance
|
|
3728
|
+
const params = {...}
|
|
3729
|
+
const api = new API(params);
|
|
3730
|
+
const { success } = await api.login.recover('myusername');
|
|
3731
|
+
```
|
|
3732
|
+
<a name="Session"></a>
|
|
3733
|
+
|
|
3734
|
+
## Session
|
|
3735
|
+
Session manager of the API
|
|
3736
|
+
|
|
3737
|
+
**Kind**: global class
|
|
3738
|
+
<a name="Session+information"></a>
|
|
3739
|
+
|
|
3740
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3741
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
3742
|
+
|
|
3743
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3744
|
+
**Access**: public
|
|
3745
|
+
|
|
3746
|
+
| Param | Type | Default | Description |
|
|
3747
|
+
| --- | --- | --- | --- |
|
|
3748
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3749
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3750
|
+
|
|
3751
|
+
**Example**
|
|
3752
|
+
```js
|
|
3753
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3754
|
+
const api = new API();
|
|
3755
|
+
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3756
|
+
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3757
|
+
await api.session.information(sessionId, suSessionId);
|
|
2899
3758
|
```
|