@@ -14,12 +14,16 @@ export = SpotifyWebApi;
14
14
declare var SpotifyWebApi : SpotifyWebApiJs . SpotifyWebApiJsStatic ;
15
15
16
16
declare namespace SpotifyWebApiJs {
17
+ interface VoidResultsCallback {
18
+ ( error : ErrorObject ) : any ;
19
+ }
20
+
17
21
/**
18
22
* An optional callback that receives 2 parameters. The first
19
23
* one is the error object (null if no error), and the second is the value if the request succeeded.
20
24
*/
21
25
interface ResultsCallback < T > {
22
- ( error : ErrorObject , value : T ) : any
26
+ ( error : ErrorObject , value : T ) : any ;
23
27
}
24
28
25
29
/**
@@ -207,7 +211,9 @@ declare namespace SpotifyWebApiJs {
207
211
* one is the error object (null if no error), and the second is the value if the request succeeded.
208
212
* @return {Object } Null if a callback is provided, a `Promise` object otherwise
209
213
*/
210
- getMyRecentlyPlayedTracks ( options ?: Object , callback ?: ResultsCallback < SpotifyApi . UsersRecentlyPlayedTracksResponse > ) : Promise < SpotifyApi . UsersRecentlyPlayedTracksResponse > ;
214
+ getMyRecentlyPlayedTracks ( options ?: SpotifyApi . RecentlyPlayedParameterObject ) : Promise < SpotifyApi . UsersRecentlyPlayedTracksResponse > ;
215
+ getMyRecentlyPlayedTracks ( options : SpotifyApi . RecentlyPlayedParameterObject , callback : ResultsCallback < SpotifyApi . UsersRecentlyPlayedTracksResponse > ) : void ;
216
+ getMyRecentlyPlayedTracks ( callback : ResultsCallback < SpotifyApi . UsersRecentlyPlayedTracksResponse > ) : void ;
211
217
212
218
/**
213
219
* Adds the current user as a follower of one or more other Spotify users.
@@ -877,7 +883,180 @@ declare namespace SpotifyWebApiJs {
877
883
* one is the error object (null if no error), and the second is the value if the request succeeded.
878
884
* @return {Object } Null if a callback is provided, a `Promise` object otherwise
879
885
*/
880
- getAvailableGenreSeeds ( callback ?: ResultsCallback < SpotifyApi . AvailableGenreSeedsResponse > ) : Promise < SpotifyApi . AvailableGenreSeedsResponse >
886
+ getAvailableGenreSeeds ( callback ?: ResultsCallback < SpotifyApi . AvailableGenreSeedsResponse > ) : Promise < SpotifyApi . AvailableGenreSeedsResponse > ;
887
+
888
+ /**
889
+ * Get information about a user’s available devices.
890
+ * See [Get a User’s Available Devices](https://developer.spotify.com/web-api/get-a-users-available-devices/) on
891
+ * the Spotify Developer site for more information about the endpoint.
892
+ *
893
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
894
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
895
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
896
+ */
897
+ getMyDevices ( ) : Promise < SpotifyApi . UserDevicesResponse > ;
898
+ getMyDevices ( callback : ResultsCallback < SpotifyApi . UserDevicesResponse > ) : void ;
899
+
900
+ /**
901
+ * Get information about the user’s current playback state, including track, track progress, and active device.
902
+ * See [Get Information About The User’s Current Playback](https://developer.spotify.com/web-api/get-information-about-the-users-current-playback/) on
903
+ * the Spotify Developer site for more information about the endpoint.
904
+ *
905
+ * @param {Object } options A JSON object with options that can be passed.
906
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
907
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
908
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
909
+ */
910
+ getMyCurrentPlaybackState ( options ?: SpotifyApi . TrackRelinkingParameterObject ) : Promise < SpotifyApi . CurrentPlaybackResponse > ;
911
+ getMyCurrentPlaybackState ( options : SpotifyApi . TrackRelinkingParameterObject , callback : ResultsCallback < SpotifyApi . CurrentPlaybackResponse > ) : void ;
912
+ getMyCurrentPlaybackState ( callback : ResultsCallback < SpotifyApi . CurrentPlaybackResponse > ) : void ;
913
+
914
+ /**
915
+ * Get the object currently being played on the user’s Spotify account.
916
+ * See [Get the User’s Currently Playing Track](https://developer.spotify.com/web-api/get-the-users-currently-playing-track/) on
917
+ * the Spotify Developer site for more information about the endpoint.
918
+ *
919
+ * @param {Object } options A JSON object with options that can be passed.
920
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
921
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
922
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
923
+ */
924
+ getMyCurrentPlayingTrack ( options ?: SpotifyApi . TrackRelinkingParameterObject ) : Promise < SpotifyApi . CurrentlyPlayingResponse > ;
925
+ getMyCurrentPlayingTrack ( options : SpotifyApi . TrackRelinkingParameterObject , callback : ResultsCallback < SpotifyApi . CurrentlyPlayingResponse > ) : void ;
926
+ getMyCurrentPlayingTrack ( callback : ResultsCallback < SpotifyApi . CurrentlyPlayingResponse > ) : void ;
927
+
928
+ /**
929
+ * Transfer playback to a new device and determine if it should start playing.
930
+ * See [Transfer a User’s Playback](https://developer.spotify.com/web-api/transfer-a-users-playback/) on
931
+ * the Spotify Developer site for more information about the endpoint.
932
+ *
933
+ * @param {Array<string> } deviceIds A JSON array containing the ID of the device on which playback should be started/transferred.
934
+ * @param {Object } options A JSON object with options that can be passed.
935
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
936
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
937
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
938
+ */
939
+ transferMyPlayback ( deviceIds : string [ ] , options ?: SpotifyApi . TransferPlaybackParameterObject ) : Promise < void > ;
940
+ transferMyPlayback ( deviceIds : string [ ] , options : SpotifyApi . TransferPlaybackParameterObject , callback : VoidResultsCallback ) : void ;
941
+ transferMyPlayback ( deviceIds : string [ ] , callback : VoidResultsCallback ) : void ;
942
+
943
+ /**
944
+ * Start a new context or resume current playback on the user’s active device.
945
+ * See [Start/Resume a User’s Playback](https://developer.spotify.com/web-api/start-a-users-playback/) on
946
+ * the Spotify Developer site for more information about the endpoint.
947
+ *
948
+ * @param {Object } options A JSON object with options that can be passed.
949
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
950
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
951
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
952
+ */
953
+ play ( options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
954
+ play ( options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
955
+ play ( callback : VoidResultsCallback ) : void ;
956
+
957
+ /**
958
+ * Pause playback on the user’s account.
959
+ * See [Pause a User’s Playback](https://developer.spotify.com/web-api/pause-a-users-playback/) on
960
+ * the Spotify Developer site for more information about the endpoint.
961
+ *
962
+ * @param {Object } options A JSON object with options that can be passed.
963
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
964
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
965
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
966
+ */
967
+ pause ( options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
968
+ pause ( options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
969
+ pause ( callback : VoidResultsCallback ) : void ;
970
+
971
+ /**
972
+ * Skips to next track in the user’s queue.
973
+ * See [Skip User’s Playback To Next Track](https://developer.spotify.com/web-api/skip-users-playback-to-next-track/) on
974
+ * the Spotify Developer site for more information about the endpoint.
975
+ *
976
+ * @param {Object } options A JSON object with options that can be passed.
977
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
978
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
979
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
980
+ */
981
+ skipToNext ( options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
982
+ skipToNext ( options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
983
+ skipToNext ( callback : VoidResultsCallback ) : void ;
984
+
985
+ /**
986
+ * Skips to previous track in the user’s queue.
987
+ * Note that this will ALWAYS skip to the previous track, regardless of the current track’s progress.
988
+ * Returning to the start of the current track should be performed using `.seek()`
989
+ * See [Skip User’s Playback To Previous Track](https://developer.spotify.com/web-api/skip-users-playback-to-next-track/) on
990
+ * the Spotify Developer site for more information about the endpoint.
991
+ *
992
+ * @param {Object } options A JSON object with options that can be passed.
993
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
994
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
995
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
996
+ */
997
+ skipToPrevious ( options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
998
+ skipToPrevious ( options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
999
+ skipToPrevious ( callback : VoidResultsCallback ) : void ;
1000
+
1001
+ /**
1002
+ * Seeks to the given position in the user’s currently playing track.
1003
+ * See [Seek To Position In Currently Playing Track](https://developer.spotify.com/web-api/seek-to-position-in-currently-playing-track/) on
1004
+ * the Spotify Developer site for more information about the endpoint.
1005
+ *
1006
+ * @param {number } position_ms The position in milliseconds to seek to. Must be a positive number.
1007
+ * @param {Object } options A JSON object with options that can be passed.
1008
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
1009
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
1010
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
1011
+ */
1012
+ seek ( position : number , options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
1013
+ seek ( position : number , options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
1014
+ seek ( position : number , callback : VoidResultsCallback ) : void ;
1015
+
1016
+ /**
1017
+ * Set the repeat mode for the user’s playback. Options are repeat-track, repeat-context, and off.
1018
+ * See [Set Repeat Mode On User’s Playback](https://developer.spotify.com/web-api/set-repeat-mode-on-users-playback/) on
1019
+ * the Spotify Developer site for more information about the endpoint.
1020
+ *
1021
+ * @param {String } state A string set to 'track', 'context' or 'off'.
1022
+ * @param {Object } options A JSON object with options that can be passed.
1023
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
1024
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
1025
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
1026
+ */
1027
+ setRepeat ( state : SpotifyApi . PlaybackRepeatState , options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
1028
+ setRepeat ( state : SpotifyApi . PlaybackRepeatState , options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
1029
+ setRepeat ( state : SpotifyApi . PlaybackRepeatState , callback : VoidResultsCallback ) : void ;
1030
+
1031
+ /**
1032
+ * Set the volume for the user’s current playback device.
1033
+ * See [Set Volume For User’s Playback](https://developer.spotify.com/web-api/set-volume-for-users-playback/) on
1034
+ * the Spotify Developer site for more information about the endpoint.
1035
+ *
1036
+ * @param {number } volume_percent The volume to set. Must be a value from 0 to 100 inclusive.
1037
+ * @param {Object } options A JSON object with options that can be passed.
1038
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
1039
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
1040
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
1041
+ */
1042
+ setVolume ( volumePercent : number , options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
1043
+ setVolume ( volumePercent : number , options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
1044
+ setVolume ( volumePercent : number , callback : VoidResultsCallback ) : void ;
1045
+
1046
+ /**
1047
+ * Toggle shuffle on or off for user’s playback.
1048
+ * See [Toggle Shuffle For User’s Playback](https://developer.spotify.com/web-api/toggle-shuffle-for-users-playback/) on
1049
+ * the Spotify Developer site for more information about the endpoint.
1050
+ *
1051
+ * @param {bool } state Whether or not to shuffle user's playback.
1052
+ * @param {Object } options A JSON object with options that can be passed.
1053
+ * @param {function(Object,Object) } callback An optional callback that receives 2 parameters. The first
1054
+ * one is the error object (null if no error), and the second is the value if the request succeeded.
1055
+ * @return {Object } Null if a callback is provided, a `Promise` object otherwise
1056
+ */
1057
+ setShuffle ( state : boolean , options ?: SpotifyApi . DeviceSpecificParameterObject ) : Promise < void > ;
1058
+ setShuffle ( state : boolean , options : SpotifyApi . DeviceSpecificParameterObject , callback : VoidResultsCallback ) : void ;
1059
+ setShuffle ( state : boolean , callback : VoidResultsCallback ) : void ;
881
1060
882
1061
/**
883
1062
* Gets the access token in use.
0 commit comments