mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-11-26 23:50:32 +00:00
Split KtorClient to separate module
This commit is contained in:
parent
cd764ec8b4
commit
a63f3e5d6e
@ -16,6 +16,7 @@ kotlinx-coroutines = "1.7.0"
|
|||||||
kotlinx-serialization = "1.5.0"
|
kotlinx-serialization = "1.5.0"
|
||||||
ktor = "1.6.8"
|
ktor = "1.6.8"
|
||||||
nexuspublish = "1.3.0"
|
nexuspublish = "1.3.0"
|
||||||
|
okhttp = "4.10.0"
|
||||||
slf4j = "2.0.7"
|
slf4j = "2.0.7"
|
||||||
swagger-parser = "2.1.13"
|
swagger-parser = "2.1.13"
|
||||||
|
|
||||||
@ -33,17 +34,19 @@ android-gradle = { module = "com.android.tools.build:gradle", version.ref = "and
|
|||||||
clikt = { module = "com.github.ajalt.clikt:clikt", version.ref = "clikt" }
|
clikt = { module = "com.github.ajalt.clikt:clikt", version.ref = "clikt" }
|
||||||
kasechange = { module = "net.pearx.kasechange:kasechange", version.ref = "kasechange" }
|
kasechange = { module = "net.pearx.kasechange:kasechange", version.ref = "kasechange" }
|
||||||
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
|
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
|
||||||
kotest-framework-engine = { module = "io.kotest:kotest-framework-engine", version.ref = "kotest" }
|
|
||||||
kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
|
kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
|
||||||
|
kotest-framework-engine = { module = "io.kotest:kotest-framework-engine", version.ref = "kotest" }
|
||||||
kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
|
kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
|
||||||
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlin-logging" }
|
kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = "kotlin-logging" }
|
||||||
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
|
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
|
||||||
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
||||||
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
|
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
|
||||||
|
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
|
||||||
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
|
||||||
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||||
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
|
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
|
||||||
ktor-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
ktor-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||||
|
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||||
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
|
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
|
||||||
swagger-parser = { module = "io.swagger.parser.v3:swagger-parser", version.ref = "swagger-parser" }
|
swagger-parser = { module = "io.swagger.parser.v3:swagger-parser", version.ref = "swagger-parser" }
|
||||||
|
53
jellyfin-api-ktor/build.gradle.kts
Normal file
53
jellyfin-api-ktor/build.gradle.kts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
explicitApi()
|
||||||
|
|
||||||
|
jvm()
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
all {
|
||||||
|
languageSettings {
|
||||||
|
progressiveMode = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(projects.jellyfinApi)
|
||||||
|
implementation(projects.jellyfinModel)
|
||||||
|
|
||||||
|
implementation(libs.kotlinx.serialization.core)
|
||||||
|
implementation(libs.ktor.core)
|
||||||
|
|
||||||
|
implementation(libs.kotlin.logging)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val jvmMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.ktor.okhttp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(projects.testutils)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enablePublishing {
|
||||||
|
val javadocJar by tasks.creating(Jar::class) {
|
||||||
|
dependsOn(tasks.getByName("dokkaHtml"))
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
from("$buildDir/dokka/html")
|
||||||
|
}
|
||||||
|
|
||||||
|
publications.withType<MavenPublication> {
|
||||||
|
artifact(javadocJar)
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,9 @@
|
|||||||
package org.jellyfin.sdk.api.client
|
package org.jellyfin.sdk.api.ktor
|
||||||
|
|
||||||
|
import org.jellyfin.sdk.api.client.ApiClient
|
||||||
|
import org.jellyfin.sdk.api.client.HttpClientOptions
|
||||||
|
import org.jellyfin.sdk.api.client.HttpMethod
|
||||||
|
import org.jellyfin.sdk.api.client.RawResponse
|
||||||
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
||||||
import org.jellyfin.sdk.api.sockets.SocketInstance
|
import org.jellyfin.sdk.api.sockets.SocketInstance
|
||||||
import org.jellyfin.sdk.model.ClientInfo
|
import org.jellyfin.sdk.model.ClientInfo
|
@ -1,4 +1,4 @@
|
|||||||
package org.jellyfin.sdk.api.client
|
package org.jellyfin.sdk.api.ktor
|
||||||
|
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.call.NoTransformationFoundException
|
import io.ktor.client.call.NoTransformationFoundException
|
||||||
@ -17,6 +17,10 @@ import io.ktor.network.sockets.SocketTimeoutException
|
|||||||
import io.ktor.util.toMap
|
import io.ktor.util.toMap
|
||||||
import kotlinx.serialization.SerializationException
|
import kotlinx.serialization.SerializationException
|
||||||
import mu.KotlinLogging
|
import mu.KotlinLogging
|
||||||
|
import org.jellyfin.sdk.api.client.ApiClient
|
||||||
|
import org.jellyfin.sdk.api.client.HttpClientOptions
|
||||||
|
import org.jellyfin.sdk.api.client.HttpMethod
|
||||||
|
import org.jellyfin.sdk.api.client.RawResponse
|
||||||
import org.jellyfin.sdk.api.client.exception.ApiClientException
|
import org.jellyfin.sdk.api.client.exception.ApiClientException
|
||||||
import org.jellyfin.sdk.api.client.exception.InvalidContentException
|
import org.jellyfin.sdk.api.client.exception.InvalidContentException
|
||||||
import org.jellyfin.sdk.api.client.exception.InvalidStatusException
|
import org.jellyfin.sdk.api.client.exception.InvalidStatusException
|
@ -22,7 +22,7 @@ kotlin {
|
|||||||
|
|
||||||
implementation(libs.kotlinx.coroutines)
|
implementation(libs.kotlinx.coroutines)
|
||||||
implementation(libs.kotlinx.serialization.json)
|
implementation(libs.kotlinx.serialization.json)
|
||||||
implementation(libs.ktor.core)
|
implementation(libs.ktor.http)
|
||||||
|
|
||||||
implementation(libs.kotlin.logging)
|
implementation(libs.kotlin.logging)
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ kotlin {
|
|||||||
|
|
||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.ktor.okhttp)
|
implementation(libs.okhttp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import kotlin.time.Duration.Companion.seconds
|
|||||||
|
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
public class SocketInstance internal constructor(
|
public class SocketInstance(
|
||||||
private val api: ApiClient,
|
private val api: ApiClient,
|
||||||
private val socketConnectionFactory: SocketConnectionFactory,
|
private val socketConnectionFactory: SocketConnectionFactory,
|
||||||
context: CoroutineContext = Dispatchers.Default,
|
context: CoroutineContext = Dispatchers.Default,
|
||||||
|
@ -21,6 +21,7 @@ kotlin {
|
|||||||
val commonMain by getting {
|
val commonMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(projects.jellyfinApi)
|
api(projects.jellyfinApi)
|
||||||
|
api(projects.jellyfinApiKtor)
|
||||||
api(projects.jellyfinModel)
|
api(projects.jellyfinModel)
|
||||||
|
|
||||||
implementation(libs.kotlinx.coroutines)
|
implementation(libs.kotlinx.coroutines)
|
||||||
|
@ -2,7 +2,7 @@ package org.jellyfin.sdk
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.jellyfin.sdk.android.androidDevice
|
import org.jellyfin.sdk.android.androidDevice
|
||||||
import org.jellyfin.sdk.api.client.KtorClient
|
import org.jellyfin.sdk.api.ktor.KtorClient
|
||||||
import org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession
|
import org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession
|
||||||
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
||||||
import org.jellyfin.sdk.model.ClientInfo
|
import org.jellyfin.sdk.model.ClientInfo
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.jellyfin.sdk
|
package org.jellyfin.sdk
|
||||||
|
|
||||||
import org.jellyfin.sdk.api.client.KtorClient
|
import org.jellyfin.sdk.api.ktor.KtorClient
|
||||||
import org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession
|
import org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession
|
||||||
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
import org.jellyfin.sdk.api.sockets.SocketConnectionFactory
|
||||||
import org.jellyfin.sdk.model.ClientInfo
|
import org.jellyfin.sdk.model.ClientInfo
|
||||||
|
@ -6,6 +6,7 @@ rootProject.name = "jellyfin-sdk-kotlin"
|
|||||||
include(":jellyfin-core")
|
include(":jellyfin-core")
|
||||||
include(":jellyfin-model")
|
include(":jellyfin-model")
|
||||||
include(":jellyfin-api")
|
include(":jellyfin-api")
|
||||||
|
include(":jellyfin-api-ktor")
|
||||||
|
|
||||||
// Code generation
|
// Code generation
|
||||||
include(":openapi-generator")
|
include(":openapi-generator")
|
||||||
|
Loading…
Reference in New Issue
Block a user