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.
45 lines
1.5 KiB
45 lines
1.5 KiB
package com.community.pocket.data.main.visitor;
|
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
import com.community.pocket.data.model.LocalToken;
|
|
import com.community.pocket.ui.main.ui.visitor.reservation.VisitorReservationResponse;
|
|
import com.community.pocket.util.HttpRequest;
|
|
import com.community.pocket.util.HttpUtil;
|
|
import com.community.pocket.util.SimpleHttpParse;
|
|
|
|
import okhttp3.FormBody;
|
|
|
|
/**
|
|
* 我的预约请求接口
|
|
*/
|
|
public class VisitorReservationRequest {
|
|
private static volatile VisitorReservationRequest instance;
|
|
|
|
private VisitorReservationRequest() {
|
|
}
|
|
|
|
public static VisitorReservationRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new VisitorReservationRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
/**
|
|
* 我的预约
|
|
*/
|
|
@HttpRequest("/visitor/reservation")
|
|
public void loadReservation(MutableLiveData<VisitorReservationResponse> liveData, String startDate, String endDate, Long currentPage) {
|
|
FormBody.Builder builder = LocalToken.create();
|
|
if (startDate != null && !startDate.isEmpty()) {
|
|
builder.add("startDate", startDate);
|
|
}
|
|
if (endDate != null && !endDate.isEmpty()) {
|
|
builder.add("endDate", endDate);
|
|
}
|
|
builder.add("currentPage", String.valueOf(currentPage));
|
|
HttpUtil.getRequest(HttpUtil.Method.GET,
|
|
new SimpleHttpParse<VisitorReservationResponse>(liveData).getInterface(VisitorReservationResponse.class), builder.build());
|
|
}
|
|
}
|
|
|