package com.common.commonlibtest.manager

import com.common.commonlib.net.BaseObserve
import com.common.commonlib.net.callback.RequestCallBack
import com.common.commonlibtest.bean.ArticlesResponse
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Path

/**
 * 网络请求样例
 */
class InternetLoader : BaseObserve<InternetLoader.HomeApi>(HomeApi::class.java) {

    fun getHomeArticles(pageName: Int, callBack: RequestCallBack<ArticlesResponse>) {
        observe(api.getHomeArticles(pageName), callBack)
    }

    interface HomeApi {
        @Headers("baseurl:debug1")
        @GET("/article/list/{pageNum}/json")
        fun getHomeArticles(@Path("pageNum") pageNum: Int): Observable<ArticlesResponse>
    }
}