Module: SpotifyService

SpotifyService module
Source:

Members

(inner, constant) firebaseFunctions

It allows to use firebaseFunctions.
Source:

(inner, constant) querystring

It allows to create url from parameters
Source:

(inner) request

It is required to send requests
Source:

(inner, constant) scopes

All the scopes needed to run the spotify api
Source:

(inner, constant) spotifyApi

Source:

(inner, constant) SpotifyWebApi

It allows to use spotify web api node
Source:

Methods

(inner) callBack(req, res, serverData, SpotifyTokens)

Callback linked to redirect URI for Spotify Will set the access token and refresh token with the given authorizations
Parameters:
Name Type Description
req * the request
res * the request's result
serverData * client credentials of the developper
SpotifyTokens * object containing the tokens and the uid of the user
Source:

(async, inner) createPlaylist(uid, playlistName__playlistDesc)

Create a new playlist for the logged user
Parameters:
Name Type Description
uid * the uid of the spotify user
playlistName__playlistDesc * the name and the description of the playlist
Source:
Returns:
true if the playlist has been created false otherwise

(async, inner) isfollowing(uid, artistUids)

Checks if the logged user follows some
Parameters:
Name Type Description
uid * the uid of the spotify user
artistUids * the spotify uid of the searched artists (is given as an array for multiples follows)
Source:
Returns:
True if the user follows the given artists, False Otherwise

(async, inner) isListening(uid)

Checks if the logged user is currently listening to some music
Parameters:
Name Type Description
uid * the uid of the spotify user
Source:
Returns:
True if the user is listening music, False otherwise

(async, inner) isListeningTo(uid, musicName)

Checks if the logged user is listening to a specific music searched by the music name
Parameters:
Name Type Description
uid * the uid of the spotify user
musicName * the name of the music we're looking for
Source:
Returns:
True if the user is listening to musicName, false otherwise

(async, inner) pauseMusic(uid)

If ther is a music playing, pause
Parameters:
Name Type Description
uid * the uid of the spotify user
Source:
Returns:
true if the music has been paused, false otherwise

(inner) registerUser(req, res)

Register a User to spotify, thanks to his client ID and Secret
Parameters:
Name Type Description
req * the request
res * the request's result
Source:
Returns:
the needed credentials to register the user

(async, inner) setShuffle(uid)

Set the shuffle mode to on or off, corresponding to want shuffle The logged user should listen to music, or it can lead to undefined behavior
Parameters:
Name Type Description
uid * the uid of the spotify user
Source:
Returns:
true if the user track has been shuffled, false otherwise

(inner) setUserDataSpotify(SpotifyTokens)

Sets the user data in the Firebase database.
Parameters:
Name Type Description
SpotifyTokens Object An object containing the Spotify API access and refresh tokens, as well as the user ID.
Source:

(async, inner) SpotifyLoop(uid, func, param)

Parameters:
Name Type Description
uid * uid of the user
func * function chosen by the user
param * playlist name and description on an array or empty string
Source:
Returns:
the boolean result of the chosen function