Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-spotify-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-spotify-wrapper

A small and awesome wrapper to get general information from the Spotify Web API.

  • 3.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple Spotify Wrapper

Build Status Coverage Status

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
import SpotifyWrapper from 'simple-spotify-wrapper';

// create a instance
const spotify = new SpotifyWrapper({
  token: 'PUT YOUR TOKEN HERE'
});

const albums = spotify.search.albums('Choose your artist');
albums.then(data => console.log(data.albums));

CommonJS

var spotifyWrapper = require('spotify-wrapper');

UMD in Browser

<!-- 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. Check this example:

const spotify = new SpotifyWrapper({
    token: 'PUT YOUR TOKEN HERE'
});
const albums = spotify.search.albums('Choose your artist');
albums.then(data => console.log(data.albums.items));

Methods

Below are all the methods that the library provide:

search.artists(query)

Search for informations about Artists with provided query. Test in Spotify Web Console with type defined as artist.

Arguments

ArgumentTypeOptions
querystring'Any search query'

Example

search.artists('Isadora Pompeo')
  .then(data => {
    // do what you want here
  })
⇯ go back

search.albums(query)

Search for informations about Albums with provided query. Test in Spotify Web Console with type defined as album.

Arguments

ArgumentTypeOptions
querystring'Any search query'

Example

spotify.search.albums('Isadora Pompeo')
  .then(data => {
    // do what you want here
  })
⇯ go back

search.tracks(query)

Search for informations about Tracks with provided query. Test in Spotify Web Console with type defined as track.

Arguments

ArgumentTypeOptions
querystring'Any search query'

Example

spotify.search.tracks('Isadora Pompeo')
  .then(data => {
    // do what you want here
  })
⇯ go back

search.playlists(query)

Search for informations about Playlists with provided query. Test in Spotify Web Console with type defined as playlist.

Arguments

ArgumentTypeOptions
querystring'Any search query'

Example

spotify.search.tracks('Isadora Pompeo')
  .then(data => {
    // do what you want here
  })
⇯ go back

album.getAlbum(id)

Search for informations about a specific Album with a id.

Arguments

ArgumentTypeOptions
idstring'Specific id'

Example

spotify.album.getAlbum('4aawyAB9vmqN3uQ7FjRGTy')
  .then(data => {
    // do what you want here
  })
⇯ go back

album.getAlbums(ids)

Search for informations about a specific Album with their ids.

Arguments

ArgumentTypeOptions
idsArray of strings['id1', 'id2']

Example

spotify.album.getAlbums(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo'])
  .then(data => {
    // do what you want here
  })
⇯ go back

album.getTracks(id)

Search for all tracks from a specific album.

Arguments

ArgumentTypeOptions
idstring'Specific id'

Example

spotify.album.getTracks('4aawyAB9vmqN3uQ7FjRGTy')
  .then(data => {
    // do what you want here
  })
⇯ go back

Browser Support

This library relies on Fetch API. And this API is supported in the following browsers.

ChromeFirefoxOperaSafariIE
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
João Pedro Schmitz

Keywords

FAQs

Package last updated on 10 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc