/** * Get pull requests from repository matching state * * @param repository * @param state * @return list of pull requests * @throws IOException */ public List<PullRequest> getPullRequests(IRepositoryIdProvider repository, String state) throws IOException { return getAll(pagePullRequests(repository, state)); }
/** * Get all comments on commits in given pull request * * @param repository * @param id * @return non-null list of comments * @throws IOException */ public List<CommitComment> getComments(IRepositoryIdProvider repository, int id) throws IOException { return getAll(pageComments(repository, id)); }
/** * Get all commits associated with given pull request id * * @param repository * @param id * @return list of commits * @throws IOException */ public List<RepositoryCommit> getCommits(IRepositoryIdProvider repository, int id) throws IOException { final String repoId = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(repoId); uri.append(SEGMENT_PULLS); uri.append('/').append(id); uri.append(SEGMENT_COMMITS); PagedRequest<RepositoryCommit> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<RepositoryCommit>>() { }.getType()); return getAll(request); }
/** * Get all changed files associated with given pull request id * * @param repository * @param id * @return list of commit files * @throws IOException */ public List<CommitFile> getFiles(IRepositoryIdProvider repository, int id) throws IOException { final String repoId = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(repoId); uri.append(SEGMENT_PULLS); uri.append('/').append(id); uri.append(SEGMENT_FILES); PagedRequest<CommitFile> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<CommitFile>>() { }.getType()); return getAll(request); }