예제 #1
0
 /// <summary>
 /// Loads the issue from its github api json representation
 /// </summary>
 /// <param name="jsonIssue">The github api json representation</param>
 public override void LoadFromJson(JObject jsonIssue)
 {
     IsOpen = jsonIssue["state"].Value<string>() == "open";
     Title = jsonIssue["title"].Value<string>();
     Body = jsonIssue["body"].Value<string>();
     Number = jsonIssue["number"].Value<int>();
     HtmlUrl = jsonIssue["html_url"].Value<string>();
     labels.Clear();
     var labelsJArray = jsonIssue["labels"] as JArray;
     if (labelsJArray != null) labels.AddRange(GitLabel.LoadFromJson(labelsJArray, Repos));
     var userJObject = jsonIssue["user"] as JObject;
     User = null;
     if (userJObject != null)
     {
         User = new GitUser(Repos);
         User.LoadFromJson(userJObject);
     }
     var assigneeJObject = jsonIssue["assignee"] as JObject;
     Assignee = null;
     if (assigneeJObject != null)
     {
         Assignee = new GitUser(Repos);
         Assignee.LoadFromJson(assigneeJObject);
     }
     var milestoneJObject = jsonIssue["milestone"] as JObject;
     Milestone = null;
     if (milestoneJObject != null)
     {
         Milestone = new GitMilestone(Repos);
         Milestone.LoadFromJson(milestoneJObject);
     }
 }
예제 #2
0
        /// <summary>
        /// Load the milestone from its github api json representation.
        /// </summary>
        /// <param name="json">The github api json representation</param>
        public override void LoadFromJson(JObject json)
        {
            Number = json["number"] != null ? json["number"].Value<int>() : -1;
            Title = json["title"] != null ? json["title"].Value<string>() : "";
            Description = json["description"] != null ? json["description"].Value<string>() : "";
            var creatorJObject = json["creator"] as JObject;
            Creator = null;
            if (creatorJObject != null)
            {
                Creator = new GitUser(repos);
                Creator.LoadFromJson(creatorJObject);
            }

            DueOn = GetJsonValue<DateTime?>(json, "due_on", null);

            //if (json["due_on"] != null) DueOn = json["due_on"].Value<DateTime>();
        }
예제 #3
0
 /// <summary>
 /// Load the comment from its github api json representation.
 /// </summary>
 /// <param name="json">The github api json representation</param>
 public override void LoadFromJson(JObject json)
 {
     Id = json["id"] != null ? json["id"].Value<int>() : -1;
     Body = json["body"] != null ? json["body"].Value<string>() : "";
     var userJObject = json["user"] as JObject;
     User = null;
     if (userJObject != null)
     {
         User = new GitUser(Issue);
         User.LoadFromJson(userJObject);
     }
     CreatedAt = null;
     if (json["created_at"] != null) CreatedAt = json["created_at"].Value<DateTime>();
     UpdatedAt = null;
     if (json["updated_at"] != null) UpdatedAt = json["updated_at"].Value<DateTime>();
 }