feat: 预留新网页版个人信息接口
This commit is contained in:
parent
1adb7d11d1
commit
4041b6284b
|
|
@ -7,6 +7,7 @@ import com.huanchengfly.tieba.post.api.models.*
|
|||
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
||||
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
||||
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
||||
import com.huanchengfly.tieba.post.api.models.web.Profile
|
||||
import com.huanchengfly.tieba.post.api.retrofit.ApiResult
|
||||
import com.huanchengfly.tieba.post.models.DislikeBean
|
||||
import com.huanchengfly.tieba.post.models.MyInfoBean
|
||||
|
|
@ -111,6 +112,12 @@ interface ITiebaApi {
|
|||
subPostId: String?
|
||||
): Call<SubFloorListBean>
|
||||
|
||||
/**
|
||||
* 获取首页关注吧列表(网页版接口)
|
||||
*
|
||||
* @param sortType 排序方式(0 = 等级排序,1 = 关注顺序)
|
||||
* @param page 分页页码(从 0 开始)
|
||||
*/
|
||||
fun forumHomeAsync(
|
||||
sortType: Int,
|
||||
page: Int = 0
|
||||
|
|
@ -172,6 +179,11 @@ interface ITiebaApi {
|
|||
uid: String
|
||||
): Call<ProfileBean>
|
||||
|
||||
/**
|
||||
* 用户信息(异步)
|
||||
*/
|
||||
fun myProfileAsync(): Deferred<ApiResult<Profile>>
|
||||
|
||||
/**
|
||||
* 取关一个吧
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.huanchengfly.tieba.post.api.models.*
|
|||
import com.huanchengfly.tieba.post.api.models.web.ForumBean
|
||||
import com.huanchengfly.tieba.post.api.models.web.ForumHome
|
||||
import com.huanchengfly.tieba.post.api.models.web.HotMessageListBean
|
||||
import com.huanchengfly.tieba.post.api.models.web.Profile
|
||||
import com.huanchengfly.tieba.post.api.retrofit.ApiResult
|
||||
import com.huanchengfly.tieba.post.api.retrofit.RetrofitTiebaApi
|
||||
import com.huanchengfly.tieba.post.models.DislikeBean
|
||||
|
|
@ -29,6 +30,9 @@ object MixedTiebaApiImpl : ITiebaApi {
|
|||
override fun personalized(loadType: Int, page: Int): Call<PersonalizedBean> =
|
||||
RetrofitTiebaApi.MINI_TIEBA_API.personalized(loadType, page)
|
||||
|
||||
override fun myProfileAsync(): Deferred<ApiResult<Profile>> =
|
||||
RetrofitTiebaApi.WEB_TIEBA_API.myProfileAsync("json", "", "")
|
||||
|
||||
override fun agree(
|
||||
threadId: String,
|
||||
postId: String
|
||||
|
|
@ -75,8 +79,7 @@ object MixedTiebaApiImpl : ITiebaApi {
|
|||
page,
|
||||
20,
|
||||
"",
|
||||
"",
|
||||
AccountUtil.getCookie(BaseApplication.instance)
|
||||
""
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.huanchengfly.tieba.post.api.models.web
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class Profile : WebBase<ProfileData>()
|
||||
|
||||
data class ProfileData(
|
||||
@SerializedName("is_login")
|
||||
val isLogin: Int,
|
||||
val sid: String,
|
||||
val user: User
|
||||
)
|
||||
|
||||
data class User(
|
||||
val intro: String,
|
||||
val name: String,
|
||||
@SerializedName("name_show")
|
||||
val nameShow: String,
|
||||
val portrait: String,
|
||||
val sex: Int,
|
||||
@SerializedName("show_nickname")
|
||||
val showNickName: String
|
||||
)
|
||||
|
|
@ -41,10 +41,23 @@ interface WebTiebaApi {
|
|||
@Query("pn") page: Int,
|
||||
@Query("rn") pageSize: Int,
|
||||
@Query("eqid") eqid: String,
|
||||
@Query("refer") refer: String,
|
||||
@retrofit2.http.Header("Cookie") cookie: String?
|
||||
@Query("refer") refer: String
|
||||
): Deferred<ApiResult<ForumHome>>
|
||||
|
||||
@Headers(
|
||||
"${Header.FORCE_LOGIN}: ${Header.FORCE_LOGIN_TRUE}",
|
||||
"${Header.REFERER}: https://tieba.baidu.com/index/tbwise/mine?source=index",
|
||||
"sec-ch-ua: \".Not/A)Brand\";v=\"99\", \"Microsoft Edge\";v=\"103\", \"Chromium\";v=\"103\"",
|
||||
"sec-ch-ua-mobile: ?1",
|
||||
"sec-ch-ua-platform: Android"
|
||||
)
|
||||
@GET("/mg/o/profile")
|
||||
fun myProfileAsync(
|
||||
@Query("format") format: String,
|
||||
@Query("eqid") eqid: String,
|
||||
@Query("refer") refer: String
|
||||
): Deferred<ApiResult<Profile>>
|
||||
|
||||
@GET("/mo/q/hotMessage/main")
|
||||
fun hotTopicMain(
|
||||
@Query("topic_id") topicId: String,
|
||||
|
|
@ -118,6 +131,7 @@ interface WebTiebaApi {
|
|||
@retrofit2.http.Header("cookie") cookie: String
|
||||
): Deferred<ApiResult<MyInfoBean>>
|
||||
|
||||
|
||||
@GET("/mo/q/search/forum")
|
||||
fun searchForum(
|
||||
@Query("word") keyword: String
|
||||
|
|
|
|||
Loading…
Reference in New Issue