zoho cliq code style

pull/2377/head
panos 2 years ago
parent 73bfdb9ef9
commit 68bc7ac421

@ -44,7 +44,6 @@ class ZohoCliq extends NotificationProvider {
monitorName, monitorName,
monitorUrl, monitorUrl,
}) => { }) => {
const payload = ["### Uptime Kuma\n"]; const payload = ["### Uptime Kuma\n"];
payload.push(this._statusMessageFactory(status, monitorName)); payload.push(this._statusMessageFactory(status, monitorName));
payload.push(`*Description:* ${monitorMessage}`); payload.push(`*Description:* ${monitorMessage}`);
@ -74,7 +73,15 @@ class ZohoCliq extends NotificationProvider {
return this._sendNotification(webhookUrl, payload); return this._sendNotification(webhookUrl, payload);
}; };
_monitorUrlFactory = (monitorJSON) => { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
try {
if (heartbeatJSON == null) {
await this._handleGeneralNotification(notification.webhookUrl, msg);
return okMsg;
}
let url; let url;
switch(monitorJSON["type"]) { switch(monitorJSON["type"]) {
case "http": case "http":
@ -88,22 +95,11 @@ class ZohoCliq extends NotificationProvider {
url = monitorJSON["hostname"]; url = monitorJSON["hostname"];
break; break;
} }
return url;
};
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
try {
if (heartbeatJSON == null) {
await this._handleGeneralNotification(notification.webhookUrl, msg);
return okMsg;
}
const payload = this._notificationPayloadFactory({ const payload = this._notificationPayloadFactory({
monitorMessage: heartbeatJSON.msg, monitorMessage: heartbeatJSON.msg,
monitorName: monitorJSON.name, monitorName: monitorJSON.name,
monitorUrl: this._monitorUrlFactory(monitorJSON), monitorUrl: url,
status: heartbeatJSON.status, status: heartbeatJSON.status,
}); });

Loading…
Cancel
Save