From b7d03f74635912c0de4523cc125d5160cb94a8f4 Mon Sep 17 00:00:00 2001 From: seregamorph Date: Thu, 24 Sep 2020 22:40:32 +0300 Subject: [PATCH 1/3] user, push, pull event extensions --- .../org/kohsuke/github/GHEventPayload.java | 24 +- src/main/java/org/kohsuke/github/GitUser.java | 17 +- .../kohsuke/github/GHEventPayloadTest.java | 43 ++ .../pull_request_labeled.json | 541 ++++++++++++++++++ 4 files changed, 619 insertions(+), 6 deletions(-) create mode 100644 src/test/resources/org/kohsuke/github/GHEventPayloadTest/pull_request_labeled.json diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java index bea96ba813..ef725210de 100644 --- a/src/main/java/org/kohsuke/github/GHEventPayload.java +++ b/src/main/java/org/kohsuke/github/GHEventPayload.java @@ -382,6 +382,7 @@ public static class PullRequest extends GHEventPayload { private int number; private GHPullRequest pull_request; private GHRepository repository; + private GHLabel label; /** * Gets action. @@ -420,6 +421,15 @@ public GHRepository getRepository() { return repository; } + /** + * Gets label. + * + * @return the label + */ + public GHLabel getLabel() { + return label; + } + @Override void wrapUp(GitHub root) { super.wrapUp(root); @@ -1280,6 +1290,7 @@ public static class Push extends GHEventPayload { private List commits; private GHRepository repository; private Pusher pusher; + private String compare; /** * The SHA of the HEAD commit on the repository @@ -1387,6 +1398,15 @@ public void setPusher(Pusher pusher) { this.pusher = pusher; } + /** + * Gets compare. + * + * @return compare + */ + public String getCompare() { + return compare; + } + @Override void wrapUp(GitHub root) { super.wrapUp(root); @@ -1440,7 +1460,7 @@ public void setEmail(String email) { } /** - * Commit in a push + * Commit in a push. Note: sha is an alias for id. */ public static class PushCommit { private GitUser author; @@ -1477,7 +1497,7 @@ public String getUrl() { } /** - * Gets sha. + * Gets sha (id). * * @return the sha */ diff --git a/src/main/java/org/kohsuke/github/GitUser.java b/src/main/java/org/kohsuke/github/GitUser.java index 64851ba8a4..e1cc737cea 100644 --- a/src/main/java/org/kohsuke/github/GitUser.java +++ b/src/main/java/org/kohsuke/github/GitUser.java @@ -15,10 +15,10 @@ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API") public class GitUser { - private String name, email, date; + private String name, email, date, username; /** - * Gets name. + * Gets name (e.g. from git commit). * * @return Human readable name of the user, such as "Kohsuke Kawaguchi" */ @@ -27,14 +27,23 @@ public String getName() { } /** - * Gets email. + * Gets email (e.g. from git commit). * - * @return E -mail address, such as "foo@example.com" + * @return E-mail address, such as "foo@example.com" */ public String getEmail() { return email; } + /** + * Gets username. + * + * @return GitHub username + */ + public String getUsername() { + return username; + } + /** * Gets date. * diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index b618635d7b..9c09e4e09d 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -8,6 +8,7 @@ import java.util.Collections; import java.util.TimeZone; +import static java.lang.Boolean.TRUE; import static org.hamcrest.Matchers.*; public class GHEventPayloadTest extends AbstractGitHubWireMockTest { @@ -203,6 +204,44 @@ public void pull_request() throws Exception { assertThat(event.getSender().getLogin(), is("baxterthehacker")); } + @Test + public void pull_request_labeled() throws Exception { + GHEventPayload.PullRequest event = GitHub.offline() + .parseEventPayload(payload.asReader(), GHEventPayload.PullRequest.class); + assertThat(event.getAction(), is("labeled")); + assertThat(event.getNumber(), is(79)); + assertThat(event.getPullRequest().getNumber(), is(79)); + assertThat(event.getPullRequest().getTitle(), is("Base POJO test enhancement")); + assertThat(event.getPullRequest().getBody(), + is("This is a pretty simple change that we need to pull into develop.")); + assertThat(event.getPullRequest().getUser().getLogin(), is("seregamorph")); + assertThat(event.getPullRequest().getHead().getUser().getLogin(), is("trilogy-group")); + assertThat(event.getPullRequest().getHead().getRef(), is("changes")); + assertThat(event.getPullRequest().getHead().getLabel(), is("trilogy-group:changes")); + assertThat(event.getPullRequest().getHead().getSha(), is("4b91e3a970fb967fb7be4d52e0969f8e3fb063d0")); + assertThat(event.getPullRequest().getBase().getUser().getLogin(), is("trilogy-group")); + assertThat(event.getPullRequest().getBase().getRef(), is("3.10")); + assertThat(event.getPullRequest().getBase().getLabel(), is("trilogy-group:3.10")); + assertThat(event.getPullRequest().getBase().getSha(), is("7a735f17d686c6a1fc7df5b9d395e5863868f364")); + assertThat(event.getPullRequest().isMerged(), is(false)); + assertThat(event.getPullRequest().getMergeable(), is(TRUE)); + assertThat(event.getPullRequest().getMergeableState(), is("draft")); + assertThat(event.getPullRequest().getMergedBy(), nullValue()); + assertThat(event.getPullRequest().getCommentsCount(), is(1)); + assertThat(event.getPullRequest().getReviewComments(), is(14)); + assertThat(event.getPullRequest().getAdditions(), is(137)); + assertThat(event.getPullRequest().getDeletions(), is(81)); + assertThat(event.getPullRequest().getChangedFiles(), is(22)); + assertThat(event.getRepository().getName(), is("trilogy-rest-api-framework")); + assertThat(event.getRepository().getOwner().getLogin(), is("trilogy-group")); + assertThat(event.getSender().getLogin(), is("schernov-xo")); + assertThat(event.getLabel().getUrl(), + is("https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels/rest%20api")); + assertThat(event.getLabel().getName(), is("rest api")); + assertThat(event.getLabel().getColor(), is("fef2c0")); + assertThat(event.getLabel().getDescription(), is("REST API pull request")); + } + @Test public void pull_request_review() throws Exception { GHEventPayload.PullRequestReview event = GitHub.offline() @@ -272,7 +311,9 @@ public void push() throws Exception { assertThat(event.getCommits().size(), is(1)); assertThat(event.getCommits().get(0).getSha(), is("0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c")); assertThat(event.getCommits().get(0).getAuthor().getEmail(), is("baxterthehacker@users.noreply.github.com")); + assertThat(event.getCommits().get(0).getAuthor().getUsername(), is("baxterthehacker")); assertThat(event.getCommits().get(0).getCommitter().getEmail(), is("baxterthehacker@users.noreply.github.com")); + assertThat(event.getCommits().get(0).getCommitter().getUsername(), is("baxterthehacker")); assertThat(event.getCommits().get(0).getAdded().size(), is(0)); assertThat(event.getCommits().get(0).getRemoved().size(), is(0)); assertThat(event.getCommits().get(0).getModified().size(), is(1)); @@ -284,6 +325,8 @@ public void push() throws Exception { assertThat(event.getPusher().getName(), is("baxterthehacker")); assertThat(event.getPusher().getEmail(), is("baxterthehacker@users.noreply.github.com")); assertThat(event.getSender().getLogin(), is("baxterthehacker")); + assertThat(event.getCompare(), + is("https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f")); } @Test diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/pull_request_labeled.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/pull_request_labeled.json new file mode 100644 index 0000000000..73ee47ded2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/pull_request_labeled.json @@ -0,0 +1,541 @@ +{ + "action": "labeled", + "number": 79, + "pull_request": { + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79", + "id": 486650647, + "node_id": "MDExOlB1bGxSZXF1ZXN0NDg2NjUwNjQ3", + "html_url": "https://github.com/trilogy-group/trilogy-rest-api-framework/pull/79", + "diff_url": "https://github.com/trilogy-group/trilogy-rest-api-framework/pull/79.diff", + "patch_url": "https://github.com/trilogy-group/trilogy-rest-api-framework/pull/79.patch", + "issue_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/79", + "number": 79, + "state": "open", + "locked": false, + "title": "Base POJO test enhancement", + "user": { + "login": "seregamorph", + "id": 2844909, + "node_id": "MDQ6VXNlcjE2NjAxNjgz", + "avatar_url": "https://avatars1.githubusercontent.com/u/2844909?s=460&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seregamorph", + "html_url": "https://github.com/seregamorph", + "followers_url": "https://api.github.com/users/seregamorph/followers", + "following_url": "https://api.github.com/users/seregamorph/following{/other_user}", + "gists_url": "https://api.github.com/users/seregamorph/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seregamorph/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seregamorph/subscriptions", + "organizations_url": "https://api.github.com/users/seregamorph/orgs", + "repos_url": "https://api.github.com/users/seregamorph/repos", + "events_url": "https://api.github.com/users/seregamorph/events{/privacy}", + "received_events_url": "https://api.github.com/users/seregamorph/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a pretty simple change that we need to pull into develop.", + "created_at": "2020-09-14T14:14:03Z", + "updated_at": "2020-09-24T12:07:04Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "37e688510ad7d8c2981a030e7d9e30653bbbdbab", + "assignee": { + "login": "seregamorph", + "id": 2844909, + "node_id": "MDQ6VXNlcjE2NjAxNjgz", + "avatar_url": "https://avatars1.githubusercontent.com/u/2844909?s=460&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seregamorph", + "html_url": "https://github.com/seregamorph", + "followers_url": "https://api.github.com/users/seregamorph/followers", + "following_url": "https://api.github.com/users/seregamorph/following{/other_user}", + "gists_url": "https://api.github.com/users/seregamorph/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seregamorph/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seregamorph/subscriptions", + "organizations_url": "https://api.github.com/users/seregamorph/orgs", + "repos_url": "https://api.github.com/users/seregamorph/repos", + "events_url": "https://api.github.com/users/seregamorph/events{/privacy}", + "received_events_url": "https://api.github.com/users/seregamorph/received_events", + "type": "User", + "site_admin": false + }, + "assignees": [ + { + "login": "seregamorph", + "id": 2844909, + "node_id": "MDQ6VXNlcjE2NjAxNjgz", + "avatar_url": "https://avatars1.githubusercontent.com/u/2844909?s=460&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seregamorph", + "html_url": "https://github.com/seregamorph", + "followers_url": "https://api.github.com/users/seregamorph/followers", + "following_url": "https://api.github.com/users/seregamorph/following{/other_user}", + "gists_url": "https://api.github.com/users/seregamorph/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seregamorph/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seregamorph/subscriptions", + "organizations_url": "https://api.github.com/users/seregamorph/orgs", + "repos_url": "https://api.github.com/users/seregamorph/repos", + "events_url": "https://api.github.com/users/seregamorph/events{/privacy}", + "received_events_url": "https://api.github.com/users/seregamorph/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 1647993625, + "node_id": "MDU6TGFiZWwxNjQ3OTkzNjI1", + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels/Ready%20for%20Review", + "name": "Ready for Review", + "color": "0e8a16", + "default": false, + "description": "" + }, + { + "id": 1650486524, + "node_id": "MDU6TGFiZWwxNjUwNDg2NTI0", + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels/rest%20api", + "name": "rest api", + "color": "fef2c0", + "default": false, + "description": "REST API pull request" + } + ], + "milestone": null, + "draft": true, + "commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79/commits", + "review_comments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79/comments", + "review_comment_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/79/comments", + "statuses_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/statuses/4b91e3a970fb967fb7be4d52e0969f8e3fb063d0", + "head": { + "label": "trilogy-group:changes", + "ref": "changes", + "sha": "4b91e3a970fb967fb7be4d52e0969f8e3fb063d0", + "user": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/trilogy-group", + "html_url": "https://github.com/trilogy-group", + "followers_url": "https://api.github.com/users/trilogy-group/followers", + "following_url": "https://api.github.com/users/trilogy-group/following{/other_user}", + "gists_url": "https://api.github.com/users/trilogy-group/gists{/gist_id}", + "starred_url": "https://api.github.com/users/trilogy-group/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/trilogy-group/subscriptions", + "organizations_url": "https://api.github.com/users/trilogy-group/orgs", + "repos_url": "https://api.github.com/users/trilogy-group/repos", + "events_url": "https://api.github.com/users/trilogy-group/events{/privacy}", + "received_events_url": "https://api.github.com/users/trilogy-group/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 217940615, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTc5NDA2MTU=", + "name": "trilogy-rest-api-framework", + "full_name": "trilogy-group/trilogy-rest-api-framework", + "private": true, + "owner": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/trilogy-group", + "html_url": "https://github.com/trilogy-group", + "followers_url": "https://api.github.com/users/trilogy-group/followers", + "following_url": "https://api.github.com/users/trilogy-group/following{/other_user}", + "gists_url": "https://api.github.com/users/trilogy-group/gists{/gist_id}", + "starred_url": "https://api.github.com/users/trilogy-group/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/trilogy-group/subscriptions", + "organizations_url": "https://api.github.com/users/trilogy-group/orgs", + "repos_url": "https://api.github.com/users/trilogy-group/repos", + "events_url": "https://api.github.com/users/trilogy-group/events{/privacy}", + "received_events_url": "https://api.github.com/users/trilogy-group/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "description": "https://confluence.devfactory.com/display/REST/Framework", + "fork": false, + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework", + "forks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/forks", + "keys_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/teams", + "hooks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/hooks", + "issue_events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/events{/number}", + "events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/events", + "assignees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/assignees{/user}", + "branches_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/branches{/branch}", + "tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/tags", + "blobs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/statuses/{sha}", + "languages_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/languages", + "stargazers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/stargazers", + "contributors_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contributors", + "subscribers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscribers", + "subscription_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscription", + "commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contents/{+path}", + "compare_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/merges", + "archive_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/downloads", + "issues_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues{/number}", + "pulls_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls{/number}", + "milestones_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/milestones{/number}", + "notifications_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels{/name}", + "releases_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/releases{/id}", + "deployments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/deployments", + "created_at": "2019-10-28T01:12:50Z", + "updated_at": "2020-08-31T07:30:39Z", + "pushed_at": "2020-09-23T09:25:21Z", + "git_url": "git://github.com/trilogy-group/trilogy-rest-api-framework.git", + "ssh_url": "git@github.com:trilogy-group/trilogy-rest-api-framework.git", + "clone_url": "https://github.com/trilogy-group/trilogy-rest-api-framework.git", + "svn_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "homepage": "", + "size": 852, + "stargazers_count": 2, + "watchers_count": 2, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "forks": 0, + "open_issues": 1, + "watchers": 2, + "default_branch": "develop", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": true + } + }, + "base": { + "label": "trilogy-group:3.10", + "ref": "3.10", + "sha": "7a735f17d686c6a1fc7df5b9d395e5863868f364", + "user": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/trilogy-group", + "html_url": "https://github.com/trilogy-group", + "followers_url": "https://api.github.com/users/trilogy-group/followers", + "following_url": "https://api.github.com/users/trilogy-group/following{/other_user}", + "gists_url": "https://api.github.com/users/trilogy-group/gists{/gist_id}", + "starred_url": "https://api.github.com/users/trilogy-group/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/trilogy-group/subscriptions", + "organizations_url": "https://api.github.com/users/trilogy-group/orgs", + "repos_url": "https://api.github.com/users/trilogy-group/repos", + "events_url": "https://api.github.com/users/trilogy-group/events{/privacy}", + "received_events_url": "https://api.github.com/users/trilogy-group/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 217940615, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTc5NDA2MTU=", + "name": "trilogy-rest-api-framework", + "full_name": "trilogy-group/trilogy-rest-api-framework", + "private": true, + "owner": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/trilogy-group", + "html_url": "https://github.com/trilogy-group", + "followers_url": "https://api.github.com/users/trilogy-group/followers", + "following_url": "https://api.github.com/users/trilogy-group/following{/other_user}", + "gists_url": "https://api.github.com/users/trilogy-group/gists{/gist_id}", + "starred_url": "https://api.github.com/users/trilogy-group/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/trilogy-group/subscriptions", + "organizations_url": "https://api.github.com/users/trilogy-group/orgs", + "repos_url": "https://api.github.com/users/trilogy-group/repos", + "events_url": "https://api.github.com/users/trilogy-group/events{/privacy}", + "received_events_url": "https://api.github.com/users/trilogy-group/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "description": "https://confluence.devfactory.com/display/REST/Framework", + "fork": false, + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework", + "forks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/forks", + "keys_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/teams", + "hooks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/hooks", + "issue_events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/events{/number}", + "events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/events", + "assignees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/assignees{/user}", + "branches_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/branches{/branch}", + "tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/tags", + "blobs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/statuses/{sha}", + "languages_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/languages", + "stargazers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/stargazers", + "contributors_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contributors", + "subscribers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscribers", + "subscription_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscription", + "commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contents/{+path}", + "compare_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/merges", + "archive_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/downloads", + "issues_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues{/number}", + "pulls_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls{/number}", + "milestones_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/milestones{/number}", + "notifications_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels{/name}", + "releases_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/releases{/id}", + "deployments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/deployments", + "created_at": "2019-10-28T01:12:50Z", + "updated_at": "2020-08-31T07:30:39Z", + "pushed_at": "2020-09-23T09:25:21Z", + "git_url": "git://github.com/trilogy-group/trilogy-rest-api-framework.git", + "ssh_url": "git@github.com:trilogy-group/trilogy-rest-api-framework.git", + "clone_url": "https://github.com/trilogy-group/trilogy-rest-api-framework.git", + "svn_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "homepage": "", + "size": 852, + "stargazers_count": 2, + "watchers_count": 2, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "forks": 0, + "open_issues": 1, + "watchers": 2, + "default_branch": "develop", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": true + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79" + }, + "html": { + "href": "https://github.com/trilogy-group/trilogy-rest-api-framework/pull/79" + }, + "issue": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/79" + }, + "comments": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/79/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls/79/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/statuses/4b91e3a970fb967fb7be4d52e0969f8e3fb063d0" + } + }, + "author_association": "COLLABORATOR", + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "draft", + "merged_by": null, + "comments": 1, + "review_comments": 14, + "maintainer_can_modify": false, + "commits": 3, + "additions": 137, + "deletions": 81, + "changed_files": 22 + }, + "label": { + "id": 1650486524, + "node_id": "MDU6TGFiZWwxNjUwNDg2NTI0", + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels/rest%20api", + "name": "rest api", + "color": "fef2c0", + "default": false, + "description": "REST API pull request" + }, + "repository": { + "id": 217940615, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTc5NDA2MTU=", + "name": "trilogy-rest-api-framework", + "full_name": "trilogy-group/trilogy-rest-api-framework", + "private": true, + "owner": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/trilogy-group", + "html_url": "https://github.com/trilogy-group", + "followers_url": "https://api.github.com/users/trilogy-group/followers", + "following_url": "https://api.github.com/users/trilogy-group/following{/other_user}", + "gists_url": "https://api.github.com/users/trilogy-group/gists{/gist_id}", + "starred_url": "https://api.github.com/users/trilogy-group/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/trilogy-group/subscriptions", + "organizations_url": "https://api.github.com/users/trilogy-group/orgs", + "repos_url": "https://api.github.com/users/trilogy-group/repos", + "events_url": "https://api.github.com/users/trilogy-group/events{/privacy}", + "received_events_url": "https://api.github.com/users/trilogy-group/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "description": "https://confluence.devfactory.com/display/REST/Framework", + "fork": false, + "url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework", + "forks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/forks", + "keys_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/teams", + "hooks_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/hooks", + "issue_events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/events{/number}", + "events_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/events", + "assignees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/assignees{/user}", + "branches_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/branches{/branch}", + "tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/tags", + "blobs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/statuses/{sha}", + "languages_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/languages", + "stargazers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/stargazers", + "contributors_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contributors", + "subscribers_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscribers", + "subscription_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/subscription", + "commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/contents/{+path}", + "compare_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/merges", + "archive_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/downloads", + "issues_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/issues{/number}", + "pulls_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/pulls{/number}", + "milestones_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/milestones{/number}", + "notifications_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/labels{/name}", + "releases_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/releases{/id}", + "deployments_url": "https://api.github.com/repos/trilogy-group/trilogy-rest-api-framework/deployments", + "created_at": "2019-10-28T01:12:50Z", + "updated_at": "2020-08-31T07:30:39Z", + "pushed_at": "2020-09-23T09:25:21Z", + "git_url": "git://github.com/trilogy-group/trilogy-rest-api-framework.git", + "ssh_url": "git@github.com:trilogy-group/trilogy-rest-api-framework.git", + "clone_url": "https://github.com/trilogy-group/trilogy-rest-api-framework.git", + "svn_url": "https://github.com/trilogy-group/trilogy-rest-api-framework", + "homepage": "", + "size": 852, + "stargazers_count": 2, + "watchers_count": 2, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "forks": 0, + "open_issues": 1, + "watchers": 2, + "default_branch": "develop" + }, + "organization": { + "login": "trilogy-group", + "id": 22237814, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjIyMjM3ODE0", + "url": "https://api.github.com/orgs/trilogy-group", + "repos_url": "https://api.github.com/orgs/trilogy-group/repos", + "events_url": "https://api.github.com/orgs/trilogy-group/events", + "hooks_url": "https://api.github.com/orgs/trilogy-group/hooks", + "issues_url": "https://api.github.com/orgs/trilogy-group/issues", + "members_url": "https://api.github.com/orgs/trilogy-group/members{/member}", + "public_members_url": "https://api.github.com/orgs/trilogy-group/public_members{/member}", + "avatar_url": "https://avatars1.githubusercontent.com/u/22237814?v=4", + "description": "" + }, + "sender": { + "login": "schernov-xo", + "id": 41187778, + "node_id": "MDQ6VXNlcjQxMTg3Nzc4", + "avatar_url": "https://avatars3.githubusercontent.com/u/41187778?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/schernov-xo", + "html_url": "https://github.com/schernov-xo", + "followers_url": "https://api.github.com/users/schernov-xo/followers", + "following_url": "https://api.github.com/users/schernov-xo/following{/other_user}", + "gists_url": "https://api.github.com/users/schernov-xo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/schernov-xo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/schernov-xo/subscriptions", + "organizations_url": "https://api.github.com/users/schernov-xo/orgs", + "repos_url": "https://api.github.com/users/schernov-xo/repos", + "events_url": "https://api.github.com/users/schernov-xo/events{/privacy}", + "received_events_url": "https://api.github.com/users/schernov-xo/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file From 0456f107091e7b688b6a25d1c185b9ddacca3a01 Mon Sep 17 00:00:00 2001 From: seregamorph Date: Thu, 24 Sep 2020 22:55:04 +0300 Subject: [PATCH 2/3] address objections --- src/main/java/org/kohsuke/github/GitUser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GitUser.java b/src/main/java/org/kohsuke/github/GitUser.java index e1cc737cea..63e79740b3 100644 --- a/src/main/java/org/kohsuke/github/GitUser.java +++ b/src/main/java/org/kohsuke/github/GitUser.java @@ -18,7 +18,7 @@ public class GitUser { private String name, email, date, username; /** - * Gets name (e.g. from git commit). + * Gets the git user name for an author or committer on a git commit. * * @return Human readable name of the user, such as "Kohsuke Kawaguchi" */ @@ -27,7 +27,7 @@ public String getName() { } /** - * Gets email (e.g. from git commit). + * Gets the git email for an author or committer on a git commit. * * @return E-mail address, such as "foo@example.com" */ From 6e3f754366132d82f4a1880807776b4fef340887 Mon Sep 17 00:00:00 2001 From: seregamorph Date: Sat, 26 Sep 2020 12:07:00 +0300 Subject: [PATCH 3/3] javadoc --- src/main/java/org/kohsuke/github/GitUser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GitUser.java b/src/main/java/org/kohsuke/github/GitUser.java index 63e79740b3..3162ff04fc 100644 --- a/src/main/java/org/kohsuke/github/GitUser.java +++ b/src/main/java/org/kohsuke/github/GitUser.java @@ -4,6 +4,8 @@ import java.util.Date; +import javax.annotation.CheckForNull; + /** * Represents a user in Git who authors/commits a commit. *

@@ -36,10 +38,13 @@ public String getEmail() { } /** - * Gets username. + * Gets username. Note: it presents only in events. * * @return GitHub username */ + @Preview + @Deprecated + @CheckForNull public String getUsername() { return username; }