All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.jellyfin.sdk.model.serializer.UUIDSerializer.kt Maven / Gradle / Ivy

There is a newer version: 1.6.4
Show newest version
package org.jellyfin.sdk.model.serializer

import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import org.jellyfin.sdk.model.UUID

/**
 * Convert string to UUID. Accepts simple and hyphenated notations.
 * @throws IllegalArgumentException if string is not a valid UUID.
 */
public expect fun String.toUUID(): UUID

/**
 * Convert string to UUID or null if the string is not an UUID.
 * Accepts simple and hyphenated notations.
 */
public expect fun String.toUUIDOrNull(): UUID?

/**
 * A UUID serializer that supports the GUIDs without dashes from the Jellyfin API.
 */
public expect class UUIDSerializer : KSerializer {
	override val descriptor: SerialDescriptor

	override fun deserialize(decoder: Decoder): UUID

	override fun serialize(encoder: Encoder, value: UUID)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy