internal TicketActivityContent(JObject data, ActivityAction action) : base(action) { if (action == ActivityAction.MultiUpdated) { TransactionId = data.Value <int>("tx_id"); Tickets = (data.Value <JArray>("link") ?? Enumerable.Empty <object>()).Cast <JObject>() .Select(x => new TicketSummary(new _TicketSummary() { id = x.Value <int>("id"), keyId = x.Value <int>("key_id"), summary = x.Value <string>("title"), })) .ToArray(); } else { Ticket = new TicketSummary(new _TicketSummary() { id = data.Value <int>("id"), keyId = data.Value <int>("key_id"), summary = data.Value <string>("summary"), description = data.Value <string>("description"), }); } var comment = data.Value <JObject>("comment")?.ToObject <_CommentSummary>(); if (comment?.id != default) { Comment = new CommentSummary(comment, Ticket); } Attachments = (data.Value <JArray>("attachments") ?? Enumerable.Empty <object>()).Cast <JObject>() .Select(x => new AttachmentSummary(x.ToObject <_Attachment>())) .ToArray(); Changes = (data.Value <JArray>("changes") ?? Enumerable.Empty <object>()).Cast <JObject>() .Select(x => new Change(x)) .ToArray(); }
internal CommentSummary(_CommentSummary data, TicketSummary ticket) : base(data.id) { Content = data.content; Ticket = ticket; }