1.0.1 • Published 2 years ago
@torr7s/spotify-api v1.0.1
Spotify Wrapper
A wrapper to get data from spotify's api
Demonstration
If you don't know how to get Spotify credentials, go to this link to learn how to get them.
- Setup spotify client credentials
import { SpotifyClient } from '@torr7s/spotify-api';
const spotify = new SpotifyClient('spotify_client_id', 'spotify_client_secret');
After this, you will be able to use the methods provided by the client.
Album methods
- Get information about a single album
const album = await spotify.album.getOne('spotify_album_id');
console.log(album);
- Get a list of new album releases featured
const albums = await spotify.album.getReleases();
console.log(albums)
- Get information about an album's tracks
const albumTracks = await spotify.album.getTracks('spotify_album_id');
console.log(albumTracks);
Artist methods
- Get information about a single artist
const artist = await spotify.artist.getOne('spotify_artist_id');
console.log(artist);
- Get information about an artist's albums
const albums = await spotify.artist.getAlbums('spotify_artist_id');
console.log(albums);
- Get information about an artist's top tracks
const topTracks = await spotify.artist.getTopTracks('spotify_artist_id');
console.log(topTracks);
Playlist methods
- Get information about a single playlist
const playlist = await spotify.playlist.getOne('spotify_playlist_id');
console.log(playlist);
- Get a list of Spotify featured playlists
const playlists = await spotify.playlist.getFeaturedPlaylists();
console.log(playlists);
- Get information from a playlist's tracks
const playlistTracks = await spotify.playlist.getTracks('spotify_playlist_id');
console.log(playlistTracks);
Tracks methods
- Get information about a single track
const track = await spotify.track.getOne('spotify_track_id');
console.log(track);
- Get audio feature information for a single track
const trackAudioFeatures = await spotify.track.getAudioFeatures('spotify_track_id');
console.log(trackAudioFeatures);
- Get information about multiple tracks
const tracks = await spotify.track.getTracks(['spotify_track_id', 'spotify_track_id']);
console.log(tracks);