SyncList

interface SyncList

SyncList is an ordered sequence of Item objects as values.

You can add, remove and modify values associated with each index in the list.

To obtain an instance of a SyncList use SyncClient.lists

Types

Link copied to clipboard
interface Events
Link copied to clipboard
data class Item(val index: Long, val data: <Error class: unknown class>, val dateCreated: <Error class: unknown class>, val dateUpdated: <Error class: unknown class>, val dateExpires: <Error class: unknown class>?)

Represents a value associated with each index in SyncList.

Properties

Link copied to clipboard
abstract val dateCreated: <Error class: unknown class>

A date when this SyncList was created.

Link copied to clipboard
abstract val dateExpires: <Error class: unknown class>?

A date this SyncList will expire, null means will not expire.

Link copied to clipboard
abstract val dateUpdated: <Error class: unknown class>

A date when this SyncList was last updated.

Link copied to clipboard
abstract val events: SyncList.Events

Provides scope of Flows objects to get notified about events.

Link copied to clipboard

true when this SyncList is offline and doesn't receive updates from backend, false otherwise.

Link copied to clipboard
abstract val isRemoved: Boolean

true when this SyncList has been removed on the backend, false otherwise.

Link copied to clipboard
abstract val sid: EntitySid

An immutable system-assigned identifier of this SyncList.

Link copied to clipboard

Current subscription state.

Link copied to clipboard
abstract val uniqueName: String?

An optional unique name for this SyncList, assigned at creation time.

Functions

Link copied to clipboard
abstract suspend fun addItem(itemData: <Error class: unknown class>): SyncList.Item

Add Item to the SyncList.

Link copied to clipboard
inline suspend fun <T : Any> SyncList.addItem(itemData: T): SyncList.Item

Serializes the given value into an equivalent JsonObject using a serializer retrieved from reified type parameter and adds it as a new item to the end of the SyncList.

Link copied to clipboard
abstract suspend fun addItemWithTtl(itemData: <Error class: unknown class>, ttl: <Error class: unknown class>): SyncList.Item

Add Item to the SyncList.

Link copied to clipboard
inline suspend fun <T : Any> SyncList.addItemWithTtl(itemData: T, ttl: <Error class: unknown class>): SyncList.Item

Serializes the given value into an equivalent JsonObject using a serializer retrieved from reified type parameter and adds it as a new item to the end of the SyncList with a specified TTL.

Link copied to clipboard
abstract fun close()

Close this SyncList.

Link copied to clipboard
abstract suspend fun getItem(itemIndex: Long, useCache: Boolean = true): SyncList.Item?

Retrieve Item from the SyncList.

Link copied to clipboard
open operator fun iterator(): SyncIterator<SyncList.Item>
Link copied to clipboard
abstract suspend fun mutateItem(itemIndex: Long, mutator: suspend (<Error class: unknown class>) -> <Error class: unknown class>?): SyncList.Item

Mutate value of the existing Item using provided Mutator function.

Link copied to clipboard
inline suspend fun <T : Any> SyncList.mutateItem(itemIndex: Long, crossinline mutator: suspend (currentData: T) -> T?): SyncList.Item

Serializes the value returned by Mutator function into an equivalent JsonObject using a serializer retrieved from reified type parameter and uses the JsonObject to mutate value of the SyncList.Item

Link copied to clipboard
abstract suspend fun mutateItemWithTtl(itemIndex: Long, ttl: <Error class: unknown class>, mutator: suspend (<Error class: unknown class>) -> <Error class: unknown class>?): SyncList.Item

Mutate value of the existing Item using provided Mutator function.

Link copied to clipboard
inline suspend fun <T : Any> SyncList.mutateItemWithTtl(itemIndex: Long, ttl: <Error class: unknown class>, crossinline mutator: suspend (currentData: T) -> T?): SyncList.Item

Serializes the value returned by Mutator function into an equivalent JsonObject using a serializer retrieved from reified type parameter and uses the JsonObject to mutate value of the SyncList.Item

Link copied to clipboard
abstract fun queryItems(startIndex: Long? = null, includeStartIndex: Boolean = true, queryOrder: <Error class: unknown class> = QueryOrder.Ascending, pageSize: Int = kDefaultPageSize, useCache: Boolean = true): SyncIterator<SyncList.Item>

Retrieve items from the SyncList.

Link copied to clipboard
abstract suspend fun removeItem(itemIndex: Long)

Remove Item from the SyncList.

Link copied to clipboard
abstract suspend fun removeList()

Remove this SyncList.

Link copied to clipboard
abstract suspend fun setItem(itemIndex: Long, itemData: <Error class: unknown class>): SyncList.Item

Set Item in the SyncList.

Link copied to clipboard
inline suspend fun <T : Any> SyncList.setItem(itemIndex: Long, itemData: T): SyncList.Item

Serializes the given value into an equivalent JsonObject using a serializer retrieved from reified type parameter and set it as value of the SyncList.Item.

Link copied to clipboard
abstract suspend fun setItemWithTtl(itemIndex: Long, itemData: <Error class: unknown class>, ttl: <Error class: unknown class>): SyncList.Item

Set Item in the SyncList.

Link copied to clipboard
abstract suspend fun setTtl(ttl: <Error class: unknown class>)

Set time to live for this SyncList.

Link copied to clipboard
inline fun <R> SyncList.use(block: (SyncList) -> R): R

Executes the given block function on SyncList and then closes it down correctly whether an exception is thrown or not.