Search in sources :

Example 1 with IssueRequest

use of com.meisolsson.githubsdk.model.request.issue.IssueRequest in project PocketHub by pockethub.

the class EditLabelsTask method subscribe.

@Override
public void subscribe(ObservableEmitter<Issue> emitter) throws Exception {
    try {
        List<String> labelNames = new ArrayList<>(labels.length);
        for (Label label : labels) {
            labelNames.add(label.name());
        }
        IssueRequest editIssue = IssueRequest.builder().labels(labelNames).build();
        emitter.onNext(store.editIssue(repositoryId, issueNumber, editIssue));
    } catch (IOException e) {
        emitter.onError(e);
    }
}
Also used : IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) ArrayList(java.util.ArrayList) Label(com.meisolsson.githubsdk.model.Label) IOException(java.io.IOException)

Example 2 with IssueRequest

use of com.meisolsson.githubsdk.model.request.issue.IssueRequest in project PocketHub by pockethub.

the class EditMilestoneTask method subscribe.

@Override
public void subscribe(ObservableEmitter<Issue> emitter) throws Exception {
    try {
        IssueRequest editedIssue = IssueRequest.builder().milestone(milestoneNumber).build();
        emitter.onNext(store.editIssue(repositoryId, issueNumber, editedIssue));
    } catch (IOException e) {
        emitter.onError(e);
    }
}
Also used : IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) IOException(java.io.IOException)

Example 3 with IssueRequest

use of com.meisolsson.githubsdk.model.request.issue.IssueRequest in project PocketHub by pockethub.

the class EditAssigneeTask method subscribe.

@Override
public void subscribe(ObservableEmitter<Issue> emitter) throws Exception {
    try {
        String assigneLogin;
        if (assignee != null) {
            assigneLogin = assignee.login();
        } else {
            assigneLogin = "";
        }
        IssueRequest edit = IssueRequest.builder().assignees(Collections.singletonList(assigneLogin)).build();
        emitter.onNext(store.editIssue(repositoryId, issueNumber, edit));
    } catch (IOException e) {
        emitter.onError(e);
    }
}
Also used : IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) IOException(java.io.IOException)

Example 4 with IssueRequest

use of com.meisolsson.githubsdk.model.request.issue.IssueRequest in project PocketHub by pockethub.

the class IssueStore method changeState.

public Issue changeState(Repository repository, int issueNumber, IssueState state) throws IOException {
    IssueRequest editIssue = IssueRequest.builder().state(state).build();
    Issue issue = service.editIssue(repository.owner().login(), repository.name(), issueNumber, editIssue).blockingGet();
    return addIssue(repository, issue);
}
Also used : IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) Issue(com.meisolsson.githubsdk.model.Issue)

Aggregations

IssueRequest (com.meisolsson.githubsdk.model.request.issue.IssueRequest)4 IOException (java.io.IOException)3 Issue (com.meisolsson.githubsdk.model.Issue)1 Label (com.meisolsson.githubsdk.model.Label)1 ArrayList (java.util.ArrayList)1