diff --git a/src/Zirconium/Core/Models/BaseMessage.cs b/src/Zirconium/Core/Models/BaseMessage.cs index 209b461..da5803a 100644 --- a/src/Zirconium/Core/Models/BaseMessage.cs +++ b/src/Zirconium/Core/Models/BaseMessage.cs @@ -1,15 +1,51 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Zirconium.Core.Models { public class BaseMessage { - public string ID {get; set;} - public string MessageType {get; set;} - public string From {get; set;} - public string To {get; set;} - public bool Ok {get; set;} - public string AuthToken {get; set;} - public IDictionary Payload {get; set;} + [JsonProperty("id")] + public string ID { get; set; } + + [JsonProperty("type")] + public string MessageType { get; set; } + + [JsonProperty("from")] + public string From { get; set; } + + [JsonProperty("to")] + public string To { get; set; } + + [JsonProperty("ok")] + public bool Ok { get; set; } + + [JsonProperty("authToken")] + public string AuthToken { get; set; } + + [JsonProperty("payload")] + public IDictionary Payload { get; set; } + + public BaseMessage() { } + + public BaseMessage(BaseMessage message, bool reply) + { + ID = message.ID; + MessageType = message.MessageType; + if (reply) + { + From = message.To; + To = message.From; + } + else + { + From = message.From; + To = message.To; + } + + Ok = message.Ok; + AuthToken = message.AuthToken; + Payload = message.Payload; + } } } \ No newline at end of file diff --git a/src/Zirconium/Core/Models/ProtocolError.cs b/src/Zirconium/Core/Models/ProtocolError.cs new file mode 100644 index 0000000..074e45f --- /dev/null +++ b/src/Zirconium/Core/Models/ProtocolError.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Zirconium.Core.Models +{ + public class ProtocolError + { + [JsonProperty("errCode")] + public string ErrCode { get; set; } + + [JsonProperty("errText")] + public string ErrText { get; set; } + + [JsonProperty("errPayload")] + public IDictionary ErrPayload { get; set; } + } +} \ No newline at end of file