SpotifyRestAction

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

Properties

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

Functions

Link copied to clipboard
Link copied to clipboard
fun complete(): T

Invoke supplier and synchronously retrieve T. This is only available on JVM/Native and will fail on JS.

Link copied to clipboard

Whether this REST action has been fully completed

Link copied to clipboard

Whether this REST action has been commenced.

Link copied to clipboard
fun queue(failure: (Throwable) -> Unit = { throw it }, consumer: (T) -> Unit = {})

Invoke supplier asynchronously and consume consumer with the T value returned

Link copied to clipboard
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.

Link copied to clipboard
suspend fun suspendComplete(context: CoroutineContext = Dispatchers.Default): T

Switch to given context, invoke SpotifyRestAction.supplier and synchronously retrieve T

Link copied to clipboard
suspend fun suspendQueue(): T

Suspend the coroutine, invoke SpotifyRestAction.supplier asynchronously/queued and resume with result T

Link copied to clipboard
open override fun toString(): String