SpotifyApiSpotify LogoJS

Client src/Client.ts#L118

The basic client to interact with the Spotify Web API.


Properties:

albums artists auth browse cacheSettings episodes onRefresh playlists refreshMeta retryOnRateLimit shows token tracks user users version

Methods:

_init fetch refreshFromMeta search create

constructor(options) src/Client.ts#L118

No documentation found.

NameTypeDescription
optionsClientOptionsThe options necessary for the client.

.albums src/Client.ts#L60

Type:

AlbumManager

A manager to perform actions which belongs to the spotify album web api.

.artists src/Client.ts#L50

Type:

ArtistManager

A manager to perform actions which belongs to the spotify artist web api.

.auth src/Client.ts#L40

Type:

AuthManager

The manager to perform actions regarding the authorization to the web api.

.browse src/Client.ts#L55

Type:

BrowseManager

A manager to perform actions which belongs to the spotify browse web api.

.cacheSettings src/Client.ts#L110

Type:

CacheSettings

Cache settings for the client.

.episodes src/Client.ts#L65

Type:

EpisodeManager

A manager to perform actions which belongs to the spotify episode web api.

.onRefresh src/Client.ts#L95

Type:

Function

No documentation found.

.playlists src/Client.ts#L70

Type:

PlaylistManager

A manager to perform actions which belongs to the spotify playlist web api.

.refreshMeta src/Client.ts#L100
OPTIONAL

Type:

ClientRefreshMeta

The metadata for continous refresh of token.

.retryOnRateLimit src/Client.ts#L105
OPTIONAL

Type:

boolean

Boolean stating should the client retry when the request is rate limited or not by default it is true.

.shows src/Client.ts#L75

Type:

ShowManager

A manager to perform actions which belongs to the spotify show web api.

.token src/Client.ts#L35

Type:

string

The token of the spotify web client.

.tracks src/Client.ts#L80

Type:

TrackManager

A manager to perform actions which belongs to the spotify track web api.

.user src/Client.ts#L85

Type:

UserClient

The client which handles all the current user api endpoints and with the details of the current user.

.users src/Client.ts#L45

Type:

UserManager

A manager to perform actions which belongs to the spotify user web api.

.version src/Client.ts#L90

Type:

"v${number}"

The version of spotify web api. For future purposes.

._init(options) src/Client.ts#L243

A function to initate the client through options and client options.

Returns:

Promise<void>

Parameters:

NameTypeDescription
optionsClientOptions

.fetch(url, options) src/Client.ts#L190

Used to fetch data from spotify rest api.

await client.fetch('/users/id');

Returns:

any

Parameters:

NameTypeDescription
urlstringThe path from spotify api to fetch!
optionsFetchOptionsThe additional options required to fetch from the api.

.refreshFromMeta() src/Client.ts#L217

Refreshes the token from meta.

Returns:

Promise<void>

Parameters:

NameTypeDescription

.search(query, options) src/Client.ts#L161

Search a query in spotify through web api across various types.

const { tracks, albums } = await client.search('some query', { types: ['track', 'album'] });

Returns:

Promise<SearchContent>

Parameters:

NameTypeDescription
querystringThe query to search.
optionsClientSearchOptionsThe types, limit, offset, market query paramaters.

.create(options) src/Client.ts#L150
STATIC

Creates a client and returns it as promise when its ready.

const client = await Client.create({ token: "token" });

Returns:

Promise<Client>

Parameters:

NameTypeDescription
optionsOmit<ClientOptions, "onReady">The same client options provided for the constructor but "onReady" field should not be provided.