SpotifyApiOptions

data class SpotifyApiOptions(useCache: Boolean, cacheLimit: Int?, automaticRefresh: Boolean, retryWhenRateLimited: Boolean, enableLogger: Boolean, testTokenValidity: Boolean, defaultLimit: Int, allowBulkRequests: Boolean, requestTimeoutMillis: Long?, json: Json, refreshTokenProducer: suspend (GenericSpotifyApi) -> Token?, onTokenRefresh: suspend (GenericSpotifyApi) -> Unit?, requiredScopes: List<SpotifyScope>?, proxyBaseUrl: String?, retryIfInternalServerError: Boolean)

API Utilities

Parameters

useCache

Set whether to cache requests. Default: true

cacheLimit

The maximum amount of cached requests allowed at one time. Null means no limit

automaticRefresh

Enable or disable automatic refresh of the Spotify access token

retryWhenRateLimited

Set whether to block the current thread and wait until the API can retry the request

enableLogger

Set whether to enable to the exception logger

testTokenValidity

After API creation, test whether the token is valid by performing a lightweight request

defaultLimit

The default amount of objects to retrieve in one request

json

The Json serializer/deserializer instance

allowBulkRequests

Allow splitting too-large requests into smaller, allowable api requests

requestTimeoutMillis

The maximum time, in milliseconds, before terminating an http request

refreshTokenProducer

Provide if you want to use your own logic when refreshing a Spotify token

onTokenRefresh

Provide if you want to act on token refresh event

requiredScopes

Scopes that your application requires to function (only applicable to SpotifyClientApi and SpotifyImplicitGrantApi).

proxyBaseUrl

Provide if you have a proxy base URL that you would like to use instead of the Spotify API base (https://api.spotify.com/v1).

retryIfInternalServerError

Whether to retry once if an internal server error (500..599) has been received

Constructors

SpotifyApiOptions
Link copied to clipboard
common
fun SpotifyApiOptions(useCache: Boolean = true, cacheLimit: Int? = 200, automaticRefresh: Boolean = true, retryWhenRateLimited: Boolean = true, enableLogger: Boolean = true, testTokenValidity: Boolean = false, defaultLimit: Int = 50, allowBulkRequests: Boolean = true, requestTimeoutMillis: Long? = null, json: Json = nonstrictJson, refreshTokenProducer: suspend (GenericSpotifyApi) -> Token? = null, onTokenRefresh: suspend (GenericSpotifyApi) -> Unit? = null, requiredScopes: List<SpotifyScope>? = null, proxyBaseUrl: String? = null, retryIfInternalServerError: Boolean = true)
Set whether to cache requests.

Functions

component1
Link copied to clipboard
common
operator fun component1(): Boolean
component10
Link copied to clipboard
common
operator fun component10(): Json
component11
Link copied to clipboard
common
operator fun component11(): suspend (GenericSpotifyApi) -> Token?
component12
Link copied to clipboard
common
operator fun component12(): suspend (GenericSpotifyApi) -> Unit?
component13
Link copied to clipboard
common
operator fun component13(): List<SpotifyScope>?
component14
Link copied to clipboard
common
operator fun component14(): String?
component15
Link copied to clipboard
common
operator fun component15(): Boolean
component2
Link copied to clipboard
common
operator fun component2(): Int?
component3
Link copied to clipboard
common
operator fun component3(): Boolean
component4
Link copied to clipboard
common
operator fun component4(): Boolean
component5
Link copied to clipboard
common
operator fun component5(): Boolean
component6
Link copied to clipboard
common
operator fun component6(): Boolean
component7
Link copied to clipboard
common
operator fun component7(): Int
component8
Link copied to clipboard
common
operator fun component8(): Boolean
component9
Link copied to clipboard
common
operator fun component9(): Long?
copy
Link copied to clipboard
common
fun copy(useCache: Boolean = true, cacheLimit: Int? = 200, automaticRefresh: Boolean = true, retryWhenRateLimited: Boolean = true, enableLogger: Boolean = true, testTokenValidity: Boolean = false, defaultLimit: Int = 50, allowBulkRequests: Boolean = true, requestTimeoutMillis: Long? = null, json: Json = nonstrictJson, refreshTokenProducer: suspend (GenericSpotifyApi) -> Token? = null, onTokenRefresh: suspend (GenericSpotifyApi) -> Unit? = null, requiredScopes: List<SpotifyScope>? = null, proxyBaseUrl: String? = null, retryIfInternalServerError: Boolean = true): SpotifyApiOptions
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

allowBulkRequests
Link copied to clipboard
common
var allowBulkRequests: Boolean = true
Allow splitting too-large requests into smaller, allowable api requests
automaticRefresh
Link copied to clipboard
common
var automaticRefresh: Boolean = true
Enable or disable automatic refresh of the Spotify access token
cacheLimit
Link copied to clipboard
common
var cacheLimit: Int? = 200
The maximum amount of cached requests allowed at one time.
defaultLimit
Link copied to clipboard
common
var defaultLimit: Int = 50
The default amount of objects to retrieve in one request
enableLogger
Link copied to clipboard
common
var enableLogger: Boolean = true
Set whether to enable to the exception logger
json
Link copied to clipboard
common
var json: Json
The Json serializer/deserializer instance
onTokenRefresh
Link copied to clipboard
common
var onTokenRefresh: suspend (GenericSpotifyApi) -> Unit? = null
Provide if you want to act on token refresh event
proxyBaseUrl
Link copied to clipboard
common
var proxyBaseUrl: String? = null
Provide if you have a proxy base URL that you would like to use instead of the Spotify API base (https://api.spotify.com/v1).
refreshTokenProducer
Link copied to clipboard
common
var refreshTokenProducer: suspend (GenericSpotifyApi) -> Token? = null
Provide if you want to use your own logic when refreshing a Spotify token
requestTimeoutMillis
Link copied to clipboard
common
var requestTimeoutMillis: Long? = null
The maximum time, in milliseconds, before terminating an http request
requiredScopes
Link copied to clipboard
common
var requiredScopes: List<SpotifyScope>? = null
Scopes that your application requires to function (only applicable to SpotifyClientApi and SpotifyImplicitGrantApi).
retryIfInternalServerError
Link copied to clipboard
common
var retryIfInternalServerError: Boolean = true
Whether to retry once if an internal server error (500..
retryWhenRateLimited
Link copied to clipboard
common
var retryWhenRateLimited: Boolean = true
Set whether to block the current thread and wait until the API can retry the request
testTokenValidity
Link copied to clipboard
common
var testTokenValidity: Boolean = false
After API creation, test whether the token is valid by performing a lightweight request
useCache
Link copied to clipboard
common
var useCache: Boolean = true
Set whether to cache requests.

Sources

(source)
Link copied to clipboard