You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
package com.community.pocket.data.main.forum;
|
|
|
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
import com.community.pocket.data.model.LocalToken;
|
|
import com.community.pocket.ui.main.ui.forum.my.ForumMyResponse;
|
|
import com.community.pocket.util.HttpRequest;
|
|
import com.community.pocket.util.HttpUtil;
|
|
import com.community.pocket.util.SimpleHttpParse;
|
|
|
|
import okhttp3.FormBody;
|
|
|
|
/**
|
|
* 我的帖子请求接口
|
|
*/
|
|
public class ForumMyRequest {
|
|
private static volatile ForumMyRequest instance;
|
|
|
|
private ForumMyRequest() {
|
|
}
|
|
|
|
public static ForumMyRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new ForumMyRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
/**
|
|
* 加载我的帖子
|
|
*/
|
|
@HttpRequest("/forum/my")
|
|
public void loadForumMy(MutableLiveData<ForumMyResponse> liveData, Long page, String title) {
|
|
HttpUtil.getRequest(HttpUtil.Method.GET,
|
|
new SimpleHttpParse<ForumMyResponse>(liveData).getInterface(ForumMyResponse.class),
|
|
new FormBody.Builder()
|
|
.add("currentPage", String.valueOf(page))
|
|
.add("username", LocalToken.getUsername())
|
|
.add("title", title)
|
|
.build());
|
|
}
|
|
}
|
|
|