|
| 1 | +## GetDevices |
| 2 | +> Get information about a user’s available devices. |
| 3 | +
|
| 4 | +**Paramters** |
| 5 | + |
| 6 | +|Name|Description|Example| |
| 7 | +|--------------|-------------------------|-------------------------| |
| 8 | + |
| 9 | +**Usage** |
| 10 | + |
| 11 | +```cs |
| 12 | +AvailabeDevices devices = _spotify.GetDevices(); |
| 13 | +devices.Devices.ForEach(device => Console.WriteLine(device.Name)); |
| 14 | +``` |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## GetPlayback |
| 19 | +> Get information about the user’s current playback state, including track, track progress, and active device. |
| 20 | +
|
| 21 | +**Paramters** |
| 22 | + |
| 23 | +|Name|Description|Example| |
| 24 | +|--------------|-------------------------|-------------------------| |
| 25 | +|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `"DE"` |
| 26 | + |
| 27 | +**Usage** |
| 28 | + |
| 29 | +```cs |
| 30 | +PlaybackContext context = _spotify.GetPlayback(); |
| 31 | +if(contex.Item != null) |
| 32 | + Console.WriteLine(context.Item.Name)); //Print the current song |
| 33 | +``` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## GetPlayingTrack |
| 38 | +> Get the object currently being played on the user’s Spotify account. |
| 39 | +
|
| 40 | +**Paramters** |
| 41 | + |
| 42 | +|Name|Description|Example| |
| 43 | +|--------------|-------------------------|-------------------------| |
| 44 | +|[market]| An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking. | `"DE"` |
| 45 | + |
| 46 | +This is a simpler (less data) version of `GetPlayback` |
| 47 | + |
| 48 | +**Usage** |
| 49 | + |
| 50 | +```cs |
| 51 | +PlaybackContext context = _spotify.GetPlayingTrack(); |
| 52 | +if(contex.Item != null) |
| 53 | + Console.WriteLine(context.Item.Name)); //Print the current song |
| 54 | +``` |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## TransferPlayback |
| 59 | +> Transfer playback to a new device and determine if it should start playing. |
| 60 | +
|
| 61 | +**Paramters** |
| 62 | + |
| 63 | +|Name|Description|Example| |
| 64 | +|--------------|-------------------------|-------------------------| |
| 65 | +|deviceIds or deviceId| A JSON array containing the ID of the device on which playback should be started/transferred | `"XXXX-XXXX-XXXX-XXXX"` |
| 66 | +| play | true: ensure playback happens on new device, false: keep current playback state | `true` |
| 67 | + |
| 68 | +**Usage** |
| 69 | + |
| 70 | +```cs |
| 71 | +ErrorResponse error = _spotify.TransferPlayback("XXXX-XXXX-XXXX-XXXX"); |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## ResumePlayback |
| 77 | +> Start a new context or resume current playback on the user’s active device. |
| 78 | +
|
| 79 | +**Paramters** |
| 80 | + |
| 81 | +|Name|Description|Example| |
| 82 | +|--------------|-------------------------|-------------------------| |
| 83 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 84 | +| contextUri | Spotify URI of the context to play | `"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"` |
| 85 | +| uris | An array of the Spotify track URIs to play. | `new List<string> { "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" }` |
| 86 | +| offset | Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object, or when the uris parameter is used. | `0` |
| 87 | + |
| 88 | +**Usage** |
| 89 | + |
| 90 | +```cs |
| 91 | +ErrorResponse error = _spotify.ResumePlayback(uris: new List<string> { "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" }); |
| 92 | +``` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## PausePlayback |
| 97 | +> Pause playback on the user’s account. |
| 98 | +
|
| 99 | +**Paramters** |
| 100 | + |
| 101 | +|Name|Description|Example| |
| 102 | +|--------------|-------------------------|-------------------------| |
| 103 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 104 | + |
| 105 | +**Usage** |
| 106 | + |
| 107 | +```cs |
| 108 | +ErrorResponse error = _spotify.PausePlayback(); |
| 109 | +``` |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## SkipPlaybackToNext |
| 114 | +> Skips to next track in the user’s queue. |
| 115 | +
|
| 116 | +**Paramters** |
| 117 | + |
| 118 | +|Name|Description|Example| |
| 119 | +|--------------|-------------------------|-------------------------| |
| 120 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 121 | + |
| 122 | +**Usage** |
| 123 | + |
| 124 | +```cs |
| 125 | +ErrorResponse error = _spotify.SkipPlaybackToNext(); |
| 126 | +``` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## SkipPlaybackToPrevious |
| 131 | +> Skips to previous track in the user’s queue. |
| 132 | +Note that this will ALWAYS skip to the previous track, regardless of the current track’s progress. |
| 133 | +Returning to the start of the current track should be performed using the https://api.spotify.com/v1/me/player/seek endpoint. |
| 134 | + |
| 135 | +**Paramters** |
| 136 | + |
| 137 | +|Name|Description|Example| |
| 138 | +|--------------|-------------------------|-------------------------| |
| 139 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 140 | + |
| 141 | +**Usage** |
| 142 | + |
| 143 | +```cs |
| 144 | +ErrorResponse error = _spotify.SkipPlaybackToPrevious(); |
| 145 | +``` |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## SeekPlayback |
| 150 | +> Seeks to the given position in the user’s currently playing track. |
| 151 | +
|
| 152 | +**Paramters** |
| 153 | + |
| 154 | +|Name|Description|Example| |
| 155 | +|--------------|-------------------------|-------------------------| |
| 156 | +|positionMs|The position in milliseconds to seek to. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.| `50` |
| 157 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 158 | + |
| 159 | +**Usage** |
| 160 | + |
| 161 | +```cs |
| 162 | +ErrorResponse error = _spotify.SeekPlayback(50); |
| 163 | +``` |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## SetRepeatMode |
| 168 | +> Set the repeat mode for the user’s playback. Options are repeat-track, repeat-context, and off. |
| 169 | +
|
| 170 | +**Paramters** |
| 171 | + |
| 172 | +|Name|Description|Example| |
| 173 | +|--------------|-------------------------|-------------------------| |
| 174 | +|state|track, context or off.| `RepeatState.Track` |
| 175 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 176 | + |
| 177 | +**Usage** |
| 178 | + |
| 179 | +```cs |
| 180 | +ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Track); |
| 181 | +``` |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## SetVolume |
| 186 | +> Set the volume for the user’s current playback device. |
| 187 | +
|
| 188 | +**Paramters** |
| 189 | + |
| 190 | +|Name|Description|Example| |
| 191 | +|--------------|-------------------------|-------------------------| |
| 192 | +|volumePercent|Integer. The volume to set. Must be a value from 0 to 100 inclusive.| `50` |
| 193 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 194 | + |
| 195 | +**Usage** |
| 196 | + |
| 197 | +```cs |
| 198 | +ErrorResponse error = _spotify.SetVolume(50); |
| 199 | +``` |
| 200 | + |
| 201 | +--- |
| 202 | + |
| 203 | +## SetShuffle |
| 204 | +> Toggle shuffle on or off for user’s playback. |
| 205 | +
|
| 206 | +**Paramters** |
| 207 | + |
| 208 | +|Name|Description|Example| |
| 209 | +|--------------|-------------------------|-------------------------| |
| 210 | +|shuffle|True or False| `false` |
| 211 | +|[deviceId]| The id of the device this command is targeting. If not supplied, the user's currently active device is the target. | `"XXXX-XXXX-XXXX-XXXX"` |
| 212 | + |
| 213 | +**Usage** |
| 214 | + |
| 215 | +```cs |
| 216 | +ErrorResponse error = _spotify.SetShuffle(false); |
| 217 | +``` |
0 commit comments