我想知道如何使用改型在android中发出Include filter
请求。这就是回送中请求的样子。
{
"filter": {
"counts":["agendas"],
"include":["meetingHall"]
}
}
这是来自回送服务器的响应的样子
{
"count": 1,
"rows": [
{
"meetingId": "2010-5-8",
"titleEn": "horticulture follow up final report.",
"descriptionEn": "Management Letter Gewane Collage ኣፈጉባኤ ፎረም tigray.pdf ኣፈጉባኤ ፎረም tigray.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf",
"titleAm": "horticulture follow up final report.",
"descriptionAm": ".የአካባቢ ደንና አየር ንብረት ለውጥ ኣፈጉባኤ ፎረም tigray.pdf ኣፈጉባኤ ፎረም tigray.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf",
"status": "FINISHED",
"finishDetail": {
"attendanceNo": 0,
"remark": ""
},
"postponeDetail": null,
"cancelDetail": null,
"startDateGe": "2018-09-10T00:00:00.000Z",
"startDateEt": "2010-13-05",
"startTimeGe": {
"hour": 10,
"minute": 0
},
"startTimeEt": {
"hour": 10,
"minute": 0
},
"isArchive": false,
"regularMeetingDetail": {
"meetingNo": 8,
"round": 5,
"year": 2010
},
"seenStatus": 0,
"id": "5b926b5b9fab48001459004e",
"meetingHallId": "5b926a899fab480014590049",
"userGroupIds": [
"5b926a5b9fab480014590045",
"5b926a619fab480014590046"
],
"createdAt": "2018-09-07T12:13:15.880Z",
"updatedAt": "2018-09-18T12:43:28.577Z",
"meetingTypeId": "5b92668c9fab480014590021",
"agendasCount": 1,
"meetingHall": {
"nameEn": "በቋሚ ኮሚቴ አዳራሽ\t",
"nameAm": "በቋሚ ኮሚቴ አዳራሽ\t",
"id": "5b926a899fab480014590049",
"createdAt": "2018-09-07T12:09:45.776Z",
"updatedAt": "2018-09-07T12:09:45.776Z",
"name": "",
"description": ""
}
}
]
}
由于响应中已存储了其他属性,因此通常一次只需要一个以上的请求... 我的意思是,我很想知道在我的android改造中,端点调用看起来是什么样子。
示例api调用
@GET(ENDPOINT_MEETING)
@Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
Observable<MeetingsResponse> loadMeetings(@Query("isArchive") Boolean isArchive);
此类请求的参考可以在here中的环回官方页面中找到 我该如何提出要求?我应该使用其他任何属性的查询吗?谢谢!
答案 0 :(得分:0)
您可以像这样在请求中包含过滤器
f = np.sum( float(i)/m**2 for i in counter.keys() )
答案 1 :(得分:0)
好像您是在请求正文中发送此数据,因此请使用:
创建请求正文的类,例如:
用于过滤器 FilterRequestWrapper.java :
public class FilterRequestWrapper {
/* {
"filter": {
"counts":["agendas"],
"include":["meetingHall"]
}
}
*/
@Expose
public FilterRequest filter;
public class FilterRequest {
@Expose
public List<String> counts;
@Expose
public List<String> include;
}
}
并像这样使用它:
@GET(ENDPOINT_MEETING)
@Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
Observable<MeetingsResponse> loadMeetings(@Query("isArchive") Boolean isArchive, @Body FilterRequestWrapper filterRequestWrapper);
答案 2 :(得分:0)
API的端点以及我的调用方式
@GET(ENDPOINT_MEETING)
@Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
Observable<MeetingsResponse> loadMeetings(@Query("filter") String meetingFilter);
我在 Presenter 班上的称呼方式
getMvpView().showLoading();
getCompositeDisposable().add(getDataManager()
.loadMeetings("{ \"counts\":[\"agendas\"], \"include\":[\"meetingHall\"]}")
//.loadArchiveMeetings()
.subscribeOn(getSchedulerProvider().io())
.observeOn(getSchedulerProvider().ui())
.subscribe(meetingsResponse -> {
if (!isViewAttached()) {
return;
}
getMvpView().showMeetings(meetingsResponse.getMeetings());
},
throwable -> {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
if (!CommonUtils.getErrorMessage(throwable).isEmpty())
getMvpView().onError(CommonUtils.getErrorMessage(throwable));
}));
这就是我在GET请求中实现过滤器的方式。