SpotifyApiSpotify LogoJS

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 uri

Methods:

createPlaylist followsArtists followsPlaylist followsUsers getFollowingArtists getPlaylists getSavedAlbums getSavedEpisodes getSavedShows getSavedTracks getTopArtists getTopTracks hasAlbums hasEpisodes hasShows hasTracks patchInfo removeAlbums removeEpisodes removeShows removeTracks saveAlbums saveEpisodes saveShows saveTracks

constructor(client) src/managers/UserClient.ts#L99

No documentation found.

NameTypeDescription
clientClientThe spotify api client.

.client src/managers/UserClient.ts#L30

Type:

Client

The spotify client for this UserClient to work with.

.country src/managers/UserClient.ts#L80
OPTIONAL

Type:

string

The country of the user, as set in the user’s account profile.

.displayName src/managers/UserClient.ts#L40
OPTIONAL

Type:

"null" | string

The name displayed on the user’s profile. null if not available.

.email src/managers/UserClient.ts#L85
OPTIONAL

Type:

string

The user’s email address, as entered by the user when creating their account.

.explicitContent src/managers/UserClient.ts#L90
OPTIONAL

Type:

CamelCaseObjectKeys<ExplicitContentSettings>

The user’s explicit content settings.

.externalURL src/managers/UserClient.ts#L70
OPTIONAL

Type:

ExternalUrl

Known external URLs for this user.

.id src/managers/UserClient.ts#L45

Type:

string

The Spotify user ID for the user.

.images src/managers/UserClient.ts#L60
OPTIONAL

Type:

Image[]

The user’s profile image.

.player src/managers/UserClient.ts#L35

Type:

Player

The manager for the player api endpoints.

.product src/managers/UserClient.ts#L75
OPTIONAL

Type:

UserProductType

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:

number

Information about the followers of the user.

.type src/managers/UserClient.ts#L55
OPTIONAL

Type:

SpotifyType

The Spotify object type which will be 'user'.

.uri src/managers/UserClient.ts#L50
OPTIONAL

Type:

string

The Spotify URI for the user.

.createPlaylist(playlist) src/managers/UserClient.ts#L150

Create a playlist.

const playlist = await client.user.createPlaylist({ name: 'My playlist' });

Returns:

Promise<"null" | Playlist>

Parameters:

NameTypeDescription
playlistCreatePlaylistQueryThe 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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
playlistIDstringThe 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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<Artist[]>

Parameters:

NameTypeDescription
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:

Promise<Playlist[]>

Parameters:

NameTypeDescription
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:

Promise<Saved<Album>[]>

Parameters:

NameTypeDescription
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:

Promise<Saved<Episode>[]>

Parameters:

NameTypeDescription
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:

Promise<Saved<Show>[]>

Parameters:

NameTypeDescription
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:

Promise<Saved<Track>[]>

Parameters:

NameTypeDescription
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:

Promise<Artist[]>

Parameters:

NameTypeDescription
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:

Promise<Track[]>

Parameters:

NameTypeDescription
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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean[]>

Parameters:

NameTypeDescription
idsstring[]The array of spotify track ids.

.patchInfo() src/managers/UserClient.ts#L107

Patches the current user details info to this manager.

Returns:

Promise<UserClient>

Parameters:

NameTypeDescription

.removeAlbums(ids) src/managers/UserClient.ts#L294

Remove albums from the current user library.

await client.user.removeAlbums('id1', 'id2');

Returns:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]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:

Promise<boolean>

Parameters:

NameTypeDescription
idsstring[]The array of spotify user ids.