Add support for getting paginated sets of Waifus

pull/10/head
Hammy 3 years ago
parent d05c80c499
commit 1206db4bf8

@ -101,6 +101,11 @@ public class APIWrapper {
return apiMapper.deserializeToPaginationData(waifuImagesResult, paginationData(WaifuImage.class)); return apiMapper.deserializeToPaginationData(waifuImagesResult, paginationData(WaifuImage.class));
} }
Response<PaginationData<FilteredWaifu>> getWaifusByPage(String pageNum) throws APIResponseException, APIMapperException {
Result waifusByPageResult = sendRequest("waifu?page=" + pageNum);
return apiMapper.deserializeToPaginationData(waifusByPageResult, paginationData(FilteredWaifu.class));
}
Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException { Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException {
Result dailyWaifuResult = sendRequest("meta/daily"); Result dailyWaifuResult = sendRequest("meta/daily");
return apiMapper.deserialize(dailyWaifuResult, FilteredWaifu.class); return apiMapper.deserialize(dailyWaifuResult, FilteredWaifu.class);

@ -100,6 +100,10 @@ public class MyWaifuClient {
return APIWrapper.getWaifuImages(String.valueOf(id), String.valueOf(pageNum)); return APIWrapper.getWaifuImages(String.valueOf(id), String.valueOf(pageNum));
} }
public Response<PaginationData<FilteredWaifu>> getWaifusByPage(@NotNull Integer pageNum) throws APIMapperException, APIResponseException {
return APIWrapper.getWaifusByPage(String.valueOf(pageNum));
}
public Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException { public Response<FilteredWaifu> getDailyWaifu() throws APIResponseException, APIMapperException {
return APIWrapper.getDailyWaifu(); return APIWrapper.getDailyWaifu();
} }

Loading…
Cancel
Save