diff --git a/UptimeSharp/IUptimeClient.cs b/UptimeSharp/IUptimeClient.cs index be23ef9..93e03dd 100644 --- a/UptimeSharp/IUptimeClient.cs +++ b/UptimeSharp/IUptimeClient.cs @@ -1,4 +1,8 @@ using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using UptimeSharp.Models; namespace UptimeSharp { @@ -20,5 +24,168 @@ namespace UptimeSharp /// The pre request callback. /// Action PreRequest { get; set; } + + + #region Monitors + /// + /// Retrieves specified monitors from UptimeRobot + /// + /// The monitor IDs. + /// The custom uptime ratio. + /// if set to true [show log]. + /// if set to true [show alerts]. + /// The cancellation token. + /// + /// Monitor List + /// + /// + Task> GetMonitors( + string[] monitorIDs = null, + float[] customUptimeRatio = null, + bool showLog = false, + bool showAlerts = true, + CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Retrieves a monitor from UptimeRobot + /// + /// a specific monitor ID + /// The custom uptime ratio. + /// if set to true [show log]. + /// if set to true [show alerts]. + /// The cancellation token. + /// + /// The Monitor + /// + /// + Task GetMonitor( + string monitorId, + float[] customUptimeRatio = null, + bool showLog = false, + bool showAlerts = true, + CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes a monitor + /// + /// a specific monitor ID + /// + /// Success state + /// + /// + Task DeleteMonitor(string monitorId, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes a monitor + /// + /// The monitor. + /// + /// Success state + /// + /// + Task DeleteMonitor(Models.Monitor monitor, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Creates a monitor. + /// + /// The name of the new monitor. + /// The URI or IP to watch. + /// The type of the monitor. + /// The subtype of the monitor (if port). + /// The port (only for Subtype.Custom). + /// The keyword value. + /// Type of the keyword. + /// An ID list of existing alerts to notify. + /// The HTTP username. + /// The HTTP password. + /// The cancellation token. + /// + /// New Monitor (without details) + /// + /// + Task AddMonitor( + string name, + string target, + Models.Type type = Models.Type.HTTP, + Subtype subtype = Subtype.Unknown, + int? port = null, + string keywordValue = null, + KeywordType keywordType = KeywordType.Unknown, + string[] alerts = null, + string HTTPUsername = null, + string HTTPPassword = null, + CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Edits a monitor. + /// + /// The monitor. + /// The cancellation token. + /// + /// Success state + /// + /// + Task ModifyMonitor(Models.Monitor monitor, CancellationToken cancellationToken = default(CancellationToken)); + #endregion + + + #region Alerts + /// + /// Retrieves alerts from UptimeRobot + /// + /// Retrieve specified alert contacts by supplying IDs for them. + /// The cancellation token. + /// + /// + Task> GetAlerts(string[] alertIDs = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Retrieves an alert from UptimeRobot + /// + /// The alertID. + /// The cancellation token. + /// + /// + Task GetAlert(string alertID, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Adds an alert. + /// mobile/SMS alert contacts are not supported yet, see: http://www.uptimerobot.com/api.asp#methods + /// + /// The type. + /// The value. + /// The cancellation token. + /// + /// AlertType.SMS and AlertType.Twitter are not supported by the UptimeRobot API + Task AddAlert(AlertType type, string value, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Adds an alert. + /// mobile/SMS alert contacts are not supported yet, see: http://www.uptimerobot.com/api.asp#methods + /// + /// The alert. + /// The cancellation token. + /// + /// + Task AddAlert(Alert alert, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Removes an alert. + /// + /// The alert ID. + /// The cancellation token. + /// + /// + Task DeleteAlert(string alertID, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Removes an alert. + /// + /// The alert. + /// The cancellation token. + /// + /// + Task DeleteAlert(Alert alert, CancellationToken cancellationToken = default(CancellationToken)); + #endregion } }