SauceNaoAPI/src/commonMain/kotlin/dev/inmo/saucenaoapi/SauceRequestSubject.kt

17 lines
526 B
Kotlin
Raw Normal View History

2020-12-02 08:39:54 +00:00
package dev.inmo.saucenaoapi
2019-12-12 18:47:52 +00:00
import io.ktor.http.ContentType
2020-08-13 05:17:11 +00:00
import io.ktor.utils.io.core.Input
2019-12-12 18:47:52 +00:00
internal sealed class SauceRequestSubject
internal data class UrlSauceRequestSubject(val url: String) : SauceRequestSubject()
internal data class InputRequestSubject(val input: Input, val mimeType: ContentType) : SauceRequestSubject()
internal val String.asSauceRequestSubject
get() = UrlSauceRequestSubject(this)
internal fun Input.asSauceRequestSubject(mimeType: ContentType)
= InputRequestSubject(this, mimeType)