Search in sources :

Example 1 with IssueEvent

use of com.meisolsson.githubsdk.model.IssueEvent in project PocketHub by pockethub.

the class RefreshIssueTask method subscribe.

@Override
public void subscribe(ObservableEmitter<FullIssue> emitter) throws Exception {
    try {
        Issue issue = store.refreshIssue(repo, issueNumber);
        if (issue.pullRequest() != null) {
            PullRequest pull = getPullRequest(repo.owner().login(), repo.name(), issueNumber);
            issue = issue.toBuilder().pullRequest(pull).build();
        }
        bodyImageGetter.encode(issue.id(), issue.bodyHtml());
        List<GitHubComment> comments;
        if (issue.comments() > 0) {
            comments = getAllComments(repo.owner().login(), repo.name(), issueNumber);
        } else {
            comments = Collections.emptyList();
        }
        for (GitHubComment comment : comments) {
            commentImageGetter.encode(comment.id(), comment.bodyHtml());
        }
        List<IssueEvent> events = getAllEvents(repo.owner().login(), repo.name(), issueNumber);
        emitter.onNext(new FullIssue(issue, comments, events));
    } catch (IOException e) {
        emitter.onError(e);
    }
}
Also used : Issue(com.meisolsson.githubsdk.model.Issue) PullRequest(com.meisolsson.githubsdk.model.PullRequest) GitHubComment(com.meisolsson.githubsdk.model.GitHubComment) IOException(java.io.IOException) IssueEvent(com.meisolsson.githubsdk.model.IssueEvent)

Aggregations

GitHubComment (com.meisolsson.githubsdk.model.GitHubComment)1 Issue (com.meisolsson.githubsdk.model.Issue)1 IssueEvent (com.meisolsson.githubsdk.model.IssueEvent)1 PullRequest (com.meisolsson.githubsdk.model.PullRequest)1 IOException (java.io.IOException)1