public IssueMinerV3(final IGitHubClient ghc) { this(); service = new IssueService(ghc); }
/** * Create comment on specified issue number * * @param repository * @param issueNumber * @param comment * @return created issue * @throws IOException */ public Comment createComment(IRepositoryIdProvider repository, int issueNumber, String comment) throws IOException { return createComment(repository, Integer.toString(issueNumber), comment); }
/** * Create issue * * @param repository * @param issue * @return created issue * @throws IOException */ public Issue createIssue(IRepositoryIdProvider repository, Issue issue) throws IOException { String repoId = getId(repository); return createIssue(repoId, issue); }
/** * Delete the issue comment with the given id * * @param repository * @param commentId * @throws IOException */ public void deleteComment(IRepositoryIdProvider repository, String commentId) throws IOException { String repoId = getId(repository); deleteComment(repoId, commentId); }
/** * Get an issue's comments * * @param repository * @param issueNumber * @return list of comments * @throws IOException */ public List<Comment> getComments(IRepositoryIdProvider repository, String issueNumber) throws IOException { String repoId = getId(repository); return getComments(repoId, issueNumber); }
client.setOAuth2Token(gitAccessToken); RepositoryId repoID = new RepositoryId(gitRepoUser, gitRepo); IssueService issueService = new IssueService(client); boolean isNewIssue = true; if (duplicate != null) { issueService.createComment(repoID, duplicate.getNumber(), generateGitHubIssueBody(environmentDetails, false)); newGibHubIssue = duplicate; isNewIssue = false; } else { newGibHubIssue = issueService.createIssue(repoID, newGibHubIssue);
issueService = (IssueService) service; } else { issueService = new IssueService(); commentIds.add(comment.getId()); List<Comment> comments = issueService.getComments(getRepository(), pullRequest.getNumber()); for (Comment comment : comments) { commentIds.add(comment.getId());
@Override @Result protected String doInBackground(Void... params) { GitHubClient client; if (login.shouldUseApiToken()) { client = new GitHubClient().setOAuth2Token(login.getApiToken()); } else { client = new GitHubClient().setCredentials(login.getUsername(), login.getPassword()); } Issue issue = new Issue().setTitle(report.getTitle()).setBody(report.getDescription()); try { new IssueService(client).createIssue(target.getUsername(), target.getRepository(), issue); return RESULT_OK; } catch (RequestException e) { switch (e.getStatus()) { case STATUS_BAD_CREDENTIALS: if (login.shouldUseApiToken()) return RESULT_INVALID_TOKEN; return RESULT_BAD_CREDENTIALS; case STATUS_ISSUES_NOT_ENABLED: return RESULT_ISSUES_NOT_ENABLED; default: e.printStackTrace(); return RESULT_UNKNOWN; } } catch (IOException e) { e.printStackTrace(); return RESULT_UNKNOWN; } }
IssueService service = new IssueService(client); Issue issue; try { issue = service.getIssue(owner, name, id); } catch (RequestException ex) { if (ex.getStatus() == 404) {
/** * Get an issue's comments * * @param repository * @param issueNumber * @return list of comments * @throws IOException */ public List<Comment> getComments(IRepositoryIdProvider repository, int issueNumber) throws IOException { return getComments(repository, Integer.toString(issueNumber)); }
/** * Create comment on specified issue number * * @param repository * @param issueNumber * @param comment * @return created issue * @throws IOException */ public Comment createComment(IRepositoryIdProvider repository, String issueNumber, String comment) throws IOException { String repoId = getId(repository); return createComment(repoId, issueNumber, comment); }
/** * Create comment on specified issue number * * @param user * @param repository * @param issueNumber * @param comment * @return created issue * @throws IOException */ public Comment createComment(String user, String repository, String issueNumber, String comment) throws IOException { verifyRepository(user, repository); String repoId = user + '/' + repository; return createComment(repoId, issueNumber, comment); }
/** * Get issue * * @param repository * @param issueNumber * @return issue * @throws IOException */ public Issue getIssue(IRepositoryIdProvider repository, int issueNumber) throws IOException { return getIssue(repository, Integer.toString(issueNumber)); }
/** * Get issues for currently authenticated user * * @return non-null but possibly empty list of issues * @throws IOException */ public List<RepositoryIssue> getIssues() throws IOException { return getIssues(null); }
@Override public void close(String issueId) { Validate.notNull(gitHubClient, "GitHub REST client must be specified."); Comment comment = null; try { final Issue issue = getIssue(issueId); issue.setState(IssueService.STATE_CLOSED); comment = this.issueService.createComment(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issueId, getClosingMessage()); this.issueService.editIssue(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issue); } catch (Exception e) { if (comment != null) { deleteComment(comment); } logger.warning(String.format("An exception has occured while closing the issue %s. Exception: %s", issueId, e.getMessage())); } }
/** * Get an issue's comments * * @param user * @param repository * @param issueNumber * @return list of comments * @throws IOException */ public List<Comment> getComments(String user, String repository, String issueNumber) throws IOException { verifyRepository(user, repository); String repoId = user + '/' + repository; return getComments(repoId, issueNumber); }
/** * Get issue * * @param user * @param repository * @param issueNumber * @return issue * @throws IOException */ public Issue getIssue(String user, String repository, String issueNumber) throws IOException { verifyRepository(user, repository); String repoId = user + '/' + repository; return getIssue(repoId, issueNumber); }
/** * Create issue * * @param user * @param repository * @param issue * @return created issue * @throws IOException */ public Issue createIssue(String user, String repository, Issue issue) throws IOException { verifyRepository(user, repository); String repoId = user + '/' + repository; return createIssue(repoId, issue); }
/** * Delete the issue comment with the given id * * @param user * @param repository * @param commentId * @throws IOException */ public void deleteComment(String user, String repository, long commentId) throws IOException { deleteComment(user, repository, Long.toString(commentId)); }