commonMain.org.jellyfin.sdk.model.extensions.PairExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jellyfin-model-jvm Show documentation
Show all versions of jellyfin-model-jvm Show documentation
Official Kotlin/Java SDK for Jellyfin. org.jellyfin.sdk:jellyfin-model-jvm
package org.jellyfin.sdk.model.extensions
import org.jellyfin.sdk.model.UUID
import org.jellyfin.sdk.model.api.NameGuidPair
import org.jellyfin.sdk.model.api.NameIdPair
import org.jellyfin.sdk.model.api.NameValuePair
/**
* Convert a [NameIdPair] to a [Pair] with [NameIdPair.id] as [Pair.first] and [NameIdPair.name] as [Pair.second].
*/
public fun NameIdPair.toPair(): Pair = id to name
/**
* Convert a [Pair] to a [NameIdPair] with [Pair.first] as [NameIdPair.id] and [Pair.second] as [NameIdPair.name].
*/
public fun Pair.toNameIdPair(): NameIdPair = NameIdPair(id = first, name = second)
/**
* Convert a [NameGuidPair] to a [Pair] with [NameGuidPair.id] as [Pair.first] and [NameGuidPair.name] as [Pair.second].
*/
public fun NameGuidPair.toPair(): Pair = id to name
/**
* Convert a [Pair] to a [NameGuidPair] with [Pair.first] as [NameGuidPair.id] and [Pair.second] as [NameGuidPair.name].
*/
public fun Pair.toNameGuidPair(): NameGuidPair = NameGuidPair(id = first, name = second)
/**
* Convert a [NameValuePair] to a [Pair] with [NameValuePair.name] as [Pair.first] and [NameValuePair.value] as
* [Pair.second].
*/
public fun NameValuePair.toPair(): Pair = name to value
/**
* Convert a [Pair] to a [NameValuePair] with [Pair.first] as [NameValuePair.name] and [Pair.second] as
* [NameValuePair.value].
*/
public fun Pair.toNameValuePair(): NameValuePair = NameValuePair(name = first, value = second)