mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-11-23 13:59:42 +00:00
Enable explicit API mode in jellyfin-model (#145)
This commit is contained in:
parent
58571417bf
commit
f56c8ffcc0
@ -12,7 +12,7 @@ dependencies {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
explicitApiWarning()
|
||||
explicitApi()
|
||||
}
|
||||
|
||||
sourceSets.getByName("main").java.srcDir("src/main/kotlin-generated")
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.jellyfin.apiclient.model
|
||||
|
||||
data class ClientInfo(
|
||||
public data class ClientInfo(
|
||||
val name: String,
|
||||
val version: String
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.jellyfin.apiclient.model
|
||||
|
||||
data class DeviceInfo(
|
||||
public data class DeviceInfo(
|
||||
val id: String,
|
||||
val name: String
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import kotlinx.serialization.Serializable
|
||||
* Contains the information exposed by the server via discovery
|
||||
*/
|
||||
@Serializable
|
||||
data class DiscoveryServerInfo(
|
||||
public data class DiscoveryServerInfo(
|
||||
/**
|
||||
* The unique id of this server. Usually a UUID but not guaranteed.
|
||||
*/
|
||||
|
@ -8,14 +8,14 @@ import org.jellyfin.apiclient.model.discovery.ServerVersion.Companion.fromString
|
||||
* Use [fromString] to parse strings. The format is similar to SemVer.
|
||||
*/
|
||||
@Serializable
|
||||
data class ServerVersion(
|
||||
public data class ServerVersion(
|
||||
val major: Int,
|
||||
val minor: Int,
|
||||
val patch: Int
|
||||
) {
|
||||
operator fun compareTo(other: ServerVersion) = comparator.compare(this, other)
|
||||
public operator fun compareTo(other: ServerVersion): Int = comparator.compare(this, other)
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
private val comparator = compareBy<ServerVersion>(
|
||||
{ it.major },
|
||||
{ it.minor },
|
||||
@ -26,7 +26,7 @@ data class ServerVersion(
|
||||
* Create an instance of [ServerVersion] from a string. The string must be in the format
|
||||
* "\d+\.\d+\.\d+\". Example: 1.0.0 or 10.6.4. Characters are not allowed.
|
||||
*/
|
||||
fun fromString(str: String): ServerVersion? {
|
||||
public fun fromString(str: String): ServerVersion? {
|
||||
// Split into major, minor and patch
|
||||
val stringParts = str.split('.')
|
||||
// Check if we found 3 parts
|
||||
|
@ -14,7 +14,7 @@ import java.time.format.DateTimeParseException
|
||||
/**
|
||||
* Serializer to read zoned date times as local date time and writing it back
|
||||
*/
|
||||
class LocalDateTimeSerializer : KSerializer<LocalDateTime> {
|
||||
public class LocalDateTimeSerializer : KSerializer<LocalDateTime> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("LocalDateTime", PrimitiveKind.STRING)
|
||||
|
||||
override fun deserialize(decoder: Decoder): LocalDateTime = try {
|
||||
@ -25,6 +25,6 @@ class LocalDateTimeSerializer : KSerializer<LocalDateTime> {
|
||||
LocalDateTime.MIN
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: LocalDateTime) =
|
||||
override fun serialize(encoder: Encoder, value: LocalDateTime): Unit =
|
||||
encoder.encodeString(value.atZone(ZoneId.systemDefault()).toString())
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.*
|
||||
/**
|
||||
* A UUID serializer that supports the GUIDs without dashes from the Jellyfin API
|
||||
*/
|
||||
class UUIDSerializer : KSerializer<UUID> {
|
||||
public class UUIDSerializer : KSerializer<UUID> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING)
|
||||
|
||||
override fun deserialize(decoder: Decoder): UUID {
|
||||
@ -25,7 +25,7 @@ class UUIDSerializer : KSerializer<UUID> {
|
||||
encoder.encodeString(value.toString())
|
||||
}
|
||||
|
||||
companion object {
|
||||
val UUID_REGEX = "^([a-z\\d]{8})([a-z\\d]{4})(4[a-z\\d]{3})([a-z\\d]{4})([a-z\\d]{12})\$".toRegex()
|
||||
private companion object {
|
||||
private val UUID_REGEX = "^([a-z\\d]{8})([a-z\\d]{4})(4[a-z\\d]{3})([a-z\\d]{4})([a-z\\d]{12})\$".toRegex()
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ActivityLogEntryMessage(
|
||||
public data class ActivityLogEntryMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("ActivityLogEntryStart")
|
||||
data class ActivityLogEntryStartMessage(
|
||||
public data class ActivityLogEntryStartMessage(
|
||||
@SerialName("Data")
|
||||
val period: PeriodicListenerPeriod = PeriodicListenerPeriod(),
|
||||
) : OutgoingSocketMessage
|
||||
|
@ -5,4 +5,4 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("ActivityLogEntryStop")
|
||||
class ActivityLogEntryStopMessage : OutgoingSocketMessage
|
||||
public class ActivityLogEntryStopMessage : OutgoingSocketMessage
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ForceKeepAliveMessage(
|
||||
public data class ForceKeepAliveMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class GeneralCommandMessage(
|
||||
public data class GeneralCommandMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
enum class GeneralCommandType {
|
||||
public enum class GeneralCommandType {
|
||||
@SerialName("MoveUp")
|
||||
MoveUp,
|
||||
|
||||
|
@ -7,12 +7,12 @@ import kotlinx.serialization.UseSerializers
|
||||
import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
interface IncomingSocketMessage : SocketMessage {
|
||||
public interface IncomingSocketMessage : SocketMessage {
|
||||
/**
|
||||
* The id of the received message.
|
||||
*
|
||||
* Implementation note: Copy the @SerialName notation to the implementation side
|
||||
*/
|
||||
@SerialName("MessageId")
|
||||
val messageId: UUID
|
||||
public val messageId: UUID
|
||||
}
|
||||
|
@ -5,4 +5,4 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("KeepAlive")
|
||||
class KeepAliveMessage : OutgoingSocketMessage
|
||||
public class KeepAliveMessage : OutgoingSocketMessage
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class LibraryChangedMessage(
|
||||
public data class LibraryChangedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.jellyfin.apiclient.model.socket
|
||||
|
||||
interface OutgoingSocketMessage : SocketMessage
|
||||
public interface OutgoingSocketMessage : SocketMessage
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PackageInstallationCancelledMessage(
|
||||
public data class PackageInstallationCancelledMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PackageInstallationCompletedMessage(
|
||||
public data class PackageInstallationCompletedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PackageInstallationFailedMessage(
|
||||
public data class PackageInstallationFailedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PackageInstallingMessage(
|
||||
public data class PackageInstallingMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PackageUninstalledMessage(
|
||||
public data class PackageUninstalledMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -4,11 +4,12 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable(with = PeriodicListenerPeriod.Serializer::class)
|
||||
data class PeriodicListenerPeriod(
|
||||
public data class PeriodicListenerPeriod(
|
||||
val initialDelay: Long = 0,
|
||||
val interval: Long = 1000,
|
||||
) {
|
||||
@ -16,8 +17,8 @@ data class PeriodicListenerPeriod(
|
||||
return "$initialDelay,$interval"
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun fromString(str: String): PeriodicListenerPeriod? {
|
||||
public companion object {
|
||||
public fun fromString(str: String): PeriodicListenerPeriod? {
|
||||
val values = str.split(',')
|
||||
val dueTimeMs = values.getOrNull(0)?.toLongOrNull() ?: return null
|
||||
val periodMs = values.getOrNull(1)?.toLongOrNull() ?: return null
|
||||
@ -29,10 +30,10 @@ data class PeriodicListenerPeriod(
|
||||
}
|
||||
}
|
||||
|
||||
class Serializer : KSerializer<PeriodicListenerPeriod> {
|
||||
override val descriptor = PrimitiveSerialDescriptor("PeriodicListenerPeriod", PrimitiveKind.STRING)
|
||||
public class Serializer : KSerializer<PeriodicListenerPeriod> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("PeriodicListenerPeriod", PrimitiveKind.STRING)
|
||||
|
||||
override fun serialize(encoder: Encoder, value: PeriodicListenerPeriod) =
|
||||
override fun serialize(encoder: Encoder, value: PeriodicListenerPeriod): Unit =
|
||||
encoder.encodeString(value.toString())
|
||||
|
||||
override fun deserialize(decoder: Decoder): PeriodicListenerPeriod =
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PlayMessage(
|
||||
public data class PlayMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class PlayStateMessage(
|
||||
public data class PlayStateMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class RefreshProgressMessage(
|
||||
public data class RefreshProgressMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class RestartRequiredMessage(
|
||||
public data class RestartRequiredMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
) : IncomingSocketMessage
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ScheduledTaskEndedMessage(
|
||||
public data class ScheduledTaskEndedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ScheduledTasksInfoMessage(
|
||||
public data class ScheduledTasksInfoMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("ScheduledTasksInfoStart")
|
||||
data class ScheduledTasksInfoStartMessage(
|
||||
public data class ScheduledTasksInfoStartMessage(
|
||||
@SerialName("Data")
|
||||
val period: PeriodicListenerPeriod = PeriodicListenerPeriod(),
|
||||
) : OutgoingSocketMessage
|
||||
|
@ -5,4 +5,4 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("ScheduledTasksInfoStop")
|
||||
class ScheduledTasksInfoStopMessage : OutgoingSocketMessage
|
||||
public class ScheduledTasksInfoStopMessage : OutgoingSocketMessage
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class SeriesTimerCancelledMessage(
|
||||
public data class SeriesTimerCancelledMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class SeriesTimerCreatedMessage(
|
||||
public data class SeriesTimerCreatedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ServerRestartingMessage(
|
||||
public data class ServerRestartingMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
) : IncomingSocketMessage
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ServerShuttingDownMessage(
|
||||
public data class ServerShuttingDownMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
) : IncomingSocketMessage
|
||||
|
@ -10,9 +10,9 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class SessionsMessage(
|
||||
public data class SessionsMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
@SerialName("Data")
|
||||
val Session: List<SessionInfo>,
|
||||
val session: List<SessionInfo>,
|
||||
) : IncomingSocketMessage
|
||||
|
@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("SessionsStart")
|
||||
data class SessionsStartMessage(
|
||||
public data class SessionsStartMessage(
|
||||
@SerialName("Data")
|
||||
val period: PeriodicListenerPeriod = PeriodicListenerPeriod(),
|
||||
) : OutgoingSocketMessage
|
||||
|
@ -5,4 +5,4 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("SessionsStart")
|
||||
class SessionsStopMessage : OutgoingSocketMessage
|
||||
public class SessionsStopMessage : OutgoingSocketMessage
|
||||
|
@ -1,3 +1,3 @@
|
||||
package org.jellyfin.apiclient.model.socket
|
||||
|
||||
interface SocketMessage
|
||||
public interface SocketMessage
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class SyncPlayCommandMessage(
|
||||
public data class SyncPlayCommandMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class SyncPlayGroupUpdateMessage(
|
||||
public data class SyncPlayGroupUpdateMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class TimerCancelledMessage(
|
||||
public data class TimerCancelledMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class TimerCreatedMessage(
|
||||
public data class TimerCreatedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class UserDataChangedMessage(
|
||||
public data class UserDataChangedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
@SerialName("UserId")
|
||||
|
@ -9,7 +9,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class UserDeletedMessage(
|
||||
public data class UserDeletedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.jellyfin.apiclient.model.serializer.UUIDSerializer
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class UserUpdatedMessage(
|
||||
public data class UserUpdatedMessage(
|
||||
@SerialName("MessageId")
|
||||
override val messageId: UUID,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user