Kotlin Multiplatform TMDB API

A Kotlin Multiplatform library to access the TMDB API.

License

License

GroupId

GroupId

app.moviebase
ArtifactId

ArtifactId

tmdb-api-android-debug
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

aar
Description

Description

Kotlin Multiplatform TMDB API
A Kotlin Multiplatform library to access the TMDB API.
Project URL

Project URL

https://github.com/MoviebaseApp/tmdb-api
Source Code Management

Source Code Management

https://github.com/MoviebaseApp/tmdb-api

Download tmdb-api-android-debug

How to add to project

<!-- https://jarcasting.com/artifacts/app.moviebase/tmdb-api-android-debug/ -->
<dependency>
    <groupId>app.moviebase</groupId>
    <artifactId>tmdb-api-android-debug</artifactId>
    <version>0.3.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/app.moviebase/tmdb-api-android-debug/
implementation 'app.moviebase:tmdb-api-android-debug:0.3.0'
// https://jarcasting.com/artifacts/app.moviebase/tmdb-api-android-debug/
implementation ("app.moviebase:tmdb-api-android-debug:0.3.0")
'app.moviebase:tmdb-api-android-debug:aar:0.3.0'
<dependency org="app.moviebase" name="tmdb-api-android-debug" rev="0.3.0">
  <artifact name="tmdb-api-android-debug" type="aar" />
</dependency>
@Grapes(
@Grab(group='app.moviebase', module='tmdb-api-android-debug', version='0.3.0')
)
libraryDependencies += "app.moviebase" % "tmdb-api-android-debug" % "0.3.0"
[app.moviebase/tmdb-api-android-debug "0.3.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.32
org.jetbrains.kotlinx : kotlinx-io jar 0.1.16
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.4.32

runtime (8)

Group / Artifact Type Version
io.ktor : ktor-client-android jar 1.5.2
org.jetbrains.kotlinx : kotlinx-coroutines-core-jvm jar 1.4.3-native-mt
org.jetbrains.kotlinx : kotlinx-serialization-json-jvm jar 1.1.0
org.jetbrains.kotlinx : kotlinx-datetime-jvm jar 0.1.1
io.ktor : ktor-client-core-jvm jar 1.5.2
io.ktor : ktor-client-json-jvm jar 1.5.2
io.ktor : ktor-client-logging-jvm jar 1.5.2
io.ktor : ktor-client-serialization-jvm jar 1.5.2

Project Modules

There are no modules declared in this project.

Website | Forum | Documentation | TMDb 3 API

TMDb

Get movie and TV show content from TMDb in a fast and simple way.

Maven Central Build Status Issues Kotlin Gradle GitHub License


TMDb API

This library gives the access to TMDb API version 3 and 4 for mobile, desktop and web applications. It supports Swift, Kotlin and JavaScript by setting up as a Kotlin Multiplatform project.

Mainly used and supported by Moviebase.

Adding to your project

The library is published to Maven Central.

Gradle

Add the Maven Central repository if it is not already there.

repositories {
    mavenCentral()
}

To use the library in a single-platform project, add a dependency.

dependencies {
    implementation("app.moviebase:tmdb-api:0.4.0")
}

In Kotlin Multiplatform projects, add the dependency to your commonMain source-set dependencies.

commonMain {
    dependencies {
        implementation("app.moviebase:tmdb-api:0.4.0")
    }
}

Maven

Add a dependency to the <dependencies> element.

<dependency>
    <groupId>app.moviebase</groupId>
    <artifactId>tmdb-api</artifactId>
    <version>0.4.0</version>
</dependency>

Usage

Most of the library follows the possibilities and naming at the official TMDb documentation.

The endpoints are described in Version 3 and Version 4.

Get information

For getting basic information about a movie or other media content.

val tmdb = Tmdb3("apiKey")
val movieDetail = tmdb.movies.getDetails(
    movieId = 12,
    language = "DE",
    appendResponses = listOf(AppendResponse.MOVIE_CREDITS)
)

Search

Search for TV shows by a query.

val tmdb = Tmdb3("apiKey")
val showPageResult = tmdb.search.findShows(
    query = "The Expanse",
    page = 1,
    language = "DE",
    region = "US",
    includeAdult = false
)

Discover

Discover a movie or TV show by the discover parameter class.

val discover = TmdbDiscover.Movie(
    sortBy = TmdbDiscoverMovieSortBy.POPULARITY,
    sortOrder = TmdbSortOrder.DESC,
    voteAverageGte = 5,
    voteCountGte = 200,
    releaseDate = TmdbDiscoverTimeRange.BetweenYears(from = 2020, to = 2021)
)

val discoverPageResult = tmdb.discover.discoverMovie(
    page = 1,
    region = "DE",
    language = "de",
    discover = discover
)

Alternatively, use predefined discover categories like upcoming, networks or on streaming.

val discoverCategory = DiscoverCategory.OnStreaming.Netflix(
    mediaType = TmdbMediaType.MOVIE,
    watchRegion = "DE"
)

val result = tmdb.discover.discoverByCategory(
    page = 1,
    region = "DE",
    language = "de",
    category = discoverCategory
)

Build image URL

You can build an image URL via the poster file path and size key. More information on the TMDb images site.

val url = TmdbImageUrlBuilder.build("nBNZadXqJSdt05SHLqgT0HuC5Gm.jpg", "w154")

Or create the URL by an image class with the best matched width/height.

val url = TmdbImageUrlBuilder.build(image = movie.posterImage, width = 200, height = 300)

For creating the poster URL by the movie item.

val url = TmdbImageUrlBuilder.buildPoster(item = movie, width = 200)


This library uses the TMDb but is not endorsed or certified by TMDb. These services are licensed under CC BY-NC 4.0.

app.moviebase

Moviebase

Discover Movies & TV Shows on Android 🚀

Versions

Version
0.3.0
0.2.0
0.1.3