package ml.docilealligator.infinityforreddit.apis; import com.google.common.util.concurrent.ListenableFuture; import java.util.Map; import ml.docilealligator.infinityforreddit.thing.SortType; import ml.docilealligator.infinityforreddit.utils.APIUtils; import okhttp3.MultipartBody; import okhttp3.RequestBody; import retrofit2.Call; import retrofit2.Response; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.Field; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.HeaderMap; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Part; import retrofit2.http.PartMap; import retrofit2.http.Path; import retrofit2.http.Query; public interface RedditAPI { @FormUrlEncoded @POST("api/v1/access_token") Call getAccessToken(@HeaderMap Map headers, @FieldMap Map params); @GET("r/{subredditName}/about.json?raw_json=1") Call getSubredditData(@Path("subredditName") String subredditName); @GET("r/{subredditName}/about.json?raw_json=1") Call getSubredditDataOauth(@Path("subredditName") String subredditName, @HeaderMap Map headers); @GET("subreddits/mine/subscriber?raw_json=1") Call getSubscribedThing(@Query("after") String lastItem, @HeaderMap Map headers); @GET("api/v1/me?raw_json=1") Call getMyInfo(@HeaderMap Map headers); @FormUrlEncoded @POST("api/vote") Call voteThing(@HeaderMap Map headers, @FieldMap Map params); @GET("comments/{id}.json?raw_json=1") Call getPostOauth(@Path("id") String id, @HeaderMap Map headers); @GET("comments/{id}.json?raw_json=1") Call getPost(@Path("id") String id); @GET("user/{username}/about.json?raw_json=1") Call getUserData(@Path("username") String username); @GET("user/{username}/about.json?raw_json=1&limit=100") Call getUserDataOauth(@HeaderMap Map headers, @Path("username") String username); @GET("user/{username}/comments.json?raw_json=1&limit=100") Call getUserComments(@Path("username") String username, @Query("after") String after, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("user/{username}/comments.json?raw_json=1&limit=100") Call getUserCommentsOauth(@HeaderMap Map headers, @Path("username") String username, @Query("after") String after, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("user/{username}/{where}.json?&type=comments&raw_json=1&limit=100") Call getUserSavedCommentsOauth(@Path("username") String username, @Path("where") String where, @Query("after") String lastItem, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime, @HeaderMap Map headers); @FormUrlEncoded @POST("api/subscribe") Call subredditSubscription(@HeaderMap Map headers, @FieldMap Map params); @GET("/api/info.json?raw_json=1") Call getInfo(@Query("id") String id); @GET("/api/info.json?raw_json=1") Call getInfoOauth(@Query("id") String id, @HeaderMap Map headers); @GET("subreddits/search.json?raw_json=1") Call searchSubreddits(@Query("q") String subredditName, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("include_over_18") int nsfw, @HeaderMap Map headers); @GET("search.json?raw_json=1&type=user") Call searchUsers(@Query("q") String profileName, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("include_over_18") int nsfw); @FormUrlEncoded @POST("api/comment") Call sendCommentOrReplyToMessage(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("api/del") Call delete(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("api/submit") Call submit(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("api/media/asset.json?raw_json=1&gilding_detail=1") Call uploadImage(@HeaderMap Map headers, @FieldMap Map params); @GET("r/{subredditName}/api/link_flair.json?raw_json=1") Call getFlairs(@HeaderMap Map headers, @Path("subredditName") String subredditName); @GET("/r/{subredditName}/about/rules.json?raw_json=1") Call getRules(@Path("subredditName") String subredditName); @GET("/r/{subredditName}/about/rules.json?raw_json=1") Call getRulesOauth(@HeaderMap Map headers, @Path("subredditName") String subredditName); @GET("/comments/{id}/placeholder/{singleCommentId}.json?raw_json=1") Call getPostAndCommentsSingleThreadByIdOauth(@Path("id") String id, @Path("singleCommentId") String singleCommentId, @Query("sort") SortType.Type sortType, @Query("context") String contextNumber, @HeaderMap Map headers); @GET("/comments/{id}.json?raw_json=1") Call getPostAndCommentsByIdOauth(@Path("id") String id, @Query("sort") SortType.Type sortType, @HeaderMap Map headers); @GET("/comments/{id}/placeholder/{singleCommentId}.json?raw_json=1") Call getPostAndCommentsSingleThreadById(@Path("id") String id, @Path("singleCommentId") String singleCommentId, @Query("sort") SortType.Type sortType, @Query("context") String contextNumber); @GET("/comments/{id}.json?raw_json=1") Call getPostAndCommentsById(@Path("id") String id, @Query("sort") SortType.Type sortType); @Multipart @POST(".") Call uploadMediaToAWS(@PartMap() Map params, @Part() MultipartBody.Part file); @FormUrlEncoded @POST("/api/editusertext") Call editPostOrComment(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/marknsfw") Call markNSFW(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/unmarknsfw") Call unmarkNSFW(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/spoiler") Call markSpoiler(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/unspoiler") Call unmarkSpoiler(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("{subredditNamePrefixed}/api/selectflair") Call selectFlair(@Path("subredditNamePrefixed") String subredditName, @HeaderMap Map headers, @FieldMap Map params); @GET("/message/{where}.json?raw_json=1") Call getMessages(@HeaderMap Map headers, @Path("where") String where, @Query("after") String after); @FormUrlEncoded @POST("/api/read_message") Call readMessage(@HeaderMap Map headers, @FieldMap Map ids); @FormUrlEncoded @POST("/api/save") Call save(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/unsave") Call unsave(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/hide") Call hide(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/unhide") Call unhide(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/favorite") Call favoriteThing(@HeaderMap Map headers, @FieldMap Map params); @GET("/api/multi/mine") Call getMyMultiReddits(@HeaderMap Map headers); @FormUrlEncoded @POST("/api/multi/favorite?raw_json=1&gilding_detail=1") Call favoriteMultiReddit(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/multi/multipath") Call createMultiReddit(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @PUT("/api/multi/multipath") Call updateMultiReddit(@HeaderMap Map headers, @FieldMap Map params); @DELETE("/api/multi/multipath") Call deleteMultiReddit(@HeaderMap Map headers, @Query("multipath") String multipath); @GET("/api/multi/multipath/") Call getMultiRedditInfo(@HeaderMap Map headers, @Query("multipath") String multipath); @FormUrlEncoded @POST("/api/report") Call report(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/compose") Call composePrivateMessage(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("api/block_user") Call blockUser(@HeaderMap Map headers, @FieldMap Map params); @GET("r/{subredditName}/api/user_flair_v2.json?raw_json=1") Call getUserFlairs(@HeaderMap Map headers, @Path("subredditName") String subredditName); @FormUrlEncoded @POST("/r/{subredditName}/api/selectflair?raw_json=1") Call selectUserFlair(@HeaderMap Map headers, @FieldMap Map params, @Path("subredditName") String subredditName); @FormUrlEncoded @POST("api/v2/gold/gild") Call awardThing(@HeaderMap Map headers, @FieldMap Map params); @GET("/r/random/comments.json?limit=1&raw_json=1") Call getRandomPost(); @GET("/r/randnsfw/new.json?sort=new&t=all&limit=1&raw_json=1") Call getRandomNSFWPost(); @POST("/api/read_all_messages") Call readAllMessages(@HeaderMap Map headers); @FormUrlEncoded @PUT("/api/multi{multipath}/r/{subredditName}") Call addSubredditToMultiReddit(@HeaderMap Map headers, @FieldMap Map params, @Path(value = "multipath", encoded = true) String multipath, @Path("subredditName") String subredditName); @FormUrlEncoded @POST("/api/quarantine_option?raw_json=1") Call optInQuarantinedSubreddit(@HeaderMap Map headers, @FieldMap Map params); @GET("/api/subreddit_autocomplete_v2?typeahead_active=true&include_profiles=false&raw_json=1") Call subredditAutocomplete(@HeaderMap Map headers, @Query("query") String query, @Query("include_over_18") boolean nsfw); @POST("/api/submit_gallery_post.json?resubmit=true&raw_json=1") Call submitGalleryPost(@HeaderMap Map headers, @Body String body); @POST("/api/submit_poll_post.json?resubmit=true&raw_json=1&gilding_detail=1") Call submitPollPost(@HeaderMap Map headers, @Body String body); @GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1") Call getTrendingSearches(); @GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1") Call getTrendingSearchesOauth(@HeaderMap Map headers); @GET("/r/{subredditName}/wiki/{wikiPage}.json?raw_json=1") Call getWikiPage(@Path("subredditName") String subredditName, @Path("wikiPage") String wikiPage); @GET("{sortType}?raw_json=1&limit=100") ListenableFuture> getBestPostsListenableFuture(@Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem, @HeaderMap Map headers); @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1") ListenableFuture> getSubredditBestPostsOauthListenableFuture(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem, @HeaderMap Map headers); @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1") ListenableFuture> getSubredditBestPostsListenableFuture(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem); @GET("user/{username}/{where}.json?type=links&raw_json=1&limit=100") ListenableFuture> getUserPostsOauthListenableFuture(@Header(APIUtils.AUTHORIZATION_KEY) String authorization, @Path("username") String username, @Path("where") String where, @Query("after") String lastItem, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("user/{username}/submitted.json?raw_json=1&limit=100") ListenableFuture> getUserPostsListenableFuture(@Path("username") String username, @Query("after") String lastItem, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link") ListenableFuture> searchPostsOauthListenableFuture(@Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("source") String source, @HeaderMap Map headers); @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link") ListenableFuture> searchPostsListenableFuture(@Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("source") String source); @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true") ListenableFuture> searchPostsInSpecificSubredditOauthListenableFuture(@Path("subredditName") String subredditName, @Query("q") String query, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("after") String after, @HeaderMap Map headers); @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true") ListenableFuture> searchPostsInSpecificSubredditListenableFuture(@Path("subredditName") String subredditName, @Query("q") String query, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("after") String after); @GET("{multipath}?raw_json=1&limit=100") ListenableFuture> getMultiRedditPostsListenableFuture(@Path(value = "multipath", encoded = true) String multiPath, @Path(value = "sortType", encoded = true) SortType.Type sortType, @Query("after") String after, @Query("t") SortType.Time sortTime); @GET("{multipath}/{sortType}.json?raw_json=1&limit=100") ListenableFuture> getMultiRedditPostsOauthListenableFuture(@Path(value = "multipath", encoded = true) String multiPath, @Path(value = "sortType", encoded = true) SortType.Type sortType, @Query("after") String after, @Query("t") SortType.Time sortTime, @HeaderMap Map headers); @GET("{multipath}/search.json?raw_json=1&limit=100&type=link&restrict_sr=on&sr_detail=true&include_over_18=1&always_show_media=1") ListenableFuture> searchMultiRedditPostsListenableFuture(@Path(value = "multipath", encoded = true) String multiPath, @Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("{multipath}/search.json?raw_json=1&limit=100&type=link&restrict_sr=on&sr_detail=true&include_over_18=1&always_show_media=1") ListenableFuture> searchMultiRedditPostsOauthListenableFuture(@Path(value = "multipath", encoded = true) String multiPath, @Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime, @HeaderMap Map headers); @GET("{sortType}?raw_json=1&limit=100") Call getBestPosts(@Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem, @HeaderMap Map headers); @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1") Call getSubredditBestPostsOauth(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem, @HeaderMap Map headers); @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1") Call getSubredditBestPosts(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime, @Query("after") String lastItem); @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=100") Call getUserPostsOauth(@Path("username") String username, @Path("where") String where, @Query("after") String lastItem, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime, @HeaderMap Map headers); @GET("user/{username}/submitted.json?raw_json=1&limit=100") Call getUserPosts(@Path("username") String username, @Query("after") String lastItem, @Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime); @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link") Call searchPostsOauth(@Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("source") String source, @HeaderMap Map headers); @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link") Call searchPosts(@Query("q") String query, @Query("after") String after, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("source") String source); @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true") Call searchPostsInSpecificSubredditOauth(@Path("subredditName") String subredditName, @Query("q") String query, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("after") String after, @HeaderMap Map headers); @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true") Call searchPostsInSpecificSubreddit(@Path("subredditName") String subredditName, @Query("q") String query, @Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime, @Query("after") String after); @GET("{multipath}?raw_json=1&limit=100") Call getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after, @Query("t") SortType.Time sortTime); @GET("{multipath}.json?raw_json=1&limit=100") Call getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath, @Query("after") String after, @Query("t") SortType.Time sortTime, @HeaderMap Map headers); @POST("r/{subredditName}/api/delete_sr_icon") Call deleteSrIcon(@HeaderMap Map headers, @Path("subredditName") String subredditName); @POST("r/{subredditName}/api/delete_sr_banner") Call deleteSrBanner(@HeaderMap Map headers, @Path("subredditName") String subredditName); @Multipart @POST("r/{subredditName}/api/upload_sr_img") Call uploadSrImg(@HeaderMap Map headers, @Path("subredditName") String subredditName, @PartMap Map params, @Part MultipartBody.Part file); @GET("r/{subredditName}/about/edit?raw_json=1") Call getSubredditSetting(@HeaderMap Map headers, @Path("subredditName") String subredditName); @FormUrlEncoded @POST("/api/site_admin") Call postSiteAdmin(@HeaderMap Map headers, @FieldMap Map params); @FormUrlEncoded @POST("/api/morechildren.json?raw_json=1&api_type=json") Call moreChildren(@Field("link_id") String linkId, @Field("children") String children, @Field("sort") SortType.Type sort); @FormUrlEncoded @POST("/api/morechildren.json?raw_json=1&api_type=json") Call moreChildrenOauth(@Field("link_id") String linkId, @Field("children") String children, @Field("sort") SortType.Type sort, @HeaderMap Map headers); @FormUrlEncoded @POST("/api/sendreplies") Call toggleRepliesNotification(@HeaderMap Map headers, @FieldMap Map params); }