Website | Support | Documentation
Track and discover your TV shows and movies with Trakt.
Trakt Kotlin is a Kotlin Multiplatform library for tracking your series and movies.
- Written in Kotlin native with ktor from the ground up.
- Support for Android, iOS, desktop, and web applications.
- High customizable HttpClient configuration
Sample projects:
The library is available on Maven Central.
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:trakt-api:0.7.0")
}
In Kotlin Multiplatform projects, add the dependency to your commonMain source-set dependencies.
commonMain {
dependencies {
implementation("app.moviebase:trakt-api:0.7.0")
}
}
Most of the library follows the possibilities and naming at the official Trakt documentation.
Build up your Trakt instance to access the APIs. You can configure the entire HttpClient of ktor.
val trakt = Trakt {
traktApiKey = "clientId"
expectSuccess = false // if you want to disable exceptions
useCache = true
useTimeout = true
maxRetriesOnException = 3 // retries when network calls throw an exception
// add your own client
httpClient(OkHttp) {
engine {
}
}
httpClient {
// for custom HttpClient configuration
}
}
For getting basic information about a shows or other media content.
val trakt = Trakt("clientId")
val traktShow = trakt.shows.getSummary(traktSlug = "vikings")
Search for TV shows by a query.
val trakt = Trakt("clientId")
val showPageResult = trakt.search.search(
searchType = TraktSearchType.TMDB,
id = "63639",
mediaType = TraktMediaType.SHOW
)
Please feel free to open an issue if you have any questions or suggestions. Or participate in the discussion. If you want to contribute, please read the contribution guidelines for more information.
This library uses the Trakt but is not endorsed or certified by Trakt.