Need help with tmdb-java?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

UweTrottmann
146 Stars 57 Forks Apache License 2.0 495 Commits 3 Opened issues

Description

A Java wrapper around themoviedb.org API v3 using retrofit2.

Services available

!
?

Need anything else?

Contributors list

Pull requests (e.g. support for more API endpoints, bug fixes) are welcome!

tmdb-java

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:2.6.0")

or your Maven project:

    com.uwetrottmann.tmdb2
    tmdb-java
    2.6.0

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 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.

Android

This library ships Java 8 bytecode. This requires Android Gradle Plugin 3.2.x or newer.

Use Proguard, R8!

It is likely not every method in this library is used, so it is probably useful to strip unused ones with Proguard. Apply the Proguard rules for retrofit.

Due to R8 being very eager in stripping unused fields even if they are set by a constructor, prevent entities from getting optimized. Obviously they also should not be obfuscated.

proguard
-keep class com.uwetrottmann.tmdb2.entities.** { *; }
-keep class com.uwetrottmann.tmdb2.enumerations.** { *; }

License

This work by Uwe Trottmann is licensed under the Apache License 2.0.

Contributors and changes are tracked by Git.

Do not just copy, make it better.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.