Search in sources :

Example 11 with PullRequestReviewCommentService

use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.

the class EditPullRequestDiffCommentActivity method createComment.

@Override
protected Single<GitHubCommentBase> createComment(String repoOwner, String repoName, String body, long replyToCommentId) {
    Bundle extras = getIntent().getExtras();
    int prNumber = extras.getInt("pull_request_number", 0);
    PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
    CreateReviewComment.Builder builder = CreateReviewComment.builder().body(body);
    if (replyToCommentId != 0) {
        builder.inReplyTo(replyToCommentId);
    } else {
        builder.commitId(extras.getString("commit_id")).path(extras.getString("path")).position(extras.getInt("position"));
    }
    return service.createReviewComment(repoOwner, repoName, prNumber, builder.build()).map(ApiHelpers::throwOnFailure);
}
Also used : Bundle(android.os.Bundle) ApiHelpers(com.gh4a.utils.ApiHelpers) CreateReviewComment(com.meisolsson.githubsdk.model.request.pull_request.CreateReviewComment) PullRequestReviewCommentService(com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService)

Example 12 with PullRequestReviewCommentService

use of com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService in project gh4a by slapperwan.

the class EditPullRequestDiffCommentActivity method editComment.

@Override
protected Single<GitHubCommentBase> editComment(String repoOwner, String repoName, long commentId, String body) {
    PullRequestReviewCommentService service = ServiceFactory.get(PullRequestReviewCommentService.class, false);
    CommentRequest request = CommentRequest.builder().body(body).build();
    return service.editReviewComment(repoOwner, repoName, commentId, request).map(ApiHelpers::throwOnFailure);
}
Also used : CommentRequest(com.meisolsson.githubsdk.model.request.CommentRequest) ApiHelpers(com.gh4a.utils.ApiHelpers) PullRequestReviewCommentService(com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)12 PullRequestReviewCommentService (com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService)12 Intent (android.content.Intent)6 ServiceFactory (com.gh4a.ServiceFactory)6 RxUtils (com.gh4a.utils.RxUtils)6 ReviewComment (com.meisolsson.githubsdk.model.ReviewComment)6 IntentUtils (com.gh4a.utils.IntentUtils)5 Optional (com.gh4a.utils.Optional)5 CreateReviewComment (com.meisolsson.githubsdk.model.request.pull_request.CreateReviewComment)5 Single (io.reactivex.Single)5 Bundle (android.os.Bundle)4 GitHubFile (com.meisolsson.githubsdk.model.GitHubFile)4 PullRequestReviewService (com.meisolsson.githubsdk.service.pull_request.PullRequestReviewService)4 PullRequestService (com.meisolsson.githubsdk.service.pull_request.PullRequestService)4 List (java.util.List)4 VisibleForTesting (android.support.annotation.VisibleForTesting)3 FragmentActivity (android.support.v4.app.FragmentActivity)3 View (android.view.View)3 R (com.gh4a.R)3 TimelineItem (com.gh4a.model.TimelineItem)3