@docbrasil/api-systemmanager 1.0.67 → 1.0.70

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/login.js CHANGED
@@ -173,7 +173,7 @@ class Login {
173
173
  *
174
174
  * const API = require('@docbrasil/api-systemmanager');
175
175
  *
176
- * // Params of the instance
176
+ * // Params of the instance
177
177
  * const params = {...}
178
178
  * const api = new API(params);
179
179
  * const params = {
@@ -64,6 +64,7 @@ class Notification {
64
64
  * @param {object} params Params to add notification token
65
65
  * @param {string} params.token The token
66
66
  * @param {object} params.type The token type
67
+ * @param {string} session Is token JWT of user NOT allow SU
67
68
  * @returns {promise<object>} data
68
69
  * @returns {boolean} data._id the id of the added token
69
70
  * @public
@@ -71,13 +72,14 @@ class Notification {
71
72
  *
72
73
  * const API = require('@docbrasil/api-systemmanager');
73
74
  * const api = new API();
75
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
74
76
  * const params = {
75
77
  * token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
76
78
  * type: 'FCM_WEB'
77
79
  * };
78
- * const retData = await api.user.notification.addToken(params);
80
+ * const retData = await api.user.notification.addToken(params, session);
79
81
  */
80
- async addToken(params = {}) {
82
+ async addToken(params = {}, session) {
81
83
  const self = this;
82
84
 
83
85
  try {
@@ -86,7 +88,7 @@ class Notification {
86
88
  Joi.assert(params.type, Joi.string().required(), ' The token type');
87
89
 
88
90
  const apiCall = self._client
89
- .put(`/users/notifications/token`, params);
91
+ .put(`/users/notifications/token`, params, self._setHeader(session));
90
92
 
91
93
  const retData = self._returnData(await apiCall);
92
94
  return retData;
package/api/user/user.js CHANGED
@@ -186,7 +186,7 @@ class User {
186
186
  Joi.assert(data.file, Joi.string().required());
187
187
  Joi.assert(session, Joi.string().required());
188
188
 
189
- const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
189
+ const apiCall = self._client.put(`/users/signature`, data, self._setHeader(session));
190
190
  return self._returnData(await apiCall);
191
191
  } catch (ex) {
192
192
  throw ex;
package/dist/bundle.cjs CHANGED
@@ -362,7 +362,7 @@ class Login {
362
362
  *
363
363
  * const API = require('@docbrasil/api-systemmanager');
364
364
  *
365
- * // Params of the instance
365
+ * // Params of the instance
366
366
  * const params = {...}
367
367
  * const api = new API(params);
368
368
  * const params = {
@@ -1837,7 +1837,7 @@ class User {
1837
1837
  Joi__default["default"].assert(data.file, Joi__default["default"].string().required());
1838
1838
  Joi__default["default"].assert(session, Joi__default["default"].string().required());
1839
1839
 
1840
- const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
1840
+ const apiCall = self._client.put(`/users/signature`, data, self._setHeader(session));
1841
1841
  return self._returnData(await apiCall);
1842
1842
  } catch (ex) {
1843
1843
  throw ex;
@@ -8932,6 +8932,7 @@ class Notification {
8932
8932
  * @param {object} params Params to add notification token
8933
8933
  * @param {string} params.token The token
8934
8934
  * @param {object} params.type The token type
8935
+ * @param {string} session Is token JWT of user NOT allow SU
8935
8936
  * @returns {promise<object>} data
8936
8937
  * @returns {boolean} data._id the id of the added token
8937
8938
  * @public
@@ -8939,13 +8940,14 @@ class Notification {
8939
8940
  *
8940
8941
  * const API = require('@docbrasil/api-systemmanager');
8941
8942
  * const api = new API();
8943
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
8942
8944
  * const params = {
8943
8945
  * token: 'V6OSBr4aEVoiE9H1b4xzLe+vqmXB+ShVNc/FvJGxnIz4tZv6jBJkk4aQzz2',
8944
8946
  * type: 'FCM_WEB'
8945
8947
  * };
8946
- * const retData = await api.user.notification.addToken(params);
8948
+ * const retData = await api.user.notification.addToken(params, session);
8947
8949
  */
8948
- async addToken(params = {}) {
8950
+ async addToken(params = {}, session) {
8949
8951
  const self = this;
8950
8952
 
8951
8953
  try {
@@ -8954,7 +8956,7 @@ class Notification {
8954
8956
  Joi__default["default"].assert(params.type, Joi__default["default"].string().required(), ' The token type');
8955
8957
 
8956
8958
  const apiCall = self._client
8957
- .put(`/users/notifications/token`, params);
8959
+ .put(`/users/notifications/token`, params, self._setHeader(session));
8958
8960
 
8959
8961
  const retData = self._returnData(await apiCall);
8960
8962
  return retData;