Add new endpoint - /search/beta

pull/16/head
Hammy 3 years ago
parent 87b2b8025c
commit de1f2fc1ab

@ -367,11 +367,25 @@ public class APIWrapper {
return apiMapper.deserialize(userProfileResult, UserList.class);
}
/**
* Retrieve a {@link List} of {@link FilteredWaifu} with a search term by sending a POST request to the API
*
* @param searchString {@link String} that should be searched for
* @return {@link Response} of {@link List} with {@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>> betaSearch(String searchString) throws APIMapperException, APIResponseException {
Result betaSearchResult = sendPostRequest("search/beta", Map.of("term", searchString));
return apiMapper.deserializeToList(betaSearchResult, listOf(FilteredWaifu.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}
* @return {@link Response} of {@link List} with {@link FilteredWaifu}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*
@ -385,7 +399,7 @@ public class APIWrapper {
* 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}
* @return {@link Response} of {@link List} with {@link FilteredSeries}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*

@ -328,6 +328,19 @@ public class MyWaifuClient {
return APIWrapper.getUserList(String.valueOf(userId), String.valueOf(listId));
}
/**
* Allows searching for a {@link Waifu}
* This search is more aggressive when it comes to name matching, resulting in better accuracy in most cases
*
* @param searchString {@link String} that should be searched for
* @return {@link Response} of {@link List} with {@link FilteredWaifu}
* @throws APIResponseException If {@link APIWrapper} could not return information properly
* @throws APIMapperException If {@link APIMapper} could not correctly {@code deserialize} model
*/
public Response<List<FilteredWaifu>> betaSearch(@NotNull String searchString) throws APIResponseException, APIMapperException {
return APIWrapper.betaSearch(searchString);
}
/**
* Searches only Waifu's using a given query. The higher the relevance, the better the match
*

Loading…
Cancel
Save