use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.
the class IssueLabelListActivity method deleteLabel.
private void deleteLabel(IssueLabelAdapter.EditableLabel label) {
String errorMessage = getString(R.string.issue_error_delete_label, label.base().name());
IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
service.deleteLabel(mRepoOwner, mRepoName, label.base().name()).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.deleting_msg, errorMessage)).subscribe(result -> {
loadLabels(true);
setResult(RESULT_OK);
}, error -> handleActionFailure("Deleting label failed", error));
}
use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.
the class EditCommitCommentActivity method editComment.
@Override
protected Single<GitHubCommentBase> editComment(String repoOwner, String repoName, long commentId, String body) {
RepositoryCommentService service = ServiceFactory.get(RepositoryCommentService.class, false);
CommentRequest request = CommentRequest.builder().body(body).build();
return service.editCommitComment(repoOwner, repoName, commentId, request).map(ApiHelpers::throwOnFailure);
}
use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.
the class EditCommitCommentActivity method createComment.
@Override
protected Single<GitHubCommentBase> createComment(String repoOwner, String repoName, String body, long replyToCommentId) {
RepositoryCommentService service = ServiceFactory.get(RepositoryCommentService.class, false);
CreateCommitComment request = CreateCommitComment.builder().body(body).build();
String sha = getIntent().getStringExtra("commit");
return service.createCommitComment(repoOwner, repoName, sha, request).map(ApiHelpers::throwOnFailure);
}
use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.
the class EditIssueCommentActivity method editComment.
@Override
protected Single<GitHubCommentBase> editComment(String repoOwner, String repoName, long commentId, String body) {
IssueCommentService service = ServiceFactory.get(IssueCommentService.class, false);
CommentRequest request = CommentRequest.builder().body(body).build();
return service.editIssueComment(repoOwner, repoName, commentId, request).map(ApiHelpers::throwOnFailure);
}
use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.
the class CreateReviewActivity method onEditorDoSend.
@Override
public Single<?> onEditorDoSend(String body) {
int position = mReviewEventSpinner.getSelectedItemPosition();
@SuppressWarnings("ConstantConditions") ReviewEventDesc desc = mReviewEventAdapter.getItem(position);
PullRequestReviewService service = ServiceFactory.get(PullRequestReviewService.class, false);
final Single<Response<Review>> resultSingle;
if (mPendingReview == null) {
CreateReview request = CreateReview.builder().body(body).event(desc.mCreateEvent).build();
resultSingle = service.createReview(mRepoOwner, mRepoName, mPullRequestNumber, request);
} else {
SubmitReview request = SubmitReview.builder().body(body).event(desc.mSubmitEvent).build();
resultSingle = service.submitReview(mRepoOwner, mRepoName, mPullRequestNumber, mPendingReview.id(), request);
}
return resultSingle.map(ApiHelpers::throwOnFailure);
}
Aggregations