SpotifyClientApi

open class SpotifyClientApi(clientId: String?, clientSecret: String?, var redirectUri: String?, token: Token, val usesPkceAuth: Boolean, enableDefaultTokenRefreshProducerIfNoneExists: Boolean, spotifyApiOptions: SpotifyApiOptions) : SpotifyApi<SpotifyClientApi, SpotifyClientApiBuilder> (source)

An API instance created through client authentication, with access to private information managed through the scopes exposed in token

Inheritors

Constructors

Link copied to clipboard
constructor(clientId: String?, clientSecret: String?, token: Token, spotifyApiOptions: SpotifyApiOptions)
constructor(clientId: String?, clientSecret: String?, redirectUri: String?, token: Token, usesPkceAuth: Boolean, enableDefaultTokenRefreshProducerIfNoneExists: Boolean, spotifyApiOptions: SpotifyApiOptions)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val albums: AlbumApi

Provides access to Spotify album endpoints

Link copied to clipboard
open override val artists: ArtistApi

Provides access to Spotify artist endpoints

Link copied to clipboard
open override val browse: BrowseApi

Provides access to Spotify browse endpoints

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val endpoints: List<SpotifyEndpoint>

A list of all endpoints included in this api type

Link copied to clipboard
open override val episodes: ClientEpisodeApi

Provides access to Spotify episode endpoints

Link copied to clipboard
Link copied to clipboard
open override val following: ClientFollowingApi

Provides access to endpoints for managing the artists, users, and playlists that a Spotify user follows. Superset of FollowingApi

Link copied to clipboard

Provides access to endpoints for retrieving information about, and managing, tracks that the current user has saved in their “Your Music” library.

Link copied to clipboard
open override val markets: MarketsApi

Provides access to Spotify market endpoints

Link copied to clipboard

Provides access to endpoints for retrieving information about the user’s listening habits.

Link copied to clipboard

Provides access to the beta player api, including track playing and pausing endpoints.

Link copied to clipboard
open override val playlists: ClientPlaylistApi

Provides access to endpoints for retrieving information about a user’s playlists and for managing a user’s playlists. Superset of PlaylistApi

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val search: SearchApi

Provides access to the Spotify search endpoint

Link copied to clipboard
open override val shows: ClientShowApi

Provides access to Spotify show endpoints

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val tracks: TrackApi

Provides access to Spotify track endpoints

Link copied to clipboard
Link copied to clipboard
open override val users: ClientProfileApi

Provides access to endpoints for retrieving information about a user’s profile. Superset of UserApi

Link copied to clipboard

Functions

Link copied to clipboard

If the cache is enabled, clear all stored queries in the cache

Link copied to clipboard
open override fun getApiBuilder(): SpotifyApiBuilder

Return a new SpotifyApiBuilder with the parameters provided to this api instance

Link copied to clipboard

Return a new B with the parameters provided to this api instance

Link copied to clipboard
fun getAuthorizationUrl(vararg scopes: SpotifyScope, redirectUri: String, state: String? = null): String
fun getAuthorizationUrl(vararg scopes: SpotifyScope, state: String? = null): String

Create a Spotify authorization URL from which client access can be obtained

Link copied to clipboard

Obtain a map of all currently-cached requests

Link copied to clipboard
fun getSpotifyPkceAuthorizationUrl(vararg scopes: SpotifyScope, redirectUri: String, codeChallenge: String, state: String? = null): String
Link copied to clipboard
suspend fun getUserId(): String

The Spotify user id to which the api instance is connected

Link copied to clipboard

The Spotify user id to which the api instance is connected

Link copied to clipboard
suspend fun hasScope(scope: SpotifyScope): Boolean?

Whether the current access token allows access to scope scope

Link copied to clipboard

Whether the current access token allows access to scope scope

Link copied to clipboard
suspend fun hasScopes(scope: SpotifyScope, vararg scopes: SpotifyScope): Boolean?

Whether the current access token allows access to all of the provided scopes

Link copied to clipboard

Whether the current access token allows access to all of the provided scopes

Link copied to clipboard
suspend fun isTokenValid(makeTestRequest: Boolean = true): TokenValidityResponse

Tests whether the current token is actually valid. By default, an endpoint is called once to verify validity.

Link copied to clipboard

Tests whether the current token is actually valid. By default, an endpoint is called once to verify validity.

Link copied to clipboard
suspend fun refreshToken(): Token

If the method used to create the token supports token refresh and the information in token is accurate, attempt to refresh the token

Link copied to clipboard

If the method used to create the token supports token refresh and the information in token is accurate, attempt to refresh the token

Link copied to clipboard
fun shutdown()

Stop all automatic functions like refreshToken or clearCache and shut down the scheduled executor

Link copied to clipboard
fun updateToken(modifier: Token.() -> Unit)

Modify the current Token via DSL

Link copied to clipboard
fun updateTokenWith(tokenString: String)

Change the current Token's access token