Skip to content

Commit d8e11ff

Browse files
JMPerezandyruwruw
andauthored
Add shows and episodes endpoints (#161)
* Added New Show and Episode Endpoints * Add tests, typescript, general clean up after addition of shows and episodes Co-authored-by: Andrew Young <[email protected]>
1 parent ddcc4cc commit d8e11ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+74800
-38085
lines changed

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"trailingComma": "none",
3+
"singleQuote": true
4+
}

README.md

+19-17
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ A list of selected wrappers for different languages and environments is availabl
88

99
The wrapper includes helper functions to do the following:
1010

11-
#### Music metadata
11+
#### Music and Podcast metadata
1212

1313
- Albums, artists, tracks and playlists
1414
- Audio features and audio analysis for tracks
1515
- Albums for a specific artist
1616
- Top tracks for a specific artist
1717
- Artists similar to a specific artist
18+
- Shows and episodes (podcasts)
1819

1920
#### Profiles
2021

2122
- User's emails, product type, display name, birthdate, image
2223

2324
#### Search
2425

25-
- Albums, artists, tracks, and playlists
26+
- Albums, artists, tracks, playlists, shows, and episodes
2627

27-
#### Playlist manipulation
28+
#### Playlist Management
2829

2930
- Get a user's playlists
3031
- Create playlists
@@ -35,10 +36,11 @@ The wrapper includes helper functions to do the following:
3536
- Reorder tracks in a playlist
3637
- Upload custom playlist cover image
3738

38-
#### Your Music library
39+
#### User's Library
3940

40-
- Add, remove, and get tracks that are in the signed in user's Your Music library
41-
- Check if a track is in the signed in user's Your Music library
41+
- Add, remove, and get tracks on a user's library
42+
- Check if a track is in the signed in user's library
43+
- Add, remove, and get shows (podcasts) on a user's library
4244

4345
#### Personalization
4446

@@ -92,7 +94,7 @@ Install via node (since the requests are made using XMLHttpRequest, you will nee
9294

9395
Then, in your javascript file
9496

95-
```javascript
97+
```js
9698
var Spotify = require('spotify-web-api-js');
9799
var s = new Spotify();
98100
//s.searchTracks()...
@@ -109,27 +111,27 @@ The wrapper supports callback functions, as well as [Promises](http://www.html5r
109111

110112
First, instantiate the wrapper.
111113

112-
```javascript
114+
```js
113115
var spotifyApi = new SpotifyWebApi();
114116
```
115117

116118
If you have an access token, you can set it doing:
117119

118-
```javascript
120+
```js
119121
spotifyApi.setAccessToken('<here_your_access_token>');
120122
```
121123

122124
When you set an access token, it will be used for signing your requests. An access token is required for all endpoints.
123125

124126
If you want to use a Promises/A+ library, you can set it:
125127

126-
```javascript
128+
```js
127129
spotifyApi.setPromiseImplementation(Q);
128130
```
129131

130132
Here you see how to get basic information using a function like `getArtistAlbums`:
131133

132-
```javascript
134+
```js
133135
// get Elvis' albums, passing a callback. When a callback is passed, no Promise is returned
134136
spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE', function (err, data) {
135137
if (err) console.error(err);
@@ -150,7 +152,7 @@ spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE').then(
150152
The promises also expose an `abort` method that aborts the XMLHttpRequest. This is useful to cancel
151153
requests that were made earlier and could be resolved out-of-sync:
152154

153-
```javascript
155+
```js
154156
var prev = null;
155157

156158
function onUserInput(queryTerm) {
@@ -177,7 +179,7 @@ function onUserInput(queryTerm) {
177179

178180
The functions that fetch data from the API support also an optional JSON object with a set of options, such as the ones regarding pagination. These options will be sent as query parameters:
179181

180-
```javascript
182+
```js
181183
// passing a callback - get Elvis' albums in range [20...29]
182184
spotifyApi.getArtistAlbums(
183185
'43ZHCT0cAZBISjO8DG9PnE',
@@ -207,7 +209,7 @@ _Note: The following examples use Promises/Q/when as the return object._
207209

208210
Here you can see more examples of the usage of this wrapper:
209211

210-
```javascript
212+
```js
211213
// get multiple albums
212214
spotifyApi.getAlbums(['5U4W9E5WsYb2jUQWePT8Xm', '3KyVcddATClQKIdtaap4bV']).then(
213215
function (data) {
@@ -285,7 +287,7 @@ spotifyApi.searchTracks('artist:Love').then(
285287

286288
When you need to make multiple calls to get some dataset, you can take advantage of the Promises to get a cleaner code:
287289

288-
```javascript
290+
```js
289291
// track detail information for album tracks
290292
spotifyApi
291293
.getAlbum('5U4W9E5WsYb2jUQWePT8Xm')
@@ -324,7 +326,7 @@ spotifyApi
324326

325327
In order to get user's information you need to request a user-signed access token, from either the Implicit Grant or Authorization Code flow. Say for instance you want to get user's playlists. Once you get an access token, set it and fetch the data:
326328

327-
```javascript
329+
```js
328330
// get an access token
329331
...
330332

@@ -349,7 +351,7 @@ spotifyApi.getPlaylist('4vHIKV7j4QcZwgzGQcZg1x')
349351
Some functions don't need to receive the user's id as a parameter, and will use the
350352
user's information from the access token:
351353

352-
```javascript
354+
```js
353355
var spotifyApi = new SpotifyWebApi();
354356
spotifyApi.setAccessToken('<here_your_access_token>');
355357
spotifyApi

__test__/fixtures.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ module.exports = {
3131
search_artist: loadFixture('search_artist'),
3232
search_track: loadFixture('search_track'),
3333
search_playlist: loadFixture('search_playlist'),
34+
search_show: loadFixture('search_show'),
35+
search_episode: loadFixture('search_episode'),
3436
user: loadFixture('user'),
3537
me: loadFixture('me'),
3638
user_playlists: loadFixture('user_playlists'),
3739
user_new_playlist: loadFixture('user_new_playlist'),
3840
user_saved_tracks: loadFixture('user_saved_tracks'),
3941
user_saved_albums: loadFixture('user_saved_albums'),
42+
user_saved_shows: loadFixture('user_saved_shows'),
4043
user_top_artists: loadFixture('user_top_artists'),
4144
user_top_tracks: loadFixture('user_top_tracks'),
4245
playlist: loadFixture('playlist'),
@@ -55,5 +58,10 @@ module.exports = {
5558
recently_played_tracks: loadFixture('recently_played_tracks'),
5659
available_devices: loadFixture('available_devices'),
5760
current_playback: loadFixture('current_playback'),
58-
current_playing_track: loadFixture('current_playing_track')
61+
current_playing_track: loadFixture('current_playing_track'),
62+
show: loadFixture('show'),
63+
shows: loadFixture('shows'),
64+
show_episodes: loadFixture('show_episodes'),
65+
episode: loadFixture('episode'),
66+
episodes: loadFixture('episodes')
5967
};

0 commit comments

Comments
 (0)