Align event type enum with current documented and undocumented events

Closes gh-5
This commit is contained in:
Andy Wilkinson
2018-12-06 20:44:04 +00:00
parent 937a2a71dc
commit 5c78afe490
3 changed files with 140 additions and 61 deletions

View File

@@ -69,39 +69,9 @@ public class Event {
public enum Type {
/**
* The issue was closed by the actor.
* The issue was added to a project board.
*/
CLOSED("closed"),
/**
* The issue was reopened by the actor.
*/
REOPENED("reopened"),
/**
* The actor subscribed to receive notifications for an issue.
*/
SUBSCRIBED("subscribed"),
/**
* The actor unsubscribed from receibing notifications for an issue.
*/
UNSUBSCRIBED("unsubscribed"),
/**
* The issue was merged by the actor.
*/
MERGED("merged"),
/**
* The issue was referenced from a commit message.
*/
REFERENCED("referenced"),
/**
* The actor was {@code @mentioned} in an issue body.
*/
MENTIONED("mentioned"),
ADDED_TO_PROJECT("added_to_project"),
/**
* The issue was assigned to the actor.
@@ -109,45 +79,25 @@ public class Event {
ASSIGNED("assigned"),
/**
* The actor was unassigned from the issue.
* The issue was closed by the actor.
*/
UNASSIGNED("unassigned"),
CLOSED("closed"),
/**
* A label was added to the issue.
* A comment on the issue has been deleted by the actor.
*/
LABELED("labeled"),
COMMENT_DELETED("comment_deleted"),
/**
* A label was removed from the issue.
* The issue was created by converting a note in a project board to an issue.
*/
UNLABELED("unlabeled"),
/**
* The issue was added to a milestone.
*/
MILESTONED("milestoned"),
CONVERTED_NOTE_TO_ISSUE("converted_note_to_issue"),
/**
* The issue was removed from a milestone.
*/
DEMILESTONED("demilestoned"),
/**
* The issue title was changed.
*/
RENAMED("renamed"),
/**
* The issue was locked by the actor.
*/
LOCKED("locked"),
/**
* The issue was unlocked by the actor.
*/
UNLOCKED("unlocked"),
/**
* The pull request's branch was deleted.
*/
@@ -156,9 +106,109 @@ public class Event {
/**
* The pull request's branch was restored.
*/
HEAD_REF_RESTORED("head_ref_restored");
HEAD_REF_RESTORED("head_ref_restored"),
private String type;
/**
* A label was added to the issue.
*/
LABELED("labeled"),
/**
* The issue was locked by the actor.
*/
LOCKED("locked"),
/**
* The issue was marked as a duplicate.
*/
MARKED_AS_DUPLICATE("marked_as_duplicate"),
/**
* The actor was {@code @mentioned} in an issue body.
*/
MENTIONED("mentioned"),
/**
* The issue was merged by the actor.
*/
MERGED("merged"),
/**
* The issue was added to a milestone.
*/
MILESTONED("milestoned"),
/**
* The issue was moved between columns in a project board.
*/
MOVED_COLUMNS_IN_PROJECT("moved_columns_in_project"),
/**
* The issue was referenced from a commit message.
*/
REFERENCED("referenced"),
/**
* The issue was removed from a project board.
*/
REMOVED_FROM_PROJECT("removed_from_project"),
/**
* The issue title was changed.
*/
RENAMED("renamed"),
/**
* The issue was reopened by the actor.
*/
REOPENED("reopened"),
/**
* The actor dismissed a review from the pull request.
*/
REVIEW_DISMISSED("review_dismissed"),
/**
* The actor requested a review from the subject on the pull request.
*/
REVIEW_REQUESTED("review_requested"),
/**
* The actor removed the review request from the subject on the pull request.
*/
REVIEW_REQUEST_REMOVED("review_request_removed"),
/**
* The actor subscribed to receive notifications for an issue.
*/
SUBSCRIBED("subscribed"),
/**
* The actor was unassigned from the issue.
*/
UNASSIGNED("unassigned"),
/**
* A label was removed from the issue.
*/
UNLABELED("unlabeled"),
/**
* The issue was unlocked by the actor.
*/
UNLOCKED("unlocked"),
/**
* The issue was unmarked as a duplicate.
*/
UNMARKED_AS_DUPLICATE("unmarked_as_duplicate"),
/**
* The actor unsubscribed from receiving notifications for an issue.
*/
UNSUBSCRIBED("unsubscribed");
private final String type;
Type(String type) {
this.type = type;

View File

@@ -221,7 +221,7 @@ public class GitHubTemplateTests {
assertThat(pageOne.getContent()).hasSize(12);
Page<Event> pageTwo = pageOne.next();
assertThat(pageTwo).isNotNull();
assertThat(pageTwo.getContent()).hasSize(3);
assertThat(pageTwo.getContent()).hasSize(4);
}
@Test

View File

@@ -79,5 +79,34 @@
"commit_id": "ffd6e8d7eb944d8a3613e40e6aa1f6aa57127046",
"commit_url": "https://api.github.com/repos/spring-projects/spring-boot/commits/ffd6e8d7eb944d8a3613e40e6aa1f6aa57127046",
"created_at": "2015-12-02T14:02:24Z"
},
{
"actor": {
"avatar_url": "https://avatars0.githubusercontent.com/u/317776?v=4",
"events_url": "https://api.github.com/users/spring-projects/events{/privacy}",
"followers_url": "https://api.github.com/users/spring-projects/followers",
"following_url": "https://api.github.com/users/spring-projects/following{/other_user}",
"gists_url": "https://api.github.com/users/spring-projects/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/spring-projects",
"id": 317776,
"login": "spring-projects",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjMxNzc3Ng==",
"organizations_url": "https://api.github.com/users/spring-projects/orgs",
"received_events_url": "https://api.github.com/users/spring-projects/received_events",
"repos_url": "https://api.github.com/users/spring-projects/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/spring-projects/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/spring-projects/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/spring-projects"
},
"commit_id": null,
"commit_url": null,
"created_at": "2018-12-04T13:51:24Z",
"event": "comment_deleted",
"id": 2004328133,
"node_id": "MDE5OkNvbW1lbnREZWxldGVkRXZlbnQyMDA0MzI4MTMz",
"url": "https://api.github.com/repos/spring-projects/spring-boot/issues/events/2004328133"
}
]