diff options
| author | Kevin Sawicki | 2011-04-13 17:06:10 +0000 |
|---|---|---|
| committer | Chris Aniszczyk | 2011-04-14 14:50:23 +0000 |
| commit | 02c60b82615110aeada76e9446cfb3f10d38df96 (patch) | |
| tree | 480c0b7b05edaffaaeb549944eb8d5b0f68e3bfb | |
| parent | 8f7221c3d29ed844278b879935a03ec4efbe9fad (diff) | |
| download | egit-github-02c60b82615110aeada76e9446cfb3f10d38df96.tar.gz egit-github-02c60b82615110aeada76e9446cfb3f10d38df96.tar.xz egit-github-02c60b82615110aeada76e9446cfb3f10d38df96.zip | |
Add model classes for gist and gist file
Change-Id: I9b4754c34f77fe2859c87fd2f9df98926c3ec310
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
4 files changed, 179 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF index 2494f24a..c6eab623 100644 --- a/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF @@ -10,5 +10,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0", org.eclipse.mylyn.tasks.core;bundle-version="3.2.0", org.eclipse.mylyn.commons.net;bundle-version="3.2.0" Import-Package: com.google.gson;version="1.6.0", + com.google.gson.annotations;version="1.6.0", com.google.gson.reflect;version="1.6.0", org.apache.commons.logging diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java new file mode 100644 index 00000000..56e16907 --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java @@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * 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: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import java.util.Date; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + +/** + * GitHub gist class. + */ +public class Gist { + + @SerializedName("public") + private boolean isPublic; + + private Date createdAt; + + private int comments; + + private Map<String, GistFile> files; + + private String description; + + private String gitPullUrl; + + private String gitPushUrl; + + private String id; + + private String repo; + + private String url; + + private User author; + + /** + * @return isPublic + */ + public boolean isPublic() { + return this.isPublic; + } + + /** + * @return createdAt + */ + public Date getCreatedAt() { + return this.createdAt; + } + + /** + * @return comments + */ + public int getComments() { + return this.comments; + } + + /** + * @return files + */ + public Map<String, GistFile> getFiles() { + return this.files; + } + + /** + * @return description + */ + public String getDescription() { + return this.description; + } + + /** + * @return gitPullUrl + */ + public String getGitPullUrl() { + return this.gitPullUrl; + } + + /** + * @return gitPushUrl + */ + public String getGitPushUrl() { + return this.gitPushUrl; + } + + /** + * @return id + */ + public String getId() { + return this.id; + } + + /** + * @return repo + */ + public String getRepo() { + return this.repo; + } + + /** + * @return url + */ + public String getUrl() { + return this.url; + } + + /** + * @return author + */ + public User getAuthor() { + return this.author; + } + +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java new file mode 100644 index 00000000..10f022a5 --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * 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: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +/** + * Gist file class. + */ +public class GistFile { + + private int size; + + private String filename; + + private String rawUrl; + + /** + * @return size + */ + public int getSize() { + return this.size; + } + + /** + * @return filename + */ + public String getFilename() { + return this.filename; + } + + /** + * @return rawUrl + */ + public String getRawUrl() { + return this.rawUrl; + } + +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java index 1d02cc4a..8b836a73 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java @@ -41,6 +41,16 @@ public interface IGitHubConstants { String SEGMENT_MILESTONES = "/milestones"; //$NON-NLS-1$ /** + * SEGMENT_GISTS + */ + String SEGMENT_GISTS = "/gists"; //$NON-NLS-1$ + + /** + * SEGMENT_USERS + */ + String SEGMENT_USERS = "/users"; //$NON-NLS-1$ + + /** * SUFFIX_JSON */ String SUFFIX_JSON = ".json"; //$NON-NLS-1$ |
