mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Add module for seerr api
This commit is contained in:
parent
e0d50baf15
commit
2cc762a5b8
8 changed files with 7869 additions and 2 deletions
|
|
@ -247,4 +247,6 @@ dependencies {
|
||||||
if (ffmpegModuleExists || isCI) {
|
if (ffmpegModuleExists || isCI) {
|
||||||
implementation(files("libs/lib-decoder-ffmpeg-release.aar"))
|
implementation(files("libs/lib-decoder-ffmpeg-release.aar"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
implementation(project(":seerr-api"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.internal.headersContentLength
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
|
|
@ -211,7 +210,7 @@ class UpdateChecker
|
||||||
if (it.isSuccessful && it.body != null) {
|
if (it.isSuccessful && it.body != null) {
|
||||||
Timber.v("Request successful for ${release.downloadUrl}")
|
Timber.v("Request successful for ${release.downloadUrl}")
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
callback.contentLength(it.headersContentLength())
|
callback.contentLength(it.body.contentLength())
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
val contentValues =
|
val contentValues =
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,13 @@ autoServiceKsp = "1.2.0"
|
||||||
desugar_jdk_libs = "2.1.5"
|
desugar_jdk_libs = "2.1.5"
|
||||||
hiltNavigationCompose = "1.3.0"
|
hiltNavigationCompose = "1.3.0"
|
||||||
kotlin = "2.2.21"
|
kotlin = "2.2.21"
|
||||||
|
kotlinxCoroutinesCore = "1.10.2"
|
||||||
ksp = "2.3.0"
|
ksp = "2.3.0"
|
||||||
coreKtx = "1.17.0"
|
coreKtx = "1.17.0"
|
||||||
appcompat = "1.7.1"
|
appcompat = "1.7.1"
|
||||||
composeBom = "2025.12.00"
|
composeBom = "2025.12.00"
|
||||||
multiplatformMarkdownRenderer = "0.38.1"
|
multiplatformMarkdownRenderer = "0.38.1"
|
||||||
|
okhttpBom = "5.3.2"
|
||||||
programguide = "1.6.0"
|
programguide = "1.6.0"
|
||||||
slf4j2Timber = "1.2"
|
slf4j2Timber = "1.2"
|
||||||
timber = "5.0.1"
|
timber = "5.0.1"
|
||||||
|
|
@ -63,8 +65,11 @@ auto-service-ksp = { module = "dev.zacsweers.autoservice:auto-service-ksp", vers
|
||||||
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
||||||
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
||||||
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
|
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
|
||||||
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
|
||||||
multiplatform-markdown-renderer = { module = "com.mikepenz:multiplatform-markdown-renderer", version.ref = "multiplatformMarkdownRenderer" }
|
multiplatform-markdown-renderer = { module = "com.mikepenz:multiplatform-markdown-renderer", version.ref = "multiplatformMarkdownRenderer" }
|
||||||
multiplatform-markdown-renderer-m3 = { module = "com.mikepenz:multiplatform-markdown-renderer-m3", version.ref = "multiplatformMarkdownRenderer" }
|
multiplatform-markdown-renderer-m3 = { module = "com.mikepenz:multiplatform-markdown-renderer-m3", version.ref = "multiplatformMarkdownRenderer" }
|
||||||
|
okhttp = { module = "com.squareup.okhttp3:okhttp" }
|
||||||
|
okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttpBom" }
|
||||||
programguide = { module = "io.github.oleksandrbalan:programguide", version.ref = "programguide" }
|
programguide = { module = "io.github.oleksandrbalan:programguide", version.ref = "programguide" }
|
||||||
protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protobuf-javalite" }
|
protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protobuf-javalite" }
|
||||||
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
|
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
|
||||||
|
|
|
||||||
1
seerr-api/.gitignore
vendored
Normal file
1
seerr-api/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
||||||
51
seerr-api/build.gradle.kts
Normal file
51
seerr-api/build.gradle.kts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
plugins {
|
||||||
|
id("java-library")
|
||||||
|
alias(libs.plugins.kotlin.jvm)
|
||||||
|
id("org.openapi.generator") version "7.17.0"
|
||||||
|
}
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
kotlin.srcDirs("$buildDir/generated/seerr_api/src/main/kotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
openApiGenerate {
|
||||||
|
generatorName.set("kotlin")
|
||||||
|
inputSpec.set("$projectDir/src/main/seerr-api.yml")
|
||||||
|
outputDir.set("$buildDir/generated/seerr_api")
|
||||||
|
apiPackage.set("com.github.damontecres.api.seerr")
|
||||||
|
modelPackage.set("com.github.damontecres.api.seerr.model")
|
||||||
|
groupId.set("com.github.damontecres.api.seerr")
|
||||||
|
id.set("seerr-api")
|
||||||
|
packageName.set("com.github.damontecres.api.seerr")
|
||||||
|
additionalProperties.apply {
|
||||||
|
put("serializationLibrary", "kotlinx_serialization")
|
||||||
|
put("sortModelPropertiesByRequiredFlag", true)
|
||||||
|
put("sortParamsByRequiredFlag", true)
|
||||||
|
put("useCoroutines", true)
|
||||||
|
put("enumPropertyNaming", "UPPERCASE")
|
||||||
|
put("modelMutable", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("compileKotlin") {
|
||||||
|
dependsOn.add(tasks.named("openApiGenerate"))
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(platform(libs.okhttp.bom))
|
||||||
|
implementation(libs.okhttp)
|
||||||
|
implementation(libs.kotlinx.serialization.core)
|
||||||
|
implementation(libs.kotlinx.serialization.json)
|
||||||
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.github.damontecres.api.seerr
|
||||||
|
|
||||||
|
import com.github.damontecres.api.seerr.infrastructure.ApiClient
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
class SeerrApiClient(
|
||||||
|
val baseUrl: String,
|
||||||
|
val apiKey: String,
|
||||||
|
okHttpClient: OkHttpClient,
|
||||||
|
) {
|
||||||
|
private val client =
|
||||||
|
okHttpClient
|
||||||
|
.newBuilder()
|
||||||
|
.addInterceptor {
|
||||||
|
it.proceed(
|
||||||
|
it
|
||||||
|
.request()
|
||||||
|
.newBuilder()
|
||||||
|
.header("X-Api-Key", apiKey)
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
private fun <T : ApiClient> create(initializer: (String, Call.Factory) -> T): Lazy<T> =
|
||||||
|
lazy {
|
||||||
|
initializer.invoke(baseUrl, client)
|
||||||
|
}
|
||||||
|
|
||||||
|
val authApi by create(::AuthApi)
|
||||||
|
val blacklistApi by create(::BlacklistApi)
|
||||||
|
val collectionApi by create(::CollectionApi)
|
||||||
|
val issueApi by create(::IssueApi)
|
||||||
|
val mediaApi by create(::MediaApi)
|
||||||
|
val moviesApi by create(::MoviesApi)
|
||||||
|
val otherApi by create(::OtherApi)
|
||||||
|
val overrideruleApi by create(::OverrideruleApi)
|
||||||
|
val personApi by create(::PersonApi)
|
||||||
|
val publicApi by create(::PublicApi)
|
||||||
|
val requestApi by create(::RequestApi)
|
||||||
|
val searchApi by create(::SearchApi)
|
||||||
|
val serviceApi by create(::ServiceApi)
|
||||||
|
val settingsApi by create(::SettingsApi)
|
||||||
|
val tmdbApi by create(::TmdbApi)
|
||||||
|
val tvApi by create(::TvApi)
|
||||||
|
val usersApi by create(::UsersApi)
|
||||||
|
val watchlistApi by create(::WatchlistApi)
|
||||||
|
}
|
||||||
7760
seerr-api/src/main/seerr-api.yml
Normal file
7760
seerr-api/src/main/seerr-api.yml
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -27,3 +27,4 @@ dependencyResolutionManagement {
|
||||||
|
|
||||||
rootProject.name = "Wholphin"
|
rootProject.name = "Wholphin"
|
||||||
include(":app")
|
include(":app")
|
||||||
|
include(":seerr-api")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue