Skip to content

A Java library for easily connecting to the Open Library API and getting the received data as RxJava observables. The client is optimized for Android but can also be used elsewhere.

License

Notifications You must be signed in to change notification settings

rickardzettervall/openlibrary-api-rxclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Library API RxClient

The Open Library API RxClient is a Java library for easily connecting to https://openlibrary.org/developers/api/ and getting the received data as RxJava observables. The client is optimized for Android but can also be used elsewhere.

Supported APIs

  • Books (https://openlibrary.org/dev/docs/api/books)
  • Covers (https://openlibrary.org/dev/docs/api/covers)
  • Read (https://openlibrary.org/dev/docs/api/read)
  • RecentChanges (https://openlibrary.org/dev/docs/api/recentchanges)
  • Search (https://openlibrary.org/dev/docs/api/search)
  • Subjects (https://openlibrary.org/dev/docs/api/subjects)
  • Setup (gradle)

    Add jitpack.io to your root build.gradle file:

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
    

    Add the dependency to your project build.gradle file:

    dependencies {
            ...
            implementation 'com.github.rickardzettervall:openlibrary-api-rxclient:0.2'
    }
    

    More setup options can be found over at jitpack.io.

    Getting started

    // Get instance
    OpenLibraryClient client = OpenLibraryClient.getInstance();
    
    // Implement your own RxJava observer, e.g.
    DisposableSingleObserver<List<BookView>> disposable =
                client.getRepository().getBooks(BookView.class, "ISBN:0385472579", "LCCN:62019420")
                        .observeOn(Schedulers.from(ContextCompat.getMainExecutor(this)))
                        .subscribeOn(Schedulers.io())
                        .subscribeWith(new DisposableSingleObserver<List<BookView>>() {
                            @Override
                            public void onSuccess(@NonNull List<BookView> bookViews) {
                                // Do stuff
                            }
    
                            @Override
                            public void onError(@NonNull Throwable e) {
                                // Do stuff
                            }
                        });
    

    Android

    Add internet permission to your AndroidManifest.xml file:

    <uses-permission android:name="android.permission.INTERNET" />
    

    License

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this repository except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    About

    A Java library for easily connecting to the Open Library API and getting the received data as RxJava observables. The client is optimized for Android but can also be used elsewhere.

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Languages