Add endpoint support for searchSeries & Update documentation

pull/12/head
Hammy 3 years ago
parent 92002c18e4
commit e8bced78cb

@ -367,11 +367,34 @@ public class APIWrapper {
return apiMapper.deserialize(userProfileResult, UserList.class); return apiMapper.deserialize(userProfileResult, UserList.class);
} }
/**
* Retrieve a List of {@link FilteredWaifu}'s given a query, by sending POST request to API
*
* @param waifuName The name of the Waifu
* @return {@link Response} of {@link FilteredWaifu}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
Response<List<FilteredWaifu>> searchWaifus(String waifuName) throws APIMapperException, APIResponseException { Response<List<FilteredWaifu>> searchWaifus(String waifuName) throws APIMapperException, APIResponseException {
Result searchWaifusResult = sendPostRequest("search/waifus", Map.of("term", waifuName)); Result searchWaifusResult = sendPostRequest("search/waifus", Map.of("term", waifuName));
return apiMapper.deserializeToList(searchWaifusResult, listOf(FilteredWaifu.class)); return apiMapper.deserializeToList(searchWaifusResult, listOf(FilteredWaifu.class));
} }
/**
* Retrieve a List of {@link FilteredSeries}'s given a query, by sending POST request to API
*
* @param seriesName The name of the Series
* @return {@link Response} of {@link FilteredSeries}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
Response<List<FilteredSeries>> searchSeries(String seriesName) throws APIMapperException, APIResponseException {
Result searchSeriesResult = sendPostRequest("search/series", Map.of("term", seriesName));
return apiMapper.deserializeToList(searchSeriesResult, listOf(FilteredSeries.class));
}
void setApiKey(String apiKey) { void setApiKey(String apiKey) {
this.apiKey = apiKey; this.apiKey = apiKey;
} }

@ -328,10 +328,32 @@ public class MyWaifuClient {
return APIWrapper.getUserList(String.valueOf(userId), String.valueOf(listId)); return APIWrapper.getUserList(String.valueOf(userId), String.valueOf(listId));
} }
/**
* Searches only Waifu's using a given query. The higher the relevance, the better the match
*
* @param name The name of the Waifu
* @return {@link Response} of {@link FilteredWaifu}
* @throws APIMapperException If {@link APIWrapper} could not return information properly
* @throws APIResponseException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
public Response<List<FilteredWaifu>> searchWaifus(@NotNull String name) throws APIMapperException, APIResponseException { public Response<List<FilteredWaifu>> searchWaifus(@NotNull String name) throws APIMapperException, APIResponseException {
return APIWrapper.searchWaifus(name); return APIWrapper.searchWaifus(name);
} }
/**
* Searches only Series' using a given query. The higher the relevance, the better the match
*
* @param name The name of the Series
* @return {@link Response} of {@link FilteredSeries}
* @throws APIMapperException If {@link APIWrapper} could not return information properly
* @throws APIResponseException If {@link APIMapper} could not correctly {@code deserialize} model
*
*/
public Response<List<FilteredSeries>> searchSeries(@NotNull String name) throws APIMapperException, APIResponseException {
return APIWrapper.searchSeries(name);
}
/** /**
* Builder for {@link MyWaifuClient} * Builder for {@link MyWaifuClient}
* *

Loading…
Cancel
Save