package ceui.lisa.http; import java.util.List; import java.util.Map; import ceui.lisa.model.ListArticle; import ceui.lisa.model.ListLive; import ceui.lisa.model.ListSimpleUser; import ceui.lisa.model.ListTag; import ceui.lisa.model.NovelSeries; import ceui.lisa.models.GifResponse; import ceui.lisa.model.ListBookmarkTag; import ceui.lisa.model.ListComment; import ceui.lisa.models.IllustSearchResponse; import ceui.lisa.model.ListIllust; import ceui.lisa.model.ListNovel; import ceui.lisa.model.ListUser; import ceui.lisa.model.ListTrendingtag; import ceui.lisa.models.CommentHolder; import ceui.lisa.models.MutedHistory; import ceui.lisa.models.NovelDetail; import ceui.lisa.models.NullResponse; import ceui.lisa.models.UserDetailResponse; import ceui.lisa.models.UserState; import io.reactivex.Observable; import okhttp3.MultipartBody; import okhttp3.RequestBody; import retrofit2.http.Body; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.PartMap; import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.http.Url; public interface AppApi { //用作各个页面请求数据 String API_BASE_URL = "https://app-api.pixiv.net/"; /** * 获取排行榜 * * @param mode * @return */ @GET("v1/illust/ranking?filter=for_android") Observable<ListIllust> getRank(@Header("Authorization") String token, @Query("mode") String mode, @Query("date") String date); @GET("v1/novel/ranking?filter=for_android") Observable<ListNovel> getRankNovel(@Header("Authorization") String token, @Query("mode") String mode, @Query("date") String date); /** * 推荐榜单 * * @param token * @return */ @GET("v1/illust/recommended?include_privacy_policy=true&filter=for_android&include_ranking_illusts=true") Observable<ListIllust> getRecmdIllust(@Header("Authorization") String token); @GET("v1/manga/recommended?include_privacy_policy=true&filter=for_android&include_ranking_illusts=true") Observable<ListIllust> getRecmdManga(@Header("Authorization") String token); @GET("v1/novel/recommended?include_privacy_policy=true&filter=for_android&include_ranking_novels=true") Observable<ListNovel> getRecmdNovel(@Header("Authorization") String token); @GET("v1/trending-tags/{type}?filter=for_android&include_translated_tag_results=true") Observable<ListTrendingtag> getHotTags(@Header("Authorization") String token, @Path("type") String type); /** * 原版app登录时候的背景墙 * * @param token * @return */ @GET("v1/walkthrough/illusts?filter=for_android") Observable<ListIllust> getLoginBg(@Header("Authorization") String token); /** * /v1/search/illust? * filter=for_android& * include_translated_tag_results=true& * word=%E8%89%A6%E9%9A%8A%E3%81%93%E3%82%8C%E3%81%8F%E3%81%97%E3%82%87%E3%82%93& * sort=date_desc& 最新 * sort=date_asc& 旧的在前面 * search_target=exact_match_for_tags 标签完全匹配 * search_target=partial_match_for_tags 标签部分匹配 * search_target=title_and_caption 标题或简介 */ @GET("v1/search/illust?filter=for_android&include_translated_tag_results=true") Observable<ListIllust> searchIllust(@Header("Authorization") String token, @Query("word") String word, @Query("sort") String sort, @Query("search_target") String search_target); @GET("v1/search/novel?filter=for_android&include_translated_tag_results=true") Observable<ListNovel> searchNovel(@Header("Authorization") String token, @Query("word") String word, @Query("sort") String sort, @Query("search_target") String search_target); @GET("v2/illust/related?filter=for_android") Observable<ListIllust> relatedIllust(@Header("Authorization") String token, @Query("illust_id") int illust_id); /** * 推荐用户 * * @param token * @return */ @GET("v1/user/recommended?filter=for_android") Observable<ListUser> getRecmdUser(@Header("Authorization") String token); // /v1/user/bookmarks/illust?user_id=24218478&restrict=public HTTP/1.1 @GET("v1/user/bookmarks/illust") Observable<ListIllust> getUserLikeIllust(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("restrict") String restrict, @Query("tag") String tag); @GET("v1/user/bookmarks/illust") Observable<ListIllust> getUserLikeIllust(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("restrict") String restrict); @GET("v1/user/bookmarks/novel") Observable<ListNovel> getUserLikeNovel(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("restrict") String restrict); @GET("v1/user/illusts?filter=for_android") Observable<ListIllust> getUserSubmitIllust(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("type") String type); @GET("v1/user/novels") Observable<ListNovel> getUserSubmitNovel(@Header("Authorization") String token, @Query("user_id") int user_id); @GET("v2/illust/follow?restrict=all") Observable<ListIllust> getFollowUserIllust(@Header("Authorization") String token); @GET("v1/spotlight/articles?filter=for_android") Observable<ListArticle> getArticles(@Header("Authorization") String token, @Query("category") String category); ///v1/user/detail?filter=for_android&user_id=24218478 @GET("v1/user/detail?filter=for_android") Observable<UserDetailResponse> getUserDetail(@Header("Authorization") String token, @Query("user_id") int user_id); // /v1/ugoira/metadata?illust_id=47297805 @GET("v1/ugoira/metadata") Observable<GifResponse> getGifPackage(@Header("Authorization") String token, @Query("illust_id") int illust_id); @FormUrlEncoded @POST("v1/user/follow/add") Observable<NullResponse> postFollow(@Header("Authorization") String token, @Field("user_id") int user_id, @Field("restrict") String followType); @FormUrlEncoded @POST("v1/user/follow/delete") Observable<NullResponse> postUnFollow(@Header("Authorization") String token, @Field("user_id") int user_id); /** * 获取userid 所关注的人 * * @param token * @param user_id * @param restrict * @return */ @GET("v1/user/following?filter=for_android") Observable<ListUser> getFollowUser(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("restrict") String restrict); //获取关注 这个userid 的人 @GET("v1/user/follower?filter=for_android") Observable<ListUser> getWhoFollowThisUser(@Header("Authorization") String token, @Query("user_id") int user_id); @GET("v1/illust/comments") Observable<ListComment> getComment(@Header("Authorization") String token, @Query("illust_id") int illust_id); @GET Observable<ListComment> getNextComment(@Header("Authorization") String token, @Url String nextUrl); @FormUrlEncoded @POST("v1/illust/comment/add") Observable<CommentHolder> postComment(@Header("Authorization") String token, @Field("illust_id") int illust_id, @Field("comment") String comment); @FormUrlEncoded @POST("v1/illust/comment/add") Observable<CommentHolder> postComment(@Header("Authorization") String token, @Field("illust_id") int illust_id, @Field("comment") String comment, @Field("parent_comment_id") int parent_comment_id); @FormUrlEncoded @POST("v2/illust/bookmark/add") Observable<NullResponse> postLike(@Header("Authorization") String token, @Field("illust_id") int illust_id, @Field("restrict") String restrict); @FormUrlEncoded @POST("v2/novel/bookmark/add") Observable<NullResponse> postLikeNovel(@Header("Authorization") String token, @Field("novel_id") int novel_id, @Field("restrict") String restrict); @FormUrlEncoded @POST("v2/illust/bookmark/add") Observable<NullResponse> postLike(@Header("Authorization") String token, @Field("illust_id") int illust_id, @Field("restrict") String restrict, @Field("tags[]") String... tags); @FormUrlEncoded @POST("v1/illust/bookmark/delete") Observable<NullResponse> postDislike(@Header("Authorization") String token, @Field("illust_id") int illust_id); @FormUrlEncoded @POST("v1/novel/bookmark/delete") Observable<NullResponse> postDislikeNovel(@Header("Authorization") String token, @Field("novel_id") int novel_id); @GET("v1/illust/detail?filter=for_android") Observable<IllustSearchResponse> getIllustByID(@Header("Authorization") String token, @Query("illust_id") int illust_id); @GET("v1/search/user?filter=for_android") Observable<ListUser> searchUser(@Header("Authorization") String token, @Query("word") String word); // v2/search/autocomplete?merge_plain_keyword_results=true&word=%E5%A5%B3%E4%BD%93 HTTP/1.1 @GET("v2/search/autocomplete?merge_plain_keyword_results=true") Observable<ListTrendingtag> searchCompleteWord(@Header("Authorization") String token, @Query("word") String word); /** * 获取收藏的标签 */ //GET v1/user/bookmark-tags/illust?user_id=41531382&restrict=public HTTP/1.1 @GET("v1/user/bookmark-tags/illust") Observable<ListTag> getBookmarkTags(@Header("Authorization") String token, @Query("user_id") int user_id, @Query("restrict") String restrict); @GET Observable<ListTag> getNextTags(@Header("Authorization") String token, @Url String nextUrl); // GET v2/illust/bookmark/detail?illust_id=72878894 HTTP/1.1 @GET("v2/illust/bookmark/detail") Observable<ListBookmarkTag> getIllustBookmarkTags(@Header("Authorization") String token, @Query("illust_id") int illust_id); /** * 获取已屏蔽的标签/用户 * <p> * 这功能感觉做了没啥卵用,因为未开会员的用户只能屏蔽一个标签/用户, * <p> * 你屏蔽了一个用户,就不能再屏蔽标签,屏蔽了标签,就不能屏蔽用户,而且都只能屏蔽一个,擦 * * @param token * @return */ @GET("v1/mute/list") Observable<MutedHistory> getMutedHistory(@Header("Authorization") String token); //获取好P友 @GET("v1/user/mypixiv?filter=for_android") Observable<ListUser> getNiceFriend(@Header("Authorization") String token, @Query("user_id") int user_id); //获取最新作品 @GET("v1/illust/new?filter=for_android") Observable<ListIllust> getNewWorks(@Header("Authorization") String token, @Query("content_type") String content_type); //获取最新作品 @GET("v1/novel/new") Observable<ListNovel> getNewNovels(@Header("Authorization") String token); @GET Observable<ListUser> getNextUser(@Header("Authorization") String token, @Url String next_url); @GET Observable<ListSimpleUser> getNextSimpleUser(@Header("Authorization") String token, @Url String next_url); @GET Observable<ListIllust> getNextIllust(@Header("Authorization") String token, @Url String next_url); @GET Observable<ListNovel> getNextNovel(@Header("Authorization") String token, @Url String next_url); @GET Observable<NovelSeries> getNextSeriesNovel(@Header("Authorization") String token, @Url String next_url); @GET Observable<ListArticle> getNextArticals(@Header("Authorization") String token, @Url String next_url); //获取好P友 @GET("v1/novel/text") Observable<NovelDetail> getNovelDetail(@Header("Authorization") String token, @Query("novel_id") int novel_id); //获取好P友 @GET("v1/user/me/state") Observable<UserState> getAccountState(@Header("Authorization") String token); @Multipart @POST("v1/user/profile/edit") Observable<NullResponse> updateUserProfile(@Header("Authorization") String token, @Part List<MultipartBody.Part> parts); @GET("v1/live/list") Observable<ListLive> getLiveList(@Header("Authorization") String token, @Query("list_type") String list_type); @GET("v1/illust/bookmark/users?filter=for_android") Observable<ListSimpleUser> getUsersWhoLikeThisIllust(@Header("Authorization") String token, @Query("illust_id") int illust_id); @GET("v2/novel/series") Observable<NovelSeries> getNovelSeries(@Header("Authorization") String token, @Query("series_id") int series_id); }