spotifyAppApi

fun spotifyAppApi(clientId: String, clientSecret: String): SpotifyAppApiBuilder(source)

Instantiate a new SpotifyAppApiBuilder using a Spotify clientId and clientSecret.

Use case: I am using the client credentials flow. I only need access to public Spotify API endpoints, might have an existing token, and might want to deal with advanced configuration.

Return

Configurable SpotifyAppApiBuilder that, when built, creates a new SpotifyAppApi

Parameters

clientId

Spotify client id

clientSecret

fun spotifyAppApi(clientId: String, clientSecret: String, block: SpotifyAppApiBuilder.() -> Unit = {}): SpotifyAppApiBuilder(source)

Instantiate a new SpotifyAppApiBuilder using a Spotify clientId and clientSecret, with the ability to configure the api settings by providing a builder initialization block

Use case: I am using the client credentials flow. I only need access to public Spotify API endpoints, might have an existing token, and might want to deal with advanced configuration.

Return

Configurable SpotifyAppApiBuilder that, when built, creates a new SpotifyAppApi

Parameters

clientId

Spotify client id

clientSecret
block

Api settings block


fun spotifyAppApi(clientId: String?, clientSecret: String?, authorization: SpotifyUserAuthorization, block: SpotifyApiOptions.() -> Unit = {}): SpotifyAppApiBuilder(source)

Instantiate a new SpotifyAppApiBuilder using a Token

Use case: I am using the client credentials flow. I only need access to public Spotify API endpoints, I have an existing token, and I don't want to deal with advanced configuration.

Return

Configurable SpotifyAppApiBuilder that, when built, creates a new SpotifyAppApi

Parameters

clientId

Spotify client id

clientSecret
authorization

A SpotifyUserAuthorization that must contain one of the following: authorization code (preferred), access token string (tokenString), Token object, and that may contain a refresh token (preferred) with which to refresh the access token

block

Override default API options such as the cache limit


fun spotifyAppApi(clientId: String?, clientSecret: String?, token: Token, block: SpotifyApiOptions.() -> Unit = {}): SpotifyAppApiBuilder(source)

Instantiate a new SpotifyAppApiBuilder using a Token

Use case: I am using the client credentials flow. I only need access to public Spotify API endpoints, I have an existing token, and I don't want to deal with advanced configuration.

Return

Configurable SpotifyAppApiBuilder that, when built, creates a new SpotifyAppApi

Parameters

clientId

Spotify client id

clientSecret
token

Build the API using an existing token.

block

Override default API options such as the cache limit


Instantiate a new SpotifyAppApiBuilder by providing a builder initialization block.

Note: You must provide your app credentials in the SpotifyAppApiBuilder.credentials block

Use case: I am using the client credentials flow. I only need access to public Spotify API endpoints, and I want to use the SpotifyAppApiBuilder DSL to configure everything myself.

Return

Configurable SpotifyAppApiBuilder that, when built, creates a new SpotifyAppApi

Parameters

block

Api settings block