package com.fastaccess.data.service; import android.support.annotation.NonNull; import com.fastaccess.data.dao.BranchesModel; import com.fastaccess.data.dao.CommentRequestModel; import com.fastaccess.data.dao.CommitCountModel; import com.fastaccess.data.dao.CreateMilestoneModel; import com.fastaccess.data.dao.LabelModel; import com.fastaccess.data.dao.MarkdownModel; import com.fastaccess.data.dao.MilestoneModel; import com.fastaccess.data.dao.Pageable; import com.fastaccess.data.dao.RepoSubscriptionModel; import com.fastaccess.data.dao.model.Comment; import com.fastaccess.data.dao.model.Commit; import com.fastaccess.data.dao.model.Release; import com.fastaccess.data.dao.model.Repo; import com.fastaccess.data.dao.model.RepoFile; import com.fastaccess.data.dao.model.User; import retrofit2.Response; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.Headers; import retrofit2.http.PATCH; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.http.Url; import rx.Observable; /** * Created by Kosh on 10 Dec 2016, 3:16 PM */ public interface RepoService { @NonNull @GET @Headers("Accept: application/vnd.github.VERSION.raw") Observable getFileAsStream(@Url String url); @NonNull @POST("markdown") Observable convertReadmeToHtml(@Body MarkdownModel model); @NonNull @GET("repos/{login}/{repoId}") @Headers({"Accept: application/vnd.github.drax-preview+json"}) Observable getRepo(@Path("login") String login, @Path("repoId") String repoId); @NonNull @DELETE("repos/{login}/{repoId}") Observable> deleteRepo(@Path("login") String login, @Path("repoId") String repoId); @NonNull @GET @Headers("Accept: application/vnd.github.html") Observable getReadmeHtml(@NonNull @Url String url); @NonNull @GET("user/starred/{owner}/{repo}") Observable> checkStarring(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); @NonNull @PUT("user/starred/{owner}/{repo}") Observable> starRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); @NonNull @DELETE("user/starred/{owner}/{repo}") Observable> unstarRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); @NonNull @POST("/repos/{owner}/{repo}/forks") Observable forkRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); @NonNull @GET("repos/{owner}/{repo}/subscription") Observable isWatchingRepo(@Path("owner") String owner, @Path("repo") String repo); @NonNull @PUT("user/subscriptions/{owner}/{repo}") Observable> watchRepo(@Path("owner") String owner, @Path("repo") String repo); @NonNull @DELETE("user/subscriptions/{owner}/{repo}") Observable> unwatchRepo(@Path("owner") String owner, @Path("repo") String repo); @NonNull @GET("repos/{owner}/{repo}/commits") Observable> getCommits(@Path("owner") String owner, @Path("repo") String repo, @NonNull @Query("sha") String branch, @Query("page") int page); @NonNull @GET("repos/{owner}/{repo}/releases") @Headers("Accept: application/vnd.github.VERSION.full+json") Observable> getReleases(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); @NonNull @GET("repos/{owner}/{repo}/contributors") Observable> getContributors(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); @NonNull @GET("repos/{owner}/{repo}/commits/{sha}") @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") Observable getCommit(@Path("owner") String owner, @Path("repo") String repo, @Path("sha") String sha); @NonNull @GET("repos/{owner}/{repo}/commits/{sha}/comments") @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") Observable> getCommitComments(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @NonNull @Path("sha") String ref, @Query("page") int page); @NonNull @POST("repos/{owner}/{repo}/commits/{sha}/comments") @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") Observable postCommitComment(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @NonNull @Path("sha") String ref, @Body CommentRequestModel model); @NonNull @PATCH("repos/{owner}/{repo}/comments/{id}") @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") Observable editCommitComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id, @Body CommentRequestModel body); @NonNull @DELETE("repos/{owner}/{repo}/comments/{id}") Observable> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); @NonNull @GET("repos/{owner}/{repo}/contents/{path}") Observable> getRepoFiles(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @NonNull @Path("path") String path, @NonNull @Query("ref") String ref); @NonNull @GET("repos/{owner}/{repo}/labels") Observable> getLabels(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo); @NonNull @GET("repos/{owner}/{repo}/collaborators/{username}") Observable> isCollaborator(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @NonNull @Path("username") String username); @NonNull @GET("repos/{owner}/{repo}/branches") Observable> getBranches(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo); @NonNull @GET("repos/{owner}/{repo}/milestones") Observable> getMilestones(@Path("owner") String owner, @Path("repo") String repo); @NonNull @POST("repos/{owner}/{repo}/milestones") Observable createMilestone(@Path("owner") String owner, @Path("repo") String repo, @Body CreateMilestoneModel create); @NonNull @GET("repos/{owner}/{repo}/assignees") Observable> getAssignees(@Path("owner") String owner, @Path("repo") String repo); @NonNull @GET("/repos/{owner}/{repo}/stats/participation") Observable getCommitCounts(@Path("owner") String owner, @Path("repo") String repo); }