Search in sources :

Example 1 with ReactionRequest

use of com.meisolsson.githubsdk.model.request.ReactionRequest in project gh4a by slapperwan.

the class IssueFragmentBase method addReaction.

@Override
public Single<Reaction> addReaction(ReactionBar.Item item, String content) {
    ReactionService service = ServiceFactory.get(ReactionService.class, false);
    ReactionRequest request = ReactionRequest.builder().content(content).build();
    return service.createIssueReaction(mRepoOwner, mRepoName, mIssue.number(), request).map(ApiHelpers::throwOnFailure);
}
Also used : ReactionRequest(com.meisolsson.githubsdk.model.request.ReactionRequest) ReactionService(com.meisolsson.githubsdk.service.reactions.ReactionService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 2 with ReactionRequest

use of com.meisolsson.githubsdk.model.request.ReactionRequest in project gh4a by slapperwan.

the class ReviewFragment method addReaction.

@Override
public Single<Reaction> addReaction(GitHubCommentBase comment, String content) {
    final ReactionService service = ServiceFactory.get(ReactionService.class, false);
    final ReactionRequest request = ReactionRequest.builder().content(content).build();
    final Single<Response<Reaction>> responseSingle = comment instanceof ReviewComment ? service.createPullRequestReviewCommentReaction(mRepoOwner, mRepoName, comment.id(), request) : service.createIssueCommentReaction(mRepoOwner, mRepoName, comment.id(), request);
    return responseSingle.map(ApiHelpers::throwOnFailure);
}
Also used : ReactionRequest(com.meisolsson.githubsdk.model.request.ReactionRequest) Response(retrofit2.Response) CreateReviewComment(com.meisolsson.githubsdk.model.request.pull_request.CreateReviewComment) ReviewComment(com.meisolsson.githubsdk.model.ReviewComment) ReactionService(com.meisolsson.githubsdk.service.reactions.ReactionService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 3 with ReactionRequest

use of com.meisolsson.githubsdk.model.request.ReactionRequest in project gh4a by slapperwan.

the class IssueFragmentBase method addReaction.

@Override
public Single<Reaction> addReaction(GitHubCommentBase comment, String content) {
    ReactionService service = ServiceFactory.get(ReactionService.class, false);
    ReactionRequest request = ReactionRequest.builder().content(content).build();
    return service.createIssueCommentReaction(mRepoOwner, mRepoName, comment.id(), request).map(ApiHelpers::throwOnFailure);
}
Also used : ReactionRequest(com.meisolsson.githubsdk.model.request.ReactionRequest) ReactionService(com.meisolsson.githubsdk.service.reactions.ReactionService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 4 with ReactionRequest

use of com.meisolsson.githubsdk.model.request.ReactionRequest in project gh4a by slapperwan.

the class PullRequestDiffViewerActivity method addReaction.

@Override
public Single<Reaction> addReaction(ReactionBar.Item item, String content) {
    CommitCommentWrapper comment = (CommitCommentWrapper) item;
    ReactionService service = ServiceFactory.get(ReactionService.class, false);
    ReactionRequest request = ReactionRequest.builder().content(content).build();
    return service.createPullRequestReviewCommentReaction(mRepoOwner, mRepoName, comment.comment.id(), request).map(ApiHelpers::throwOnFailure);
}
Also used : ReactionRequest(com.meisolsson.githubsdk.model.request.ReactionRequest) ReactionService(com.meisolsson.githubsdk.service.reactions.ReactionService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 5 with ReactionRequest

use of com.meisolsson.githubsdk.model.request.ReactionRequest in project gh4a by slapperwan.

the class CommitDiffViewerActivity method addReaction.

@Override
public Single<Reaction> addReaction(ReactionBar.Item item, String content) {
    CommitCommentWrapper comment = (CommitCommentWrapper) item;
    final ReactionService service = ServiceFactory.get(ReactionService.class, false);
    ReactionRequest request = ReactionRequest.builder().content(content).build();
    return service.createCommitCommentReaction(mRepoOwner, mRepoName, comment.comment.id(), request).map(ApiHelpers::throwOnFailure);
}
Also used : ReactionRequest(com.meisolsson.githubsdk.model.request.ReactionRequest) ReactionService(com.meisolsson.githubsdk.service.reactions.ReactionService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)6 ReactionRequest (com.meisolsson.githubsdk.model.request.ReactionRequest)6 ReactionService (com.meisolsson.githubsdk.service.reactions.ReactionService)6 ReviewComment (com.meisolsson.githubsdk.model.ReviewComment)1 GitComment (com.meisolsson.githubsdk.model.git.GitComment)1 CreateReviewComment (com.meisolsson.githubsdk.model.request.pull_request.CreateReviewComment)1 Response (retrofit2.Response)1