@docbrasil/api-systemmanager 1.0.67 → 1.0.68
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/notification.js +5 -3
- package/dist/bundle.cjs +5 -3
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +5 -3
- package/package.json +1 -1
package/api/user/notification.js
CHANGED
|
@@ -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/dist/bundle.cjs
CHANGED
|
@@ -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;
|