/**
* Returns a list of all release from the specified repository.
*
* @param owner the repository's owner
* @param repo the repository's name
* @return a list of all release from the specified repository.
* @throws IOException if an IO error occurs while communicating with GitHub.
* @throws URISyntaxException if the crafted URI is incorrect.
*/
public List<GithubRelease> getAllReleases(String owner, String repo) throws IOException, URISyntaxException {
URIBuilder requestUrl = new URIBuilder()
.setScheme(URL_PROTOCOL)
.setHost(GITHUB_API_HOSTNAME)
.setPath("/repos/" + owner + "/" + repo + "/releases");
logger.debug(() -> "requestUrl = " + requestUrl);
HttpGet httpget = new HttpGet(requestUrl.build());
return httpClient.execute(httpget, new AbstractResponseHandler<List<GithubRelease>>() {
@Override
public List<GithubRelease> handleEntity(HttpEntity entity) throws IOException {
return gson.fromJson(EntityUtils.toString(entity), new TypeToken<ArrayList<GithubRelease>>() {
}.getType());
}
});
}
GithubApi.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:binjr
作者:
评论列表
文章目录