/* (non-Javadoc) * @see com.github.api.v2.services.ObjectService#getObjectContent(java.lang.String, java.lang.String, java.lang.String) */ @Override public InputStream getObjectContent(String userName, String repositoryName, String objectSha) { GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.ObjectApiUrls.GET_OBJECT_CONTENT_URL); String apiUrl = builder .withField(ParameterNames.USER_NAME, userName) .withField(ParameterNames.REPOSITORY_NAME, repositoryName) .withField(ParameterNames.SHA, objectSha) .buildUrl(); GitHubAPIResponse resp = callApiGet(apiUrl); processHeaders(resp.getHeaders()); return resp.getInputStream(); }
/* (non-Javadoc) * @see com.github.api.v2.services.ObjectService#getTree(java.lang.String, java.lang.String, java.lang.String) */ @Override public List<Tree> getTree(String userName, String repositoryName, String treeSha) { GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.ObjectApiUrls.GET_TREE_URL); String apiUrl = builder .withField(ParameterNames.USER_NAME, userName) .withField(ParameterNames.REPOSITORY_NAME, repositoryName) .withField(ParameterNames.SHA, treeSha) .buildUrl(); GitHubAPIResponse resp = callApiGet(apiUrl); processHeaders(resp.getHeaders()); JsonObject json = unmarshall(resp.getInputStream()); return unmarshall(new TypeToken<List<Tree>>() {}, json.get("tree")); }
/* (non-Javadoc) * @see com.github.api.v2.services.ObjectService#getBlob(java.lang.String, java.lang.String, java.lang.String, java.lang.String) */ @Override public Blob getBlob(String userName, String repositoryName, String treeSha, String filePath) { GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.ObjectApiUrls.GET_BLOBS_URL); String apiUrl = builder .withField(ParameterNames.USER_NAME, userName) .withField(ParameterNames.REPOSITORY_NAME, repositoryName) .withField(ParameterNames.SHA, treeSha) .withField(ParameterNames.FILE_PATH, filePath) .buildUrl(); GitHubAPIResponse resp = callApiGet(apiUrl); processHeaders(resp.getHeaders()); JsonObject json = unmarshall(resp.getInputStream()); return unmarshall(new TypeToken<Blob>() {}, json.get("blob")); }