这里请求一个新闻列表,首先设置response
注意,NewData里的参数(news和isLast)要和json数据的参数名保持一致
在build中设置以下信息
androidExtensions {
experimental = true
}
class NewsResponse(code: Int, msg: String, val data: NewsData) : BaseResponse(code, msg)
class NewsData(
val news: List<NewsEntity>,
val isLast: Boolean
)
@Keep
@Parcelize
data class NewsEntity(
val id: String,
val title: String? = null,
val content: String? = null,
val publishedtime: String? = null,
val author: String? = null,
val coverpic1: String? = null,
val coverpic2: String? = null,
val coverpic3: String? = null,
val catId: Int,
val language: String?,
val sourceUrl: String?,
val catName: String? = null,
val catNameEn: String? = null,
val timeAgo: String? = null,
val webview: Int,
val subTitle: String? = null,
val type: Int,
var showType: Int = 0,
var viewType: Int = 0
) : Parcelable