use of com.meisolsson.githubsdk.model.request.pull_request.EditPullRequest in project gh4a by slapperwan.
the class PullRequestActivity method updatePullRequestState.
private void updatePullRequestState(boolean open) {
@StringRes int dialogMessageResId = open ? R.string.opening_msg : R.string.closing_msg;
@StringRes int errorMessageResId = open ? R.string.issue_error_reopen : R.string.issue_error_close;
String errorMessage = getString(errorMessageResId, mPullRequest.number());
PullRequestService service = ServiceFactory.get(PullRequestService.class, false);
EditPullRequest request = EditPullRequest.builder().state(open ? ApiHelpers.IssueState.OPEN : ApiHelpers.IssueState.CLOSED).build();
service.editPullRequest(mRepoOwner, mRepoName, mPullRequestNumber, request).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, dialogMessageResId, errorMessage)).subscribe(result -> {
mPullRequest = result;
handlePullRequestUpdate();
}, error -> handleActionFailure("Updating pull request failed", error));
}
Aggregations