Simple Spotify Wrapper
A small and awesome wrapper to get general information from the Spotify Web API.
Installation
You can install the library using npm
:
$ npm i simple-spotify-wrapper
or using yarn
:
$ yarn add simple-spotify-wrapper
How to use
ES6
// import the library; // create a instanceconst spotify = token: 'PUT YOUR TOKEN HERE'; const albums = spotifysearch;albums;
CommonJS
var spotifyWrapper = ;
UMD in Browser
<!-- to import non-minified version --> <!-- to import minified version -->
After that the library will be available to the Global as SpotifyWrapper
. Check this example:
const spotify = token: 'PUT YOUR TOKEN HERE';const albums = spotifysearch;albums;
Methods
Below are all the methods that the library provide:
- search.artists(query)
- search.albums(query)
- search.tracks(query)
- search.playlists(query)
- album.getAlbum(id)
- album.getAlbums(ids)
- album.getTracks(id)
search.artists(query)
Search for informations about Artists with provided query. Test in Spotify Web Console with type defined as artist.
Arguments
Argument | Type | Options |
---|---|---|
query |
string | 'Any search query' |
Example
search
⇯ go back
search.albums(query)
Search for informations about Albums with provided query. Test in Spotify Web Console with type defined as album.
Arguments
Argument | Type | Options |
---|---|---|
query |
string | 'Any search query' |
Example
spotifysearch
⇯ go back
search.tracks(query)
Search for informations about Tracks with provided query. Test in Spotify Web Console with type defined as track.
Arguments
Argument | Type | Options |
---|---|---|
query |
string | 'Any search query' |
Example
spotifysearch
⇯ go back
search.playlists(query)
Search for informations about Playlists with provided query. Test in Spotify Web Console with type defined as playlist.
Arguments
Argument | Type | Options |
---|---|---|
query |
string | 'Any search query' |
Example
spotifysearch
⇯ go back
album.getAlbum(id)
Search for informations about a specific Album with a id.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Specific id' |
Example
spotifyalbum
⇯ go back
album.getAlbums(ids)
Search for informations about a specific Album with their ids.
Arguments
Argument | Type | Options |
---|---|---|
ids |
Array of strings | ['id1', 'id2'] |
Example
spotifyalbum
⇯ go back
album.getTracks(id)
Search for all tracks from a specific album.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Specific id' |
Example
spotifyalbum
⇯ go back
Browser Support
This library relies on Fetch API. And this API is supported in the following browsers.
42+ ✔ | 39+ ✔ | 29+ ✔ | 10.1+ ✔ | Nope ✘ |
Dependencies
This library depends on fetch to make requests to the Spotify Web API. For environments that don't support fetch, you'll need to provide a polyfill to browser or polyfill to node.
Testing
To run the tests you can use the following command inside the project folder:
npm test
Or if you want to test the coverage use:
npm run test:coverage
Projects using the library
If you want to submit your application read the CONTRIBUTING.md for more details.
Upcoming methods :)
If you want to help in the project or see the upcoming methods check this link.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
Project License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Authors
João Pedro Schmitz |