All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.app.moviebase.trakt.core.HttpRequestBuilderExtensions.kt Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package app.moviebase.trakt.core

import app.moviebase.trakt.TraktExtended
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.request.parameter
import kotlinx.datetime.Instant

fun HttpRequestBuilder.parameters(parameters: Map) {
    parameters.entries.forEach {
        if (it.value != null) parameter(it.key, it.value)
    }
}

fun HttpRequestBuilder.parameterPage(page: Int) {
    parameter("page", page)
}

fun HttpRequestBuilder.parameterLimit(limit: Int) {
    parameter("limit", limit)
}

fun HttpRequestBuilder.parameterExtended(extended: TraktExtended = TraktExtended.FULL) {
    parameter("extended", extended.value)
}

fun HttpRequestBuilder.parameterStartAt(startAt: Instant) {
    parameter("start_at", startAt.toString())
}

fun HttpRequestBuilder.parameterEndAt(endAt: Instant) {
    parameter("end_at", endAt.toString())
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy