Skip to content
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
9 changes: 8 additions & 1 deletion src/main/java/org/kohsuke/github/ReactionContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
* @see GHReaction
*/
public enum ReactionContent {
PLUS_ONE("+1"), MINUS_ONE("-1"), LAUGH("laugh"), CONFUSED("confused"), HEART("heart"), HOORAY("hooray");
PLUS_ONE("+1"),
MINUS_ONE("-1"),
LAUGH("laugh"),
CONFUSED("confused"),
HEART("heart"),
HOORAY("hooray"),
ROCKET("rocket"),
EYES("eyes");

private final String content;

Expand Down
53 changes: 49 additions & 4 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -874,15 +874,60 @@ public void checkToString() throws Exception {
public void reactions() throws Exception {
GHIssue i = gitHub.getRepository("github-api/github-api").getIssue(311);

List<GHReaction> l;
// retrieval
GHReaction r = i.listReactions().iterator().next();
assertThat(r.getUser().getLogin(), is("kohsuke"));
assertThat(r.getContent(), is(ReactionContent.HEART));
l = i.listReactions().asList();
assertThat(l.size(), equalTo(1));

assertThat(l.get(0).getUser().getLogin(), is("kohsuke"));
assertThat(l.get(0).getContent(), is(ReactionContent.HEART));

// CRUD
GHReaction a = i.createReaction(ReactionContent.HOORAY);
GHReaction a;
a = i.createReaction(ReactionContent.HOORAY);
assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(a.getContent(), is(ReactionContent.HOORAY));
a.delete();

l = i.listReactions().asList();
assertThat(l.size(), equalTo(1));

a = i.createReaction(ReactionContent.PLUS_ONE);
assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(a.getContent(), is(ReactionContent.PLUS_ONE));

a = i.createReaction(ReactionContent.CONFUSED);
assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(a.getContent(), is(ReactionContent.CONFUSED));

a = i.createReaction(ReactionContent.EYES);
assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(a.getContent(), is(ReactionContent.EYES));

a = i.createReaction(ReactionContent.ROCKET);
assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(a.getContent(), is(ReactionContent.ROCKET));

l = i.listReactions().asList();
assertThat(l.size(), equalTo(5));
assertThat(l.get(0).getUser().getLogin(), is("kohsuke"));
assertThat(l.get(0).getContent(), is(ReactionContent.HEART));
assertThat(l.get(1).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(l.get(1).getContent(), is(ReactionContent.PLUS_ONE));
assertThat(l.get(2).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(l.get(2).getContent(), is(ReactionContent.CONFUSED));
assertThat(l.get(3).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(l.get(3).getContent(), is(ReactionContent.EYES));
assertThat(l.get(4).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
assertThat(l.get(4).getContent(), is(ReactionContent.ROCKET));

l.get(1).delete();
l.get(2).delete();
l.get(3).delete();
l.get(4).delete();

l = i.listReactions().asList();
assertThat(l.size(), equalTo(1));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,48 @@
"releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}",
"deployments_url": "https://api.github.com/repos/github-api/github-api/deployments",
"created_at": "2010-04-19T04:13:03Z",
"updated_at": "2019-10-25T01:32:16Z",
"pushed_at": "2019-10-25T16:41:09Z",
"updated_at": "2020-02-23T02:42:15Z",
"pushed_at": "2020-02-23T02:48:53Z",
"git_url": "git://github.com/github-api/github-api.git",
"ssh_url": "git@github.com:github-api/github-api.git",
"clone_url": "https://github.com/github-api/github-api.git",
"svn_url": "https://github.com/github-api/github-api",
"homepage": "http://github-api.kohsuke.org/",
"size": 13494,
"stargazers_count": 565,
"watchers_count": 565,
"homepage": "https://github-api.kohsuke.org/",
"size": 19552,
"stargazers_count": 613,
"watchers_count": 613,
"language": "Java",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": true,
"forks_count": 433,
"forks_count": 456,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 64,
"open_issues_count": 57,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"forks": 433,
"open_issues": 64,
"watchers": 565,
"forks": 456,
"open_issues": 57,
"watchers": 613,
"default_branch": "master",
"permissions": {
"admin": true,
"push": true,
"pull": true
},
"temp_clone_token": "",
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"delete_branch_on_merge": false,
"organization": {
"login": "github-api",
"id": 54909825,
Expand All @@ -125,6 +127,6 @@
"type": "Organization",
"site_admin": false
},
"network_count": 433,
"subscribers_count": 48
"network_count": 456,
"subscribers_count": 47
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": 63220306,
"node_id": "MDg6UmVhY3Rpb242MzIyMDMwNg==",
"user": {
"login": "bitwiseman",
"id": 1958953,
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bitwiseman",
"html_url": "https://github.com/bitwiseman",
"followers_url": "https://api.github.com/users/bitwiseman/followers",
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
"repos_url": "https://api.github.com/users/bitwiseman/repos",
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
"type": "User",
"site_admin": false
},
"content": "eyes",
"created_at": "2020-02-23T03:15:56Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": 63220307,
"node_id": "MDg6UmVhY3Rpb242MzIyMDMwNw==",
"user": {
"login": "bitwiseman",
"id": 1958953,
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bitwiseman",
"html_url": "https://github.com/bitwiseman",
"followers_url": "https://api.github.com/users/bitwiseman/followers",
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
"repos_url": "https://api.github.com/users/bitwiseman/repos",
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
"type": "User",
"site_admin": false
},
"content": "rocket",
"created_at": "2020-02-23T03:15:57Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": 63220305,
"node_id": "MDg6UmVhY3Rpb242MzIyMDMwNQ==",
"user": {
"login": "bitwiseman",
"id": 1958953,
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bitwiseman",
"html_url": "https://github.com/bitwiseman",
"followers_url": "https://api.github.com/users/bitwiseman/followers",
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
"repos_url": "https://api.github.com/users/bitwiseman/repos",
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
"type": "User",
"site_admin": false
},
"content": "confused",
"created_at": "2020-02-23T03:15:56Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"id": 5037900,
"node_id": "MDg6UmVhY3Rpb241MDM3OTAw",
"user": {
"login": "kohsuke",
"id": 50003,
"node_id": "MDQ6VXNlcjUwMDAz",
"avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/kohsuke",
"html_url": "https://github.com/kohsuke",
"followers_url": "https://api.github.com/users/kohsuke/followers",
"following_url": "https://api.github.com/users/kohsuke/following{/other_user}",
"gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}",
"starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions",
"organizations_url": "https://api.github.com/users/kohsuke/orgs",
"repos_url": "https://api.github.com/users/kohsuke/repos",
"events_url": "https://api.github.com/users/kohsuke/events{/privacy}",
"received_events_url": "https://api.github.com/users/kohsuke/received_events",
"type": "User",
"site_admin": false
},
"content": "heart",
"created_at": "2016-11-17T02:40:15Z"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": 63220303,
"node_id": "MDg6UmVhY3Rpb242MzIyMDMwMw==",
"user": {
"login": "bitwiseman",
"id": 1958953,
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/bitwiseman",
"html_url": "https://github.com/bitwiseman",
"followers_url": "https://api.github.com/users/bitwiseman/followers",
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
"repos_url": "https://api.github.com/users/bitwiseman/repos",
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
"type": "User",
"site_admin": false
},
"content": "+1",
"created_at": "2020-02-23T03:15:55Z"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": 54107401,
"node_id": "MDg6UmVhY3Rpb241NDEwNzQwMQ==",
"id": 63220302,
"node_id": "MDg6UmVhY3Rpb242MzIyMDMwMg==",
"user": {
"login": "bitwiseman",
"id": 1958953,
Expand All @@ -22,5 +22,5 @@
"site_admin": false
},
"content": "hooray",
"created_at": "2019-10-26T01:27:43Z"
"created_at": "2020-02-23T03:15:55Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"id": 5037900,
"node_id": "MDg6UmVhY3Rpb241MDM3OTAw",
"user": {
"login": "kohsuke",
"id": 50003,
"node_id": "MDQ6VXNlcjUwMDAz",
"avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/kohsuke",
"html_url": "https://github.com/kohsuke",
"followers_url": "https://api.github.com/users/kohsuke/followers",
"following_url": "https://api.github.com/users/kohsuke/following{/other_user}",
"gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}",
"starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions",
"organizations_url": "https://api.github.com/users/kohsuke/orgs",
"repos_url": "https://api.github.com/users/kohsuke/repos",
"events_url": "https://api.github.com/users/kohsuke/events{/privacy}",
"received_events_url": "https://api.github.com/users/kohsuke/received_events",
"type": "User",
"site_admin": false
},
"content": "heart",
"created_at": "2016-11-17T02:40:15Z"
}
]
Loading