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 versionMethods:
_init fetch refreshFromMeta search createconstructor(options) src/Client.ts#L118
No documentation found.
Name | Type | Description |
---|---|---|
options | ClientOptions | The options necessary for the client. |
.albums src/Client.ts#L60
Type:
A manager to perform actions which belongs to the spotify album web api.
.artists src/Client.ts#L50
Type:
A manager to perform actions which belongs to the spotify artist web api.
.auth src/Client.ts#L40
Type:
The manager to perform actions regarding the authorization to the web api.
.browse src/Client.ts#L55
Type:
A manager to perform actions which belongs to the spotify browse web api.
.episodes src/Client.ts#L65
Type:
A manager to perform actions which belongs to the spotify episode web api.
.playlists src/Client.ts#L70
Type:
A manager to perform actions which belongs to the spotify playlist web api.
.retryOnRateLimit src/Client.ts#L105 OPTIONAL
Type:
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:
A manager to perform actions which belongs to the spotify show web api.
.tracks src/Client.ts#L80
Type:
A manager to perform actions which belongs to the spotify track web api.
.user src/Client.ts#L85
Type:
The client which handles all the current user api endpoints and with the details of the current user.
.users src/Client.ts#L45
Type:
A manager to perform actions which belongs to the spotify user web api.
._init(options) src/Client.ts#L243
A function to initate the client through options and client options.
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | ClientOptions |
.fetch(url, options) src/Client.ts#L190
Used to fetch data from spotify rest api.
await client.fetch('/users/id');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
url | string | The path from spotify api to fetch! |
options | FetchOptions | The additional options required to fetch from the api. |
.refreshFromMeta() src/Client.ts#L217
Refreshes the token from meta.
Returns:
Parameters:
Name | Type | Description |
---|
.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:
Parameters:
Name | Type | Description |
---|---|---|
query | string | The query to search. |
options | ClientSearchOptions | The 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:
Parameters:
Name | Type | Description |
---|---|---|
options | Omit<ClientOptions, "onReady"> | The same client options provided for the constructor but "onReady" field should not be provided. |