@docbrasil/api-systemmanager 1.1.29 → 1.1.30
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/application.js +36 -0
- package/api/user/notification.js +38 -7
- package/dist/bundle.cjs +74 -7
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +52 -1
- package/docs/Application.html +246 -0
- package/docs/Notification.html +194 -2
- package/docs/user_application.js.html +36 -0
- package/docs/user_notification.js.html +38 -7
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -1367,6 +1367,11 @@ API request, user permission level
|
|
|
1367
1367
|
Class for Applications, permission user
|
|
1368
1368
|
|
|
1369
1369
|
**Kind**: global class
|
|
1370
|
+
|
|
1371
|
+
* [Application](#Application)
|
|
1372
|
+
* [.list(params, session)](#Application+list) ⇒ <code>promise</code>
|
|
1373
|
+
* [.changeApplication(params, session)](#Application+changeApplication) ⇒ <code>promise</code>
|
|
1374
|
+
|
|
1370
1375
|
<a name="Application+list"></a>
|
|
1371
1376
|
|
|
1372
1377
|
### application.list(params, session) ⇒ <code>promise</code>
|
|
@@ -1392,6 +1397,31 @@ const params = {
|
|
|
1392
1397
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1393
1398
|
await api.user.application.list(params, session);
|
|
1394
1399
|
```
|
|
1400
|
+
<a name="Application+changeApplication"></a>
|
|
1401
|
+
|
|
1402
|
+
### application.changeApplication(params, session) ⇒ <code>promise</code>
|
|
1403
|
+
Changes the application for a user in an organization
|
|
1404
|
+
|
|
1405
|
+
**Kind**: instance method of [<code>Application</code>](#Application)
|
|
1406
|
+
**Access**: public
|
|
1407
|
+
**Author**: Myndware <augusto.pissarra@myndware.com>
|
|
1408
|
+
|
|
1409
|
+
| Param | Type | Description |
|
|
1410
|
+
| --- | --- | --- |
|
|
1411
|
+
| params | <code>object</code> | Params to get task |
|
|
1412
|
+
| params.applicationId | <code>object</code> | The application id to change to |
|
|
1413
|
+
| session | <code>string</code> | Session, token JWT |
|
|
1414
|
+
|
|
1415
|
+
**Example**
|
|
1416
|
+
```js
|
|
1417
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1418
|
+
const api = new API();
|
|
1419
|
+
const params = {
|
|
1420
|
+
applicationId: '55e4a3bd6be6b45210833fae',
|
|
1421
|
+
};
|
|
1422
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1423
|
+
await api.user.application.changeApplication(params, session);
|
|
1424
|
+
```
|
|
1395
1425
|
<a name="Chart"></a>
|
|
1396
1426
|
|
|
1397
1427
|
## Chart
|
|
@@ -2463,6 +2493,7 @@ Class for user registration in a user
|
|
|
2463
2493
|
* [.getNew(session)](#Notification+getNew)
|
|
2464
2494
|
* [.getOld(session)](#Notification+getOld)
|
|
2465
2495
|
* [.setRead(params, session)](#Notification+setRead) ⇒ <code>Promise</code>
|
|
2496
|
+
* [.setReadAll(session)](#Notification+setReadAll) ⇒ <code>Promise</code>
|
|
2466
2497
|
* [.setUnread(params, session)](#Notification+setUnread) ⇒ <code>Promise</code>
|
|
2467
2498
|
|
|
2468
2499
|
<a name="Notification+tokenTypes"></a>
|
|
@@ -2542,7 +2573,7 @@ await api.user.notification.getOld(session);
|
|
|
2542
2573
|
<a name="Notification+setRead"></a>
|
|
2543
2574
|
|
|
2544
2575
|
### notification.setRead(params, session) ⇒ <code>Promise</code>
|
|
2545
|
-
Set notification as
|
|
2576
|
+
Set notification as read
|
|
2546
2577
|
|
|
2547
2578
|
**Kind**: instance method of [<code>Notification</code>](#Notification)
|
|
2548
2579
|
**Access**: public
|
|
@@ -2564,6 +2595,26 @@ const params = {
|
|
|
2564
2595
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2565
2596
|
await api.user.notification.setRead(params, session);
|
|
2566
2597
|
```
|
|
2598
|
+
<a name="Notification+setReadAll"></a>
|
|
2599
|
+
|
|
2600
|
+
### notification.setReadAll(session) ⇒ <code>Promise</code>
|
|
2601
|
+
Set all notification of the logged user as read
|
|
2602
|
+
|
|
2603
|
+
**Kind**: instance method of [<code>Notification</code>](#Notification)
|
|
2604
|
+
**Access**: public
|
|
2605
|
+
**Author**: Myndware <augusto.pissarra@myndware.com>
|
|
2606
|
+
|
|
2607
|
+
| Param | Type | Description |
|
|
2608
|
+
| --- | --- | --- |
|
|
2609
|
+
| session | <code>string</code> | JWT Token |
|
|
2610
|
+
|
|
2611
|
+
**Example**
|
|
2612
|
+
```js
|
|
2613
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
2614
|
+
const api = new API();
|
|
2615
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2616
|
+
await api.user.notification.setReadAll(session);
|
|
2617
|
+
```
|
|
2567
2618
|
<a name="Notification+setUnread"></a>
|
|
2568
2619
|
|
|
2569
2620
|
### notification.setUnread(params, session) ⇒ <code>Promise</code>
|
package/docs/Application.html
CHANGED
|
@@ -224,6 +224,252 @@
|
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
|
|
227
|
+
<h4 class="name" id="changeApplication">
|
|
228
|
+
<a class="href-link" href="#changeApplication">#</a>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<span class='tag'>async</span>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
<span class="code-name">
|
|
235
|
+
|
|
236
|
+
changeApplication<span class="signature">(params, session)</span><span class="type-signature"> → {promise}</span>
|
|
237
|
+
|
|
238
|
+
</span>
|
|
239
|
+
</h4>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
<div class="description">
|
|
245
|
+
Changes the application for a user in an organization
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
<h5>Parameters:</h5>
|
|
258
|
+
|
|
259
|
+
<div class="table-container">
|
|
260
|
+
<table class="params table">
|
|
261
|
+
<thead>
|
|
262
|
+
<tr>
|
|
263
|
+
|
|
264
|
+
<th>Name</th>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
<th>Type</th>
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<th class="last">Description</th>
|
|
274
|
+
</tr>
|
|
275
|
+
</thead>
|
|
276
|
+
|
|
277
|
+
<tbody>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<tr class="deep-level-0">
|
|
282
|
+
|
|
283
|
+
<td class="name"><code>params</code></td>
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
<td class="type">
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
<code class="param-type">object</code>
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
</td>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<td class="description last">Params to get task</td>
|
|
300
|
+
</tr>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
<tr class="deep-level-1">
|
|
306
|
+
|
|
307
|
+
<td class="name"><code>applicationId</code></td>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<td class="type">
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
<code class="param-type">object</code>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
</td>
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
<td class="description last">The application id to change to</td>
|
|
324
|
+
</tr>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
<tr class="deep-level-0">
|
|
333
|
+
|
|
334
|
+
<td class="name"><code>session</code></td>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
<td class="type">
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
<code class="param-type">string</code>
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
</td>
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
<td class="description last">Session, token JWT</td>
|
|
351
|
+
</tr>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
</tbody>
|
|
356
|
+
</table>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
<dl class="details">
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
<dt class="tag-author">Author:</dt>
|
|
383
|
+
<dd class="tag-author">
|
|
384
|
+
<ul>
|
|
385
|
+
<li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
|
|
386
|
+
</ul>
|
|
387
|
+
</dd>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
<p class="tag-source">
|
|
403
|
+
<a href="user_application.js.html" class="button">View Source</a>
|
|
404
|
+
<span>
|
|
405
|
+
<a href="user_application.js.html">user/application.js</a>, <a href="user_application.js.html#line106">line 106</a>
|
|
406
|
+
</span>
|
|
407
|
+
</p>
|
|
408
|
+
|
|
409
|
+
</dl>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
<div class='columns method-parameter'>
|
|
429
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
430
|
+
<div class="column is-10">
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
<div class="columns">
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
<div class='column is-5 has-text-left'>
|
|
438
|
+
<label>Type: </label>
|
|
439
|
+
|
|
440
|
+
<code class="param-type">promise</code>
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
</div>
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
</div>
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
<h5>Example</h5>
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
458
|
+
const api = new API();
|
|
459
|
+
const params = {
|
|
460
|
+
applicationId: '55e4a3bd6be6b45210833fae',
|
|
461
|
+
};
|
|
462
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
463
|
+
await api.user.application.changeApplication(params, session);</code></pre>
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<div class="member">
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
227
473
|
<h4 class="name" id="list">
|
|
228
474
|
<a class="href-link" href="#list">#</a>
|
|
229
475
|
|
package/docs/Notification.html
CHANGED
|
@@ -946,7 +946,7 @@ await api.user.notification.getOld(session);</code></pre>
|
|
|
946
946
|
|
|
947
947
|
|
|
948
948
|
<div class="description">
|
|
949
|
-
Set notification as
|
|
949
|
+
Set notification as read
|
|
950
950
|
</div>
|
|
951
951
|
|
|
952
952
|
|
|
@@ -1168,6 +1168,198 @@ await api.user.notification.setRead(params, session);</code></pre>
|
|
|
1168
1168
|
|
|
1169
1169
|
|
|
1170
1170
|
|
|
1171
|
+
</div>
|
|
1172
|
+
|
|
1173
|
+
<div class="member">
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
<h4 class="name" id="setReadAll">
|
|
1178
|
+
<a class="href-link" href="#setReadAll">#</a>
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
<span class='tag'>async</span>
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
<span class="code-name">
|
|
1185
|
+
|
|
1186
|
+
setReadAll<span class="signature">(session)</span><span class="type-signature"> → {Promise}</span>
|
|
1187
|
+
|
|
1188
|
+
</span>
|
|
1189
|
+
</h4>
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
<div class="description">
|
|
1195
|
+
Set all notification of the logged user as read
|
|
1196
|
+
</div>
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
<h5>Parameters:</h5>
|
|
1208
|
+
|
|
1209
|
+
<div class="table-container">
|
|
1210
|
+
<table class="params table">
|
|
1211
|
+
<thead>
|
|
1212
|
+
<tr>
|
|
1213
|
+
|
|
1214
|
+
<th>Name</th>
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
<th>Type</th>
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
<th class="last">Description</th>
|
|
1224
|
+
</tr>
|
|
1225
|
+
</thead>
|
|
1226
|
+
|
|
1227
|
+
<tbody>
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
<tr class="deep-level-0">
|
|
1232
|
+
|
|
1233
|
+
<td class="name"><code>session</code></td>
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
<td class="type">
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
<code class="param-type">string</code>
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
</td>
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
<td class="description last">JWT Token</td>
|
|
1250
|
+
</tr>
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
</tbody>
|
|
1255
|
+
</table>
|
|
1256
|
+
</div>
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
<dl class="details">
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
<dt class="tag-author">Author:</dt>
|
|
1282
|
+
<dd class="tag-author">
|
|
1283
|
+
<ul>
|
|
1284
|
+
<li><a href="mailto:augusto.pissarra@myndware.com">Myndware</a></li>
|
|
1285
|
+
</ul>
|
|
1286
|
+
</dd>
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
<p class="tag-source">
|
|
1302
|
+
<a href="user_notification.js.html" class="button">View Source</a>
|
|
1303
|
+
<span>
|
|
1304
|
+
<a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#line202">line 202</a>
|
|
1305
|
+
</span>
|
|
1306
|
+
</p>
|
|
1307
|
+
|
|
1308
|
+
</dl>
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
<div class='columns method-parameter'>
|
|
1328
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
1329
|
+
<div class="column is-10">
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
<div class="columns">
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
<div class='column is-5 has-text-left'>
|
|
1337
|
+
<label>Type: </label>
|
|
1338
|
+
|
|
1339
|
+
<code class="param-type">Promise</code>
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
</div>
|
|
1343
|
+
|
|
1344
|
+
</div>
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
</div>
|
|
1348
|
+
</div>
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
<h5>Example</h5>
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
1357
|
+
const api = new API();
|
|
1358
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1359
|
+
await api.user.notification.setReadAll(session);</code></pre>
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1171
1363
|
</div>
|
|
1172
1364
|
|
|
1173
1365
|
<div class="member">
|
|
@@ -1352,7 +1544,7 @@ await api.user.notification.setRead(params, session);</code></pre>
|
|
|
1352
1544
|
<p class="tag-source">
|
|
1353
1545
|
<a href="user_notification.js.html" class="button">View Source</a>
|
|
1354
1546
|
<span>
|
|
1355
|
-
<a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#
|
|
1547
|
+
<a href="user_notification.js.html">user/notification.js</a>, <a href="user_notification.js.html#line238">line 238</a>
|
|
1356
1548
|
</span>
|
|
1357
1549
|
</p>
|
|
1358
1550
|
|
|
@@ -171,6 +171,42 @@ class Application {
|
|
|
171
171
|
throw ex;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
177
|
+
* @description Changes the application for a user in an organization
|
|
178
|
+
* @param {object} params Params to get task
|
|
179
|
+
* @param {object} params.applicationId The application id to change to
|
|
180
|
+
* @param {string} session Session, token JWT
|
|
181
|
+
* @returns {promise}
|
|
182
|
+
* @public
|
|
183
|
+
* @example
|
|
184
|
+
*
|
|
185
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
186
|
+
* const api = new API();
|
|
187
|
+
* const params = {
|
|
188
|
+
* applicationId: '55e4a3bd6be6b45210833fae',
|
|
189
|
+
* };
|
|
190
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
191
|
+
* await api.user.application.changeApplication(params, session);
|
|
192
|
+
*/
|
|
193
|
+
async changeApplication(params, session) {
|
|
194
|
+
const self = this;
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
Joi.assert(params, Joi.object().required(), 'Params to get task');
|
|
198
|
+
Joi.assert(params.applicationId, Joi.string().required(), 'The application id');
|
|
199
|
+
Joi.assert(session, Joi.string().required(), 'Session token JWT');
|
|
200
|
+
|
|
201
|
+
const { orgId} = params;
|
|
202
|
+
const apiCall = self._client
|
|
203
|
+
.put('/organizations/applications/change', { applicationId: params.applicationId }, self._setHeader(session));
|
|
204
|
+
|
|
205
|
+
return self._returnData(await apiCall);
|
|
206
|
+
} catch (ex) {
|
|
207
|
+
throw ex;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
174
210
|
}
|
|
175
211
|
|
|
176
212
|
export default Application;
|
|
@@ -238,7 +238,7 @@ class Notification {
|
|
|
238
238
|
|
|
239
239
|
/**
|
|
240
240
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
241
|
-
* @description Set notification as
|
|
241
|
+
* @description Set notification as read
|
|
242
242
|
* @param {object} params Params to update the notification
|
|
243
243
|
* @param {string} params.id Notification Id
|
|
244
244
|
* @param {string} session JWT Token
|
|
@@ -257,14 +257,14 @@ class Notification {
|
|
|
257
257
|
*/
|
|
258
258
|
async setRead(params = {}, session) {
|
|
259
259
|
const self = this;
|
|
260
|
-
|
|
260
|
+
|
|
261
261
|
try {
|
|
262
262
|
Joi.assert(params, Joi.object().required());
|
|
263
263
|
Joi.assert(params.id, Joi.string().required());
|
|
264
264
|
Joi.assert(session, Joi.string().required());
|
|
265
|
-
|
|
265
|
+
|
|
266
266
|
const {id} = params;
|
|
267
|
-
|
|
267
|
+
|
|
268
268
|
const apiCall = self._client.put(`/organizations/notifications/${id}/read`, {}, self._setHeader(session));
|
|
269
269
|
return self._returnData(await apiCall);
|
|
270
270
|
} catch (ex) {
|
|
@@ -272,6 +272,37 @@ class Notification {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
/**
|
|
276
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
277
|
+
* @description Set all notification of the logged user as read
|
|
278
|
+
* @param {string} session JWT Token
|
|
279
|
+
* @return {Promise}
|
|
280
|
+
* @public
|
|
281
|
+
* @async
|
|
282
|
+
* @example
|
|
283
|
+
*
|
|
284
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
285
|
+
* const api = new API();
|
|
286
|
+
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
287
|
+
* await api.user.notification.setReadAll(session);
|
|
288
|
+
*/
|
|
289
|
+
async setReadAll(session) {
|
|
290
|
+
const self = this;
|
|
291
|
+
|
|
292
|
+
try {
|
|
293
|
+
Joi.assert(params, Joi.object().required());
|
|
294
|
+
Joi.assert(params.id, Joi.string().required());
|
|
295
|
+
Joi.assert(session, Joi.string().required());
|
|
296
|
+
|
|
297
|
+
const {id} = params;
|
|
298
|
+
|
|
299
|
+
const apiCall = self._client.put(`/organizations/notifications/read/all`, {}, self._setHeader(session));
|
|
300
|
+
return self._returnData(await apiCall);
|
|
301
|
+
} catch (ex) {
|
|
302
|
+
throw ex;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
275
306
|
/**
|
|
276
307
|
* @author Myndware <augusto.pissarra@myndware.com>
|
|
277
308
|
* @description Set notification as unreaded
|
|
@@ -293,14 +324,14 @@ class Notification {
|
|
|
293
324
|
*/
|
|
294
325
|
async setUnread(params = {}, session) {
|
|
295
326
|
const self = this;
|
|
296
|
-
|
|
327
|
+
|
|
297
328
|
try {
|
|
298
329
|
Joi.assert(params, Joi.object().required());
|
|
299
330
|
Joi.assert(params.id, Joi.string().required());
|
|
300
331
|
Joi.assert(session, Joi.string().required());
|
|
301
|
-
|
|
332
|
+
|
|
302
333
|
const {id} = params;
|
|
303
|
-
|
|
334
|
+
|
|
304
335
|
const apiCall = self._client.put(`/organizations/notifications/${id}/unread`, {}, self._setHeader(session));
|
|
305
336
|
return self._returnData(await apiCall);
|
|
306
337
|
} catch (ex) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.30",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|