diff options
author | Jon Ander Peñalba | 2015-12-02 17:13:27 +0000 |
---|---|---|
committer | Matthias Sohn | 2015-12-24 00:15:52 +0000 |
commit | 68012947a4e811cde2640d9ba993f74b1f8806f2 (patch) | |
tree | 680a2e5e7201834765d0eafd80f0f9e005f5cdaf | |
parent | fbe6fc5d13d51fddf8c6bc504559932fb7dfecca (diff) | |
download | egit-github-68012947a4e811cde2640d9ba993f74b1f8806f2.tar.gz egit-github-68012947a4e811cde2640d9ba993f74b1f8806f2.tar.xz egit-github-68012947a4e811cde2640d9ba993f74b1f8806f2.zip |
Add the ReleaseEvent and its corresponding Payload
https://developer.github.com/v3/activity/events/types/#releaseevent
Change-Id: I94832a0f2ab7a69697d839086f57ff29302fbaf7
Signed-off-by: Jon Ander Peñalba <jonan88@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 files changed, 384 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Release.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Release.java new file mode 100644 index 00000000..8f653c1e --- /dev/null +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Release.java @@ -0,0 +1,315 @@ +/******************************************************************************* + * Copyright (c) 2015 Jon Ander Peñalba <jonander.penalba@gmail.com>. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jon Ander Peñalba - initial API and implementation + *******************************************************************************/ +package org.eclipse.egit.github.core; + +import java.io.Serializable; +import java.util.Date; + +import com.google.gson.annotations.SerializedName; + +/** + * Release model class + * @since 4.2 + */ +public class Release implements Serializable { + + private static final long serialVersionUID = 1L; + + private String url; + + private String htmlUrl; + + private String assetsUrl; + + private String uploadUrl; + + private String tarballUrl; + + private String zipballUrl; + + private long id; + + private String tagName; + + private String targetCommitish; + + private String name; + + private String body; + + @SerializedName("draft") + private boolean isDraft; + + @SerializedName("prerelease") + private boolean isPrerelease; + + private Date createdAt; + + private Date publishedAt; + + private User author; + + /** + * @return url + */ + public String getUrl() { + return url; + } + + /** + * @param url + * @return this release + */ + public Release setUrl(String url) { + this.url = url; + return this; + } + + /** + * @return htmlUrl + */ + public String getHtmlUrl() { + return htmlUrl; + } + + /** + * @param htmlUrl + * @return this release + */ + public Release setHtmlUrl(String htmlUrl) { + this.htmlUrl = htmlUrl; + return this; + } + + /** + * @return assetsUrl + */ + public String getAssetsUrl() { + return assetsUrl; + } + + /** + * @param assetsUrl + * @return this release + */ + public Release setAssetsUrl(String assetsUrl) { + this.assetsUrl = assetsUrl; + return this; + } + + /** + * @return uploadUrl + */ + public String getUploadUrl() { + return uploadUrl; + } + + /** + * @param uploadUrl + * @return this release + */ + public Release setUploadUrl(String uploadUrl) { + this.uploadUrl = uploadUrl; + return this; + } + + /** + * @return tarballUrl + */ + public String getTarballUrl() { + return tarballUrl; + } + + /** + * @param tarballUrl + * @return this release + */ + public Release setTarballUrl(String tarballUrl) { + this.tarballUrl = tarballUrl; + return this; + } + + /** + * @return zipballUrl + */ + public String getZipballUrl() { + return zipballUrl; + } + + /** + * @param zipballUrl + * @return this release + */ + public Release setZipballUrl(String zipballUrl) { + this.zipballUrl = zipballUrl; + return this; + } + + /** + * @return id + */ + public long getId() { + return id; + } + + /** + * @param id + * @return this release + */ + public Release setId(long id) { + this.id = id; + return this; + } + + /** + * @return tagName + */ + public String getTagName() { + return tagName; + } + + /** + * @param tagName + * @return this release + */ + public Release setTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * @return targetCommitish + */ + public String getTargetCommitish() { + return targetCommitish; + } + + /** + * @param targetCommitish + * @return this release + */ + public Release setTargetCommitish(String targetCommitish) { + this.targetCommitish = targetCommitish; + return this; + } + + /** + * @return name + */ + public String getName() { + return name; + } + + /** + * @param name + * @return this release + */ + public Release setName(String name) { + this.name = name; + return this; + } + + /** + * @return body + */ + public String getBody() { + return body; + } + + /** + * @param body + * @return this release + */ + public Release setBody(String body) { + this.body = body; + return this; + } + + /** + * @return isDraft + */ + public boolean isDraft() { + return isDraft; + } + + /** + * @param isDraft + * @return this release + */ + public Release setDraft(boolean isDraft) { + this.isDraft = isDraft; + return this; + } + + /** + * @return isPrerelease + */ + public boolean isPrerelease() { + return isPrerelease; + } + + /** + * @param isPrerelease + * @return this release + */ + public Release setPrerelease(boolean isPrerelease) { + this.isPrerelease = isPrerelease; + return this; + } + + /** + * @return createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt + * @return this release + */ + public Release setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * @return publishedAt + */ + public Date getPublishedAt() { + return publishedAt; + } + + /** + * @param publishedAt + * @return this release + */ + public Release setPublishedAt(Date publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + /** + * @return author + */ + public User getAuthor() { + return author; + } + + /** + * @param author + * @return this release + */ + public Release setAuthor(User author) { + this.author = author; + return this; + } +} diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java index cc53bcad..7943b8ee 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java @@ -27,6 +27,7 @@ import static org.eclipse.egit.github.core.event.Event.TYPE_PUBLIC; import static org.eclipse.egit.github.core.event.Event.TYPE_PULL_REQUEST; import static org.eclipse.egit.github.core.event.Event.TYPE_PULL_REQUEST_REVIEW_COMMENT; import static org.eclipse.egit.github.core.event.Event.TYPE_PUSH; +import static org.eclipse.egit.github.core.event.Event.TYPE_RELEASE; import static org.eclipse.egit.github.core.event.Event.TYPE_TEAM_ADD; import static org.eclipse.egit.github.core.event.Event.TYPE_WATCH; @@ -58,6 +59,7 @@ import org.eclipse.egit.github.core.event.PublicPayload; import org.eclipse.egit.github.core.event.PullRequestPayload; import org.eclipse.egit.github.core.event.PullRequestReviewCommentPayload; import org.eclipse.egit.github.core.event.PushPayload; +import org.eclipse.egit.github.core.event.ReleasePayload; import org.eclipse.egit.github.core.event.TeamAddPayload; import org.eclipse.egit.github.core.event.WatchPayload; @@ -116,6 +118,8 @@ public class EventFormatter implements JsonDeserializer<Event> { payloadClass = PullRequestReviewCommentPayload.class; else if (TYPE_PUSH.equals(type)) payloadClass = PushPayload.class; + else if (TYPE_RELEASE.equals(type)) + payloadClass = ReleasePayload.class; else if (TYPE_TEAM_ADD.equals(type)) payloadClass = TeamAddPayload.class; else if (TYPE_WATCH.equals(type)) diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java index 4883e909..1435e4fd 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java @@ -104,6 +104,11 @@ public class Event implements Serializable { public static final String TYPE_PUSH = "PushEvent"; /** + * Event type denoting a {@link ReleasePayload} + */ + public static final String TYPE_RELEASE = "ReleaseEvent"; + + /** * Event type denoting a {@link TeamAddPayload} */ public static final String TYPE_TEAM_ADD = "TeamAddEvent"; diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/ReleasePayload.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/ReleasePayload.java new file mode 100644 index 00000000..b08778d8 --- /dev/null +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/ReleasePayload.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2015 Jon Ander Peñalba <jonander.penalba@gmail.com>. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jon Ander Peñalba - initial API and implementation + *******************************************************************************/ +package org.eclipse.egit.github.core.event; + +import java.io.Serializable; + +import org.eclipse.egit.github.core.Release; + +/** + * ReleaseEvent payload model class. + * @since 4.2 + */ +public class ReleasePayload extends EventPayload implements Serializable { + + private static final long serialVersionUID = 3309944674574815351L; + + private String action; + + private Release release; + + /** + * @return action + */ + public String getAction() { + return action; + } + + /** + * @param action + * @return this ReleasePayload + */ + public ReleasePayload setAction(String action) { + this.action = action; + return this; + } + + /** + * @return release + */ + public Release getRelease() { + return release; + } + + /** + * @param release + * @return this ReleasePayload + */ + public ReleasePayload setRelease(Release release) { + this.release = release; + return this; + } +} |