Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loverajoel/spotify-sdk
Spotify SDK | Entity and Collection oriented | Browser and Node support!
https://github.com/loverajoel/spotify-sdk
es6 javascript spotify spotify-sdk
Last synced: 6 days ago
JSON representation
Spotify SDK | Entity and Collection oriented | Browser and Node support!
- Host: GitHub
- URL: https://github.com/loverajoel/spotify-sdk
- Owner: loverajoel
- Created: 2015-07-07T04:24:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T09:06:03.000Z (over 3 years ago)
- Last Synced: 2024-11-24T20:11:20.957Z (27 days ago)
- Topics: es6, javascript, spotify, spotify-sdk
- Language: JavaScript
- Homepage:
- Size: 1.88 MB
- Stars: 230
- Watchers: 8
- Forks: 37
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-javascript - spotify-sdk - Spotify SDK | Entity and Collection oriented | Browser and Node support! - ★ 155 (SDK)
README
# Spotify SDK
[![npm version](https://badge.fury.io/js/spotify-sdk.svg)](http://badge.fury.io/js/spotify-sdk) [![Documentation Status](https://doc.esdoc.org/github.com/loverajoel/spotify-sdk/badge.svg)](https://doc.esdoc.org/github.com/loverajoel/spotify-sdk/)
> Unofficial SDK recommended for Spotify in his [developer center](https://developer.spotify.com/web-api/code-examples/)
Entity oriented SDK to work with the [Spotify Web API](https://developer.spotify.com/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.
```javascript
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](https://github.com/loverajoel/spotify-sdk/blob/master/examples/basic.js)
[Complex example](https://github.com/loverajoel/spotify-sdk/blob/master/examples/oauth.js)
## Showcase - Projects using Spotify-SDK
#### - [MagicPlaylist](http://magicplaylist.co/)
#### - [20v](http://20v.co/)
## 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.
```javascript
import {Client, TrackHandler, PlaylistHandler} from 'spotify-sdk';
```You can import all entities, handlers and resources of the library.
### Init the client
```javascript
let client = Client.instance;client.settings = {
clientId: 'CLIENT_ID',
secretId: 'SECRET_ID'
};
```If your applications require methods that need authentication:
```javascript
client.settings = {
clientId: 'CLIENT_ID',
secretId: 'SECRET_ID',
scopes: [SCOPE, SCOPE2],
redirect_uri: 'REDIRECT_URL'
};client.token = 'TOKEN';
```
[Here](examples/oauth.js) there is a suggested implementation for login.## Documentation
[Read the documentation here](https://doc.esdoc.org/github.com/loverajoel/spotify-sdk/)
## 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.
| | | | | |
|:---:|:---:|:---:|:---:|:---:|
| 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