package com.novelbook.android.netapi; import java.util.Map; import io.reactivex.Observable; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.http.QueryMap; import retrofit2.http.Streaming; import retrofit2.http.Url; /** * Created by 眼神 on 2018/3/27. * * 存放所有的Api */ public interface HttpApi { //请填写自己的接口名 // @POST("abc") // Observable getDataForBean(@Body DouBanMovieRequest bean); @GET("top250") Observable getDataForMap(@QueryMap Map map); /** * 通过地址下载一个文件 */ @GET("ab") @Streaming Call downloadFile(@Url String fileUrl); //http://xiaoshuofenxiang.com/api/g/ @GET("g/") Observable getMasterDomain(); //http://xiaoshuofenxiang.com/api/n/f2619820112625133c14dcb170f5e092.json @GET("n/{id}") Observable getNovel(@Path("id") int novelId); //http://xiaoshuofenxiang.com/api/n/f2619820112625133c14dcb170f5e092.mulu-urls.json @GET("n/{id}/mulu-urls") Observable getNovelSites(@Path("id") int novelId); //http://xiaoshuofenxiang.com/api/s/www.qu.la.json @GET("s/{siteDomain}.json") Observable getNovelRule(@Path("siteDomain") String siteDomain); @GET("page/index") Observable getFirstPage(@Query("sex") int Sex); //分类的总榜,显示每个小说分类有多少本书http://xiaoshuofenxiang.com/api/page/noveltype @GET("page/noveltype") Observable getCates(@Query("sex") int sex); // sex:1,男, 2, 女;progress:1, 连载中、2:已完本,3. 新书 http://xiaoshuofenxiang.com/api/search/nt/言情/2?sex=2&progress=1 //@GET("search/nt/{cate}/{pageno}?sex={sex}&progress={progress} ") // Observable search(@Query("cate") String cate, @Query("pageno") int pageno, @Query("sex") int sex, @Query("progress") int progress); @GET("search/nt/{cate}/{pageno}") Observable getCateNovels(@Path("cate") String cate, @Path("pageno") int pageno, @Query("sex") int sex, @Query("progress") int progress); //小说排行 http://xiaoshuofenxiang.com/api/page/rank?fn=hot @GET("page/rank") Observable getNovelPaihang(@Query("fn") String fn,@Query("pn") int pageNo,@Query("sex") int Sex); //相关小说 http://xiaoshuofenxiang.com/api/n/6/about @GET("n/{novelId}/about") Observable getNovelsRelated(@Path("novelId") int novelId); //同作者其它小说http://xiaoshuofenxiang.com/api/n/7/author @GET("n/{novelId}/author") Observable getNovelsSameAuthor(@Path("novelId") int novelId); //站点榜单http://xiaoshuofenxiang.com/api/page/siteranks?sex=1 /* @GET("page/siteranks") Observable getSiteRanks(@Query("sex") int Sex); //http://xiaoshuofenxiang.com/api/page/siterank?fn=qidian-yuanchuangfengyunbang&pn=3 @GET("page/siterank") Observable getSiteRankDetail(@Query("fn")String fn,@Query("pn")int pageNo,@Query("sex") int Sex);*/ @GET( "search/{keyword}/{pageno}") Observable getSeachNolvelist(@Path("keyword")String keyWord,@Path("pageno")int pageNo,@Query("sex") int Sex); // 搜索分类 http://xiaoshuofenxiang.com/api/page/topdata @GET("page/topdata") Observable getSearchTitles(@Query("sex") int Sex); //返回指定id列表的小说列表api/novels/1,2 @GET("novels/{nvs}") Observable getNovelsByIds(@Path("nvs")String nvs ); //返回指定id列表的小说列表 @GET("page/hot-keywords") Observable getSearchHotKeys(); @GET("download/version.xml") Observable getVersion(); @GET("page/category") Observable getPaihangBangCateList(@Query("sex") int Sex,@Query("type") String type); @GET("page/siteranks") Observable getPaihangBangByCate(@Query("sex") int Sex,@Query("cid") int cid); @GET("page/siterank") Observable getPaihangBangList(@Query("sex") int Sex,@Query("cid") int cid,@Query("pn")int pageNo); @FormUrlEncoded @POST("r/{actionType}.shtml") //{action type}.shtml?msg=${msg} Observable reportMsg(@Path("actionType")String actionType, @FieldMap Map map); }