Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Add Rocket & Eyes reactions to ReactionSummary #2847

Merged
merged 3 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading