Skip to content

Commit

Permalink
[feat] Add Rocket & Eyes reactions to ReactionSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
Misha-133 authored Jan 16, 2024
1 parent b57cc53 commit 4254287
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
24 changes: 23 additions & 1 deletion Octokit.Tests/Models/IssueTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,19 @@ public void CanBeDeserialized()
""type"": ""User"",
""site_admin"": false,
},
""active_lock_reason"": null
""active_lock_reason"": null,
""reactions"": {
""url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"",
""total_count"": 5,
""+1"": 1,
""-1"": 2,
""laugh"": 0,
""hooray"": 0,
""confused"": 0,
""heart"": 0,
""rocket"": 1,
""eyes"": 1
}
}";
var serializer = new SimpleJsonSerializer();

Expand All @@ -132,6 +144,16 @@ public void CanBeDeserialized()
Assert.Equal("octocat", issue.User.Login);
Assert.Equal("bug", issue.Labels.First().Name);
Assert.Null(issue.ActiveLockReason);

Assert.Equal(5, issue.Reactions.TotalCount);
Assert.Equal(1, issue.Reactions.Plus1);
Assert.Equal(2, issue.Reactions.Minus1);
Assert.Equal(0, issue.Reactions.Laugh);
Assert.Equal(0, issue.Reactions.Hooray);
Assert.Equal(0, issue.Reactions.Confused);
Assert.Equal(0, issue.Reactions.Heart);
Assert.Equal(1, issue.Reactions.Rocket);
Assert.Equal(1, issue.Reactions.Eyes);
}

public class TheToUpdateMethod
Expand Down
12 changes: 9 additions & 3 deletions Octokit/Models/Response/ReactionSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ReactionSummary
{
public ReactionSummary() { }

public ReactionSummary(int totalCount, int plus1, int minus1, int laugh, int confused, int heart, int hooray, string url)
public ReactionSummary(int totalCount, int plus1, int minus1, int laugh, int confused, int heart, int hooray, int eyes, int rocket, string url)
{
TotalCount = totalCount;
Plus1 = plus1;
Expand All @@ -19,6 +19,8 @@ public ReactionSummary(int totalCount, int plus1, int minus1, int laugh, int con
Heart = heart;
Hooray = hooray;
Url = url;
Eyes = eyes;
Rocket = rocket;
}

public int TotalCount { get; private set; }
Expand All @@ -30,6 +32,8 @@ public ReactionSummary(int totalCount, int plus1, int minus1, int laugh, int con
public int Confused { get; private set; }
public int Heart { get; private set; }
public int Hooray { get; private set; }
public int Eyes { get; private set; }
public int Rocket { get; private set; }
public string Url { get; private set; }

internal string DebuggerDisplay
Expand All @@ -38,14 +42,16 @@ internal string DebuggerDisplay
{
return string.Format(
CultureInfo.InvariantCulture,
"TotalCount: {0} +1: {1} -1: {2} Laugh: {3} Confused: {4} Heart: {5} Hooray: {6}",
"TotalCount: {0} +1: {1} -1: {2} Laugh: {3} Confused: {4} Heart: {5} Hooray: {6} Eyes: {7} Rocket: {8}",
TotalCount,
Plus1,
Minus1,
Laugh,
Confused,
Heart,
Hooray);
Hooray,
Eyes,
Rocket);
}
}
}
Expand Down

0 comments on commit 4254287

Please sign in to comment.