|
1 |
| -# Spotify Web API JS [](https://travis-ci.org/JMPerez/spotify-web-api-js) [](https://coveralls.io/r/JMPerez/spotify-web-api-js) [](https://greenkeeper.io/) <a href="https://www.buymeacoffee.com/jmp"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=jmp&button_colour=BD5FFF&font_colour=ffffff&font_family=Poppins&outline_colour=000000&coffee_colour=FFDD00" height="20"></a> |
| 1 | +# Spotify Web API for iOS Scriptable |
2 | 2 |
|
3 |
| -This is a lightweight wrapper for the [Spotify Web API](https://developer.spotify.com/web-api/) ([2.6kB gzipped + compressed](https://cost-of-modules.herokuapp.com/result?p=spotify-web-api-js)). It includes helper functions for **all Spotify's endpoints**, such as fetching metadata (search and look-up of albums, artists, tracks, playlists, new releases, podcasts) and user's information (follow users, artists and playlists, and saved tracks management). |
| 3 | +This is a lightweight wrapper for the [Spotify Web API](https://developer.spotify.com/web-api/) for the iOS app Scriptable. It includes helper functions for **all Spotify's endpoints**, such as fetching metadata (search and look-up of albums, artists, tracks, playlists, new releases, podcasts) and user's information (follow users, artists and playlists, and saved tracks management). |
4 | 4 |
|
5 |
| -It doesn't have any dependencies and supports callbacks and promises. It is intended to be run on a browser, but if you want to use Node.JS to make the requests, please check [spotify-web-api-node](https://github.com/thelinmichael/spotify-web-api-node). |
| 5 | +It doesn't have any dependencies and supports callbacks and promises. It is intended to be run in Scriptable. Please check [spotify-web-api-node](https://github.com/thelinmichael/spotify-web-api-node) for a Node.JS implementation and [spotify-web-api-js](https://github.com/JMPerez/spotify-web-api-js) for a browser implementation. |
6 | 6 |
|
7 | 7 | A list of selected wrappers for different languages and environments is available on the Developer site's [Libraries page](https://developer.spotify.com/web-api/code-examples/).
|
8 | 8 |
|
@@ -85,24 +85,19 @@ The wrapper includes helper functions to do the following:
|
85 | 85 |
|
86 | 86 | ## Installation
|
87 | 87 |
|
88 |
| -Install via node (since the requests are made using XMLHttpRequest, you will need a tool like Browserify to run this on a browser): |
| 88 | +Download [`src/spotify-web-api.js`](src/spotify-web-api.js) and save it to your Scriptable folder in iCloud Drive (or a subfolder). |
89 | 89 |
|
90 |
| - $ npm install -S spotify-web-api-js |
91 |
| - |
92 |
| -Then, in your javascript file |
| 90 | +Then, in your Scriptable script |
93 | 91 |
|
94 | 92 | ```js
|
95 |
| -var Spotify = require('spotify-web-api-js'); |
| 93 | +var Spotify = importModule('spotify-web-api.js'); |
96 | 94 | var s = new Spotify();
|
97 | 95 | //s.searchTracks()...
|
98 | 96 | ```
|
99 | 97 |
|
100 |
| -or by making a copy of the `src/spotify-web-api.js` file |
101 |
| - |
102 | 98 | ## Usage
|
103 | 99 |
|
104 |
| -We recommend you have a look at the [documentation](https://jmperezperez.com/spotify-web-api-js/) to get an overview of the supported |
105 |
| -. |
| 100 | +We recommend you have a look at the [documentation](https://jmperezperez.com/spotify-web-api-js/) to get an overview of the supported methods. |
106 | 101 |
|
107 | 102 | The wrapper supports callback functions, as well as [Promises](http://www.html5rocks.com/en/tutorials/es6/promises/) (you can also use [a polyfill](https://github.com/jakearchibald/es6-promise)), and Promises/A+ libraries such as [Q](https://github.com/kriskowal/q) and [when](https://github.com/cujojs/when).
|
108 | 103 |
|
@@ -146,8 +141,8 @@ spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE').then(
|
146 | 141 | );
|
147 | 142 | ```
|
148 | 143 |
|
149 |
| -The promises also expose an `abort` method that aborts the XMLHttpRequest. This is useful to cancel |
150 |
| -requests that were made earlier and could be resolved out-of-sync: |
| 144 | +The promises also expose an `abort` method that _aborts_ the Request. This is useful to cancel |
| 145 | +requests that were made earlier and could be resolved out-of-sync (they are not aborted, but intercepted so the Promise isn't resolved): |
151 | 146 |
|
152 | 147 | ```js
|
153 | 148 | var prev = null;
|
@@ -367,7 +362,7 @@ spotifyApi
|
367 | 362 |
|
368 | 363 | Get great code completion for this package using the integrated typescript typings. It includes the complete typings of the Spotify Web Api too, so you'll know both how to the navigate the API as well as the response you are getting.
|
369 | 364 |
|
370 |
| - |
| 365 | + |
371 | 366 |
|
372 | 367 | ### When bundling the library
|
373 | 368 |
|
|
0 commit comments