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
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
Loading…
Add table
Add a link
Reference in a new issue