import { Logger } from "../common/Logger"; export {}; import { Alert, AlertsData } from '../common/models/Alert'; import { EventEmitter } from "events"; import { Core } from "../Core"; import { AlertDevice, AlertDevicesData } from "../common/models/AlertDevice"; import { AlertTemplate, AlertTemplatesData } from "../common/models/AlertTemplate"; import { AlertFilter, AlertFiltersData } from "../common/models/AlertFilter"; import { GenericService } from "./GenericService"; declare class AlertsService extends GenericService { private _alertEventHandler; private _alertHandlerToken; private readonly delayToSendReceiptReceived; private readonly delayToSendReceiptRead; private delayInfoLoggued; static getClassName(): string; getClassName(): string; static getAccessorName(): string; getAccessorName(): string; constructor(_core: Core, _eventEmitter: EventEmitter, logger: Logger, _startConfig: { start_up: boolean; optional: boolean; }); start(_options: any): Promise; stop(): Promise; init(useRestAtStartup: boolean): Promise; private attachHandlers; reconnect(): Promise; /** * @private * @method markAlertMessageAsReceived * @instance * @async * @category Mark as Received / Read * @param {string} jid The Jid of the sender * @param {string} messageXmppId the Xmpp Id of the alert message * @description * Mark as Received the specified alert message
* @return {Promise} the result of the operation. */ markAlertMessageAsReceived(jid: string, messageXmppId: string): Promise; /** * @public * @nodered true * @method markAlertMessageAsRead * @instance * @async * @category Mark as Received / Read * @param {string} jid The Jid of the sender * @param {string} messageXmppId the Xmpp Id of the alert message * @description * Mark as Read the specified alert message
* @return {Promise} the result of the operation. */ markAlertMessageAsRead(jid: string, messageXmppId: string): Promise; /** * @public * @nodered true * @method createDevice * @instance * @async * @category DEVICE * @param {AlertDevice} device Device to create. * @description * Create a device which can receive Alerts(notifications) from the server
* AlertDevice.jid_im cannot be specified, it's always the Jid of the current user.
* if AlertDevice.jid_resource cannot be specified, it's always the Jid_resource of the current user.
* if AlertDevice.type is not specified, automatically it's set to "desktop"
* @return {Promise} the result of the operation. */ createDevice(device: AlertDevice): Promise; /** * @public * @nodered true * @method updateDevice * @instance * @async * @category DEVICE * @param {AlertDevice} device Device to Update. * @description * Update a device which can receive Alerts(notifications) from the server
* AlertDevice.CompanyId cannot be specified, it's always the Compnay of the current user
* AlertDevice.Jid_im cannot be specified, it's always the Jid of the current user: Contacts.GetCurrentContactJid()
* AlertDevice.Jid_resource cannot be specified, it's always the Jid_resource of the current user: Application.GetResourceId()
* if AlertDevice.Type is not specified, automatically it's set to "desktop"
* @return {Promise} the result of the operation.
*/ updateDevice(device: AlertDevice): Promise; private createOrUpdateDevice; /** * @public * @nodered true * @method deleteDevice * @instance * @async * @category DEVICE * @param {AlertDevice} device Device to delete. * @description * Delete a device (using its id)
* @return {Promise} the result of the operation. */ deleteDevice(device: AlertDevice): Promise; /** * @public * @nodered true * @method getDevice * @instance * @async * @category DEVICE * @param {string} deviceId Id of the device. * @description * Get a device using its Id
* @return {Promise} the result of the operation. */ getDevice(deviceId: string): Promise; /** * @public * @nodered true * @method getDevices * @instance * @async * @category DEVICE * @param {string} companyId Allows to filter device list on the companyId provided in this option. (optional) If companyId is not provided, the devices linked to all the companies that the administrator manage are returned. * @param {string} userId Allows to filter device list on the userId provided in this option. (optional) If the user has no admin rights, this filter is forced to the logged in user's id (i.e. the user can only list is own devices). * @param {string} deviceName Allows to filter device list on the name provided in this option. (optional) The filtering is case insensitive and on partial name match: all devices containing the provided name value will be returned(whatever the position of the match). Ex: if filtering is done on My, devices with the following names are match the filter 'My device', 'My phone', 'This is my device', ... * @param {string} type Allows to filter device list on the type provided in this option. (optional, exact match, case sensitive). * @param {string} tag Allows to filter device list on the tag provided in this option. (optional, exact match, case sensitive). * @param {number} offset=0 Allow to specify the position of first device to retrieve (default value is 0 for the first device). Warning: if offset > total, no results are returned. * @param {number} limit=100 Allow to specify the number of devices to retrieve. * @description * Get list of devices
* @return {Promise} the result of the operation. */ getDevices(companyId: string, userId: string, deviceName: string, type: string, tag: string, offset?: number, limit?: number): Promise; /** * @public * @nodered true * @method getDevicesTags * @instance * @async * @category DEVICE * @param {string} companyId Allows to list the tags set for devices associated to the companyIds provided in this option. (optional) If companyId is not provided, the tags being set for devices linked to all the companies that the administrator manage are returned. * @description * Get list of all tags being assigned to devices of the compagnies managed by the administrator
* @return {Promise} the result of the operation. */ getDevicesTags(companyId: string): Promise; /** * @public * @nodered true * @method renameDevicesTags * @instance * @async * @category DEVICE * @param {string} tag tag to rename. * @param {string} companyId Allows to rename a tag for the devices being in the companyIds provided in this option.
* If companyId is not provided, the tag is renamed for all the devices linked to all the companies that the administrator manage. * @param {string} newTagName New tag name. (Body Parameters) * @description * This API can be used to rename a tag being assigned to some devices of the companies managed by the administrator. * @return {Promise} the result of the operation. */ renameDevicesTags(newTagName: string, tag: string, companyId: string): Promise; /** * @public * @nodered true * @method deleteDevicesTags * @instance * @async * @category DEVICE * @param {string} tag tag to rename. * @param {string} companyId Allows to remove a tag from the devices being in the companyIds provided in this option..
* If companyId is not provided, the tag is deleted from all the devices linked to all the companies that the administrator manage. * @description * This API can be used to remove a tag being assigned to some devices of the companies managed by the administrator. * @return {Promise} the result of the operation. */ deleteDevicesTags(tag: string, companyId: string): Promise; /** * @public * @nodered true * @method getstatsTags * @instance * @async * @category DEVICE * @param {string} companyId Allows to compute the tags statistics for the devices associated to the companyIds provided in this option.
* if companyId is not provided, the tags statistics are computed for all the devices being in all the companies managed by the logged in administrator. * @description * This API can be used to list all the tags being assigned to the devices of the companies managed by the administrator, with the number of devices for each tags. * @return {Promise} the result of the operation. */ getstatsTags(companyId: string): Promise; /** * @public * @nodered true * @method createTemplate * @instance * @async * @category TEMPLATE * @param {AlertTemplate} template Template to create. * @description * Create a template
* @return {Promise} the result of the operation. */ createTemplate(template: AlertTemplate): Promise; /** * @public * @nodered true * @method updateTemplate * @instance * @async * @category TEMPLATE * @param {AlertTemplate} template Template to Update. * @description * Update a template
* @return {Promise} the result of the operation. */ updateTemplate(template: AlertTemplate): Promise; private createOrUpdateTemplate; /** * @public * @nodered true * @method deleteTemplate * @instance * @async * @category TEMPLATE * @param {AlertTemplate} template Template to Delete. * @description * Delete a template
* @return {Promise} the result of the operation. */ deleteTemplate(template: AlertTemplate): Promise; /** * @public * @nodered true * @method getTemplate * @instance * @async * @category TEMPLATE * @param {string} templateId Id of the template. * @description * Get an template by id
* @return {Promise} the result of the operation. */ getTemplate(templateId: string): Promise; /** * @public * @nodered true * @method getTemplates * @instance * @async * @category TEMPLATE * @param {string} companyId Id of the company (optional). * @param {number} offset=0 Offset to use to retrieve templates - if offset > total, no result is returned. * @param {number} limit=100 Limit of templates to retrieve (100 by default). * @description * Get templates
* @return {Promise} the result of the operation. */ getTemplates(companyId: string, offset?: number, limit?: number): Promise; /** * @public * @nodered true * @method createFilter * @instance * @async * @category FILTERS * @param {AlertFilter} filter Filter to create. * @description * Create a filter
* @return {Promise} the result of the operation. */ createFilter(filter: AlertFilter): Promise; /** * @public * @method updateFilter * @instance * @async * @category FILTERS * @param {AlertFilter} filter Filter to Update. * @description * Update a filter
* @return {Promise} the result of the operation. */ updateFilter(filter: AlertFilter): Promise; createOrUpdateFilter(create: boolean, filter: AlertFilter): Promise; /** * @public * @nodered true * @method deleteFilter * @instance * @async * @category FILTERS * @param {AlertFilter} filter Filter to Delete. * @description * Delete a filter
* @return {Promise} the result of the operation. */ deleteFilter(filter: AlertFilter): Promise; /** * @public * @nodered true * @method getFilter * @instance * @async * @category FILTERS * @param {string} filterId Id of the Filter. * @description * Get an filter by id
* @return {Promise} the result of the operation. */ getFilter(filterId: string): Promise; /** * @public * @nodered true * @method getFilters * @instance * @async * @category FILTERS * @param {number} offset=0 Offset to use to retrieve filters - if offset > total, no result is returned. * @param {number} limit=100 Limit of filters to retrieve (100 by default). * @description * Get filters : have required role(s) superadmin, admin
* @return {Promise} the result of the operation. */ getFilters(offset?: number, limit?: number): Promise; /** * @public * @nodered true * @method createAlert * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {Alert} alert Alert to send. * @description * To create an alert. The alert will be sent using the StartDate of the Alert object (so it's possible to set it in future).
* The alert will be received by devices according the filter id and the company id used.
* The content of the alert is based on the template id.
* @return {Promise} the result of the operation. */ createAlert(alert: Alert): Promise; /** * @public * @nodered true * @method updateAlert * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {Alert} alert Alert to update. * @description * To update an existing alert. The alert will be sent using the StartDate of the Alert object (so it's possible to set it in future).
* The alert will be received by devices according the filter id and the company id used.
* The content of the alert is based on the template id.
* Note : if no expirationDate is provided, then the validity is one day from the API call.
* @return {Promise} the result of the operation. */ updateAlert(alert: Alert): Promise; createOrUpdateAlert(create: boolean, alert: Alert): Promise; /** * @public * @nodered true * @method deleteAlert * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {Alert} alert Alert to Delete. * @description * Delete an alert
* All the data related to this notification are deleted, including the reports
* @return {Promise} the result of the operation. */ deleteAlert(alert: Alert): Promise; /** * @public * @nodered true * @method getAlert * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {string} alertId Id of the alert. * @description * Get an alert by id
* @return {Promise} the result of the operation. */ getAlert(alertId: string): Promise; /** * @public * @nodered true * @method getAlerts * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {number} offset=0 Offset to use to retrieve Alerts - if offset > total, no result is returned. * @param {number} limit=100 Limit of Alerts to retrieve (100 by default). * @description * Get alerts : required role(s) superadmin,support,admin
* @return {Promise} the result of the operation. */ getAlerts(offset?: number, limit?: number): Promise; /** * @public * @nodered true * @method sendAlertFeedback * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {string} deviceId Id of the device. * @param {string} alertId Id of the alert. * @param {string} answerId Id of the answer. * @description * To send a feedback from an alert.
* To be used by end-user who has received the alert
* @return {Promise} the result of the operation. */ sendAlertFeedback(deviceId: string, alertId: string, answerId: string): Promise; /** * @public * @nodered true * @method getAlertFeedbackSentForANotificationMessage * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {string} notificationHistoryId notification history unique identifier. notificationHistoryId corresponds to the id in the history Array of the messages sent for the related notification.. * @description * This API allows to list the feedback sent by the devices for a given notification message (identified by its notification history's id).
* @return {Promise} the result of the operation. * { * fromCreationDate optionnel Date-Time Allows to filter feedback submitted from provided date (ISO 8601 format).
* toCreationDate optionnel Date-Time Allows to filter feedback submitted until provided date (ISO 8601 format).
* format optionnel String Allows to retrieve more or less feedback details in response.
* - small: id notificationId notificationHistoryId device.id creationDate
* - medium: id notificationId notificationHistoryId device.id device.name creationDate data
* - full: id notificationId companyId notificationHistoryId device.id device.name device.type device.userId device.jid_im device.jid_resource creationDate data (default value : small. Possible values : small, medium, full)
* limit optionnel Number Allow to specify the number of feedback to retrieve. (default value : 100)
* offset optionnel Number Allow to specify the position of first feedback to retrieve (first feedback if not specified). Warning: if offset > total, no results are returned. (default value : 0)
* sortField optionnel String Sort feedback list based on the creationDate field (date when the feedback submitted by the device has been received by Rainbow servers). (default value : creationDate. Possible values : creationDate)
* sortOrder optionnel Number Specify order when sorting feedback list. (default value : 1. Possible values : -1, 1)
* } */ getAlertFeedbackSentForANotificationMessage(notificationHistoryId: string): Promise; /** * @public * @nodered true * @method getAlertFeedbackSentForAnAlert * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {string} alertId Id of the alert. * @description * This API allows to list the feedback sent by the devices for a given notification.
* @return {Promise} the result of the operation. * { * fromCreationDate optionnel Date-Time Allows to filter feedback submitted from provided date (ISO 8601 format).
* toCreationDate optionnel Date-Time Allows to filter feedback submitted until provided date (ISO 8601 format).
* format optionnel String Allows to retrieve more or less feedback details in response.
* - small: id notificationId notificationHistoryId device.id creationDate
* - medium: id notificationId notificationHistoryId device.id device.name creationDate data
* - full: id notificationId companyId notificationHistoryId device.id device.name device.type device.userId device.jid_im device.jid_resource creationDate data (default value : small. Possible values : small, medium, full)
* limit optionnel Number Allow to specify the number of feedback to retrieve. (default value : 100)
* offset optionnel Number Allow to specify the position of first feedback to retrieve (first feedback if not specified). Warning: if offset > total, no results are returned. (default value : 0)
* sortField optionnel String Sort feedback list based on the creationDate field (date when the feedback submitted by the device has been received by Rainbow servers). (default value : creationDate. Possible values : creationDate)
* sortOrder optionnel Number Specify order when sorting feedback list. (default value : 1. Possible values : -1, 1)
* } */ getAlertFeedbackSentForAnAlert(alertId: string): Promise; /** * @public * @nodered true * @method getAlertStatsFeedbackSentForANotificationMessage * @instance * @async * @category CREATE / UPDATE / DELETE / GET / FEEDBACK ALERTS * @param {string} notificationHistoryId notification history unique identifier. notificationHistoryId corresponds to the id in the history Array of the messages sent for the related notification. * @description * This API can be used to list all distinct feedback data submitted by the devices for a given notification message (identified by its notification history's id), with the number of devices for each distinct submitted feedback data.
* @return {Promise} the result of the operation. * { * stats Object[] List of feedback data submitted by the devices for this given notification message
* data String data submitted by the devices
* count String Number of devices having submitted this given data
* } */ getAlertStatsFeedbackSentForANotificationMessage(notificationHistoryId: string): Promise; /** * @public * @nodered true * @method getReportSummary * @instance * @async * @category REPORTS * @param {string} alertId Id of the alert. * @description * Allow to retrieve the list of summary reports of an alert (initial alert plus alerts update if any).
* @return {Promise} the result of the operation. */ getReportSummary(alertId: string): Promise; /** * @public * @nodered true * @method getReportDetails * @instance * @async * @category REPORTS * @param {string} alertId Id of the alert. * @description * Allow to retrieve detail the list of detail reports of a alert (initial alert plus alerts update if any).
* @return {Promise} the result of the operation. */ getReportDetails(alertId: string): Promise; /** * @public * @nodered true * @method getReportComplete * @instance * @async * @category REPORTS * @param {string} alertId Id of the alert. * @description * Allows to get the fileDescriptor storing the detailed CSV report of the notification.
*
* The detailed CSV report is generated when one of the APIs getReportSummary or GET getReportDetails is called while the state of the notification message process has reached a final state:
*
* completed: all the devices targeted by the notification have been notified and have acknowledged the reception of the message,
* expired: some devices targeted by the notification haven't acknowledged the reception of the message but the notification expiration date has been reached,
* cancelled: some devices targeted by the notification haven't acknowledged the reception of the message but the notification status has been set to terminated.
*
* The generated detailed CSV report is stored in Rainbow filestorage backend. The fileDescriptor identifier returned by this API can then be used to download it using the Rainbow filestorage API GET /api/rainbow/fileserver/v1.0/files/:fileId
* The detailed CSV report contains the following columns:
* DeviceName,DeviceID,Domain_Username,IpAddress,MacAddress,sent,received,read,feedback,notificationId.
* @return {Promise} the result of the operation. */ getReportComplete(alertId: string): Promise; } export { AlertsService };