Giter Site home page Giter Site logo

spotify-sdk's Introduction

Spotify SDK

npm version Documentation Status

Unofficial SDK recommended for Spotify in his developer center

Entity oriented SDK to work with the Spotify Web API.

Entity oriented? What? Yes, you will always receive entities+helpers as the API's response.

An awesome example

Too simple like: Get my User then retrieve my Playlist, then add a Track to one Playlist.

user.me().then((myUser) => { // -> return a User entity with helpers
    myUser.playlists().then((playlistsCollection) => {
        playlistsCollection.first().tracks // -> tracksCollections
        playlistsCollection.first().addTrack(trackEntity) // -> add a track to the playlist
    });
});

More Examples

Basic example

Complex example

Showcase - Projects using Spotify-SDK

- 20v

Getting Started

You can get it on npm.

npm install spotify-sdk --save

How to start?

After installing, you should add the SDK to your project.

import {Client, TrackHandler, PlaylistHandler} from 'spotify-sdk';

You can import all entities, handlers and resources of the library.

Init the client

let client = Client.instance;

client.settings = {
    clientId: 'CLIENT_ID',
    secretId: 'SECRET_ID'
};

If your applications require methods that need authentication:

client.settings = {
    clientId: 'CLIENT_ID',
    secretId: 'SECRET_ID',
    scopes: [SCOPE, SCOPE2],
    redirect_uri: 'REDIRECT_URL'
};

client.token = 'TOKEN';

Here there is a suggested implementation for login.

Documentation

Read the documentation here

Node Support

Now you can use the sdk in node!

Browser Support

This SDK use Babel and Polyfill in order to add comptiblity with old browseres.

Chrome logo Firefox logo Internet Explorer logo Opera logo Safari logo
42+ ✔ 41+ ✔ 9+ ✔ 29+ ✔ 8 ✔

Development

git clone [email protected]:loverajoel/spotify-sdk.git

npm install

npm run watch

Contributing

Pull requests and issues are very welcome. If you have found an bug, please open an issue.

License

MIT

spotify-sdk's People

Contributors

emiprandi avatar jmperez avatar loverajoel avatar richclingman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spotify-sdk's Issues

Update token

How do I update a token using this api? Is it possible?

Few Missing Entities

@loverajoel

I think since there has been no activity in this package, it is missing a few entities like episodes and shows.

Also, I could not find a handler for search where you could perform a generic search for all entities.

I would be happy to add these in and submit a pull request.

How do I play tracks?

How play tracks? I want to play tracks on my website not on spotify. My website is acting as a remote control for Spotify.

Broken Link

@loverajoel

It looks like the Infinite Music Trivia site linked in the readme has been replaced/taken over by an explicit website.

Add support for more browsers

Now the SDK are using the native fetch, supported for a copule of browsers.
Maybe we can add github/fetch in order to win more compatibility

Encoding query parameters

I was testing today your MagicPlaylist site and I realised it's not handling some special characters properly when searching.

A search query like "Maná" triggers the following request:
https://api.spotify.com/v1/search?type=track&q=Man%E1&limit=1&market=US

however, it should trigger this one instead:
https://api.spotify.com/v1/search?type=track&q=Man%C3%A1&limit=1&market=US

The query parameters need to be url encoded here:
https://github.com/loverajoel/spotify-sdk/blob/master/src/handlers/TrackHandler.js#L24

Let me know if you think this is a valid issue and I can work myself on a fix.

Unitests

We need start to add coverage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.