Playlist.js
Playlist.js provides a minimal higher-level wrapper around Playlist's API. It can be used in Node.js or in the browser as an AMD module or standalone (generated via browserify).
Overview
Key Features
- Works in Node.js or in the browser (available on npm and bower registries)
- Exposes all Playlist API endpoints
- Supports
ETag
caching - Paged results
- Node-style callbacks as well as optional Promise support
Setup
Browser
To support promises (optional), Playlist.js depends on a promise library. Currently jQuery, AngularJS, or a promise polyfill (like es6-promise) are supported. Remember to include the library before Playlist.js.
Node.js
var Playlist = ;
Usage
First, create a Playlist instance:
var playlist = // Authentication requires either a username / password combo or an OAuth key username: 'user' password: 'pass' // for OAuth token: 'token' // (optional) Switch on whether to use ETags // Defaults to true useETags: true // (optional) switch to use HTTP POST instead of PATCH. // Defaults to false. usePostInsteadOfPatch: false // (optional) API root URL. // Defaults to 'https://api.playlist.com'. // Most likely you will never change this value. rootURL: 'https://api.playlist.com' // (optional) Sets the Accept header (and thus the API version). // Defaults to 'application/vnd.playlist.v1+json' // Most likely you will never change this value. acceptHeader: 'application/vnd.playlist.v1+json' ;
Examples
Advanced
Contributing
Please fork this repository and contribute back using [pull requests](https://github.com/playlist-api/playlist-js/pulls.
Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.