Skip to content

Commit 52d349f

Browse files
authored
Add an Item to the User's Playback Queue
add an item to queue with /me/player/queue endpoint
1 parent ddcc4cc commit 52d349f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/spotify-web-api.js

+22
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ var SpotifyWebApi = (function () {
481481
return _checkParamsAndPerformRequest(requestData, callback);
482482
};
483483

484+
484485
/**
485486
* Add the current user as a follower of one playlist.
486487
* See [Follow a Playlist](https://developer.spotify.com/web-api/follow-playlist/) on
@@ -1601,6 +1602,27 @@ var SpotifyWebApi = (function () {
16011602
return _checkParamsAndPerformRequest(requestData, newOptions, callback);
16021603
};
16031604

1605+
1606+
/**
1607+
* adds a song to the queue
1608+
* See [Add an Item to the User's Playback Queue](https://developer.spotify.com/documentation/web-api/reference/player/add-to-queue/) on
1609+
* the Spotify Developer site for more information about the endpoint.
1610+
*/
1611+
1612+
Constr.prototype.queue = function (uri, options, callback) {
1613+
options = options || {};
1614+
var params =
1615+
'device_id' in options ? { uri: uri, device_id: options.device_id } : {uri: uri};
1616+
var requestData = {
1617+
type: 'PUT',
1618+
url: _baseUri + '/me/player/queue',
1619+
params: params
1620+
};
1621+
return _checkParamsAndPerformRequest(requestData, options, callback);
1622+
};
1623+
1624+
1625+
16041626
/**
16051627
* Pause playback on the user’s account.
16061628
* See [Pause a User’s Playback](https://developer.spotify.com/web-api/pause-a-users-playback/) on

0 commit comments

Comments
 (0)