Class: SpotifyRequestHandler

SpotifyRequestHandler

new SpotifyRequestHandler(clientIdopt, clientSecretopt, tokenopt)

Create a Spotify request handler.

Parameters:
Name Type Attributes Description
clientId string <optional>

Client ID.

clientSecret string <optional>

Client secret key.

token string <optional>

Access token (if already authenticated).

Source:

Members

auth

Spotify authenticator.

Source:

Methods

getAlbum(id) → {Promise|JSON}

Fetch album metadata.

Reference.

Parameters:
Name Type Description
id string

Album ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

getAlbumsByArtist(id) → {Promise|JSON}

Get all albums by an artist.

Reference.

Parameters:
Name Type Description
id string

Artist ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

getPlaylist(idopt, owneropt, id) → {Promise|JSON}

Fetch a playlist's tracks.

Parameters:
Name Type Attributes Description
id string <optional>

The playlist ID.

owner string <optional>

The owner ID.

Reference.

id string

Album ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

getTopTracks(id) → {Promise|JSON}

Get the top tracks of an artist.

Reference.

Parameters:
Name Type Description
id string

Artist ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

getTrack(id) → {Promise|JSON}

Get a track.

Reference.

Parameters:
Name Type Description
id string

Track ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

request(uri, optionsopt) → {Promise|JSON}

Perform a Spotify request.

Parameters:
Name Type Attributes Description
uri string

The URI to resolve.

options Object <optional>

Request options.

Source:
Returns:

A JSON response.

Type
Promise | JSON

searchForAlbum(album, artistopt) → {Promise|JSON}

Search for album.

Reference.

Parameters:
Name Type Attributes Description
album string

The album to search for.

artist string <optional>

The album artist.

Source:
Returns:

A JSON response.

Type
Promise | JSON

searchForArtist(artist) → {Promise|JSON}

Search for artist.

Reference.

Parameters:
Name Type Description
artist string

The artist to search for.

Source:
Returns:

A JSON response.

Type
Promise | JSON

searchForPlaylist(playlist, playlist) → {Promise|JSON}

Search for playlist.

Parameters:
Name Type Description
playlist string

The playlist to search for. Reference.

playlist string

The track to search for.

Source:
Returns:

JSON response.

Type
Promise | JSON

searchForRelatedArtists(id) → {Promise|JSON}

Search for related artists.

Reference.

Parameters:
Name Type Description
id string

The album ID.

Source:
Returns:

A JSON response.

Type
Promise | JSON

searchForTrack(track, artistopt, albumopt) → {Promise|JSON}

Search for track.

Reference.

Parameters:
Name Type Attributes Description
track string

The track to search for.

artist string <optional>

The track artist.

album string <optional>

The track album.

Source:
Returns:

JSON response.

Type
Promise | JSON