110 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			110 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | 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<ResponseBody> getDataForBean(@Body DouBanMovieRequest bean); | |||
|  | 
 | |||
|  |     @GET("top250") | |||
|  |     Observable<ResponseBody> getDataForMap(@QueryMap Map<String, Integer> map); | |||
|  |     /** | |||
|  |      * 通过地址下载一个文件 | |||
|  |      */ | |||
|  |     @GET("ab") | |||
|  |     @Streaming | |||
|  |     Call<ResponseBody> downloadFile(@Url String fileUrl); | |||
|  | 
 | |||
|  | //http://xiaoshuofenxiang.com/api/g/ | |||
|  |     @GET("g/") | |||
|  |     Observable<ResponseBody> getMasterDomain(); | |||
|  |     //http://xiaoshuofenxiang.com/api/n/f2619820112625133c14dcb170f5e092.json | |||
|  |     @GET("n/{id}") | |||
|  |     Observable<ResponseBody> getNovel(@Path("id") int novelId); | |||
|  | 
 | |||
|  |     //http://xiaoshuofenxiang.com/api/n/f2619820112625133c14dcb170f5e092.mulu-urls.json | |||
|  |     @GET("n/{id}/mulu-urls") | |||
|  |     Observable<ResponseBody> getNovelSites(@Path("id") int novelId); | |||
|  | 
 | |||
|  |     //http://xiaoshuofenxiang.com/api/s/www.qu.la.json | |||
|  |      @GET("s/{siteDomain}.json") | |||
|  |      Observable<ResponseBody> getNovelRule(@Path("siteDomain") String siteDomain); | |||
|  | 
 | |||
|  |     @GET("page/index") | |||
|  |     Observable<ResponseBody> getFirstPage(@Query("sex") int Sex); | |||
|  | 
 | |||
|  |     //分类的总榜,显示每个小说分类有多少本书http://xiaoshuofenxiang.com/api/page/noveltype | |||
|  |     @GET("page/noveltype") | |||
|  |     Observable<ResponseBody> 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<ResponseBody> search(@Query("cate") String cate, @Query("pageno") int pageno, @Query("sex") int sex, @Query("progress") int progress); | |||
|  |     @GET("search/nt/{cate}/{pageno}") | |||
|  |     Observable<ResponseBody> 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<ResponseBody> 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<ResponseBody> getNovelsRelated(@Path("novelId") int novelId); | |||
|  |       //同作者其它小说http://xiaoshuofenxiang.com/api/n/7/author | |||
|  |     @GET("n/{novelId}/author") | |||
|  |     Observable<ResponseBody> getNovelsSameAuthor(@Path("novelId") int novelId); | |||
|  |     //站点榜单http://xiaoshuofenxiang.com/api/page/siteranks?sex=1 | |||
|  | /*    @GET("page/siteranks") | |||
|  |     Observable<ResponseBody> getSiteRanks(@Query("sex") int Sex); | |||
|  |    //http://xiaoshuofenxiang.com/api/page/siterank?fn=qidian-yuanchuangfengyunbang&pn=3 | |||
|  |    @GET("page/siterank") | |||
|  |    Observable<ResponseBody> getSiteRankDetail(@Query("fn")String fn,@Query("pn")int pageNo,@Query("sex") int Sex);*/ | |||
|  |    @GET(  "search/{keyword}/{pageno}") | |||
|  |    Observable<ResponseBody> getSeachNolvelist(@Path("keyword")String keyWord,@Path("pageno")int pageNo,@Query("sex") int Sex); | |||
|  |     // 搜索分类 http://xiaoshuofenxiang.com/api/page/topdata | |||
|  |     @GET("page/topdata") | |||
|  |     Observable<ResponseBody> getSearchTitles(@Query("sex") int Sex); | |||
|  |     //返回指定id列表的小说列表api/novels/1,2 | |||
|  |     @GET("novels/{nvs}") | |||
|  |     Observable<ResponseBody> getNovelsByIds(@Path("nvs")String nvs ); | |||
|  |     //返回指定id列表的小说列表 | |||
|  |     @GET("page/hot-keywords") | |||
|  |     Observable<ResponseBody> getSearchHotKeys(); | |||
|  | 
 | |||
|  |     @GET("download/version.xml") | |||
|  |     Observable<ResponseBody> getVersion(); | |||
|  | 
 | |||
|  |     @GET("page/category") | |||
|  |     Observable<ResponseBody> getPaihangBangCateList(@Query("sex") int Sex,@Query("type") String type); | |||
|  |     @GET("page/siteranks") | |||
|  |     Observable<ResponseBody> getPaihangBangByCate(@Query("sex") int Sex,@Query("cid") int cid); | |||
|  |     @GET("page/siterank") | |||
|  |     Observable<ResponseBody> getPaihangBangList(@Query("sex") int Sex,@Query("cid") int cid,@Query("pn")int pageNo); | |||
|  |     @FormUrlEncoded | |||
|  |     @POST("r/{actionType}.shtml") //{action type}.shtml?msg=${msg} | |||
|  |     Observable<ResponseBody> reportMsg(@Path("actionType")String actionType, @FieldMap Map<String, String> map); | |||
|  | 
 | |||
|  | } |