mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-11-23 13:59:42 +00:00
Merge pull request #205 from nielsvanvelzen/10.7.1-version
Remove server version from constants
This commit is contained in:
commit
6e5e81339c
@ -8,7 +8,5 @@ package org.jellyfin.sdk.api.info
|
||||
import kotlin.String
|
||||
|
||||
public object ApiConstants {
|
||||
public val apiVersion: String = "10.7.1.0"
|
||||
|
||||
public val serverVersion: String = "10.7.1.0"
|
||||
public const val apiVersion: String = "10.7.1.0"
|
||||
}
|
||||
|
@ -44,6 +44,6 @@ public class Jellyfin(
|
||||
|
||||
public companion object {
|
||||
public val recommendedVersion: ServerVersion = ServerVersion(10, 7, 0, 0)
|
||||
public val apiVersion: ServerVersion = ServerVersion.fromString(ApiConstants.serverVersion)!!
|
||||
public val apiVersion: ServerVersion = ServerVersion.fromString(ApiConstants.apiVersion)!!
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.jellyfin.openapi.builder.openapi
|
||||
|
||||
import com.squareup.kotlinpoet.KModifier
|
||||
import com.squareup.kotlinpoet.PropertySpec
|
||||
import com.squareup.kotlinpoet.TypeSpec
|
||||
import io.swagger.v3.oas.models.info.Info
|
||||
@ -9,14 +10,14 @@ import org.jellyfin.openapi.constants.Packages
|
||||
import org.jellyfin.openapi.model.JellyFile
|
||||
|
||||
class OpenApiConstantsBuilder : Builder<Info, JellyFile> {
|
||||
private fun TypeSpec.Builder.addConstant(name: String, value: String): TypeSpec.Builder = addProperty(PropertySpec.builder(name, String::class).initializer("%S", value).build())
|
||||
private fun TypeSpec.Builder.addConstant(name: String, value: String): TypeSpec.Builder =
|
||||
addProperty(PropertySpec.builder(name, String::class).initializer("%S", value).addModifiers(KModifier.CONST).build())
|
||||
|
||||
override fun build(data: Info): JellyFile {
|
||||
val typeSpec = TypeSpec.Companion.objectBuilder(Classes.CONSTANTS_OBJECT)
|
||||
.addConstant("apiVersion", data.version)
|
||||
.addConstant("serverVersion", data.extensions["x-jellyfin-version"].toString())
|
||||
.build()
|
||||
|
||||
return JellyFile(Packages.API_CONSTANTS, emptySet(), typeSpec)
|
||||
return JellyFile(Packages.API_CONSTANTS, emptySet(), typeSpec)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user