@docbrasil/api-systemmanager 1.1.17 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.project ADDED
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>api-systemmanager</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ </buildSpec>
9
+ <natures>
10
+ </natures>
11
+ </projectDescription>
package/api/user/help.js CHANGED
@@ -49,7 +49,8 @@ class Help {
49
49
 
50
50
  /**
51
51
  * @author Augusto Pissarra <abernardo.br@gmail.com>
52
- * @description get heps topics
52
+ * @description get help topics for a user. Either by organizaiton product or by supplied filter. But always only the user language.
53
+ * @param {object} filter a filter to apply. if empty, null or undefined, than we will bring the help topics by organizaiton product.
53
54
  * @param {string} session JWT token
54
55
  * @public
55
56
  * @async
@@ -58,15 +59,19 @@ class Help {
58
59
  * const API = require('@docbrasil/api-systemmanager');
59
60
  * const api = new API();
60
61
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
61
- * await api.user.help.getTopics(session);
62
+ * await api.user.help.getTopics({}, session);
62
63
  */
63
- async getTopics(session) {
64
+ async getTopics(filter = {}, session) {
64
65
  const self = this;
65
66
 
66
67
  try {
67
68
  Joi.assert(session, Joi.string().required(), 'SM session (JWT) to call API');
68
-
69
- const apiCall = self._client.get('/help/topics', self._setHeader(session));
69
+ let query = '';
70
+ if(!_.isEmpty(filter)) {
71
+ const queryFilter = JSON.stringify(filter);
72
+ query = `?filter=${queryFilter.toString('base64')}`;
73
+ }
74
+ const apiCall = self._client.get(`/help/topics${query}`, self._setHeader(session));
70
75
  return self._returnData(await apiCall);
71
76
  } catch (ex) {
72
77
  throw ex;
@@ -65,7 +65,7 @@ class MyTasks {
65
65
  * const API = require('@docbrasil/api-systemmanager');
66
66
  * const api = new API();
67
67
  * const params = {
68
- * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
68
+ * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20, filter: {checklistsTags:['checklist']}},
69
69
  * orgId: '55e4a3bd6be6b45210833fae',
70
70
  * };
71
71
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
package/dist/bundle.cjs CHANGED
@@ -2211,7 +2211,7 @@ class MyTasks {
2211
2211
  * const API = require('@docbrasil/api-systemmanager');
2212
2212
  * const api = new API();
2213
2213
  * const params = {
2214
- * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20},
2214
+ * query: {"s":[{"historyBegin":{"order":"desc"}}],"i":1,"p":20, filter: {checklistsTags:['checklist']}},
2215
2215
  * orgId: '55e4a3bd6be6b45210833fae',
2216
2216
  * };
2217
2217
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
@@ -10354,7 +10354,8 @@ class Help {
10354
10354
 
10355
10355
  /**
10356
10356
  * @author Augusto Pissarra <abernardo.br@gmail.com>
10357
- * @description get heps topics
10357
+ * @description get help topics for a user. Either by organizaiton product or by supplied filter. But always only the user language.
10358
+ * @param {object} filter a filter to apply. if empty, null or undefined, than we will bring the help topics by organizaiton product.
10358
10359
  * @param {string} session JWT token
10359
10360
  * @public
10360
10361
  * @async
@@ -10363,15 +10364,19 @@ class Help {
10363
10364
  * const API = require('@docbrasil/api-systemmanager');
10364
10365
  * const api = new API();
10365
10366
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
10366
- * await api.user.help.getTopics(session);
10367
+ * await api.user.help.getTopics({}, session);
10367
10368
  */
10368
- async getTopics(session) {
10369
+ async getTopics(filter = {}, session) {
10369
10370
  const self = this;
10370
10371
 
10371
10372
  try {
10372
10373
  Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'SM session (JWT) to call API');
10373
-
10374
- const apiCall = self._client.get('/help/topics', self._setHeader(session));
10374
+ let query = '';
10375
+ if(!___default["default"].isEmpty(filter)) {
10376
+ const queryFilter = JSON.stringify(filter);
10377
+ query = `?filter=${queryFilter.toString('base64')}`;
10378
+ }
10379
+ const apiCall = self._client.get(`/help/topics${query}`, self._setHeader(session));
10375
10380
  return self._returnData(await apiCall);
10376
10381
  } catch (ex) {
10377
10382
  throw ex;