UserClient src/managers/UserClient.ts#L99
The client which handles all the current user api endpoints and with the details of the current user.
Properties:
client country displayName email explicitContent externalURL id images player product totalFollowers type uriMethods:
createPlaylist followsArtists followsPlaylist followsUsers getFollowingArtists getPlaylists getSavedAlbums getSavedEpisodes getSavedShows getSavedTracks getTopArtists getTopTracks hasAlbums hasEpisodes hasShows hasTracks patchInfo removeAlbums removeEpisodes removeShows removeTracks saveAlbums saveEpisodes saveShows saveTracksconstructor(client) src/managers/UserClient.ts#L99
No documentation found.
Name | Type | Description |
---|---|---|
client | Client | The spotify api client. |
.country src/managers/UserClient.ts#L80 OPTIONAL
Type:
The country of the user, as set in the user’s account profile.
.displayName src/managers/UserClient.ts#L40 OPTIONAL
Type:
The name displayed on the user’s profile. null if not available.
.email src/managers/UserClient.ts#L85 OPTIONAL
Type:
The user’s email address, as entered by the user when creating their account.
.product src/managers/UserClient.ts#L75 OPTIONAL
Type:
The spotify subscription level of the user. If the user has the paticualr authorized scope for it.
.totalFollowers src/managers/UserClient.ts#L65 OPTIONAL
Type:
Information about the followers of the user.
.createPlaylist(playlist) src/managers/UserClient.ts#L150
Create a playlist.
const playlist = await client.user.createPlaylist({ name: 'My playlist' });
Returns:
Parameters:
Name | Type | Description |
---|---|---|
playlist | CreatePlaylistQuery | The playlist details to set. |
.followsArtists(ids) src/managers/UserClient.ts#L170
Verify if the current user follows one or more artists.
const [followsArtist] = await client.user.followsArtists('id1');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify artist ids. |
.followsPlaylist(playlistID) src/managers/UserClient.ts#L160
Verify if the current user follows a paticular playlist.
const currentUserFollows = await client.user.followsPlaylist('id');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
playlistID | string | The id of the spotify playlist. |
.followsUsers(ids) src/managers/UserClient.ts#L185
Verify if the current user follows one or more users.
const [followsUser] = await client.user.followsUsers('id1');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.getFollowingArtists(options) src/managers/UserClient.ts#L200
Get an array of artists who are been followed by the current usser.
const artists = await client.user.getFollowingArtists();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { after?: string, limit?: number, } | The limit, after query parameters. The after option is the last artist ID retrieved from the previous request. |
.getPlaylists(options) src/managers/UserClient.ts#L134
Get the list of playlists of the current user.
const playlists = await client.user.getPlaylists();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, offset?: number, } | The limit, offset query parameter options. |
.getSavedAlbums(options) src/managers/UserClient.ts#L264
Get all the saved albums of the current user.
const savedAlbums = await client.user.getSavedAlbums();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, market?: string, offset?: number, } | The limit, offset, market query paramaters. |
.getSavedEpisodes(options) src/managers/UserClient.ts#L372
Get all the saved episodes of the current user.
const savedEpisodes = await client.user.getSavedEpisodes();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, market?: string, offset?: number, } | The limit, offset, market query paramaters. |
.getSavedShows(options) src/managers/UserClient.ts#L426
Get all the saved shows of the current user.
const savedShows = await client.user.getSavedShows();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, market?: string, offset?: number, } | The limit, offset, market query paramaters. |
.getSavedTracks(options) src/managers/UserClient.ts#L318
Get all the saved tracks of the current user.
const savedTracks = await client.user.getSavedTracks();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, market?: string, offset?: number, } | The limit, offset, market query paramaters. |
.getTopArtists(options) src/managers/UserClient.ts#L240
Get the top artists of the user based on the current user's affinity.
const topArtists = await client.user.getTopArtists();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, offset?: number, timeRange?: TimeRange, } | The timeRange, limit, offset query paramaters. |
.getTopTracks(options) src/managers/UserClient.ts#L216
Get the top tracks of the user based on the current user's affinity.
const topTracks = await client.user.getTopTracks();
Returns:
Parameters:
Name | Type | Description |
---|---|---|
options | { limit?: number, offset?: number, timeRange?: TimeRange, } | The timeRange, limit, offset query paramaters. |
.hasAlbums(ids) src/managers/UserClient.ts#L307
Verify if the current user has a paticular one or more albums.
const [hasFirstAlbum, hasSecondAlbum] = await client.user.hasAlbums('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify album ids. |
.hasEpisodes(ids) src/managers/UserClient.ts#L415
Verify if the current user has a paticular one or more episodes.
const [hasFirstEpisode, hasSecondEpisode] = await client.user.hasEpisodes('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify episode ids. |
.hasShows(ids) src/managers/UserClient.ts#L469
Verify if the current user has a paticular one or more shows.
const [hasFirstShow, hasSecondShow] = await client.user.hasShows('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify show ids. |
.hasTracks(ids) src/managers/UserClient.ts#L361
Verify if the current user has a paticular one or more tracks.
const [hasFirstTrack, hasSecondTrack] = await client.user.hasTracks('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify track ids. |
.patchInfo() src/managers/UserClient.ts#L107
Patches the current user details info to this manager.
Returns:
Parameters:
Name | Type | Description |
---|
.removeAlbums(ids) src/managers/UserClient.ts#L294
Remove albums from the current user library.
await client.user.removeAlbums('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.removeEpisodes(ids) src/managers/UserClient.ts#L402
Remove episodes from the current user library.
await client.user.removeEpisodes('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.removeShows(ids) src/managers/UserClient.ts#L456
Remove shows from the current user library.
await client.user.removeShows('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.removeTracks(ids) src/managers/UserClient.ts#L348
Remove tracks from the current user library.
await client.user.removeTracks('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.saveAlbums(ids) src/managers/UserClient.ts#L281
Save albums to the current user library.
await client.user.saveAlbums('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.saveEpisodes(ids) src/managers/UserClient.ts#L389
Save episodes to the current user library.
await client.user.saveEpisodes('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.saveShows(ids) src/managers/UserClient.ts#L443
Save shows to the current user library.
await client.user.saveShows('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |
.saveTracks(ids) src/managers/UserClient.ts#L335
Save tracks to the current user library.
await client.user.saveTracks('id1', 'id2');
Returns:
Parameters:
Name | Type | Description |
---|---|---|
ids | string[] | The array of spotify user ids. |