src/main/java/tech/zettervall/openlibrary/rxclient/data/Repository.java
/**
     * Search the Open Library API.
     * "WARNING: This is an experimental API and can change in future."
     *
     * @param searchType Type of query to perform.
     * @param query      What to query for.
     * @param page       Which page to get the results for. The returned SearchResult has
     *                   a parameter called numFound, this is the number of found matches.
     *                   Each page produce 100 results, e.g. no page (page 1) returns result 1-99,
     *                   page 2 returns results 100-199 and so on.
     * @return Observable Single response of SearchResult.
     */
Search the Open Library API.
"WARNING: This is an experimental API and can change in future."

@param searchType Type of query to perform.
@param query      What to query for.
@param page       Which page to get the results for. The returned SearchResult has
a parameter called numFound, this is the number of found matches.
Each page produce 100 results, e.g. no page (page 1) returns result 1-99,
page 2 returns results 100-199 and so on.
@return Observable Single response of SearchResult.
Search the Open Library API . " WARNING : This is an experimental API and can change in future . " @param searchType Type of query to perform . @param query What to query for . @param page Which page to get the results for . The returned SearchResult has a parameter called numFound this is the number of found matches . Each page produce 100 results e . g . no page ( page 1 ) returns result 1 - 99 page 2 returns results 100 - 199 and so on . @return Observable Single response of SearchResult .
public Single<SearchResult> search(@NonNull SearchType searchType,
                                       @NonNull String query,
                                       @Nullable Integer page) {
        String reformattedQuery = query.trim().replaceAll(" +", "+");
        Single<SearchResult> response;
        switch (searchType) {
            case TITLE:
                response = openLibraryApi.search(null, reformattedQuery, null, page);
                break;
            case AUTHOR:
                response = openLibraryApi.search(null, null, reformattedQuery, page);
                break;
            default:
                response = openLibraryApi.search(reformattedQuery, null, null, page);
        }
        return response.
                map(searchResult -> {
                    if (searchResult.getResults().length == 0) {
                        throw new Exception(HTTP_404);
                    }
                    return searchResult;
                });
    }
public Single < SearchResult > search ( @ NonNull SearchType searchType , @ NonNull String query , @ Nullable Integer page ) { String reformattedQuery = query . trim ( ) . replaceAll ( " +" , "+" ) ; Single < SearchResult > response ; switch ( searchType ) { case TITLE : response = openLibraryApi . search ( null , reformattedQuery , null , page ) ; break ; case AUTHOR : response = openLibraryApi . search ( null , null , reformattedQuery , page ) ; break ; default : response = openLibraryApi . search ( reformattedQuery , null , null , page ) ; } return response . map ( searchResult -> { if ( searchResult . getResults ( ) . length == 0 ) { throw new Exception ( HTTP_404 ) ; } return searchResult ; } ) ; }
Search the Open Library API.
Search the Open Library API .