@docbrasil/api-systemmanager 1.0.82 → 1.0.84

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.
@@ -47,6 +47,30 @@ class AdminNotification {
47
47
  };
48
48
  }
49
49
 
50
+ /**
51
+ * @description Send real time notification
52
+ * @param {object} params Params to send notification
53
+ * @param {string} params.userIds Users to send notification
54
+ * @param {object} params.message Object with data to send user
55
+ * @param {object} session Session, token JWT
56
+ * @returns {Promise<*>}
57
+ */
58
+ async realTime(params, session) {
59
+ const self = this;
60
+
61
+ try {
62
+ Joi.assert(params, Joi.object().required(), 'Object with params to add notifications');
63
+ Joi.assert(params.userIds, Joi.array().required(), 'OrgId of the user SU');
64
+ Joi.assert(params.message, Joi.object().required(), 'Object with data to send user');
65
+ Joi.assert(session, Joi.string().required(), 'Session, token JWT');
66
+
67
+ const apiCall = self.client.post(`/admin/send/notifications`, params, self._setHeader(session));
68
+ return self._returnData(await apiCall);
69
+ } catch (ex) {
70
+ throw ex;
71
+ }
72
+ }
73
+
50
74
  /**
51
75
  * @author CloudBrasil <abernardo.br@gmail.com>
52
76
  * @description Create notification
@@ -3,7 +3,7 @@ import Boom from '@hapi/boom';
3
3
  import Joi from 'joi';
4
4
 
5
5
  /**
6
- * Class for user datasource access, to be used with documents
6
+ * Class for user datasource access, to be used with when creating new documents
7
7
  * @class
8
8
  */
9
9
  class Datasource {
@@ -84,7 +84,7 @@ class Datasource {
84
84
  try {
85
85
  Joi.assert(params, Joi.object().required(), 'Params to get task');
86
86
  Joi.assert(params.orgId, Joi.string().required(), 'The organization _id is required');
87
- Joi.assert(params.dataSources, Joi.object().required(), 'Datasources is required');
87
+ Joi.assert(params.dataSources, Joi.array().required(), 'Datasources is required');
88
88
  Joi.assert(params.documents, Joi.array().required(), ' Documents is required');
89
89
 
90
90
  const {
package/dist/bundle.cjs CHANGED
@@ -9110,7 +9110,7 @@ class Notification {
9110
9110
  }
9111
9111
 
9112
9112
  /**
9113
- * Class for user datasource access, to be used with documents
9113
+ * Class for user datasource access, to be used with when creating new documents
9114
9114
  * @class
9115
9115
  */
9116
9116
  class Datasource {
@@ -9191,7 +9191,7 @@ class Datasource {
9191
9191
  try {
9192
9192
  Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to get task');
9193
9193
  Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'The organization _id is required');
9194
- Joi__default["default"].assert(params.dataSources, Joi__default["default"].object().required(), 'Datasources is required');
9194
+ Joi__default["default"].assert(params.dataSources, Joi__default["default"].array().required(), 'Datasources is required');
9195
9195
  Joi__default["default"].assert(params.documents, Joi__default["default"].array().required(), ' Documents is required');
9196
9196
 
9197
9197
  const {
@@ -9792,6 +9792,30 @@ class AdminNotification {
9792
9792
  };
9793
9793
  }
9794
9794
 
9795
+ /**
9796
+ * @description Send real time notification
9797
+ * @param {object} params Params to send notification
9798
+ * @param {string} params.userIds Users to send notification
9799
+ * @param {object} params.message Object with data to send user
9800
+ * @param {object} session Session, token JWT
9801
+ * @returns {Promise<*>}
9802
+ */
9803
+ async realTime(params, session) {
9804
+ const self = this;
9805
+
9806
+ try {
9807
+ Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Object with params to add notifications');
9808
+ Joi__default["default"].assert(params.userIds, Joi__default["default"].array().required(), 'OrgId of the user SU');
9809
+ Joi__default["default"].assert(params.message, Joi__default["default"].object().required(), 'Object with data to send user');
9810
+ Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session, token JWT');
9811
+
9812
+ const apiCall = self.client.post(`/admin/send/notifications`, params, self._setHeader(session));
9813
+ return self._returnData(await apiCall);
9814
+ } catch (ex) {
9815
+ throw ex;
9816
+ }
9817
+ }
9818
+
9795
9819
  /**
9796
9820
  * @author CloudBrasil <abernardo.br@gmail.com>
9797
9821
  * @description Create notification