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.
37 lines
1.1 KiB
37 lines
1.1 KiB
package com.community.pocket.data.main.garbage;
|
|
|
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
import com.community.pocket.R;
|
|
import com.community.pocket.ui.main.ui.garbage.sorting.GarbageSortingResponse;
|
|
import com.community.pocket.util.HttpRequest;
|
|
import com.community.pocket.util.HttpUtil;
|
|
import com.community.pocket.util.SimpleHttpParse;
|
|
|
|
import okhttp3.FormBody;
|
|
|
|
/**
|
|
* 垃圾分类请求接口
|
|
*/
|
|
public class GarbageSortingRequest {
|
|
private static volatile GarbageSortingRequest instance;
|
|
|
|
private GarbageSortingRequest() {
|
|
}
|
|
|
|
public static GarbageSortingRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new GarbageSortingRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
//检索垃圾
|
|
@HttpRequest("/garbage/sorting")
|
|
public void search(MutableLiveData<GarbageSortingResponse> liveData, String name) {
|
|
HttpUtil.getRequest(HttpUtil.Method.GET,
|
|
new SimpleHttpParse<GarbageSortingResponse>(liveData, R.string.garbage_search_ok, null).getInterface(GarbageSortingResponse.class),
|
|
new FormBody.Builder().add("name", name).build());
|
|
}
|
|
}
|
|
|