Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.7 KB

README.md

File metadata and controls

58 lines (44 loc) · 1.7 KB

tmdb-rxjava

A Java wrapper around the TMDb v3 API using retrofit 2.

Usage

Available on Maven Central

Add the following dependency to your Gradle project:

implementation 'com.uwetrottmann.tmdb2:tmdb-java:1.10.0'

or your Maven project:

<dependency>
    <groupId>com.uwetrottmann.tmdb2</groupId>
    <artifactId>tmdb-java</artifactId>
    <version>1.10.0</version>
</dependency>

Use like any other retrofit2 based service. For example:

// Create an instance of the service you wish to use
// you should re-use these
Tmdb tmdb = new Tmdb(API_KEY);
MoviesService moviesService = tmdb.moviesService();
// Call any of the available endpoints
try {
    Response<Movie> response = moviesService
        .summary(550)
        .execute();
    if (response.isSuccessful()) {
        Movie movie = response.body();
        System.out.println(movie.title + " is awesome!");
    }
} catch (Exception e) {
    // see execute() javadoc 
}

See test cases in src/test/ for more examples and the retrofit website for configuration options.

Use Proguard!

You likely will not use every method in this library, so it is probably useful to strip unused ones with Proguard. Just apply the Proguard rules for retrofit.

License

Created by Uwe Trottmann.

See full list of contributors.

Except where noted otherwise, released into the public domain. Do not just copy, make it better.