A wrapper to work with the [Spotify Web Api] (https://developer.spotify.com/web-api/)
##Dependencies this library depends on fetch to make requests to the Spotify Web API. for enviroments that dont support fetch, you'll need to provide a [polifyl] (https://github.com/fetch) to browser or polifyl to Node.
$ npm install wrapper_spotify --save
//import a specific method
import { method } from 'spotify-wrapper';
//import all method
import * as spotifyWrapper from 'spotify-wrapper';
var spotify = require('spotify-wrapper');
<!-- to import non-minified version -->
<script src="spotify-wrapper.umd.js"></script>
<!-- to import minified version -->
<script src="spotify-wrapper.umd.min.js"> </script>
After that the library will be available to the Global as
spotifyWrapper
.
follow a exemple:
const albums = spotifyWrapper.searchAlbums('Chosen artist');
follow the methods that the library provides;
search for information about artist, albums, tracks of playlist. [Test in Spotify Web Console] (https://developer.spotify.com/web-api/console/get-search-item/).
Arguments
Argument | type | options
query
| string | 'Any search query'
type
| Array of strings | ['artist', 'album', 'track', 'playlist']
*Example
js search('Muse', ['artist, 'album']) .then(data => { //do what you want with the data })
search for informations about Albums with provide query. Test in Spotify Web Console with type defined as album
Arguments
Argument | type | options
query
| string | 'Any search query'
Example
js searchAlbums('Muse') .then(data => data { //do what you want with the data })
search for informations about Artists with provide query. Test in Spotify Web Console with type defined as artist
Arguments
Argument | type | options
query
| string | 'Any search query'
Example
js searchAlbums('Muse') .then(data => data { //do what you want with the data })
search for informations about Tracks with provide query. Test in [Spotify Web Console] (https://developer.spotify.com/web-api/console/get-search-item/) with type defined as track
Arguments
Argument | type | options
query
| string | 'Any search query'
Example
js searchAlbums('Pretender') .then(data => data { //do what you want with the data })
search information about Playlist with provide query. Test in Spotify Web Console whit type defined as playlist
Arguments
Argument | type | options
query
| string | 'Any search query'
Example
js searchAlbums('Run berg') .then(data => data { //do what you want with the data })
Search for informations about a specific Album with provided id Test in Spotify Web Console
Example
js getAlbum('4aawyAB9vmqN3uQ7FjRGTy') .then(data => data { //do what you want with the data })
Search for informations about some Albums whit all id's Test in [Spotify Web Console] (https://developer.spotify.com/web-api/console/get-artist-albums/)
Arguments
Argument | type | options
ids
| Array of string | ['id', 'id2']
Example
js getAlbums(['4aawyAB9vmqN3uQ7FjRGTy', '893reAB9vmqN3uQ7FjRGTy']) .then(data => data { //do what you want with the data })
Get Albums Tracks with provided id. Test in Spotify Web Console
Arguments
Argument | type | options
ids
| String | id
Example
js getAlbumTracks('4aawyAB9vmqN3uQ7FjRGTy') .then(data => data { //do what you want with the data })
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Renan Melo - Initial work - PurpleBooth
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
- Hat tip to anyone who's code was used
- Inspiration
- etc