SpotifyRestAction

open class SpotifyRestAction<T>

Provides a uniform interface to retrieve, whether synchronously or asynchronously, T from Spotify

Functions

complete
Link copied to clipboard
common
fun complete(): T
Invoke supplier and synchronously retrieve T.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
hasCompleted
Link copied to clipboard
common
fun hasCompleted(): Boolean
Whether this REST action has been fully completed
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
hasRun
Link copied to clipboard
common
fun hasRun(): Boolean
Whether this REST action has been commenced.
queue
Link copied to clipboard
common
fun queue(failure: (Throwable) -> Unit = { throw it }, consumer: (T) -> Unit = {})
Invoke supplier asynchronously and consume consumer with the T value returned
queueAfter
Link copied to clipboard
common
fun queueAfter(quantity: Int, timeUnit: TimeUnit = TimeUnit.SECONDS, scope: CoroutineScope = GlobalScope, failure: (Throwable) -> Unit = { throw it }, consumer: (T) -> Unit)
Invoke supplier asynchronously immediately and invoke consumer after the specified quantity of time.
suspendComplete
Link copied to clipboard
common
suspend fun suspendComplete(context: CoroutineContext = Dispatchers.Default): T
Switch to given context, invoke SpotifyRestAction.supplier and synchronously retrieve T
suspendQueue
Link copied to clipboard
common
suspend fun suspendQueue(): T
Suspend the coroutine, invoke SpotifyRestAction.supplier asynchronously/queued and resume with result T
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

supplier
Link copied to clipboard
common
val supplier: suspend () -> T

Extensions

asPromise
Link copied to clipboard
js
fun <T> SpotifyRestAction<T>.asPromise(): Promise<T>

Sources

(source)
Link copied to clipboard