Search in sources :

Example 66 with ApiHelpers

use of com.gh4a.utils.ApiHelpers 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)

Example 67 with ApiHelpers

use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.

the class HomeActivity method loadUserInfo.

private void loadUserInfo(boolean force) {
    UserService service = ServiceFactory.get(UserService.class, force);
    service.getUser(mUserLogin).map(ApiHelpers::throwOnFailure).compose(makeLoaderSingle(ID_LOADER_USER, force)).subscribe(result -> {
        Gh4Application.get().setCurrentAccountInfo(result);
        mUserInfo = result;
        updateUserInfo();
    }, this::handleLoadFailure);
}
Also used : UserService(com.meisolsson.githubsdk.service.users.UserService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 68 with ApiHelpers

use of com.gh4a.utils.ApiHelpers in project gh4a by slapperwan.

the class CommitNoteAdapter method addReaction.

@Override
public Single<Reaction> addReaction(ReactionBar.Item item, String content) {
    GitComment comment = ((ViewHolder) item).mBoundItem;
    ReactionService service = ServiceFactory.get(ReactionService.class, false);
    ReactionRequest request = ReactionRequest.builder().content(content).build();
    return service.createCommitCommentReaction(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) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)68 Response (retrofit2.Response)13 RxUtils (com.gh4a.utils.RxUtils)12 ServiceFactory (com.gh4a.ServiceFactory)11 Intent (android.content.Intent)10 Bundle (android.os.Bundle)10 Optional (com.gh4a.utils.Optional)10 PullRequestReviewCommentService (com.meisolsson.githubsdk.service.pull_request.PullRequestReviewCommentService)10 Single (io.reactivex.Single)9 Context (android.content.Context)7 LayoutInflater (android.view.LayoutInflater)7 CommentRequest (com.meisolsson.githubsdk.model.request.CommentRequest)7 List (java.util.List)7 View (android.view.View)6 R (com.gh4a.R)6 IntentUtils (com.gh4a.utils.IntentUtils)6 User (com.meisolsson.githubsdk.model.User)6 ReactionRequest (com.meisolsson.githubsdk.model.request.ReactionRequest)6 CreateReviewComment (com.meisolsson.githubsdk.model.request.pull_request.CreateReviewComment)6 ReactionService (com.meisolsson.githubsdk.service.reactions.ReactionService)6