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.
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.
// 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
}
});
Add internet permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
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.