Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Cilia2018-08-02 03:02:46 -0400
committerThomas Wolf2018-12-14 16:02:54 -0500
commit109003eb3a5275ffb4278036bcb85b190cb91f62 (patch)
tree184fa30eca0062b73decf69fbf221bdc28d63cd1
parentbd6e12bad6eced1d82cf3395755ce19082ad685e (diff)
downloadegit-github-109003eb3a5275ffb4278036bcb85b190cb91f62.tar.gz
egit-github-109003eb3a5275ffb4278036bcb85b190cb91f62.tar.xz
egit-github-109003eb3a5275ffb4278036bcb85b190cb91f62.zip
Implement list tags API for repository
Change-Id: Ia205fc224deed6f1c36aa6fef1b350669de28bff Signed-off-by: Frédéric Cilia <frederic.cilia@hardis.fr>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/DataServiceTest.java13
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java25
2 files changed, 38 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/DataServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/DataServiceTest.java
index 03bbdd79..d2f5ccab 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/DataServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/DataServiceTest.java
@@ -410,6 +410,19 @@ public class DataServiceTest {
}
/**
+ * List tags
+ *
+ * @throws IOException
+ */
+ @Test
+ public void listTags() throws IOException {
+ service.listTags(repo);
+ GitHubRequest request = new GitHubRequest();
+ request.setUri(Utils.page("/repos/o/n/git/refs/tags"));
+ verify(client).get(request);
+ }
+
+ /**
* Create tag with null tag
*
* @throws IOException
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
index e1037463..9a56cc39 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/DataService.java
@@ -430,6 +430,31 @@ public class DataService extends GitHubService {
}
/**
+ * List tags for given repository. You can access to more information by
+ * using URL in Reference Object returned.
+ *
+ * @param repository
+ * @return non-null but possibly empty list of references
+ * @throws IOException
+ */
+ public List<Reference> listTags(IRepositoryIdProvider repository)
+ throws IOException {
+ final String id = getId(repository);
+ StringBuilder uri = new StringBuilder();
+ uri.append(SEGMENT_REPOS);
+ uri.append('/').append(id);
+ uri.append(SEGMENT_GIT);
+ uri.append(SEGMENT_REFS);
+ uri.append(SEGMENT_TAGS);
+ PagedRequest<Reference> request = createPagedRequest();
+ request.setType(new TypeToken<List<Reference>>() {
+ // make protected type visible
+ }.getType());
+ request.setUri(uri);
+ return getAll(request);
+ }
+
+ /**
* Create tag object in given repository
*
* @param repository

Back to the top