-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Net; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace IronSharp.IronMQ | ||
{ | ||
public class Alert | ||
{ | ||
public Alert() : this(AlertType.Fixed, AlertDirection.Asc, null, null) | ||
{ | ||
} | ||
|
||
public Alert(AlertType type, AlertDirection direction, int? trigger, string queue) | ||
{ | ||
Type = type; | ||
Direction = direction; | ||
Trigger = trigger; | ||
Queue = queue; | ||
} | ||
|
||
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("snooze", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public int? Snooze { get; set; } | ||
|
||
[JsonProperty("queue", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public string Queue { get; set; } | ||
|
||
[JsonProperty("trigger", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public int? Trigger { get; set; } | ||
|
||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Include)] | ||
public AlertType Type { get; set; } | ||
|
||
[JsonProperty("direction", DefaultValueHandling = DefaultValueHandling.Include)] | ||
public AlertDirection Direction { get; set; } | ||
|
||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public string Status { get; set; } | ||
|
||
[JsonProperty("status_code", DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
protected int? Code { get; set; } | ||
|
||
[JsonIgnore] | ||
public HttpStatusCode StatusCode | ||
{ | ||
get { return (HttpStatusCode) Code.GetValueOrDefault(200); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using IronSharp.Core; | ||
using Newtonsoft.Json; | ||
|
||
namespace IronSharp.IronMQ | ||
{ | ||
public class AlertCollection : IInspectable | ||
{ | ||
[JsonProperty("alerts", DefaultValueHandling = DefaultValueHandling.Ignore)] private List<Alert> _alerts; | ||
|
||
public AlertCollection() | ||
{ | ||
} | ||
|
||
public AlertCollection(Alert alert) : this(new[] {alert}) | ||
{ | ||
} | ||
|
||
public AlertCollection(IEnumerable<Alert> alerts) | ||
{ | ||
foreach (Alert alert in alerts) | ||
{ | ||
Alerts.Add(alert); | ||
} | ||
} | ||
|
||
[JsonIgnore] | ||
public List<Alert> Alerts | ||
{ | ||
get { return LazyInitializer.EnsureInitialized(ref _alerts); } | ||
set { _alerts = value; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace IronSharp.IronMQ | ||
{ | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum AlertDirection | ||
{ | ||
[EnumMember(Value = "asc")] | ||
Asc, | ||
[EnumMember(Value = "desc")] | ||
Desc | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace IronSharp.IronMQ | ||
{ | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum AlertType | ||
{ | ||
[EnumMember(Value = "fixed")] | ||
Fixed, | ||
[EnumMember(Value = "progressive")] | ||
Progressive | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters