@docbrasil/api-systemmanager 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/user/document.js +73 -11
- package/dist/bundle.cjs +8 -10
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +1229 -499
- package/docs/Admin.html +1 -1
- package/docs/AdminDocuments.html +1 -1
- package/docs/AdminForm.html +1 -1
- package/docs/AdminLists.html +1 -1
- package/docs/AdminMessage.html +1 -1
- package/docs/AdminNotification.html +1 -1
- package/docs/AdminPlugin.html +1 -1
- package/docs/AdminPolicy.html +1 -1
- package/docs/AdminProcesses.html +1 -1
- package/docs/AdminTask.html +1 -1
- package/docs/AdminUser.html +1 -1
- package/docs/Application.html +3 -3
- package/docs/Datasource.html +1 -1
- package/docs/Dispatch.html +1 -1
- package/docs/Documents.html +10 -10
- package/docs/External.html +1 -1
- package/docs/GeoLocation.html +1 -1
- package/docs/Help.html +1 -1
- package/docs/Login.html +1 -1
- package/docs/MyTasks.html +603 -0
- package/docs/Notification.html +1 -1
- package/docs/Organization.html +1 -1
- package/docs/Page.html +1 -1
- package/docs/Process.html +1 -1
- package/docs/Register.html +1 -1
- package/docs/Session.html +1 -1
- package/docs/Task.html +5 -5
- package/docs/TaskAvailable.html +1 -1
- package/docs/Updates.html +1 -1
- package/docs/User.html +1 -1
- package/docs/Users.html +1 -1
- package/docs/admin_doctypes.js.html +1 -1
- package/docs/admin_document.js.html +1 -1
- package/docs/admin_form.js.html +1 -1
- package/docs/admin_index.js.html +1 -1
- package/docs/admin_list.js.html +1 -1
- package/docs/admin_message.js.html +1 -1
- package/docs/admin_notification.js.html +1 -1
- package/docs/admin_organization.js.html +1 -1
- package/docs/admin_plugin.js.html +1 -1
- package/docs/admin_policy.js.html +1 -1
- package/docs/admin_processes.js.html +1 -1
- package/docs/admin_task.js.html +1 -1
- package/docs/admin_user.js.html +1 -1
- package/docs/dispatch.js.html +1 -1
- package/docs/external.js.html +1 -1
- package/docs/general_geoLocation.js.html +1 -1
- package/docs/general_index.js.html +1 -1
- package/docs/index.html +1 -1
- package/docs/login.js.html +1 -1
- package/docs/session.js.html +1 -1
- package/docs/user_application.js.html +3 -1
- package/docs/user_datasource.js.html +1 -1
- package/docs/user_document.js.html +9 -11
- package/docs/user_help.js.html +1 -1
- package/docs/user_index.js.html +2 -2
- package/docs/user_my_tasks.js.html +212 -0
- package/docs/user_notification.js.html +1 -1
- package/docs/user_organization.js.html +1 -1
- package/docs/user_page.js.html +1 -1
- package/docs/user_process.js.html +1 -1
- package/docs/user_register.js.html +1 -1
- package/docs/user_task.js.html +3 -1
- package/docs/user_task_available.js.html +1 -1
- package/docs/user_updates.js.html +1 -1
- package/docs/user_user.js.html +1 -1
- package/docs/utils_promises.js.html +1 -1
- package/package.json +1 -1
- package/tests/documents_002.spec.js +107 -0
- 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>
|
|
@@ -88,18 +76,30 @@
|
|
|
88
76
|
<dt><a href="#Register">Register</a></dt>
|
|
89
77
|
<dd><p>Class for user registration in a user</p>
|
|
90
78
|
</dd>
|
|
91
|
-
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
92
|
-
<dd><p>Class for available tasks, permission user</p>
|
|
93
|
-
</dd>
|
|
94
79
|
<dt><a href="#Task">Task</a></dt>
|
|
95
80
|
<dd><p>Class for task, permission user</p>
|
|
96
81
|
</dd>
|
|
82
|
+
<dt><a href="#TaskAvailable">TaskAvailable</a></dt>
|
|
83
|
+
<dd><p>Class for available tasks, permission user</p>
|
|
84
|
+
</dd>
|
|
97
85
|
<dt><a href="#Updates">Updates</a></dt>
|
|
98
86
|
<dd><p>Class for user registration in a user</p>
|
|
99
87
|
</dd>
|
|
100
88
|
<dt><a href="#User">User</a></dt>
|
|
101
89
|
<dd><p>Class for user, permission user</p>
|
|
102
90
|
</dd>
|
|
91
|
+
<dt><a href="#Dispatch">Dispatch</a></dt>
|
|
92
|
+
<dd><p>Api dispatch manager</p>
|
|
93
|
+
</dd>
|
|
94
|
+
<dt><a href="#External">External</a></dt>
|
|
95
|
+
<dd><p>Class for documents, permission user</p>
|
|
96
|
+
</dd>
|
|
97
|
+
<dt><a href="#Login">Login</a></dt>
|
|
98
|
+
<dd><p>Login manager</p>
|
|
99
|
+
</dd>
|
|
100
|
+
<dt><a href="#Session">Session</a></dt>
|
|
101
|
+
<dd><p>Session manager of the API</p>
|
|
102
|
+
</dd>
|
|
103
103
|
</dl>
|
|
104
104
|
|
|
105
105
|
<a name="AdminDocuments"></a>
|
|
@@ -135,7 +135,33 @@ Advanced search of document in elastic search ussing system manager
|
|
|
135
135
|
|
|
136
136
|
**Example**
|
|
137
137
|
```js
|
|
138
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
139
138
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
140
139
|
query: {
|
|
141
140
|
"query": {
|
|
142
141
|
"bool": {
|
|
143
142
|
"minimum_should_match": 1,
|
|
144
143
|
"should": [
|
|
145
144
|
{
|
|
146
145
|
"match": {
|
|
147
146
|
"locationText.keyword": {
|
|
148
147
|
"query": "sao pau"
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
},
|
|
152
151
|
{
|
|
153
152
|
"wildcard": {
|
|
154
153
|
"locationText.normalized": "*sao pau*"
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
156
|
]
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
}
|
|
160
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
161
|
+
const api = new API();
|
|
162
|
+
const params = {
|
|
163
|
+
docId: '5edd11c46b6ce9729c2c297c',
|
|
164
|
+
query: {
|
|
165
|
+
"query": {
|
|
166
|
+
"bool": {
|
|
167
|
+
"minimum_should_match": 1,
|
|
168
|
+
"should": [
|
|
169
|
+
{
|
|
170
|
+
"match": {
|
|
171
|
+
"locationText.keyword": {
|
|
172
|
+
"query": "sao pau"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"wildcard": {
|
|
178
|
+
"locationText.normalized": "*sao pau*"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
186
|
+
await api.admin.document.advancedSearch(params, session);
|
|
161
187
|
```
|
|
162
188
|
<a name="AdminDocuments+findById"></a>
|
|
163
189
|
|
|
@@ -155,7 +181,14 @@ Get document by id
|
|
|
155
181
|
|
|
156
182
|
**Example**
|
|
157
183
|
```js
|
|
158
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
159
184
|
docId: '5edd11c46b6ce9729c2c297c',
|
|
160
185
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
186
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
187
|
+
const api = new API();
|
|
188
|
+
const params = {
|
|
189
|
+
docId: '5edd11c46b6ce9729c2c297c',
|
|
190
|
+
orgId: '55e4a3bd6be6b45210833fae'
|
|
191
|
+
};
|
|
192
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
193
|
+
await api.admin.document.findById(params, session);
|
|
161
194
|
```
|
|
162
195
|
<a name="AdminDocuments+signedUrl"></a>
|
|
163
196
|
|
|
@@ -176,11 +209,25 @@ Request signed url url to put or get
|
|
|
176
209
|
|
|
177
210
|
**Example**
|
|
178
211
|
```js
|
|
179
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
180
212
|
methodType: 'put',
|
|
181
213
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
214
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
215
|
+
const api = new API();
|
|
216
|
+
const params - {
|
|
217
|
+
methodType: 'put',
|
|
218
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
219
|
+
};
|
|
220
|
+
const apiKey: '...';
|
|
221
|
+
const { docId, name, areaId, type, signedUrl } = await api.admin.document.signedUrl(params, apiKey);
|
|
182
222
|
```
|
|
183
223
|
**Example**
|
|
184
224
|
```js
|
|
185
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
186
225
|
methodType: 'get',
|
|
187
226
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
227
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
228
|
+
const api = new API();
|
|
229
|
+
const params - {
|
|
230
|
+
methodType: 'get',
|
|
231
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
232
|
+
};
|
|
233
|
+
const apiKey: '...';
|
|
234
|
+
const { signedUrl, imageType } = await api.admin.document.signedUrl(params, apiKey);
|
|
188
235
|
```
|
|
189
236
|
<a name="AdminDocuments+updateContent"></a>
|
|
190
237
|
|
|
@@ -201,7 +248,14 @@ Update a document content
|
|
|
201
248
|
|
|
202
249
|
**Example**
|
|
203
250
|
```js
|
|
204
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
205
251
|
content: 'some text...',
|
|
206
252
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
253
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
254
|
+
const api = new API();
|
|
255
|
+
const params - {
|
|
256
|
+
content: 'some text...',
|
|
257
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
258
|
+
};
|
|
259
|
+
const apiKey: '...';
|
|
260
|
+
await api.admin.document.updateContent(params, apiKey);
|
|
207
261
|
```
|
|
208
262
|
<a name="AdminDocuments+updateAI"></a>
|
|
209
263
|
|
|
@@ -228,7 +282,14 @@ Update a document content
|
|
|
228
282
|
|
|
229
283
|
**Example**
|
|
230
284
|
```js
|
|
231
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
232
285
|
content: 'some text...',
|
|
233
286
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
287
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
288
|
+
const api = new API();
|
|
289
|
+
const params - {
|
|
290
|
+
content: 'some text...',
|
|
291
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
292
|
+
};
|
|
293
|
+
const apiKey: '...';
|
|
294
|
+
await api.admin.document.updateContent(params, apiKey);
|
|
234
295
|
```
|
|
235
296
|
<a name="AdminDocuments+getContent"></a>
|
|
236
297
|
|
|
@@ -249,7 +310,14 @@ Get the content of a document
|
|
|
249
310
|
|
|
250
311
|
**Example**
|
|
251
312
|
```js
|
|
252
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
253
313
|
page: '0',
|
|
254
314
|
docId: '5dadd01dc4af3941d42f8c5c'
|
|
315
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
316
|
+
const api = new API();
|
|
317
|
+
const params - {
|
|
318
|
+
page: '0',
|
|
319
|
+
docId: '5dadd01dc4af3941d42f8c5c'
|
|
320
|
+
};
|
|
321
|
+
const apiKey: '...';
|
|
322
|
+
await api.admin.document.getContent(params, apiKey);
|
|
255
323
|
```
|
|
256
324
|
<a name="AdminForm"></a>
|
|
257
325
|
|
|
@@ -280,7 +348,14 @@ Get advance form by ID
|
|
|
280
348
|
|
|
281
349
|
**Example**
|
|
282
350
|
```js
|
|
283
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
284
351
|
id: '55e4a3bd6be6b45210833fae',
|
|
285
352
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
353
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
354
|
+
const api = new API();
|
|
355
|
+
const params = {
|
|
356
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
357
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
358
|
+
};
|
|
359
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
360
|
+
await api.admin.form.findById(params, session);
|
|
286
361
|
```
|
|
287
362
|
<a name="AdminForm+getFormList"></a>
|
|
288
363
|
|
|
@@ -304,7 +379,13 @@ Request signed url url to put or get
|
|
|
304
379
|
|
|
305
380
|
**Example**
|
|
306
381
|
```js
|
|
307
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
308
382
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
383
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
384
|
+
const api = new API();
|
|
385
|
+
const params - {
|
|
386
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
387
|
+
};
|
|
388
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
389
|
+
await api.user.form.getFormList(params, session);
|
|
309
390
|
```
|
|
310
391
|
<a name="Admin"></a>
|
|
311
392
|
|
|
@@ -351,7 +432,14 @@ Get list by ID
|
|
|
351
432
|
|
|
352
433
|
**Example**
|
|
353
434
|
```js
|
|
354
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
355
435
|
id: '55e4a3bd6be6b45210833fae',
|
|
356
436
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
437
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
438
|
+
const api = new API();
|
|
439
|
+
const params = {
|
|
440
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
441
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
442
|
+
};
|
|
443
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
444
|
+
await api.admin.list.findById(params, session);
|
|
357
445
|
```
|
|
358
446
|
<a name="AdminLists+find"></a>
|
|
359
447
|
|
|
@@ -372,7 +460,13 @@ Get all lists
|
|
|
372
460
|
|
|
373
461
|
**Example**
|
|
374
462
|
```js
|
|
375
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
376
463
|
orgId: '55e4a3bd6be6b45210833fae'
|
|
464
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
465
|
+
const api = new API();
|
|
466
|
+
const params = {
|
|
467
|
+
orgId: '55e4a3bd6be6b45210833fae'
|
|
468
|
+
};
|
|
469
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
470
|
+
await api.admin.list.find(params, session);
|
|
377
471
|
```
|
|
378
472
|
<a name="AdminMessage"></a>
|
|
379
473
|
|
|
@@ -450,7 +544,15 @@ Send email, array with email list or send one email
|
|
|
450
544
|
|
|
451
545
|
**Example**
|
|
452
546
|
```js
|
|
453
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
454
547
|
subject: 'Test email',
|
|
455
548
|
message: '<h1>Hi!</h1>',
|
|
456
549
|
to: 'destination@gmail.com'
|
|
550
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
551
|
+
const api = new API();
|
|
552
|
+
const params = {
|
|
553
|
+
subject: 'Test email',
|
|
554
|
+
message: '<h1>Hi!</h1>',
|
|
555
|
+
to: 'destination@gmail.com'
|
|
556
|
+
};
|
|
557
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
558
|
+
await api.admin.message.sendEmail(params, session);
|
|
457
559
|
```
|
|
458
560
|
<a name="AdminNotification"></a>
|
|
459
561
|
|
|
@@ -499,7 +601,15 @@ Create notification
|
|
|
499
601
|
|
|
500
602
|
**Example**
|
|
501
603
|
```js
|
|
502
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
503
604
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
504
605
|
userId: '55e4a3bd6be6b45210833fae',
|
|
505
606
|
message: 'Olá como vai tudo bem?'
|
|
607
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
608
|
+
const api = new API();
|
|
609
|
+
const params = {
|
|
610
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
611
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
612
|
+
message: 'Olá como vai tudo bem?'
|
|
613
|
+
};
|
|
614
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
615
|
+
await api.admin.notifications.add(params, session);
|
|
506
616
|
```
|
|
507
617
|
<a name="AdminNotification+findById"></a>
|
|
508
618
|
|
|
@@ -519,7 +629,14 @@ Search notification using (notificationId or userId)
|
|
|
519
629
|
|
|
520
630
|
**Example**
|
|
521
631
|
```js
|
|
522
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
523
632
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
524
633
|
id: '55e4a3bd6be6b45210833fae',
|
|
634
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
635
|
+
const api = new API();
|
|
636
|
+
const params = {
|
|
637
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
638
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
639
|
+
};
|
|
640
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
641
|
+
await api.admin.notifications.findById(params, session);
|
|
525
642
|
```
|
|
526
643
|
<a name="AdminNotification+findByIdAndUpdate"></a>
|
|
527
644
|
|
|
@@ -540,7 +657,15 @@ Update notification using (notificationId or userId)
|
|
|
540
657
|
|
|
541
658
|
**Example**
|
|
542
659
|
```js
|
|
543
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
544
660
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
545
661
|
id: '55e4a3bd6be6b45210833fae',
|
|
546
662
|
read: true
|
|
663
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
664
|
+
const api = new API();
|
|
665
|
+
const params = {
|
|
666
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
667
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
668
|
+
read: true
|
|
669
|
+
};
|
|
670
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
671
|
+
await api.admin.notifications.findByIdAndUpdate(params, session);
|
|
547
672
|
```
|
|
548
673
|
<a name="AdminNotification+findByIdAndRemove"></a>
|
|
549
674
|
|
|
@@ -560,7 +685,14 @@ Delete notification using (notificationId or userId)
|
|
|
560
685
|
|
|
561
686
|
**Example**
|
|
562
687
|
```js
|
|
563
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
564
688
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
565
689
|
id: '55e4a3bd6be6b45210833fae',
|
|
690
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
691
|
+
const api = new API();
|
|
692
|
+
const params = {
|
|
693
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
694
|
+
id: '55e4a3bd6be6b45210833fae',
|
|
695
|
+
};
|
|
696
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
697
|
+
await api.admin.notifications.findByIdAndDelete(params, session);
|
|
566
698
|
```
|
|
567
699
|
<a name="Organization"></a>
|
|
568
700
|
|
|
@@ -597,7 +729,15 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
597
729
|
|
|
598
730
|
**Example**
|
|
599
731
|
```js
|
|
600
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
601
732
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
602
733
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
603
734
|
type: 'image/png',
|
|
735
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
736
|
+
const api = new API();
|
|
737
|
+
const params = {
|
|
738
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
739
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
740
|
+
type: 'image/png',
|
|
741
|
+
};
|
|
742
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
743
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
604
744
|
```
|
|
605
745
|
<a name="Organization+removeAvatar"></a>
|
|
606
746
|
|
|
@@ -615,7 +755,11 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
615
755
|
|
|
616
756
|
**Example**
|
|
617
757
|
```js
|
|
618
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
758
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
759
|
+
const api = new API();
|
|
760
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
761
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
762
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
619
763
|
```
|
|
620
764
|
<a name="Organization+findById"></a>
|
|
621
765
|
|
|
@@ -633,7 +777,11 @@ Find organization by id
|
|
|
633
777
|
|
|
634
778
|
**Example**
|
|
635
779
|
```js
|
|
636
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
780
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
781
|
+
const api = new API();
|
|
782
|
+
const orgId = '80443245000122';
|
|
783
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
784
|
+
await api.user.organization.findById(idCard, session);
|
|
637
785
|
```
|
|
638
786
|
<a name="Organization+idCardExist"></a>
|
|
639
787
|
|
|
@@ -651,7 +799,11 @@ Check if id card exist
|
|
|
651
799
|
|
|
652
800
|
**Example**
|
|
653
801
|
```js
|
|
654
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
802
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
803
|
+
const api = new API();
|
|
804
|
+
const idCard = '80443245000122';
|
|
805
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
806
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
655
807
|
```
|
|
656
808
|
<a name="Organization+upsertAvatar"></a>
|
|
657
809
|
|
|
@@ -671,7 +823,14 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
671
823
|
|
|
672
824
|
**Example**
|
|
673
825
|
```js
|
|
674
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
675
826
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
676
827
|
type: 'image/png',
|
|
828
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
829
|
+
const api = new API();
|
|
830
|
+
const params = {
|
|
831
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
832
|
+
type: 'image/png',
|
|
833
|
+
};
|
|
834
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
835
|
+
await api.user.profile.updateAvatar(params, session);
|
|
677
836
|
```
|
|
678
837
|
<a name="Organization+removeAvatar"></a>
|
|
679
838
|
|
|
@@ -688,7 +847,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
688
847
|
|
|
689
848
|
**Example**
|
|
690
849
|
```js
|
|
691
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
850
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
851
|
+
const api = new API();
|
|
852
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
853
|
+
await api.user.profile.removeAvatar(session);
|
|
692
854
|
```
|
|
693
855
|
<a name="Organization+callFetch"></a>
|
|
694
856
|
|
|
@@ -708,7 +870,14 @@ Call URL internal, need auth JWT (session)
|
|
|
708
870
|
|
|
709
871
|
**Example**
|
|
710
872
|
```js
|
|
711
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
712
873
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
713
874
|
method: 'POST'
|
|
875
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
876
|
+
const api = new API();
|
|
877
|
+
|
|
878
|
+
const params = {
|
|
879
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
880
|
+
method: 'POST'
|
|
881
|
+
}
|
|
882
|
+
await api.user.organization.callFetchs(params, session);
|
|
714
883
|
```
|
|
715
884
|
<a name="AdminPlugin"></a>
|
|
716
885
|
|
|
@@ -738,7 +907,11 @@ Find plugins
|
|
|
738
907
|
|
|
739
908
|
**Example**
|
|
740
909
|
```js
|
|
741
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
910
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
911
|
+
const api = new API();
|
|
912
|
+
const params = {page: 1, perPage: 200};
|
|
913
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
914
|
+
await api.user.organization.findById(params, session);
|
|
742
915
|
```
|
|
743
916
|
<a name="AdminPlugin+findById"></a>
|
|
744
917
|
|
|
@@ -756,7 +929,11 @@ Get plugin by ID
|
|
|
756
929
|
|
|
757
930
|
**Example**
|
|
758
931
|
```js
|
|
759
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
932
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
933
|
+
const api = new API();
|
|
934
|
+
const id ='55e4a3bd6be6b45210833fae',
|
|
935
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
936
|
+
await api.admin.plugin.findById(id, session);
|
|
760
937
|
```
|
|
761
938
|
<a name="AdminPolicy"></a>
|
|
762
939
|
|
|
@@ -779,7 +956,10 @@ Find all policies
|
|
|
779
956
|
|
|
780
957
|
**Example**
|
|
781
958
|
```js
|
|
782
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
959
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
960
|
+
const api = new API();
|
|
961
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
962
|
+
await api.admin.policy.find(session);
|
|
783
963
|
```
|
|
784
964
|
<a name="AdminProcesses"></a>
|
|
785
965
|
|
|
@@ -803,7 +983,16 @@ Advanced search of processes, check documentation, to verify all params, pass to
|
|
|
803
983
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
804
984
|
**Example**
|
|
805
985
|
```js
|
|
806
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
807
986
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
808
987
|
...
|
|
809
988
|
...
|
|
810
989
|
...
|
|
990
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
991
|
+
const api = new API();
|
|
992
|
+
const params = {
|
|
993
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
994
|
+
...
|
|
995
|
+
...
|
|
996
|
+
...
|
|
997
|
+
};
|
|
998
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
999
|
+
await api.admin.processes.search(params, session);
|
|
811
1000
|
```
|
|
812
1001
|
<a name="AdminProcesses+advancedSearch"></a>
|
|
813
1002
|
|
|
@@ -823,7 +1012,23 @@ Advanced search of process in elastic search ussing system manager
|
|
|
823
1012
|
|
|
824
1013
|
**Example**
|
|
825
1014
|
```js
|
|
826
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
827
1015
|
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
828
1016
|
query: {
|
|
829
1017
|
"_source": "processData.properties.processProperties",
|
|
830
1018
|
"query": {
|
|
831
1019
|
"term": {
|
|
832
1020
|
"initParams.email.keyword": {
|
|
833
1021
|
"value": "clintes001@gmail.com"
|
|
834
1022
|
}
|
|
835
1023
|
}
|
|
836
1024
|
}
|
|
837
1025
|
}
|
|
1026
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1027
|
+
const api = new API();
|
|
1028
|
+
const params = {
|
|
1029
|
+
orgProcessId: '5edd11c46b6ce9729c2c297c',
|
|
1030
|
+
query: {
|
|
1031
|
+
"_source": "processData.properties.processProperties",
|
|
1032
|
+
"query": {
|
|
1033
|
+
"term": {
|
|
1034
|
+
"initParams.email.keyword": {
|
|
1035
|
+
"value": "clintes001@gmail.com"
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1042
|
+
await api.admin.processes.advancedSearch(params, session);
|
|
838
1043
|
```
|
|
839
1044
|
<a name="AdminTask"></a>
|
|
840
1045
|
|
|
@@ -854,7 +1059,13 @@ Get task by user Id
|
|
|
854
1059
|
|
|
855
1060
|
**Example**
|
|
856
1061
|
```js
|
|
857
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
858
1062
|
userId: '55e4a3bd6be6b45210833fae',
|
|
1063
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1064
|
+
const api = new API();
|
|
1065
|
+
const params = {
|
|
1066
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1067
|
+
};
|
|
1068
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1069
|
+
await api.admin.task.find(params, session);
|
|
859
1070
|
```
|
|
860
1071
|
<a name="AdminUser"></a>
|
|
861
1072
|
|
|
@@ -888,7 +1099,11 @@ Request profile by userId
|
|
|
888
1099
|
|
|
889
1100
|
**Example**
|
|
890
1101
|
```js
|
|
891
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1102
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1103
|
+
const api = new API();
|
|
1104
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1105
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1106
|
+
await api.admin.user.findById(userId, session);
|
|
892
1107
|
```
|
|
893
1108
|
<a name="AdminUser+findByIds"></a>
|
|
894
1109
|
|
|
@@ -906,7 +1121,11 @@ Request profile by userId
|
|
|
906
1121
|
|
|
907
1122
|
**Example**
|
|
908
1123
|
```js
|
|
909
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1124
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1125
|
+
const api = new API();
|
|
1126
|
+
const userIds = ['55e4a3bd6be6b45210833fae', '55e4a3bd6be6b45210833fae'];
|
|
1127
|
+
const apiKey = 'c9bbd652-d112-454e-8595-f1669f49dde0';
|
|
1128
|
+
await api.admin.user.findByIds(userIds, apiKey);
|
|
910
1129
|
```
|
|
911
1130
|
<a name="AdminUser+findByIdAndUpdatePassword"></a>
|
|
912
1131
|
|
|
@@ -927,7 +1146,15 @@ Update password by userId
|
|
|
927
1146
|
|
|
928
1147
|
**Example**
|
|
929
1148
|
```js
|
|
930
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
931
1149
|
userId: '55e4a3bd6be6b45210833fae',
|
|
932
1150
|
oldPassword: '123456',
|
|
933
1151
|
newPassword: '123456789'
|
|
1152
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1153
|
+
const api = new API();
|
|
1154
|
+
const params = {
|
|
1155
|
+
userId: '55e4a3bd6be6b45210833fae',
|
|
1156
|
+
oldPassword: '123456',
|
|
1157
|
+
newPassword: '123456789'
|
|
1158
|
+
};
|
|
1159
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1160
|
+
await api.admin.user.findByIdAndUpdatePassword(params, session);
|
|
934
1161
|
```
|
|
935
1162
|
<a name="AdminUser+emailExist"></a>
|
|
936
1163
|
|
|
@@ -945,7 +1172,11 @@ Check if email is unique
|
|
|
945
1172
|
|
|
946
1173
|
**Example**
|
|
947
1174
|
```js
|
|
948
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1175
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1176
|
+
const api = new API();
|
|
1177
|
+
const email = 'ana.silva@gmail.com';
|
|
1178
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1179
|
+
await api.admin.user.emailExist(email, session);
|
|
949
1180
|
```
|
|
950
1181
|
<a name="AdminUser+findByIdAndUpdate"></a>
|
|
951
1182
|
|
|
@@ -963,7 +1194,12 @@ update userData by userSMId
|
|
|
963
1194
|
|
|
964
1195
|
**Example**
|
|
965
1196
|
```js
|
|
966
|
-
const userId = '55e4a3bd6be6b45210833fae';
|
|
967
1197
|
name: 'Maria joaquina',
|
|
968
1198
|
email: 'maria@gmail.com'
|
|
1199
|
+
const userId = '55e4a3bd6be6b45210833fae';
|
|
1200
|
+
const payload = {
|
|
1201
|
+
name: 'Maria joaquina',
|
|
1202
|
+
email: 'maria@gmail.com'
|
|
1203
|
+
};
|
|
1204
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
969
1205
|
```
|
|
970
1206
|
<a name="AdminUser+getChangePasswordGuid"></a>
|
|
971
1207
|
|
|
@@ -979,7 +1215,10 @@ Request GUID to change the password
|
|
|
979
1215
|
|
|
980
1216
|
**Example**
|
|
981
1217
|
```js
|
|
982
|
-
const payload = {
|
|
983
1218
|
email: 'maria@gmail.com'
|
|
1219
|
+
const payload = {
|
|
1220
|
+
email: 'maria@gmail.com'
|
|
1221
|
+
};
|
|
1222
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
984
1223
|
```
|
|
985
1224
|
<a name="AdminUser+changePasswordGuid"></a>
|
|
986
1225
|
|
|
@@ -997,143 +1236,11 @@ Change password guid
|
|
|
997
1236
|
|
|
998
1237
|
**Example**
|
|
999
1238
|
```js
|
|
1000
|
-
const payload = {
|
|
1001
1239
|
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1002
1240
|
newPassword: '123456789'
|
|
1003
|
-
```
|
|
1004
|
-
<a name="Dispatch"></a>
|
|
1005
|
-
|
|
1006
|
-
## Dispatch
|
|
1007
|
-
Api dispatch manager
|
|
1008
|
-
|
|
1009
|
-
**Kind**: global class
|
|
1010
|
-
|
|
1011
|
-
* [Dispatch](#Dispatch)
|
|
1012
|
-
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
1013
|
-
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
1014
|
-
|
|
1015
|
-
<a name="Dispatch+getContext"></a>
|
|
1016
|
-
|
|
1017
|
-
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
1018
|
-
Get the URL context
|
|
1019
|
-
|
|
1020
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1021
|
-
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
1022
|
-
**Access**: public
|
|
1023
|
-
|
|
1024
|
-
| Param | Type | Default | Description |
|
|
1025
|
-
| --- | --- | --- | --- |
|
|
1026
|
-
| url | <code>string</code> | | Full url |
|
|
1027
|
-
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
1028
|
-
|
|
1029
|
-
**Example**
|
|
1030
|
-
```js
|
|
1031
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1032
|
-
```
|
|
1033
|
-
<a name="Dispatch+getClient"></a>
|
|
1034
|
-
|
|
1035
|
-
### dispatch.getClient() ⇒ <code>promise</code>
|
|
1036
|
-
Get client Axios
|
|
1037
|
-
|
|
1038
|
-
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
1039
|
-
**Returns**: <code>promise</code> - return client axios
|
|
1040
|
-
**Access**: public
|
|
1041
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1042
|
-
**Example**
|
|
1043
|
-
```js
|
|
1044
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1045
|
-
```
|
|
1046
|
-
<a name="External"></a>
|
|
1047
|
-
|
|
1048
|
-
## External
|
|
1049
|
-
Class for documents, permission user
|
|
1050
|
-
|
|
1051
|
-
**Kind**: global class
|
|
1052
|
-
|
|
1053
|
-
* [External](#External)
|
|
1054
|
-
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1055
|
-
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1056
|
-
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1057
|
-
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
1058
|
-
|
|
1059
|
-
<a name="External+context"></a>
|
|
1060
|
-
|
|
1061
|
-
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
1062
|
-
Create new document
|
|
1063
|
-
|
|
1064
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1065
|
-
**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
|
|
1066
1241
|
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
1067
|
-
**Access**: public
|
|
1068
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1069
|
-
|
|
1070
|
-
| Param | Type | Description |
|
|
1071
|
-
| --- | --- | --- |
|
|
1072
|
-
| params | <code>object</code> | Object for add new document |
|
|
1073
|
-
| params.id | <code>string</code> | Organization form id |
|
|
1074
|
-
|
|
1075
|
-
**Example**
|
|
1076
|
-
```js
|
|
1077
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1078
1242
|
id: '611e679741cc63168c26d7ee'
|
|
1079
|
-
```
|
|
1080
|
-
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
1081
|
-
|
|
1082
|
-
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1083
|
-
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
1084
|
-
|
|
1085
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1086
|
-
**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
|
|
1087
|
-
**Access**: public
|
|
1088
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1089
|
-
|
|
1090
|
-
| Param | Type | Description |
|
|
1091
|
-
| --- | --- | --- |
|
|
1092
|
-
| mime | <code>string</code> | the mime type of the document |
|
|
1093
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1094
|
-
|
|
1095
|
-
**Example**
|
|
1096
|
-
```js
|
|
1097
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1098
1243
|
mime: 'application/pdf'
|
|
1099
|
-
```
|
|
1100
|
-
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
1101
|
-
|
|
1102
|
-
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1103
|
-
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
1104
|
-
|
|
1105
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1106
|
-
**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
|
|
1107
|
-
**Access**: public
|
|
1108
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1109
|
-
|
|
1110
|
-
| Param | Type | Description |
|
|
1111
|
-
| --- | --- | --- |
|
|
1112
|
-
| docs | <code>array.<object></code> | the list of documents |
|
|
1113
|
-
| docs.mime | <code>string</code> | the mime type of the document |
|
|
1114
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1115
|
-
|
|
1116
|
-
**Example**
|
|
1117
|
-
```js
|
|
1118
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1119
1244
|
{
|
|
1120
1245
|
mime: 'application/pdf'
|
|
1121
1246
|
}
|
|
1122
|
-
```
|
|
1123
|
-
<a name="External+handle"></a>
|
|
1124
|
-
|
|
1125
|
-
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
1126
|
-
Handles the execution of an external form
|
|
1127
|
-
|
|
1128
|
-
**Kind**: instance method of [<code>External</code>](#External)
|
|
1129
|
-
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
1130
|
-
**Access**: public
|
|
1131
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1132
|
-
|
|
1133
|
-
| Param | Type | Description |
|
|
1134
|
-
| --- | --- | --- |
|
|
1135
|
-
| authorization | <code>string</code> | a legal authorization |
|
|
1136
|
-
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
1137
|
-
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
1138
|
-
| params.payload.name | <code>string</code> | the name of the group |
|
|
1139
|
-
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
1140
|
-
| 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 |
|
|
1141
|
-
|
|
1142
|
-
**Example**
|
|
1143
|
-
```js
|
|
1144
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1145
1247
|
payload: [
|
|
1146
1248
|
{
|
|
1147
1249
|
name: 'My Group One',
|
|
1148
1250
|
fields: [
|
|
1149
1251
|
{}
|
|
1150
1252
|
]
|
|
1151
1253
|
}
|
|
1152
1254
|
]
|
|
1255
|
+
const payload = {
|
|
1256
|
+
guid: '5b3c049c-4861-4353-a423-5e3f14242642',
|
|
1257
|
+
newPassword: '123456789'
|
|
1258
|
+
};
|
|
1259
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1153
1260
|
```
|
|
1154
1261
|
<a name="GeoLocation"></a>
|
|
1155
1262
|
|
|
@@ -1158,7 +1265,13 @@ Get geo location of the address
|
|
|
1158
1265
|
|
|
1159
1266
|
**Example**
|
|
1160
1267
|
```js
|
|
1161
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1162
1268
|
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1163
1269
|
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1270
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1271
|
+
const api = new API();
|
|
1272
|
+
const params = {
|
|
1273
|
+
address: 'Rua Sud Menucci, 615 - Vila Camilopolis, Santo André - SP',
|
|
1274
|
+
apiKey: 'AIzaSyC7gJFOkuT-Mel3WZbX5uKuJ1USqLVkGnY',
|
|
1275
|
+
};
|
|
1276
|
+
await api.general.geo.location(params);
|
|
1164
1277
|
```
|
|
1165
1278
|
<a name="Users"></a>
|
|
1166
1279
|
|
|
@@ -1190,241 +1303,100 @@ API request, user permission level
|
|
|
1190
1303
|
| options | <code>object</code> | Params of the constructor |
|
|
1191
1304
|
| options.parent | <code>object</code> | This of the pararent |
|
|
1192
1305
|
|
|
1193
|
-
<a name="
|
|
1306
|
+
<a name="Application"></a>
|
|
1194
1307
|
|
|
1195
|
-
##
|
|
1196
|
-
|
|
1308
|
+
## Application
|
|
1309
|
+
Class for Applications, permission user
|
|
1197
1310
|
|
|
1198
1311
|
**Kind**: global class
|
|
1312
|
+
<a name="Application+list"></a>
|
|
1199
1313
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1203
|
-
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1204
|
-
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1205
|
-
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1206
|
-
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1207
|
-
|
|
1208
|
-
<a name="Login+facebook"></a>
|
|
1209
|
-
|
|
1210
|
-
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
1211
|
-
Login with social login Facebook
|
|
1314
|
+
### application.list(params, session) ⇒ <code>promise</code>
|
|
1315
|
+
Get the available applications for this user in this organizations
|
|
1212
1316
|
|
|
1213
|
-
**Kind**: instance method of [<code>
|
|
1214
|
-
**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
|
|
1317
|
+
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1215
1318
|
**Access**: public
|
|
1216
1319
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1217
1320
|
|
|
1218
1321
|
| Param | Type | Description |
|
|
1219
1322
|
| --- | --- | --- |
|
|
1220
|
-
| params | <code>object</code> | Params to
|
|
1221
|
-
| params.
|
|
1222
|
-
|
|
|
1223
|
-
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
1323
|
+
| params | <code>object</code> | Params to get task |
|
|
1324
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1325
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1224
1326
|
|
|
1225
1327
|
**Example**
|
|
1226
1328
|
```js
|
|
1227
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1329
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1330
|
+
const api = new API();
|
|
1331
|
+
const params = {
|
|
1332
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1333
|
+
};
|
|
1334
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1335
|
+
await api.user.application.list(params, session);
|
|
1228
1336
|
```
|
|
1229
|
-
<a name="
|
|
1337
|
+
<a name="Datasource"></a>
|
|
1230
1338
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1339
|
+
## Datasource
|
|
1340
|
+
Class for user datasource access, to be used with when creating new documents
|
|
1233
1341
|
|
|
1234
|
-
**Kind**:
|
|
1235
|
-
|
|
1342
|
+
**Kind**: global class
|
|
1343
|
+
<a name="Datasource+autocomplete"></a>
|
|
1344
|
+
|
|
1345
|
+
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1346
|
+
Method to get autocomplete data from a datasource
|
|
1347
|
+
|
|
1348
|
+
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1349
|
+
**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
|
|
1236
1350
|
**Access**: public
|
|
1237
1351
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1238
1352
|
|
|
1239
1353
|
| Param | Type | Description |
|
|
1240
1354
|
| --- | --- | --- |
|
|
1241
|
-
| params | <code>object</code> | Params to
|
|
1242
|
-
| params.
|
|
1243
|
-
| params.
|
|
1244
|
-
| params.
|
|
1355
|
+
| params | <code>object</code> | Params to add notification token |
|
|
1356
|
+
| params.orgId | <code>string</code> | The user organization _id |
|
|
1357
|
+
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1358
|
+
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1359
|
+
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1360
|
+
| params.documents | <code>array.<object></code> | The document list |
|
|
1361
|
+
| params.documents._id | <code>string</code> | The document _id |
|
|
1362
|
+
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1245
1363
|
|
|
1246
1364
|
**Example**
|
|
1247
1365
|
```js
|
|
1248
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1366
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1367
|
+
const api = new API();
|
|
1368
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1369
|
+
const params = {
|
|
1370
|
+
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1371
|
+
dataSources: [{}],
|
|
1372
|
+
documents: [{}]
|
|
1373
|
+
};
|
|
1374
|
+
const retData = await api.user.datasource.autocomplete(params, session);
|
|
1249
1375
|
```
|
|
1250
|
-
<a name="
|
|
1376
|
+
<a name="Documents"></a>
|
|
1251
1377
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1378
|
+
## Documents
|
|
1379
|
+
Class for documents, permission user
|
|
1254
1380
|
|
|
1255
|
-
**Kind**:
|
|
1256
|
-
**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
|
|
1257
|
-
**Access**: public
|
|
1258
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1381
|
+
**Kind**: global class
|
|
1259
1382
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1383
|
+
* [Documents](#Documents)
|
|
1384
|
+
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1385
|
+
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1386
|
+
* [.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>
|
|
1387
|
+
* [.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>
|
|
1388
|
+
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1389
|
+
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1390
|
+
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1391
|
+
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1392
|
+
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1263
1393
|
|
|
1264
|
-
|
|
1265
|
-
```js
|
|
1266
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1267
|
-
```
|
|
1268
|
-
<a name="Login+userPass"></a>
|
|
1394
|
+
<a name="Documents+add"></a>
|
|
1269
1395
|
|
|
1270
|
-
###
|
|
1271
|
-
|
|
1396
|
+
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1397
|
+
Create new document
|
|
1272
1398
|
|
|
1273
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1274
|
-
**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
|
|
1275
|
-
**Access**: public
|
|
1276
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1277
|
-
|
|
1278
|
-
| Param | Type | Description |
|
|
1279
|
-
| --- | --- | --- |
|
|
1280
|
-
| params | <code>object</code> | Object with user and password |
|
|
1281
|
-
| params.username | <code>string</code> | Username or email of the user |
|
|
1282
|
-
| params.password | <code>string</code> | Password of the user |
|
|
1283
|
-
| params.orgname | <code>string</code> | The organame of the user |
|
|
1284
|
-
|
|
1285
|
-
**Example**
|
|
1286
|
-
```js
|
|
1287
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1288
1399
|
username: 'ana.silva@gmail.com',
|
|
1289
1400
|
password: '123456'
|
|
1290
|
-
```
|
|
1291
|
-
<a name="Login+logout"></a>
|
|
1292
|
-
|
|
1293
|
-
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1294
|
-
Logout user system manager
|
|
1295
|
-
|
|
1296
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1297
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1298
|
-
**Access**: public
|
|
1299
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1300
|
-
|
|
1301
|
-
| Param | Type | Description |
|
|
1302
|
-
| --- | --- | --- |
|
|
1303
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1304
|
-
|
|
1305
|
-
**Example**
|
|
1306
|
-
```js
|
|
1307
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1308
|
-
```
|
|
1309
|
-
<a name="Login+recover"></a>
|
|
1310
|
-
|
|
1311
|
-
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
1312
|
-
Recover the password
|
|
1313
|
-
|
|
1314
|
-
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
1315
|
-
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
1316
|
-
**Access**: public
|
|
1317
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1318
|
-
|
|
1319
|
-
| Param | Type | Description |
|
|
1320
|
-
| --- | --- | --- |
|
|
1321
|
-
| username | <code>string</code> | The username or email |
|
|
1322
|
-
|
|
1323
|
-
**Example**
|
|
1324
|
-
```js
|
|
1325
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1326
|
-
```
|
|
1327
|
-
<a name="Session"></a>
|
|
1328
|
-
|
|
1329
|
-
## Session
|
|
1330
|
-
Session manager of the API
|
|
1331
|
-
|
|
1332
|
-
**Kind**: global class
|
|
1333
|
-
<a name="Session+information"></a>
|
|
1334
|
-
|
|
1335
|
-
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
1336
|
-
Show information for session, thus validating the session (Valid token JWT)
|
|
1337
|
-
|
|
1338
|
-
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
1339
|
-
**Access**: public
|
|
1340
|
-
|
|
1341
|
-
| Param | Type | Default | Description |
|
|
1342
|
-
| --- | --- | --- | --- |
|
|
1343
|
-
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
1344
|
-
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
1345
|
-
|
|
1346
|
-
**Example**
|
|
1347
|
-
```js
|
|
1348
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1349
|
-
```
|
|
1350
|
-
<a name="Application"></a>
|
|
1351
|
-
|
|
1352
|
-
## Application
|
|
1353
|
-
Class for Applications, permission user
|
|
1354
|
-
|
|
1355
|
-
**Kind**: global class
|
|
1356
|
-
<a name="Application+list"></a>
|
|
1357
|
-
|
|
1358
|
-
### application.list(params, session) ⇒ <code>promise</code>
|
|
1359
|
-
Get the available applications for this user in this organizations
|
|
1360
|
-
|
|
1361
|
-
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1362
|
-
**Access**: public
|
|
1363
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1364
|
-
|
|
1365
|
-
| Param | Type | Description |
|
|
1366
|
-
| --- | --- | --- |
|
|
1367
|
-
| params | <code>object</code> | Params to get task |
|
|
1368
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
1369
|
-
| session | <code>string</code> | Session, token JWT |
|
|
1370
|
-
|
|
1371
|
-
**Example**
|
|
1372
|
-
```js
|
|
1373
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1374
1401
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1375
|
-
```
|
|
1376
|
-
<a name="Datasource"></a>
|
|
1377
|
-
|
|
1378
|
-
## Datasource
|
|
1379
|
-
Class for user datasource access, to be used with when creating new documents
|
|
1380
|
-
|
|
1381
|
-
**Kind**: global class
|
|
1382
|
-
<a name="Datasource+autocomplete"></a>
|
|
1383
|
-
|
|
1384
|
-
### datasource.autocomplete(params, session) ⇒ <code>promise.<array></code> \| <code>string</code> \| <code>object</code>
|
|
1385
|
-
Method to get autocomplete data from a datasource
|
|
1386
|
-
|
|
1387
|
-
**Kind**: instance method of [<code>Datasource</code>](#Datasource)
|
|
1388
|
-
**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
|
|
1389
|
-
**Access**: public
|
|
1390
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1391
|
-
|
|
1392
|
-
| Param | Type | Description |
|
|
1393
|
-
| --- | --- | --- |
|
|
1394
|
-
| params | <code>object</code> | Params to add notification token |
|
|
1395
|
-
| params.orgId | <code>string</code> | The user organization _id |
|
|
1396
|
-
| params.dataSources | <code>array.<object></code> | The document type data sources information |
|
|
1397
|
-
| params.dataSources._id | <code>string</code> | The document type data sources _id |
|
|
1398
|
-
| params.dataSources.fields | <code>array.<object></code> | The document type data sources list of fields |
|
|
1399
|
-
| params.documents | <code>array.<object></code> | The document list |
|
|
1400
|
-
| params.documents._id | <code>string</code> | The document _id |
|
|
1401
|
-
| session | <code>string</code> | Is token JWT of user NOT allow SU |
|
|
1402
|
-
|
|
1403
|
-
**Example**
|
|
1404
|
-
```js
|
|
1405
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1406
1402
|
orgId: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
1407
1403
|
dataSources: [{}],
|
|
1408
1404
|
documents: [{}]
|
|
1409
|
-
|
|
1410
|
-
<a name="Documents"></a>
|
|
1411
|
-
|
|
1412
|
-
## Documents
|
|
1413
|
-
Class for documents, permission user
|
|
1414
|
-
|
|
1415
|
-
**Kind**: global class
|
|
1416
|
-
|
|
1417
|
-
* [Documents](#Documents)
|
|
1418
|
-
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1419
|
-
* [.find(params, session)](#Documents+find) ⇒ <code>Promise</code>
|
|
1420
|
-
* [.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>
|
|
1421
|
-
* [.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>
|
|
1422
|
-
* [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1423
|
-
* [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
1424
|
-
* [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.<boolean></code>
|
|
1425
|
-
* [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.<array></code> \| <code>array.<string></code>
|
|
1426
|
-
* [.searchDocuments(params, session)](#Documents+searchDocuments) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
1427
|
-
|
|
1428
|
-
<a name="Documents+add"></a>
|
|
1429
|
-
|
|
1430
|
-
### documents.add(params, session) ⇒ <code>Promise</code>
|
|
1431
|
-
Create new document
|
|
1432
|
-
|
|
1433
|
-
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1405
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1434
1406
|
**Access**: public
|
|
1435
1407
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1436
1408
|
|
|
@@ -1459,7 +1431,23 @@ Create new document
|
|
|
1459
1431
|
|
|
1460
1432
|
**Example**
|
|
1461
1433
|
```js
|
|
1462
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1463
1434
|
orgname: 'cloundbrasil',
|
|
1464
1435
|
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1465
1436
|
docId: '5edf86fbe896b817e45b8da6',
|
|
1466
1437
|
fileName: 'foto',
|
|
1467
1438
|
type: 'image/png',
|
|
1468
1439
|
name: 'Fotografia',
|
|
1469
1440
|
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1470
1441
|
bytes: 12345,
|
|
1471
1442
|
signedUrl: 'https://s3.amazonaws.com...'
|
|
1472
1443
|
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1473
1444
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1445
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1446
|
+
const api = new API();
|
|
1447
|
+
const params = {
|
|
1448
|
+
orgname: 'cloundbrasil',
|
|
1449
|
+
areaId: '5edf9f8ee896b817e45b8dac',
|
|
1450
|
+
docId: '5edf86fbe896b817e45b8da6',
|
|
1451
|
+
fileName: 'foto',
|
|
1452
|
+
type: 'image/png',
|
|
1453
|
+
name: 'Fotografia',
|
|
1454
|
+
docTypeId = '5edf9f8ee896b817e45b8dac',
|
|
1455
|
+
bytes: 12345,
|
|
1456
|
+
signedUrl: 'https://s3.amazonaws.com...'
|
|
1457
|
+
docTypeFieldsData: {extraUser: '12349f8ee896b817e45b8dac'},
|
|
1458
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1459
|
+
};
|
|
1460
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1461
|
+
await api.user.document.add(params, session);
|
|
1474
1462
|
```
|
|
1475
1463
|
<a name="Documents+find"></a>
|
|
1476
1464
|
|
|
@@ -1487,7 +1475,18 @@ const API = require('@docbrasil/api-systemmanager');
|
|
|
1487
1475
|
|
|
1488
1476
|
**Example**
|
|
1489
1477
|
```js
|
|
1490
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1491
1478
|
index: 'extraCity',
|
|
1492
1479
|
txtToSearch: 'São',
|
|
1493
1480
|
docId: '5df7f19618430c89a41a19d2',
|
|
1494
1481
|
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1495
1482
|
tag: 'Nome da cidade',
|
|
1496
1483
|
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1484
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1485
|
+
const api = new API();
|
|
1486
|
+
const params - {
|
|
1487
|
+
index: 'extraCity',
|
|
1488
|
+
txtToSearch: 'São',
|
|
1489
|
+
docId: '5df7f19618430c89a41a19d2',
|
|
1490
|
+
docAreaId: '5edd11c46b6ce9729c2c297c',
|
|
1491
|
+
tag: 'Nome da cidade',
|
|
1492
|
+
orgId: '1234d01dc4af3941d42f8c5c'
|
|
1493
|
+
};
|
|
1494
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1495
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1497
1496
|
```
|
|
1498
1497
|
<a name="Documents+findByIdAndRemove"></a>
|
|
1499
1498
|
|
|
@@ -1508,7 +1507,14 @@ Remove document by id
|
|
|
1508
1507
|
|
|
1509
1508
|
**Example**
|
|
1510
1509
|
```js
|
|
1511
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1512
1510
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1513
1511
|
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1512
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1513
|
+
const api = new API();
|
|
1514
|
+
const params - {
|
|
1515
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1516
|
+
orgIdId: '5df7f19618430c89a41a19d2',
|
|
1517
|
+
};
|
|
1518
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1519
|
+
await api.user.document.findByIdAndRemove(params, session);
|
|
1514
1520
|
```
|
|
1515
1521
|
<a name="Documents+findByIdsAndRemove"></a>
|
|
1516
1522
|
|
|
@@ -1530,7 +1536,14 @@ Remove documents
|
|
|
1530
1536
|
|
|
1531
1537
|
**Example**
|
|
1532
1538
|
```js
|
|
1533
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1534
1539
|
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1535
1540
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1541
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1542
|
+
const api = new API();
|
|
1543
|
+
const params - {
|
|
1544
|
+
documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
|
|
1545
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1546
|
+
};
|
|
1547
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1548
|
+
await api.user.document.findByIdsAndRemove(params, session);
|
|
1536
1549
|
```
|
|
1537
1550
|
<a name="Documents+signedUrl"></a>
|
|
1538
1551
|
|
|
@@ -1556,11 +1569,30 @@ Request signed url url to put or get
|
|
|
1556
1569
|
|
|
1557
1570
|
**Example**
|
|
1558
1571
|
```js
|
|
1559
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1560
1572
|
methodType: 'put',
|
|
1561
1573
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1562
1574
|
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1563
1575
|
fileName: 'Foto',
|
|
1564
1576
|
type: 'image/png'
|
|
1565
1577
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1578
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1579
|
+
const api = new API();
|
|
1580
|
+
const params - {
|
|
1581
|
+
methodType: 'put',
|
|
1582
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1583
|
+
docAreaId: '5df7f19618430c89a41a19d2',
|
|
1584
|
+
fileName: 'Foto',
|
|
1585
|
+
type: 'image/png'
|
|
1586
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1587
|
+
};
|
|
1588
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1589
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1590
|
+
const { docs } = await api.user.document.signedUrl(params, session);
|
|
1566
1591
|
```
|
|
1567
1592
|
**Example**
|
|
1568
1593
|
```js
|
|
1569
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1570
1594
|
methodType: 'get',
|
|
1571
1595
|
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1596
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1597
|
+
const api = new API();
|
|
1598
|
+
const params - {
|
|
1599
|
+
methodType: 'get',
|
|
1600
|
+
document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf',
|
|
1601
|
+
};
|
|
1602
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1603
|
+
const base64Data = await api.user.document.signedUrl(params, session);
|
|
1572
1604
|
```
|
|
1573
1605
|
<a name="Documents+signedUrls"></a>
|
|
1574
1606
|
|
|
@@ -1587,11 +1619,36 @@ Request signed url url to put or get
|
|
|
1587
1619
|
|
|
1588
1620
|
**Example**
|
|
1589
1621
|
```js
|
|
1590
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1591
1622
|
methodType: 'put',
|
|
1592
1623
|
orgId: '5df7f19618430c89a41a19f8'
|
|
1593
1624
|
docs: [
|
|
1594
1625
|
{
|
|
1595
1626
|
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1596
1627
|
areaId: '5df7f19618430c89a41a19d2',
|
|
1597
1628
|
name: 'Foto.png',
|
|
1598
1629
|
type: 'image/png'
|
|
1599
1630
|
}
|
|
1600
1631
|
]
|
|
1601
|
-
```
|
|
1602
|
-
**Example**
|
|
1603
|
-
```js
|
|
1604
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1605
1632
|
methodType: 'get',
|
|
1606
1633
|
docs: [
|
|
1607
1634
|
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1608
1635
|
],
|
|
1636
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1637
|
+
const api = new API();
|
|
1638
|
+
const params - {
|
|
1639
|
+
methodType: 'put',
|
|
1640
|
+
orgId: '5df7f19618430c89a41a19f8'
|
|
1641
|
+
docs: [
|
|
1642
|
+
{
|
|
1643
|
+
docId: '5dadd01dc4af3941d42f8c5c',
|
|
1644
|
+
areaId: '5df7f19618430c89a41a19d2',
|
|
1645
|
+
name: 'Foto.png',
|
|
1646
|
+
type: 'image/png'
|
|
1647
|
+
}
|
|
1648
|
+
]
|
|
1649
|
+
};
|
|
1650
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1651
|
+
// each doc: { docId, name, areaId, type, signedUrl }
|
|
1652
|
+
const { docs } = await api.user.document.signedUrls(params, session);
|
|
1653
|
+
```
|
|
1654
|
+
**Example**
|
|
1655
|
+
```js
|
|
1656
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1657
|
+
const api = new API();
|
|
1658
|
+
const params - {
|
|
1659
|
+
methodType: 'get',
|
|
1660
|
+
docs: [
|
|
1661
|
+
{ document: 'pinkandthebrain/5df7f19618430c89a41a19d2/5dadd01dc4af3941d42f8c5c/9dadd01dc4af3941d42f6dd4.pdf' }
|
|
1662
|
+
],
|
|
1663
|
+
};
|
|
1664
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1665
|
+
const base64Data = await api.user.document.signedUrls(params, session);
|
|
1609
1666
|
```
|
|
1610
1667
|
<a name="Documents+uploadSignedDocument"></a>
|
|
1611
1668
|
|
|
@@ -1612,7 +1669,21 @@ Uploads the file
|
|
|
1612
1669
|
|
|
1613
1670
|
**Example**
|
|
1614
1671
|
```js
|
|
1615
|
-
const FS = require('fs');
|
|
1616
1672
|
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1617
1673
|
signedUrl: 'https://signedurl.com/token...',
|
|
1618
1674
|
type: 'application/pdf'
|
|
1619
1675
|
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1620
1676
|
- loaded: The number of bytes of the file that have been uploaded.
|
|
1621
1677
|
- total: The total number of bytes in the file.
|
|
1678
|
+
const FS = require('fs');
|
|
1679
|
+
const Path = require('path');
|
|
1680
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1681
|
+
const api = new API();
|
|
1682
|
+
const params - {
|
|
1683
|
+
content: FS.readFileSync(Path.join(__dirname, '.mypdf.pdf')),
|
|
1684
|
+
signedUrl: 'https://signedurl.com/token...',
|
|
1685
|
+
type: 'application/pdf'
|
|
1686
|
+
};
|
|
1687
|
+
const retData = await api.user.document.uploadSignedDocument(params);
|
|
1688
|
+
|
|
1689
|
+
onUploadProgress return the progressEvent
|
|
1690
|
+
- lengthComputable: A Boolean that indicates whether or not the total number of bytes is known.
|
|
1691
|
+
- loaded: The number of bytes of the file that have been uploaded.
|
|
1692
|
+
- total: The total number of bytes in the file.
|
|
1622
1693
|
```
|
|
1623
1694
|
<a name="Documents+checkPrimaryKeys"></a>
|
|
1624
1695
|
|
|
@@ -1620,7 +1691,8 @@ const FS = require('fs');
|
|
|
1620
1691
|
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1621
1692
|
**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
|
|
1622
1693
|
**Access**: public
|
|
1623
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1694
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
1695
|
+
Checks if a document can be added and it does not repeat its primary key
|
|
1624
1696
|
|
|
1625
1697
|
| Param | Type | Description |
|
|
1626
1698
|
| --- | --- | --- |
|
|
@@ -1635,7 +1707,17 @@ const FS = require('fs');
|
|
|
1635
1707
|
|
|
1636
1708
|
**Example**
|
|
1637
1709
|
```js
|
|
1638
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1639
1710
|
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1640
1711
|
orgId: '5df7f19618430c89a41a19d2',
|
|
1641
1712
|
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1713
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1714
|
+
const api = new API();
|
|
1715
|
+
const docTypeFields = [...]; // the doc type fields array
|
|
1716
|
+
const docTypeFieldsData = {...}; // the data of this fields
|
|
1717
|
+
const params - {
|
|
1718
|
+
docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
|
|
1719
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1720
|
+
docTypeId: '5df7f19618430c89a41a19d5',
|
|
1721
|
+
};
|
|
1722
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1723
|
+
const retDocs = await api.user.document.checkPrimaryKeys(params, session);
|
|
1642
1724
|
```
|
|
1643
1725
|
<a name="Documents+searchDocuments"></a>
|
|
1644
1726
|
|
|
@@ -1656,7 +1738,14 @@ Method to search documents for
|
|
|
1656
1738
|
|
|
1657
1739
|
**Example**
|
|
1658
1740
|
```js
|
|
1659
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1660
1741
|
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1661
1742
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1743
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1744
|
+
const api = new API();
|
|
1745
|
+
const params = {
|
|
1746
|
+
query: {p: 20, i: 1, s: 'Mais recentes', as: '', m: 'w', ai: '57e6a3bd6be6b45210833fae'},
|
|
1747
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1748
|
+
};
|
|
1749
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1750
|
+
const retSearch = await api.user.document.searchDocuments(params, session);
|
|
1662
1751
|
```
|
|
1663
1752
|
<a name="Help"></a>
|
|
1664
1753
|
|
|
@@ -1684,7 +1773,10 @@ get heps topics
|
|
|
1684
1773
|
|
|
1685
1774
|
**Example**
|
|
1686
1775
|
```js
|
|
1687
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1776
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1777
|
+
const api = new API();
|
|
1778
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1779
|
+
await api.user.help.getTopics(session);
|
|
1688
1780
|
```
|
|
1689
1781
|
<a name="Help+get"></a>
|
|
1690
1782
|
|
|
@@ -1703,7 +1795,13 @@ Method to find helps from a topic
|
|
|
1703
1795
|
|
|
1704
1796
|
**Example**
|
|
1705
1797
|
```js
|
|
1706
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1707
1798
|
id: '5dadd01dc4af3941d42f8c5c'
|
|
1799
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1800
|
+
const api = new API();
|
|
1801
|
+
const params = {
|
|
1802
|
+
id: '5dadd01dc4af3941d42f8c5c'
|
|
1803
|
+
};
|
|
1804
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1805
|
+
await api.user.help.get(params, session);
|
|
1708
1806
|
```
|
|
1709
1807
|
<a name="Users"></a>
|
|
1710
1808
|
|
|
@@ -1760,7 +1858,14 @@ Method to find my tasks for a user
|
|
|
1760
1858
|
|
|
1761
1859
|
**Example**
|
|
1762
1860
|
```js
|
|
1763
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1764
1861
|
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1765
1862
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
1863
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1864
|
+
const api = new API();
|
|
1865
|
+
const params = {
|
|
1866
|
+
query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
1867
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
1868
|
+
};
|
|
1869
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1870
|
+
const retSearch = await api.user.task.mytasks.find(params, session);
|
|
1766
1871
|
```
|
|
1767
1872
|
<a name="Notification"></a>
|
|
1768
1873
|
|
|
@@ -1802,7 +1907,14 @@ Method to add a notification token
|
|
|
1802
1907
|
|
|
1803
1908
|
**Example**
|
|
1804
1909
|
```js
|
|
1805
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1806
1910
|
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1807
1911
|
type: 'FCM_WEB'
|
|
1912
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1913
|
+
const api = new API();
|
|
1914
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1915
|
+
const params = {
|
|
1916
|
+
token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
|
|
1917
|
+
type: 'FCM_WEB'
|
|
1918
|
+
};
|
|
1919
|
+
const retData = await api.user.notification.addToken(params, session);
|
|
1808
1920
|
```
|
|
1809
1921
|
<a name="Notification+getNew"></a>
|
|
1810
1922
|
|
|
@@ -1819,7 +1931,10 @@ get new notifications
|
|
|
1819
1931
|
|
|
1820
1932
|
**Example**
|
|
1821
1933
|
```js
|
|
1822
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1934
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1935
|
+
const api = new API();
|
|
1936
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1937
|
+
await api.user.notification.getNew(session);
|
|
1823
1938
|
```
|
|
1824
1939
|
<a name="Notification+getOld"></a>
|
|
1825
1940
|
|
|
@@ -1836,7 +1951,10 @@ get old notifications
|
|
|
1836
1951
|
|
|
1837
1952
|
**Example**
|
|
1838
1953
|
```js
|
|
1839
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1954
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1955
|
+
const api = new API();
|
|
1956
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1957
|
+
await api.user.notification.getOld(session);
|
|
1840
1958
|
```
|
|
1841
1959
|
<a name="Notification+setRead"></a>
|
|
1842
1960
|
|
|
@@ -1855,7 +1973,13 @@ Set notification as readed
|
|
|
1855
1973
|
|
|
1856
1974
|
**Example**
|
|
1857
1975
|
```js
|
|
1858
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1859
1976
|
id: '34c344c43c34c344c43c'
|
|
1977
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1978
|
+
const api = new API();
|
|
1979
|
+
const params = {
|
|
1980
|
+
id: '34c344c43c34c344c43c'
|
|
1981
|
+
};
|
|
1982
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1983
|
+
await api.user.notification.setRead(params, session);
|
|
1860
1984
|
```
|
|
1861
1985
|
<a name="Notification+setUnread"></a>
|
|
1862
1986
|
|
|
@@ -1874,7 +1998,13 @@ Set notification as unreaded
|
|
|
1874
1998
|
|
|
1875
1999
|
**Example**
|
|
1876
2000
|
```js
|
|
1877
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1878
2001
|
id: '34c344c43c34c344c43c'
|
|
2002
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2003
|
+
const api = new API();
|
|
2004
|
+
const params = {
|
|
2005
|
+
id: '34c344c43c34c344c43c'
|
|
2006
|
+
};
|
|
2007
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2008
|
+
await api.user.notification.setUnread(params, session);
|
|
1879
2009
|
```
|
|
1880
2010
|
<a name="Organization"></a>
|
|
1881
2011
|
|
|
@@ -1911,7 +2041,15 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
1911
2041
|
|
|
1912
2042
|
**Example**
|
|
1913
2043
|
```js
|
|
1914
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1915
2044
|
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
1916
2045
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1917
2046
|
type: 'image/png',
|
|
2047
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2048
|
+
const api = new API();
|
|
2049
|
+
const params = {
|
|
2050
|
+
orgId: '5dadd01dc4af3941d42f8c5c',
|
|
2051
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2052
|
+
type: 'image/png',
|
|
2053
|
+
};
|
|
2054
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2055
|
+
await api.admin.organizations.upsertAvatar(params, session);
|
|
1918
2056
|
```
|
|
1919
2057
|
<a name="Organization+removeAvatar"></a>
|
|
1920
2058
|
|
|
@@ -1929,7 +2067,11 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
1929
2067
|
|
|
1930
2068
|
**Example**
|
|
1931
2069
|
```js
|
|
1932
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2070
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2071
|
+
const api = new API();
|
|
2072
|
+
const orgId = '5dadd01dc4af3941d42f8c5c';
|
|
2073
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2074
|
+
await api.admin.organizations.removeAvatar(orgId, session);
|
|
1933
2075
|
```
|
|
1934
2076
|
<a name="Organization+findById"></a>
|
|
1935
2077
|
|
|
@@ -1947,7 +2089,11 @@ Find organization by id
|
|
|
1947
2089
|
|
|
1948
2090
|
**Example**
|
|
1949
2091
|
```js
|
|
1950
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2092
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2093
|
+
const api = new API();
|
|
2094
|
+
const orgId = '80443245000122';
|
|
2095
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2096
|
+
await api.user.organization.findById(idCard, session);
|
|
1951
2097
|
```
|
|
1952
2098
|
<a name="Organization+idCardExist"></a>
|
|
1953
2099
|
|
|
@@ -1965,7 +2111,11 @@ Check if id card exist
|
|
|
1965
2111
|
|
|
1966
2112
|
**Example**
|
|
1967
2113
|
```js
|
|
1968
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2114
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2115
|
+
const api = new API();
|
|
2116
|
+
const idCard = '80443245000122';
|
|
2117
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2118
|
+
await api.user.organization.idCardExist(idCard, session);
|
|
1969
2119
|
```
|
|
1970
2120
|
<a name="Organization+upsertAvatar"></a>
|
|
1971
2121
|
|
|
@@ -1985,7 +2135,14 @@ Update avatar of organization by session of user not allow session user SU
|
|
|
1985
2135
|
|
|
1986
2136
|
**Example**
|
|
1987
2137
|
```js
|
|
1988
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
1989
2138
|
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
1990
2139
|
type: 'image/png',
|
|
2140
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2141
|
+
const api = new API();
|
|
2142
|
+
const params = {
|
|
2143
|
+
avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
|
|
2144
|
+
type: 'image/png',
|
|
2145
|
+
};
|
|
2146
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2147
|
+
await api.user.profile.updateAvatar(params, session);
|
|
1991
2148
|
```
|
|
1992
2149
|
<a name="Organization+removeAvatar"></a>
|
|
1993
2150
|
|
|
@@ -2002,7 +2159,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2002
2159
|
|
|
2003
2160
|
**Example**
|
|
2004
2161
|
```js
|
|
2005
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2162
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2163
|
+
const api = new API();
|
|
2164
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2165
|
+
await api.user.profile.removeAvatar(session);
|
|
2006
2166
|
```
|
|
2007
2167
|
<a name="Organization+callFetch"></a>
|
|
2008
2168
|
|
|
@@ -2022,7 +2182,14 @@ Call URL internal, need auth JWT (session)
|
|
|
2022
2182
|
|
|
2023
2183
|
**Example**
|
|
2024
2184
|
```js
|
|
2025
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2026
2185
|
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2027
2186
|
method: 'POST'
|
|
2187
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2188
|
+
const api = new API();
|
|
2189
|
+
|
|
2190
|
+
const params = {
|
|
2191
|
+
url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
|
|
2192
|
+
method: 'POST'
|
|
2193
|
+
}
|
|
2194
|
+
await api.user.organization.callFetchs(params, session);
|
|
2028
2195
|
```
|
|
2029
2196
|
<a name="Page"></a>
|
|
2030
2197
|
|
|
@@ -2049,7 +2216,15 @@ Get the available page for an application inside an organization
|
|
|
2049
2216
|
|
|
2050
2217
|
**Example**
|
|
2051
2218
|
```js
|
|
2052
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2053
2219
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2054
2220
|
appId: '57e4a3bd6be6b45210833fa7',
|
|
2055
2221
|
pageId: '57e4a3bd6be6b45210833fab'
|
|
2222
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2223
|
+
const api = new API();
|
|
2224
|
+
const params = {
|
|
2225
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2226
|
+
appId: '57e4a3bd6be6b45210833fa7',
|
|
2227
|
+
pageId: '57e4a3bd6be6b45210833fab'
|
|
2228
|
+
};
|
|
2229
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2230
|
+
await api.user.application.page.get(params, session);
|
|
2056
2231
|
```
|
|
2057
2232
|
<a name="Process"></a>
|
|
2058
2233
|
|
|
@@ -2088,7 +2263,15 @@ Start process
|
|
|
2088
2263
|
|
|
2089
2264
|
**Example**
|
|
2090
2265
|
```js
|
|
2091
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2092
2266
|
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2093
2267
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2094
2268
|
payload: {}
|
|
2269
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2270
|
+
const api = new API();
|
|
2271
|
+
const params = {
|
|
2272
|
+
orgProcessId: '5dadd01dc4af3941d42f8c5c',
|
|
2273
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2274
|
+
payload: {}
|
|
2275
|
+
}
|
|
2276
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2277
|
+
await api.user.process.start(params, session);
|
|
2095
2278
|
```
|
|
2096
2279
|
<a name="Process+getProcessProperties"></a>
|
|
2097
2280
|
|
|
@@ -2108,7 +2291,14 @@ Get process properties of process
|
|
|
2108
2291
|
|
|
2109
2292
|
**Example**
|
|
2110
2293
|
```js
|
|
2111
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2112
2294
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2113
2295
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2296
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2297
|
+
const api = new API();
|
|
2298
|
+
const params = {
|
|
2299
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2300
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2301
|
+
}
|
|
2302
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2303
|
+
await api.user.process.getProcessProperties(params, session);
|
|
2114
2304
|
```
|
|
2115
2305
|
<a name="Process+getOrgProcessSearchInfo"></a>
|
|
2116
2306
|
|
|
@@ -2116,7 +2306,8 @@ const API = require('@docbrasil/api-systemmanager');
|
|
|
2116
2306
|
Get the search info of a organization process
|
|
2117
2307
|
|
|
2118
2308
|
**Kind**: instance method of [<code>Process</code>](#Process)
|
|
2119
|
-
**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
|
|
2309
|
+
**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
|
|
2310
|
+
@
|
|
2120
2311
|
**Access**: public
|
|
2121
2312
|
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2122
2313
|
|
|
@@ -2129,7 +2320,14 @@ Get the search info of a organization process
|
|
|
2129
2320
|
|
|
2130
2321
|
**Example**
|
|
2131
2322
|
```js
|
|
2132
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2133
2323
|
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2134
2324
|
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2325
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2326
|
+
const api = new API();
|
|
2327
|
+
const params = {
|
|
2328
|
+
orgProcessId: '5dadd01dc4af3941d42f8c67',
|
|
2329
|
+
orgId: '5edd11c46b6ce9729c2c297c',
|
|
2330
|
+
}
|
|
2331
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2332
|
+
const retSearchInfo = await api.user.process.getOrgProcessSearchInfo(params, session);
|
|
2135
2333
|
```
|
|
2136
2334
|
<a name="Process+find"></a>
|
|
2137
2335
|
|
|
@@ -2150,7 +2348,14 @@ Method to search processes
|
|
|
2150
2348
|
|
|
2151
2349
|
**Example**
|
|
2152
2350
|
```js
|
|
2153
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2154
2351
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2155
2352
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2353
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2354
|
+
const api = new API();
|
|
2355
|
+
const params = {
|
|
2356
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2357
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2358
|
+
};
|
|
2359
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2360
|
+
const retSearch = await api.user.process.find(params, session);
|
|
2156
2361
|
```
|
|
2157
2362
|
<a name="Process+remove"></a>
|
|
2158
2363
|
|
|
@@ -2170,7 +2375,14 @@ Method to remove process
|
|
|
2170
2375
|
|
|
2171
2376
|
**Example**
|
|
2172
2377
|
```js
|
|
2173
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2174
2378
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2175
2379
|
processId: '55e4a3bd6be6b45210833fae'
|
|
2380
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2381
|
+
const api = new API();
|
|
2382
|
+
const params = {
|
|
2383
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2384
|
+
processId: '55e4a3bd6be6b45210833fae'
|
|
2385
|
+
};
|
|
2386
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2387
|
+
const retSearch = await api.user.process.remove(params, session);
|
|
2176
2388
|
```
|
|
2177
2389
|
<a name="Process+exportStatusData"></a>
|
|
2178
2390
|
|
|
@@ -2190,7 +2402,14 @@ Method to export status data
|
|
|
2190
2402
|
|
|
2191
2403
|
**Example**
|
|
2192
2404
|
```js
|
|
2193
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2194
2405
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2195
2406
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2407
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2408
|
+
const api = new API();
|
|
2409
|
+
const params = {
|
|
2410
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2411
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2412
|
+
};
|
|
2413
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2414
|
+
const retSearch = await api.user.process.exportStatusData(params, session);
|
|
2196
2415
|
```
|
|
2197
2416
|
<a name="Process+exportProcessData"></a>
|
|
2198
2417
|
|
|
@@ -2210,7 +2429,14 @@ Method to export process data
|
|
|
2210
2429
|
|
|
2211
2430
|
**Example**
|
|
2212
2431
|
```js
|
|
2213
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2214
2432
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2215
2433
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2434
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2435
|
+
const api = new API();
|
|
2436
|
+
const params = {
|
|
2437
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2438
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2439
|
+
};
|
|
2440
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2441
|
+
const retSearch = await api.user.process.exportProcessData(params, session);
|
|
2216
2442
|
```
|
|
2217
2443
|
<a name="Process+processDocs"></a>
|
|
2218
2444
|
|
|
@@ -2232,7 +2458,15 @@ Method to get Process Docs
|
|
|
2232
2458
|
|
|
2233
2459
|
**Example**
|
|
2234
2460
|
```js
|
|
2235
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2236
2461
|
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2237
2462
|
processId: '55e4a3bd6be6b45210833fae',
|
|
2238
2463
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2464
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2465
|
+
const api = new API();
|
|
2466
|
+
const params = {
|
|
2467
|
+
orgProcessId: '55e4a3bd6be6b45210833fae',
|
|
2468
|
+
processId: '55e4a3bd6be6b45210833fae',
|
|
2469
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2470
|
+
};
|
|
2471
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2472
|
+
const retSearch = await api.user.process.processDocs(params, session);
|
|
2239
2473
|
```
|
|
2240
2474
|
<a name="Process+downloadDocs"></a>
|
|
2241
2475
|
|
|
@@ -2255,7 +2489,16 @@ Method to download the process documents
|
|
|
2255
2489
|
|
|
2256
2490
|
**Example**
|
|
2257
2491
|
```js
|
|
2258
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2259
2492
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2260
2493
|
type: 'Docs',
|
|
2261
2494
|
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2262
2495
|
footer: 'Documento - {page} de {pages}'
|
|
2496
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2497
|
+
const api = new API();
|
|
2498
|
+
const params = {
|
|
2499
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2500
|
+
type: 'Docs',
|
|
2501
|
+
docIds: ['55e4a3bd6be6b45210833fae'],
|
|
2502
|
+
footer: 'Documento - {page} de {pages}'
|
|
2503
|
+
};
|
|
2504
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2505
|
+
const result = await api.user.process.downloadDocs(params, session);
|
|
2263
2506
|
```
|
|
2264
2507
|
<a name="Register"></a>
|
|
2265
2508
|
|
|
@@ -2283,7 +2526,12 @@ Class for user registration in a user
|
|
|
2283
2526
|
|
|
2284
2527
|
**Example**
|
|
2285
2528
|
```js
|
|
2286
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2287
2529
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2530
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2531
|
+
const api = new API();
|
|
2532
|
+
const params = {
|
|
2533
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...'
|
|
2534
|
+
};
|
|
2535
|
+
const orgname = await api.user.register.getOrgname(params);
|
|
2288
2536
|
```
|
|
2289
2537
|
<a name="Register+validateEmail"></a>
|
|
2290
2538
|
|
|
@@ -2303,7 +2551,13 @@ Method to find task by id
|
|
|
2303
2551
|
|
|
2304
2552
|
**Example**
|
|
2305
2553
|
```js
|
|
2306
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2307
2554
|
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2308
2555
|
email: 'myemail@company.com'
|
|
2556
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2557
|
+
const api = new API();
|
|
2558
|
+
const params = {
|
|
2559
|
+
registerId: 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2560
|
+
email: 'myemail@company.com'
|
|
2561
|
+
};
|
|
2562
|
+
const retData = await api.user.register.validateEmail(params);
|
|
2309
2563
|
```
|
|
2310
2564
|
<a name="Register+execute"></a>
|
|
2311
2565
|
|
|
@@ -2337,60 +2591,30 @@ Method to register a user
|
|
|
2337
2591
|
|
|
2338
2592
|
**Example**
|
|
2339
2593
|
```js
|
|
2340
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2341
2594
|
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2342
2595
|
"type": 'sign',
|
|
2343
2596
|
"login": false,
|
|
2344
2597
|
"emailInfo": {
|
|
2345
2598
|
"code": "5974",
|
|
2346
2599
|
"email": "cbtoto_1@mailinator.com"
|
|
2347
2600
|
},
|
|
2348
2601
|
"registerData": {
|
|
2349
2602
|
"name": "Augusto Totlo",
|
|
2350
2603
|
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2351
2604
|
"phone": "",
|
|
2352
2605
|
"idcard": "",
|
|
2353
2606
|
"dob": "1978-01-12T03:00:00.000Z",
|
|
2354
2607
|
"registerPassword": "123456",
|
|
2355
2608
|
"emailValidationCode": "5974",
|
|
2356
2609
|
"phoneValidationCode": "",
|
|
2357
2610
|
"language": "en-US",
|
|
2358
2611
|
"timezone": "Europe/Dublin"
|
|
2359
2612
|
}
|
|
2360
2613
|
};
|
|
2361
|
-
```
|
|
2362
|
-
<a name="TaskAvailable"></a>
|
|
2363
|
-
|
|
2364
|
-
## TaskAvailable
|
|
2365
|
-
Class for available tasks, permission user
|
|
2366
|
-
|
|
2367
|
-
**Kind**: global class
|
|
2368
|
-
|
|
2369
|
-
* [TaskAvailable](#TaskAvailable)
|
|
2370
|
-
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2371
|
-
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2372
|
-
|
|
2373
|
-
<a name="TaskAvailable+find"></a>
|
|
2374
|
-
|
|
2375
|
-
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2376
|
-
Method to find available tasks for a user
|
|
2377
|
-
|
|
2378
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2379
|
-
**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
|
|
2380
|
-
**Access**: public
|
|
2381
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2382
|
-
|
|
2383
|
-
| Param | Type | Description |
|
|
2384
|
-
| --- | --- | --- |
|
|
2385
|
-
| params | <code>object</code> | Params to get task |
|
|
2386
|
-
| params.query | <code>object</code> | Search available tasks query |
|
|
2387
|
-
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2388
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2389
|
-
|
|
2390
|
-
**Example**
|
|
2391
|
-
```js
|
|
2392
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2393
2614
|
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2394
2615
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2395
|
-
```
|
|
2396
|
-
<a name="TaskAvailable+claim"></a>
|
|
2397
|
-
|
|
2398
|
-
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2399
|
-
Method for a user to claim an available task
|
|
2400
|
-
|
|
2401
|
-
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2402
|
-
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2403
|
-
**Access**: public
|
|
2404
|
-
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2405
|
-
|
|
2406
|
-
| Param | Type | Description |
|
|
2407
|
-
| --- | --- | --- |
|
|
2408
|
-
| params | <code>object</code> | Params to get task |
|
|
2409
|
-
| params.taskId | <code>object</code> | the task id to claim |
|
|
2410
|
-
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2411
|
-
| session | <code>string</code> | Session, token JWT |
|
|
2412
|
-
|
|
2413
|
-
**Example**
|
|
2414
|
-
```js
|
|
2415
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2416
2616
|
taskId: '55e4a3bd6be6b45210833f67',
|
|
2417
2617
|
orgname: 'acme',
|
|
2618
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2619
|
+
const api = new API();
|
|
2620
|
+
const params ={
|
|
2621
|
+
"registerId": 'U2FsdGVkX1+xEq+sV6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz24O5koH+rGmdl/DjqfyWfENe5NFuQ+6xXhuOSN24Z+Topo87+e+CrRO8ox...',
|
|
2622
|
+
"type": 'sign',
|
|
2623
|
+
"login": false,
|
|
2624
|
+
"emailInfo": {
|
|
2625
|
+
"code": "5974",
|
|
2626
|
+
"email": "cbtoto_1@mailinator.com"
|
|
2627
|
+
},
|
|
2628
|
+
"registerData": {
|
|
2629
|
+
"name": "Augusto Totlo",
|
|
2630
|
+
"registerEmail": "cbtoto_1@mailinator.com",
|
|
2631
|
+
"phone": "",
|
|
2632
|
+
"idcard": "",
|
|
2633
|
+
"dob": "1978-01-12T03:00:00.000Z",
|
|
2634
|
+
"registerPassword": "123456",
|
|
2635
|
+
"emailValidationCode": "5974",
|
|
2636
|
+
"phoneValidationCode": "",
|
|
2637
|
+
"language": "en-US",
|
|
2638
|
+
"timezone": "Europe/Dublin"
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
const retData = await api.user.register.execute(params);
|
|
2418
2642
|
```
|
|
2419
2643
|
<a name="Task"></a>
|
|
2420
2644
|
|
|
@@ -2423,7 +2647,15 @@ Method to find task by id
|
|
|
2423
2647
|
|
|
2424
2648
|
**Example**
|
|
2425
2649
|
```js
|
|
2426
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2427
2650
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2428
2651
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2429
2652
|
orgId: '55e4a3bd6be6b45210833fae',
|
|
2653
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2654
|
+
const api = new API();
|
|
2655
|
+
const params = {
|
|
2656
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2657
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2658
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2659
|
+
};
|
|
2660
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2661
|
+
await api.user.task.findById(params, session);
|
|
2430
2662
|
```
|
|
2431
2663
|
<a name="Task+findByIdAndUpdate"></a>
|
|
2432
2664
|
|
|
@@ -2449,7 +2681,17 @@ Find task by id and update
|
|
|
2449
2681
|
|
|
2450
2682
|
**Example**
|
|
2451
2683
|
```js
|
|
2452
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2453
2684
|
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2454
2685
|
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2455
2686
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2456
2687
|
action: 1,
|
|
2457
2688
|
formData: {name: 'CloudBrasil'},
|
|
2689
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2690
|
+
const api = new API();
|
|
2691
|
+
const params = {
|
|
2692
|
+
userId: '5739d4c6ccb0ebc61f2a9557',
|
|
2693
|
+
processId: '5dadd01dc4af3941d42f8c5c',
|
|
2694
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2695
|
+
action: 1,
|
|
2696
|
+
formData: {name: 'CloudBrasil'},
|
|
2697
|
+
};
|
|
2698
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2699
|
+
await api.user.task.findByIdAndUpdate(params, session);
|
|
2458
2700
|
```
|
|
2459
2701
|
<a name="Task+executeActionFinalize"></a>
|
|
2460
2702
|
|
|
@@ -2471,7 +2713,83 @@ Find task by id and update
|
|
|
2471
2713
|
|
|
2472
2714
|
**Example**
|
|
2473
2715
|
```js
|
|
2474
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2475
2716
|
taskId: '5df7f19618430c89a41a19d2',
|
|
2476
2717
|
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2477
2718
|
orgId: '5df7f19618430c89a41a1bc3',
|
|
2478
2719
|
payload: {}',
|
|
2720
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2721
|
+
const api = new API();
|
|
2722
|
+
const params = {
|
|
2723
|
+
taskId: '5df7f19618430c89a41a19d2',
|
|
2724
|
+
actionGuid: 'b3823a2ae52c7a05bfb9590fe427038d'
|
|
2725
|
+
orgId: '5df7f19618430c89a41a1bc3',
|
|
2726
|
+
payload: {}',
|
|
2727
|
+
};
|
|
2728
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2729
|
+
await api.user.task.executeActionFinalize(params, session);
|
|
2730
|
+
```
|
|
2731
|
+
<a name="TaskAvailable"></a>
|
|
2732
|
+
|
|
2733
|
+
## TaskAvailable
|
|
2734
|
+
Class for available tasks, permission user
|
|
2735
|
+
|
|
2736
|
+
**Kind**: global class
|
|
2737
|
+
|
|
2738
|
+
* [TaskAvailable](#TaskAvailable)
|
|
2739
|
+
* [.find(params, session)](#TaskAvailable+find) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2740
|
+
* [.claim(params, session)](#TaskAvailable+claim) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2741
|
+
|
|
2742
|
+
<a name="TaskAvailable+find"></a>
|
|
2743
|
+
|
|
2744
|
+
### taskAvailable.find(params, session) ⇒ <code>promise</code> \| <code>number</code> \| <code>array.<object></code> \| <code>number</code> \| <code>number</code>
|
|
2745
|
+
Method to find available tasks for a user
|
|
2746
|
+
|
|
2747
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2748
|
+
**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
|
|
2749
|
+
**Access**: public
|
|
2750
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2751
|
+
|
|
2752
|
+
| Param | Type | Description |
|
|
2753
|
+
| --- | --- | --- |
|
|
2754
|
+
| params | <code>object</code> | Params to get task |
|
|
2755
|
+
| params.query | <code>object</code> | Search available tasks query |
|
|
2756
|
+
| params.orgId | <code>object</code> | Organization id (_id database) |
|
|
2757
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2758
|
+
|
|
2759
|
+
**Example**
|
|
2760
|
+
```js
|
|
2761
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2762
|
+
const api = new API();
|
|
2763
|
+
const params = {
|
|
2764
|
+
query: {"orgProcessId": {"value":"62c2d1cdfb5455c195d1baa1","oper":"=","type":"string"},"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
|
|
2765
|
+
orgId: '55e4a3bd6be6b45210833fae',
|
|
2766
|
+
};
|
|
2767
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2768
|
+
const retSearch = await api.user.task.available.find(params, session);
|
|
2769
|
+
```
|
|
2770
|
+
<a name="TaskAvailable+claim"></a>
|
|
2771
|
+
|
|
2772
|
+
### taskAvailable.claim(params, session) ⇒ <code>promise</code> \| <code>boolean</code>
|
|
2773
|
+
Method for a user to claim an available task
|
|
2774
|
+
|
|
2775
|
+
**Kind**: instance method of [<code>TaskAvailable</code>](#TaskAvailable)
|
|
2776
|
+
**Returns**: <code>promise</code> - returned data from the method call<code>boolean</code> - success true|false if the method was successful
|
|
2777
|
+
**Access**: public
|
|
2778
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
2779
|
+
|
|
2780
|
+
| Param | Type | Description |
|
|
2781
|
+
| --- | --- | --- |
|
|
2782
|
+
| params | <code>object</code> | Params to get task |
|
|
2783
|
+
| params.taskId | <code>object</code> | the task id to claim |
|
|
2784
|
+
| params.orgname | <code>object</code> | Organization slug (short name of the orgnization) |
|
|
2785
|
+
| session | <code>string</code> | Session, token JWT |
|
|
2786
|
+
|
|
2787
|
+
**Example**
|
|
2788
|
+
```js
|
|
2789
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2790
|
+
const api = new API();
|
|
2791
|
+
const params = {
|
|
2792
|
+
taskId: '55e4a3bd6be6b45210833f67',
|
|
2793
|
+
orgname: 'acme',
|
|
2794
|
+
};
|
|
2795
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2796
|
+
const success = await api.user.task.available.claim(params, session);
|
|
2479
2797
|
```
|
|
2480
2798
|
<a name="Updates"></a>
|
|
2481
2799
|
|
|
@@ -2494,7 +2812,10 @@ get updates
|
|
|
2494
2812
|
|
|
2495
2813
|
**Example**
|
|
2496
2814
|
```js
|
|
2497
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2815
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2816
|
+
const api = new API();
|
|
2817
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2818
|
+
await api.user.updates.get(session);
|
|
2498
2819
|
```
|
|
2499
2820
|
<a name="User"></a>
|
|
2500
2821
|
|
|
@@ -2529,7 +2850,14 @@ Update avatar of user by session of user not allow session user SU
|
|
|
2529
2850
|
|
|
2530
2851
|
**Example**
|
|
2531
2852
|
```js
|
|
2532
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2533
2853
|
avatar: '55e4a3bd6be6b45210833fae',
|
|
2534
2854
|
type: '123456',
|
|
2855
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2856
|
+
const api = new API();
|
|
2857
|
+
const params = {
|
|
2858
|
+
avatar: '55e4a3bd6be6b45210833fae',
|
|
2859
|
+
type: '123456',
|
|
2860
|
+
};
|
|
2861
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2862
|
+
await api.user.profile.updateAvatar(params, session);
|
|
2535
2863
|
```
|
|
2536
2864
|
<a name="User+removeAvatar"></a>
|
|
2537
2865
|
|
|
@@ -2546,7 +2874,10 @@ Remove avatar of user by session of user not allow session user SU
|
|
|
2546
2874
|
|
|
2547
2875
|
**Example**
|
|
2548
2876
|
```js
|
|
2549
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2877
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2878
|
+
const api = new API();
|
|
2879
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2880
|
+
await api.user.profile.removeAvatar(session);
|
|
2550
2881
|
```
|
|
2551
2882
|
<a name="User+removeSignature"></a>
|
|
2552
2883
|
|
|
@@ -2563,7 +2894,10 @@ Remove the signature of user by session
|
|
|
2563
2894
|
|
|
2564
2895
|
**Example**
|
|
2565
2896
|
```js
|
|
2566
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2897
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2898
|
+
const api = new API();
|
|
2899
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2900
|
+
await api.user.profile.removeSignature(session);
|
|
2567
2901
|
```
|
|
2568
2902
|
<a name="User+saveSignature"></a>
|
|
2569
2903
|
|
|
@@ -2583,7 +2917,23 @@ Sava a new signature of user by session
|
|
|
2583
2917
|
|
|
2584
2918
|
**Example**
|
|
2585
2919
|
```js
|
|
2586
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2587
2920
|
type: 'CURSIVE',
|
|
2588
2921
|
file: 'allura:Mary John Heart'
|
|
2589
2922
|
type: 'HANDWRITE',
|
|
2590
2923
|
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2924
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2925
|
+
const api = new API();
|
|
2926
|
+
const data = {
|
|
2927
|
+
type: 'CURSIVE',
|
|
2928
|
+
file: 'allura:Mary John Heart'
|
|
2929
|
+
};
|
|
2930
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2931
|
+
await api.user.profile.saveSignature(data, session);
|
|
2932
|
+
|
|
2933
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2934
|
+
const api = new API();
|
|
2935
|
+
const data = {
|
|
2936
|
+
type: 'HANDWRITE',
|
|
2937
|
+
file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
|
|
2938
|
+
};
|
|
2939
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2940
|
+
await api.user.profile.saveSignature(session);
|
|
2591
2941
|
```
|
|
2592
2942
|
<a name="User+findByIdAndUpdate"></a>
|
|
2593
2943
|
|
|
@@ -2617,7 +2967,13 @@ Update a user profile by id
|
|
|
2617
2967
|
|
|
2618
2968
|
**Example**
|
|
2619
2969
|
```js
|
|
2620
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2621
2970
|
name: 'New Name'
|
|
2971
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2972
|
+
const api = new API();
|
|
2973
|
+
const params = {
|
|
2974
|
+
name: 'New Name'
|
|
2975
|
+
};
|
|
2976
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2977
|
+
await api.user.profile.findByIdAndUpdate(params, session);
|
|
2622
2978
|
```
|
|
2623
2979
|
<a name="User+changeOrganization"></a>
|
|
2624
2980
|
|
|
@@ -2635,5 +2991,379 @@ Change a user's organization
|
|
|
2635
2991
|
|
|
2636
2992
|
**Example**
|
|
2637
2993
|
```js
|
|
2638
|
-
const API = require('@docbrasil/api-systemmanager');
|
|
2994
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2995
|
+
const api = new API();
|
|
2996
|
+
const id = '616eccaaa9360a05293b10fe';
|
|
2997
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2998
|
+
await api.user.changeOrganization.updateAvatar(id, session);
|
|
2999
|
+
```
|
|
3000
|
+
<a name="Dispatch"></a>
|
|
3001
|
+
|
|
3002
|
+
## Dispatch
|
|
3003
|
+
Api dispatch manager
|
|
3004
|
+
|
|
3005
|
+
**Kind**: global class
|
|
3006
|
+
|
|
3007
|
+
* [Dispatch](#Dispatch)
|
|
3008
|
+
* [.getContext(url, session)](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
3009
|
+
* [.getClient()](#Dispatch+getClient) ⇒ <code>promise</code>
|
|
3010
|
+
|
|
3011
|
+
<a name="Dispatch+getContext"></a>
|
|
3012
|
+
|
|
3013
|
+
### dispatch.getContext(url, session) ⇒ <code>Promise.<object></code>
|
|
3014
|
+
Get the URL context
|
|
3015
|
+
|
|
3016
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3017
|
+
**Returns**: <code>Promise.<object></code> - The full data context of the URL
|
|
3018
|
+
**Access**: public
|
|
3019
|
+
|
|
3020
|
+
| Param | Type | Default | Description |
|
|
3021
|
+
| --- | --- | --- | --- |
|
|
3022
|
+
| url | <code>string</code> | | Full url |
|
|
3023
|
+
| session | <code>session</code> | <code></code> | Session, token JWT |
|
|
3024
|
+
|
|
3025
|
+
**Example**
|
|
3026
|
+
```js
|
|
3027
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3028
|
+
const api = new API();
|
|
3029
|
+
const retContext = await api.dispatch.getContext('http://myndware.io/login/myorg);
|
|
3030
|
+
```
|
|
3031
|
+
<a name="Dispatch+getClient"></a>
|
|
3032
|
+
|
|
3033
|
+
### dispatch.getClient() ⇒ <code>promise</code>
|
|
3034
|
+
Get client Axios
|
|
3035
|
+
|
|
3036
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
3037
|
+
**Returns**: <code>promise</code> - return client axios
|
|
3038
|
+
**Access**: public
|
|
3039
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3040
|
+
**Example**
|
|
3041
|
+
```js
|
|
3042
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3043
|
+
const api = new API();
|
|
3044
|
+
await api.dispatch.getClient();
|
|
3045
|
+
```
|
|
3046
|
+
<a name="External"></a>
|
|
3047
|
+
|
|
3048
|
+
## External
|
|
3049
|
+
Class for documents, permission user
|
|
3050
|
+
|
|
3051
|
+
**Kind**: global class
|
|
3052
|
+
|
|
3053
|
+
* [External](#External)
|
|
3054
|
+
* [.context(params)](#External+context) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3055
|
+
* [.getUploadDocumentSignedUrl(mime, authorization)](#External+getUploadDocumentSignedUrl) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3056
|
+
* [.getUploadDocumentsSignedUrl(docs, authorization)](#External+getUploadDocumentsSignedUrl) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3057
|
+
* [.handle(authorization, params)](#External+handle) ⇒ <code>Promise.<boolean></code>
|
|
3058
|
+
|
|
3059
|
+
<a name="External+context"></a>
|
|
3060
|
+
|
|
3061
|
+
### external.context(params) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>array.<object></code>
|
|
3062
|
+
Create new document
|
|
3063
|
+
|
|
3064
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3065
|
+
**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
|
|
3066
|
+
The authorization is unique and is ONLY valid for this session.<code>array.<object></code> - groups the form groups to render
|
|
3067
|
+
**Access**: public
|
|
3068
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3069
|
+
|
|
3070
|
+
| Param | Type | Description |
|
|
3071
|
+
| --- | --- | --- |
|
|
3072
|
+
| params | <code>object</code> | Object for add new document |
|
|
3073
|
+
| params.id | <code>string</code> | Organization form id |
|
|
3074
|
+
|
|
3075
|
+
**Example**
|
|
3076
|
+
```js
|
|
3077
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3078
|
+
const api = new API();
|
|
3079
|
+
const params = {
|
|
3080
|
+
id: '611e679741cc63168c26d7ee'
|
|
3081
|
+
};
|
|
3082
|
+
const retForm = await api.external.context(params);
|
|
3083
|
+
```
|
|
3084
|
+
<a name="External+getUploadDocumentSignedUrl"></a>
|
|
3085
|
+
|
|
3086
|
+
### external.getUploadDocumentSignedUrl(mime, authorization) ⇒ <code>Promise.<object></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3087
|
+
Get an upload signed url, so it will be possible to upload documents temporarily during the use of the external form
|
|
3088
|
+
|
|
3089
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3090
|
+
**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
|
|
3091
|
+
**Access**: public
|
|
3092
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3093
|
+
|
|
3094
|
+
| Param | Type | Description |
|
|
3095
|
+
| --- | --- | --- |
|
|
3096
|
+
| mime | <code>string</code> | the mime type of the document |
|
|
3097
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3098
|
+
|
|
3099
|
+
**Example**
|
|
3100
|
+
```js
|
|
3101
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3102
|
+
const api = new API();
|
|
3103
|
+
const authorization = '...';
|
|
3104
|
+
const doc = {
|
|
3105
|
+
mime: 'application/pdf'
|
|
3106
|
+
};
|
|
3107
|
+
const retDoc = await api.external.getUploadDocumentSignedUrl(doc, authorization);
|
|
3108
|
+
```
|
|
3109
|
+
<a name="External+getUploadDocumentsSignedUrl"></a>
|
|
3110
|
+
|
|
3111
|
+
### external.getUploadDocumentsSignedUrl(docs, authorization) ⇒ <code>Promise.<array></code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
|
|
3112
|
+
Get an upload signed url, for many documents. So it will be possible to upload documents temporarily during the use of the external form
|
|
3113
|
+
|
|
3114
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3115
|
+
**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
|
|
3116
|
+
**Access**: public
|
|
3117
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3118
|
+
|
|
3119
|
+
| Param | Type | Description |
|
|
3120
|
+
| --- | --- | --- |
|
|
3121
|
+
| docs | <code>array.<object></code> | the list of documents |
|
|
3122
|
+
| docs.mime | <code>string</code> | the mime type of the document |
|
|
3123
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3124
|
+
|
|
3125
|
+
**Example**
|
|
3126
|
+
```js
|
|
3127
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3128
|
+
const api = new API();
|
|
3129
|
+
const authorization = '...';
|
|
3130
|
+
const docs = [
|
|
3131
|
+
{
|
|
3132
|
+
mime: 'application/pdf'
|
|
3133
|
+
}
|
|
3134
|
+
];
|
|
3135
|
+
const retDocs = await api.external.getUploadDocumentsSignedUrl(docs, authorization);
|
|
3136
|
+
```
|
|
3137
|
+
<a name="External+handle"></a>
|
|
3138
|
+
|
|
3139
|
+
### external.handle(authorization, params) ⇒ <code>Promise.<boolean></code>
|
|
3140
|
+
Handles the execution of an external form
|
|
3141
|
+
|
|
3142
|
+
**Kind**: instance method of [<code>External</code>](#External)
|
|
3143
|
+
**Returns**: <code>Promise.<boolean></code> - true|false if success
|
|
3144
|
+
**Access**: public
|
|
3145
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3146
|
+
|
|
3147
|
+
| Param | Type | Description |
|
|
3148
|
+
| --- | --- | --- |
|
|
3149
|
+
| authorization | <code>string</code> | a legal authorization |
|
|
3150
|
+
| params | <code>object</code> | the parameters to handle the execution of an external form |
|
|
3151
|
+
| params.payload | <code>array.<object></code> | the payload of the external form. It should represent the form groups of the external form |
|
|
3152
|
+
| params.payload.name | <code>string</code> | the name of the group |
|
|
3153
|
+
| params.payload.fields | <code>array.<object></code> | the fields that belong to each group |
|
|
3154
|
+
| 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 |
|
|
3155
|
+
|
|
3156
|
+
**Example**
|
|
3157
|
+
```js
|
|
3158
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3159
|
+
const api = new API();
|
|
3160
|
+
const authorization = '...';
|
|
3161
|
+
const params = {
|
|
3162
|
+
payload: [
|
|
3163
|
+
{
|
|
3164
|
+
name: 'My Group One',
|
|
3165
|
+
fields: [
|
|
3166
|
+
{}
|
|
3167
|
+
]
|
|
3168
|
+
}
|
|
3169
|
+
]
|
|
3170
|
+
};
|
|
3171
|
+
const success = await api.external.handle(params, authorization);
|
|
3172
|
+
```
|
|
3173
|
+
<a name="Login"></a>
|
|
3174
|
+
|
|
3175
|
+
## Login
|
|
3176
|
+
Login manager
|
|
3177
|
+
|
|
3178
|
+
**Kind**: global class
|
|
3179
|
+
|
|
3180
|
+
* [Login](#Login)
|
|
3181
|
+
* [.facebook(params)](#Login+facebook) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3182
|
+
* [.google(params)](#Login+google) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3183
|
+
* [.apiKey(apikey)](#Login+apiKey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3184
|
+
* [.userPass(params)](#Login+userPass) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3185
|
+
* [.logout(session)](#Login+logout) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3186
|
+
* [.recover(username)](#Login+recover) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3187
|
+
|
|
3188
|
+
<a name="Login+facebook"></a>
|
|
3189
|
+
|
|
3190
|
+
### login.facebook(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3191
|
+
Login with social login Facebook
|
|
3192
|
+
|
|
3193
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3194
|
+
**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
|
|
3195
|
+
**Access**: public
|
|
3196
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3197
|
+
|
|
3198
|
+
| Param | Type | Description |
|
|
3199
|
+
| --- | --- | --- |
|
|
3200
|
+
| params | <code>object</code> | Params to login Facebook |
|
|
3201
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3202
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3203
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3204
|
+
|
|
3205
|
+
**Example**
|
|
3206
|
+
```js
|
|
3207
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3208
|
+
|
|
3209
|
+
// Params of the instance
|
|
3210
|
+
const params = {...}
|
|
3211
|
+
const api = new API(params);
|
|
3212
|
+
const params = { accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cC...' };
|
|
3213
|
+
const { auth, user } = await api.login.facebook(params);
|
|
3214
|
+
```
|
|
3215
|
+
<a name="Login+google"></a>
|
|
3216
|
+
|
|
3217
|
+
### login.google(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3218
|
+
Login with social login Google
|
|
3219
|
+
|
|
3220
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3221
|
+
**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
|
|
3222
|
+
**Access**: public
|
|
3223
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3224
|
+
|
|
3225
|
+
| Param | Type | Description |
|
|
3226
|
+
| --- | --- | --- |
|
|
3227
|
+
| params | <code>object</code> | Params to login Google |
|
|
3228
|
+
| params.accessToken | <code>string</code> | Access token of the system manager |
|
|
3229
|
+
| params.initialUserData | <code>object</code> | Object with roles default if sigin |
|
|
3230
|
+
| params.initialUserData.externalRoles | <code>array</code> | Array with permission of user |
|
|
3231
|
+
|
|
3232
|
+
**Example**
|
|
3233
|
+
```js
|
|
3234
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3235
|
+
|
|
3236
|
+
// Params of the instance
|
|
3237
|
+
const params = {...}
|
|
3238
|
+
const api = new API(params);
|
|
3239
|
+
const accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cC...';
|
|
3240
|
+
const { auth, user } = await api.login.google(accessToken);
|
|
3241
|
+
```
|
|
3242
|
+
<a name="Login+apiKey"></a>
|
|
3243
|
+
|
|
3244
|
+
### login.apiKey(apikey) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3245
|
+
Login with apikey
|
|
3246
|
+
|
|
3247
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3248
|
+
**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
|
|
3249
|
+
**Access**: public
|
|
3250
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3251
|
+
|
|
3252
|
+
| Param | Type | Description |
|
|
3253
|
+
| --- | --- | --- |
|
|
3254
|
+
| apikey | <code>string</code> | Access key |
|
|
3255
|
+
|
|
3256
|
+
**Example**
|
|
3257
|
+
```js
|
|
3258
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3259
|
+
|
|
3260
|
+
// Params of the instance
|
|
3261
|
+
const params = {...}
|
|
3262
|
+
const api = new API(params);
|
|
3263
|
+
const apiKey = '043a0eb2-f5c3-4900-b781-7f229d00d092';
|
|
3264
|
+
const { auth, user } = await api.login.apiKey(apiKey);
|
|
3265
|
+
```
|
|
3266
|
+
<a name="Login+userPass"></a>
|
|
3267
|
+
|
|
3268
|
+
### login.userPass(params) ⇒ <code>promise.<object></code> \| <code>object</code> \| <code>object</code>
|
|
3269
|
+
Login with user and password
|
|
3270
|
+
|
|
3271
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3272
|
+
**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
|
|
3273
|
+
**Access**: public
|
|
3274
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3275
|
+
|
|
3276
|
+
| Param | Type | Description |
|
|
3277
|
+
| --- | --- | --- |
|
|
3278
|
+
| params | <code>object</code> | Object with user and password |
|
|
3279
|
+
| params.username | <code>string</code> | Username or email of the user |
|
|
3280
|
+
| params.password | <code>string</code> | Password of the user |
|
|
3281
|
+
| params.orgname | <code>string</code> | The organame of the user |
|
|
3282
|
+
|
|
3283
|
+
**Example**
|
|
3284
|
+
```js
|
|
3285
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3286
|
+
|
|
3287
|
+
// Params of the instance
|
|
3288
|
+
const params = {...}
|
|
3289
|
+
const api = new API(params);
|
|
3290
|
+
const params = {
|
|
3291
|
+
username: 'ana.silva@gmail.com',
|
|
3292
|
+
password: '123456'
|
|
3293
|
+
};
|
|
3294
|
+
const { auth, user } = await api.login.userPass(params);
|
|
3295
|
+
```
|
|
3296
|
+
<a name="Login+logout"></a>
|
|
3297
|
+
|
|
3298
|
+
### login.logout(session) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3299
|
+
Logout user system manager
|
|
3300
|
+
|
|
3301
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3302
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3303
|
+
**Access**: public
|
|
3304
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3305
|
+
|
|
3306
|
+
| Param | Type | Description |
|
|
3307
|
+
| --- | --- | --- |
|
|
3308
|
+
| session | <code>string</code> | Session, token JWT |
|
|
3309
|
+
|
|
3310
|
+
**Example**
|
|
3311
|
+
```js
|
|
3312
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3313
|
+
|
|
3314
|
+
// Params of the instance
|
|
3315
|
+
const params = {...}
|
|
3316
|
+
const api = new API(params);
|
|
3317
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3318
|
+
const { success } = await api.login.logout(session);
|
|
3319
|
+
```
|
|
3320
|
+
<a name="Login+recover"></a>
|
|
3321
|
+
|
|
3322
|
+
### login.recover(username) ⇒ <code>promise.<object></code> \| <code>boolean</code>
|
|
3323
|
+
Recover the password
|
|
3324
|
+
|
|
3325
|
+
**Kind**: instance method of [<code>Login</code>](#Login)
|
|
3326
|
+
**Returns**: <code>promise.<object></code> - } data<code>boolean</code> - data.success true|false
|
|
3327
|
+
**Access**: public
|
|
3328
|
+
**Author**: CloudBrasil <abernardo.br@gmail.com>
|
|
3329
|
+
|
|
3330
|
+
| Param | Type | Description |
|
|
3331
|
+
| --- | --- | --- |
|
|
3332
|
+
| username | <code>string</code> | The username or email |
|
|
3333
|
+
|
|
3334
|
+
**Example**
|
|
3335
|
+
```js
|
|
3336
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3337
|
+
|
|
3338
|
+
// Params of the instance
|
|
3339
|
+
const params = {...}
|
|
3340
|
+
const api = new API(params);
|
|
3341
|
+
const { success } = await api.login.recover('myusername');
|
|
3342
|
+
```
|
|
3343
|
+
<a name="Session"></a>
|
|
3344
|
+
|
|
3345
|
+
## Session
|
|
3346
|
+
Session manager of the API
|
|
3347
|
+
|
|
3348
|
+
**Kind**: global class
|
|
3349
|
+
<a name="Session+information"></a>
|
|
3350
|
+
|
|
3351
|
+
### session.information(sessionId, suSessionId) ⇒ <code>Promise</code>
|
|
3352
|
+
Show information for session, thus validating the session (Valid token JWT)
|
|
3353
|
+
|
|
3354
|
+
**Kind**: instance method of [<code>Session</code>](#Session)
|
|
3355
|
+
**Access**: public
|
|
3356
|
+
|
|
3357
|
+
| Param | Type | Default | Description |
|
|
3358
|
+
| --- | --- | --- | --- |
|
|
3359
|
+
| sessionId | <code>string</code> | | The user session (JWT Token) |
|
|
3360
|
+
| suSessionId | <code>string</code> | <code>"sessionId"</code> | Given a JWT Token of a SU (SuperAdmin), allow to check session for another user. |
|
|
3361
|
+
|
|
3362
|
+
**Example**
|
|
3363
|
+
```js
|
|
3364
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
3365
|
+
const api = new API();
|
|
3366
|
+
const sessionId = 'eyJhbFVBBiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3367
|
+
const suSessionId = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
3368
|
+
await api.session.information(sessionId, suSessionId);
|
|
2639
3369
|
```
|