
commonMain.app.moviebase.provider.vodster.api.VodsterLinkApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of movie-providers-js Show documentation
Show all versions of movie-providers-js Show documentation
Kotlin Multiplatform library to access several Movie Providers.
package app.moviebase.provider.vodster.api
import app.moviebase.provider.core.remote.json
import app.moviebase.provider.vodster.VodsterWebConfig
import app.moviebase.provider.vodster.model.VodsterContent
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.http.*
class VodsterLinkApi(
private val apiKey: String,
private val client: HttpClient,
) {
suspend fun shows(tvdbId: Int): List = client.get {
url {
takeFrom(VodsterWebConfig.API_URL)
path(VodsterWebConfig.PATH_MOVIEBASE, "links.php")
}
parameter("tvdb", tvdbId)
parameter(VodsterWebConfig.URL_PARAMETER_API_KEY, apiKey)
parameter(VodsterWebConfig.URL_PARAMETER_VERSION, VodsterWebConfig.VERSION)
parameter(VodsterWebConfig.URL_PARAMETER_FORMAT, VodsterWebConfig.FORMAT_JSON)
json()
}.body()
suspend fun movies(tmdbId: Int): List = client.get {
url {
takeFrom(VodsterWebConfig.API_URL)
path(VodsterWebConfig.PATH_MOVIEBASE, "links.php")
}
parameter("tmdb", tmdbId)
parameter(VodsterWebConfig.URL_PARAMETER_API_KEY, apiKey)
parameter(VodsterWebConfig.URL_PARAMETER_VERSION, VodsterWebConfig.VERSION)
parameter(VodsterWebConfig.URL_PARAMETER_FORMAT, VodsterWebConfig.FORMAT_JSON)
json()
}.body()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy