/** * 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); }
/** * 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); }
public void process(Exchange exchange) throws Exception { Issue issue = new Issue(); String issueTitle = exchange.getIn().getHeader(GitHubConstants.GITHUB_ISSUE_TITLE, String.class); if (ObjectHelper.isEmpty(issueTitle)) { throw new IllegalArgumentException("Issue Title must be specified to create an issue"); } issue.setTitle(issueTitle); issue.setBody(exchange.getIn().getBody(String.class)); Issue finalIssue = issueService.createIssue(getRepository(), issue); // copy the header of in message to the out message exchange.getOut().copyFrom(exchange.getIn()); exchange.getOut().setBody(finalIssue); }
isNewIssue = false; } else { newGibHubIssue = issueService.createIssue(repoID, newGibHubIssue);
@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; } }