Merge pull request #205 from nielsvanvelzen/10.7.1-version

Remove server version from constants
This commit is contained in:
Max Rumpf 2021-03-25 21:40:06 +01:00 committed by GitHub
commit 6e5e81339c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -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"
}

View File

@ -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)!!
}
}

View File

@ -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)
}
}