Package-level declarations

Types

Link copied to clipboard
class DirtyList<T>(delegate: MutableList<T>, callback: (item: T, list: DirtyList<T>) -> Unit = {_, _ ->}) : MutableList<T>

A mutable list that tracks changes.

Link copied to clipboard
class DirtyMap<K, V>(delegate: MutableMap<K, V>, callback: (key: K, value: V, map: DirtyMap<K, V>) -> Unit = { _, _, _ -> }) : MutableMap<K, V>

A mutable map that tracks changes.

Link copied to clipboard
typealias JsonArrayList = List<JsonElement>
Link copied to clipboard
typealias JsonObjectMap = Map<String, Any>

Properties

Link copied to clipboard
val JsonElement.extractedContent: Any?

Extracts the content of a JsonElement to a type that can be used in Kotlin.

Functions

Link copied to clipboard
fun <R : Resource, T> R.attribute(name: String, defaultValue: T): MapDelegate<R, T>

Delegate for attributes. Let you specify the name of the attribute to delegate to.

Link copied to clipboard
suspend fun <R : Resource> R.destroy(): Boolean

Destroy a resource from the server.

Link copied to clipboard
fun <R : Resource, RL : Resource> R.hasManyRelationship(name: String, defaultValue: List<RL>? = emptyList()): MapDelegate<R, List<RL>?>

Delegate for has-many relationships. Let you specify the name of the relationship to delegate to.

Link copied to clipboard
fun <R : Resource, RL : Resource> R.hasOneRelationship(name: String, defaultValue: RL): MapDelegate<R, RL>

Delegate for relationships. Let you specify the name of the relationship to delegate to.

Link copied to clipboard
fun <R : Resource, T> R.nullableAttribute(name: String, defaultValue: T? = null): MapDelegate<R, T?>

Delegate for nullable attributes. Let you specify the name of the attribute to delegate to.

Link copied to clipboard
fun <R : Resource, RL : Resource> R.nullableHasOneRelationship(name: String, defaultValue: RL? = null): MapDelegate<R, RL?>

Delegate for relationships. Let you specify the name of the relationship to delegate to.

Link copied to clipboard
suspend fun <R : Resource> R.save(): Boolean

Save the resource to the server.

Link copied to clipboard
fun Any?.toJsonElement(): JsonElement

Converts Any? to a JsonElement.

fun Array<*>.toJsonElement(): JsonElement

Converts Array<*> to a JsonElement.

fun Collection<*>.toJsonElement(): JsonElement

Converts Collection<*> to a JsonElement.

fun Map<*, *>.toJsonElement(): JsonElement

Converts Map<*, *> to a JsonElement.

Link copied to clipboard
fun <T> MutableList<T>.trackChanges(callback: (item: T, list: DirtyList<T>) -> Unit = {_, _ ->}): DirtyList<T>

Track changes in a mutable list.

fun <K, V> MutableMap<K, V>.trackChanges(callback: (key: K, value: V, map: DirtyMap<K, V>) -> Unit = { _, _, _ ->}): DirtyMap<K, V>

Track changes in a mutable map.