一、升级版:通过注解强化ApiService实例在各种开发环境中的自动化构建;对接口方法提供内部封装实现更多功能;
一、接口声明
package com.chenliang.account
typealias Data<T> = Call<BaseResponse<T>>
typealias Datas<T> = Call<BaseResponse<ArrayList<T>>>
@MyApiService(
mName = "API",
mPath = "http://www.chenliang.com/app/",
mDevPath = "http://www.chenliang.com/dev/app/",
mTestPath = "http://www.chenliang.com/test/app/"
)
interface ApiService {
@MyRetrofitGo(mTag = "登录", mLoading = true, mFailToast = true)
@POST("home/login")
fun login(
@Query("account") account: String,
@Query("password") password: String
): Data<BeanUser>
@MyRetrofitGo(mTag = "注册", mLoading = true, mFailToast = true)
@POST("home/register")