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

commonMain.org.jellyfin.sdk.model.extensions.GeneralCommandMessageExtensions.kt Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
package org.jellyfin.sdk.model.extensions

import org.jellyfin.sdk.model.api.GeneralCommandMessage
import kotlin.reflect.KProperty

// Single get
public operator fun GeneralCommandMessage.get(name: String): String? =
	data?.arguments?.entries?.firstOrNull { (key) ->
		key.contentEquals(name, ignoreCase = true)
	}?.value

// Multi get
public operator fun GeneralCommandMessage.get(vararg names: String): List =
	names.map(::get)

// Property delegation
public operator fun GeneralCommandMessage.getValue(thisRef: Any?, property: KProperty<*>): String? =
	get(property.name)

// Value checking
public operator fun GeneralCommandMessage.contains(name: String): Boolean =
	data?.arguments?.any { (key) ->
		key.contentEquals(name, ignoreCase = true)
	} ?: false




© 2015 - 2025 Weber Informatics LLC | Privacy Policy