Пример #1
0
        internal GitPullRequestActivityContent(JObject data, Project project, ActivityAction action)
            : base(action)
        {
            Changes = (data.Value <JArray>("changes") ?? Enumerable.Empty <object>()).Cast <JObject>()
                      .Select(x => new Change(x))
                      .ToArray();

            Repository  = new GitRepoSummary(data["repository"].ToObject <_GitRepoSummary>(), project);
            PullRequest = new PullRequestSummary(data.ToObject <_PullRequestSummary>(), Repository);

            var comment = data["comment"].ToObject <_CommentSummary>();

            if (comment?.id != default)
            {
                Comment = new CommentSummary(comment, PullRequest);
            }
        }
Пример #2
0
        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();
        }