Skip to content

Commit 3184d55

Browse files
committed
Added docs for some new endpoints
1 parent 51c622e commit 3184d55

File tree

3 files changed

+249
-17
lines changed

3 files changed

+249
-17
lines changed

SpotifyAPI.Docs/docs/SpotifyWebAPI/gettingstarted.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#Getting started
1+
# Getting started
22

33
This API provides full access to the new SpotifyWebAPI introduced [here](https://developer.spotify.com/web-api/).
44
With it, you can search for Tracks/Albums/Artists and also get User-based information.
55
It's also possible to create new playlists and add tracks to it.
66

77
---
88

9-
##First steps
9+
## First steps
1010

1111
**Imports**
1212
So after you added the API to your project, you may want to add following imports to your files:
@@ -37,18 +37,18 @@ public static void Main(String[] args)
3737

3838
---
3939

40-
##Authentication
40+
## Authentication
4141
If you look through the available API-Methods, you will soon notice nearly all of them require Authentication.
4242
Further infos on how to implement Authentication can be found [here](/SpotifyWebAPI/auth)
4343

4444
---
4545

46-
##Examples
46+
## Examples
4747
A list of small examples can be found [here](/SpotifyWebAPI/examples). Do you think a specific example is missing? Feel free to open a PR/Issue!
4848

4949
---
5050

51-
##Error-Handling
51+
## Error-Handling
5252
Every API-Call returns a reponse-model which consists of base-error model. To check if a specific API-Call was successful, use the following approach:
5353
```cs
5454
PrivateProfile profile = _spotify.GetPrivateProfile();
@@ -59,7 +59,7 @@ if (profile.HasError())
5959
}
6060
```
6161

62-
##Asynchronous
62+
## Asynchronous
6363
Every API-Call now has an asynchronous method. Just append `Async` to the Method-Name.
6464
Example:
6565
```cs
@@ -72,36 +72,36 @@ public async void Test()
7272

7373
---
7474

75-
##API-Reference
75+
## API-Reference
7676

77-
###Albums
77+
### Albums
7878
* [GetAlbumTracks](/SpotifyWebAPI/albums#getalbumtracks)
7979
* [GetAlbum](/SpotifyWebAPI/albums#getalbum)
8080
* [GetSeveralAlbums](/SpotifyWebAPI/albums#getseveralalbums)
8181

82-
###Artists
82+
### Artists
8383
* [GetArtist](/SpotifyWebAPI/artists#getartist)
8484
* [GetRelatedArtists](/SpotifyWebAPI/artists#getrelatedartists)
8585
* [GetArtistsTopTracks](/SpotifyWebAPI/artists#getartiststoptracks)
8686
* [GetArtistsAlbums](/SpotifyWebAPI/artists#getartistsalbums)
8787
* [GetSeveralArtists](/SpotifyWebAPI/artists#getseveralartists)
8888

89-
###Browse
89+
### Browse
9090
* [GetFeaturedPlaylists](/SpotifyWebAPI/browse#getfeaturedplaylists)
9191
* [GetNewAlbumReleases](/SpotifyWebAPI/browse#getnewalbumreleases)
9292
* [GetCategories](/SpotifyWebAPI/browse#getcategories)
9393
* [GetCategory](/SpotifyWebAPI/browse#getcategory)
9494
* [GetCategoryPlaylists](/SpotifyWebAPI/browse#getcategoryplaylists)
9595

96-
###Follow
96+
### Follow
9797
* [Follow](/SpotifyWebAPI/follow#follow)
9898
* [Unfollow](/SpotifyWebAPI/follow#unfollow)
9999
* [IsFollowing](/SpotifyWebAPI/follow#isfollowing)
100100
* [FollowPlaylist](/SpotifyWebAPI/follow#followplaylist)
101101
* [UnfollowPlaylist](/SpotifyWebAPI/follow#unfollowplaylist)
102102
* [IsFollowingPlaylist](/SpotifyWebAPI/follow#isfollowingplaylist)
103103

104-
###Library
104+
### Library
105105
* [SaveTracks](/SpotifyWebAPI/library#savetracks)
106106
* [SaveTrack](/SpotifyWebAPI/library#savetrack)
107107
* [GetSavedTracks](/SpotifyWebAPI/library#getsavedtracks)
@@ -113,7 +113,21 @@ public async void Test()
113113
* [RemoveSavedAlbums](/SpotifyWebAPI/library#removesavedalbums)
114114
* [CheckSavedAlbums](/SpotifyWebAPI/library#checksavedalbums)
115115

116-
###Playlists
116+
### Player
117+
118+
* [GetDevices](/SpotifyWebAPI/player#getdevices)
119+
* [GetPlayback](/SpotifyWebAPI/player#getplayback)
120+
* [GetPlayingTrack](/SpotifyWebAPI/player#getplayingtrack)
121+
* [TransferPlayback](/SpotifyWebAPI/player#transferplayback)
122+
* [ResumePlayback](/SpotifyWebAPI/player#resumeplayback)
123+
* [PausePlayback](/SpotifyWebAPI/player#pauseplayback)
124+
* [SkipPlaybackToNext](/SpotifyWebAPI/player#skipplaybacktonext)
125+
* [SkipPlaybackToPrevious](/SpotifyWebAPI/player#skipplaybacktoprevious)
126+
* [SetRepeatMode](/SpotifyWebAPI/player#setrepeatmode)
127+
* [SetVolume](/SpotifyWebAPI/player#setvolume)
128+
* [SetShuffle](/SpotifyWebAPI/player#setshuffle)
129+
130+
### Playlists
117131
* [GetUserPlaylists](/SpotifyWebAPI/playlists#getuserplaylists)
118132
* [GetPlaylist](/SpotifyWebAPI/playlists#getplaylist)
119133
* [GetPlaylistTracks](/SpotifyWebAPI/playlists#getplaylisttracks)
@@ -126,16 +140,16 @@ public async void Test()
126140
* [AddPlaylistTrack](/SpotifyWebAPI/playlists#addplaylisttrack)
127141
* [ReorderPlaylist](/SpotifyWebAPI/playlists#reorderplaylist)
128142

129-
###Profiles
143+
### Profiles
130144
* [GetPublicProfile](/SpotifyWebAPI/profiles#getpublicprofile)
131145
* [GetPrivateProfile](/SpotifyWebAPI/profiles#getprivateprofile)
132146

133-
###Search
147+
### Search
134148
* [SearchItems](/SpotifyWebAPI/search#searchitems)
135149

136-
###Tracks
150+
### Tracks
137151
* [GetSeveralTracks](/SpotifyWebAPI/tracks#getseveraltracks)
138152
* [GetTrack](/SpotifyWebAPI/tracks#gettrack)
139153

140-
###Util
154+
### Util
141155
* [Utility-Functions](/SpotifyWebAPI/util)
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
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+
```

SpotifyAPI.Docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pages:
1111
- '- Browse': 'SpotifyWebAPI/browse.md'
1212
- '- Follow': 'SpotifyWebAPI/follow.md'
1313
- '- Library': 'SpotifyWebAPI/library.md'
14+
- '- Player': 'SpotifyWebAPI/player.md'
1415
- '- Playlists': 'SpotifyWebAPI/playlists.md'
1516
- '- Profiles': 'SpotifyWebAPI/profiles.md'
1617
- '- Search': 'SpotifyWebAPI/search.md'

0 commit comments

Comments
 (0)