Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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