private Issue getIssue(String repoId, String issueNumber) throws IOException { if (issueNumber == null) throw new IllegalArgumentException("Issue number cannot be null"); //$NON-NLS-1$ if (issueNumber.length() == 0) throw new IllegalArgumentException("Issue number cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(repoId); uri.append(SEGMENT_ISSUES); uri.append('/').append(issueNumber); GitHubRequest request = createRequest(); request.setUri(uri); request.setType(Issue.class); return (Issue) client.get(request).getBody(); }
/** * Get issue comment * * @param user * @param repository * @param commentId * @return comment * @throws IOException */ public Comment getComment(String user, String repository, long commentId) throws IOException { verifyRepository(user, repository); GitHubRequest request = createRequest(); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(user).append('/').append(repository); uri.append(SEGMENT_ISSUES).append(SEGMENT_COMMENTS); uri.append('/').append(commentId); request.setUri(uri); request.setType(Comment.class); return (Comment) client.get(request).getBody(); }
/** * Get issue event for repository * * @param user * @param repository * @param eventId * @return iterator over issue event pages * @throws IOException */ public IssueEvent getIssueEvent(String user, String repository, long eventId) throws IOException { verifyRepository(user, repository); GitHubRequest request = createRequest(); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(user).append('/').append(repository); uri.append(SEGMENT_ISSUES); uri.append(SEGMENT_EVENTS); uri.append('/').append(eventId); request.setUri(uri); request.setType(IssueEvent.class); return (IssueEvent) client.get(request).getBody(); }