Skip to content

Commit e3c0233

Browse files
authored
feat(api)!: sync specification (#460)
1 parent 2841d7a commit e3c0233

383 files changed

Lines changed: 21090 additions & 1864 deletions

File tree

Some content is hidden

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

‎README.md‎

Lines changed: 84 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -222,132 +222,135 @@ access token only once, after which it becomes invalid.
222222

223223

224224
## Examples
225+
226+
> **Deprecated** examples are marked with ⚠️ and will be removed in v11.0. See the `@deprecated` Javadoc tag on the
227+
> corresponding request class for the recommended alternative.
228+
225229
- **Albums**
226230
- [Get an Album](examples/data/albums/GetAlbumExample.java)
227231
- [Get an Album's Tracks](examples/data/albums/GetAlbumsTracksExample.java)
228-
- [Get several Albums](examples/data/albums/GetSeveralAlbumsExample.java)
232+
- [Check User's Saved Albums](examples/data/albums/CheckUsersSavedAlbumsExample.java)
233+
- [Get Current User's Saved Albums](examples/data/albums/GetCurrentUsersSavedAlbumsExample.java)
229234

230235

231236
- **Artists**
232237
- [Get an Artist](examples/data/artists/GetArtistExample.java)
233238
- [Get an Artist's Albums](examples/data/artists/GetArtistsAlbumsExample.java)
234-
- [Get an Artist's Top Tracks](examples/data/artists/GetArtistsTopTracksExample.java)
235239
- [Get an Artist's Related Artists](examples/data/artists/GetArtistsRelatedArtistsExample.java)
236-
- [Get Several Artists](examples/data/artists/GetSeveralArtistsExample.java)
240+
- ⚠️ [Get an Artist's Top Tracks](examples/data/artists/): deprecated; use search instead
241+
242+
243+
- **Audiobooks**
244+
- [Get an Audiobook](examples/data/audiobooks/GetAudiobookExample.java)
245+
- [Get an Audiobook's Chapters](examples/data/audiobooks/GetAudiobookChaptersExample.java)
246+
- ⚠️ [Get Several Audiobooks](examples/data/audiobooks/GetSeveralAudiobooksExample.java)
247+
- ⚠️ [Get User's Saved Audiobooks](examples/data/audiobooks/GetUsersSavedAudiobooksExample.java)
248+
- ⚠️ [Check User's Saved Audiobooks](examples/data/audiobooks/CheckUsersSavedAudiobooksExample.java)
249+
- ⚠️ [Save Audiobooks for Current User](examples/data/audiobooks/SaveAudiobooksForCurrentUserExample.java)
250+
- ⚠️ [Remove Audiobooks for Current User](examples/data/audiobooks/RemoveAudiobooksForCurrentUserExample.java)
251+
252+
253+
- **Browsing & Discovery**
254+
- [Get Available Genre Seeds](examples/data/genres/GetAvailableGenreSeedsExample.java)
255+
- ⚠️ [Get Categories](examples/data/categories/GetSeveralBrowseCategoriesExample.java)
256+
- ⚠️ [Get a Category](examples/data/categories/GetSingleBrowseCategoryExample.java)
257+
- ⚠️ [Get a Category's Playlists](examples/data/playlists/GetCategoryPlaylistsExample.java)
258+
- ⚠️ [Get Featured Playlists](examples/data/playlists/GetFeaturedPlaylistsExample.java)
259+
- ⚠️ [Get Available Markets](examples/data/markets/GetAvailableMarketsExample.java)
237260

238261

239-
- **Browse**
240-
- Miscellaneous
241-
- [Get Available Genre Seeds](examples/data/browse/miscellaneous/GetAvailableGenreSeedsExample.java)
242-
- [Get a Category](examples/data/browse/GetCategoryExample.java)
243-
- [Get a Category's Playlists](examples/data/browse/GetCategorysPlaylistsExample.java)
244-
- [Get a List of Categories](examples/data/browse/GetListOfCategoriesExample.java)
245-
- [Get a List of Featured Playlists](examples/data/browse/GetListOfFeaturedPlaylistsExample.java)
246-
- [Get a List of New Releases](examples/data/browse/GetListOfNewReleasesExample.java)
247-
- [Get Recommendations](examples/data/browse/GetRecommendationsExample.java)
262+
- **Chapters**
263+
- [Get a Chapter](examples/data/chapters/GetChapterExample.java)
264+
- ⚠️ [Get Several Chapters](examples/data/chapters/GetSeveralChaptersExample.java)
248265

249266

250267
- **Episodes**
251268
- [Get an Episode](examples/data/episodes/GetEpisodeExample.java)
252-
- [Get several Episodes](examples/data/episodes/GetSeveralEpisodesExample.java)
253-
254-
255-
- **Follow**
256-
- [Check if Current User Follows Artists or Users](examples/data/follow/CheckCurrentUserFollowsArtistsOrUsersExample.java)
257-
- [Check if Users Follow a Playlist](examples/data/follow/CheckUsersFollowPlaylistExample.java)
258-
- [Follow Artists or Users](examples/data/follow/FollowArtistsOrUsersExample.java)
259-
- [Follow a Playlist](examples/data/follow/FollowPlaylistExample.java)
260-
- [Get User's Followed Artists](examples/data/follow/GetUsersFollowedArtistsExample.java)
261-
- [Unfollow Artists or Users](examples/data/follow/UnfollowArtistsOrUsersExample.java)
262-
- [Unfollow a Playlist](examples/data/follow/UnfollowPlaylistExample.java)
263-
264-
265-
- **Library**
266-
- [Check User's Saved Albums](examples/data/library/CheckUsersSavedAlbumsExample.java)
267-
- [Check User's Saved Episodes](examples/data/library/CheckUsersSavedEpisodesExample.java)
268-
- [Check User's Saved Shows](examples/data/library/CheckUsersSavedShowsExample.java)
269-
- [Check User's Saved Tracks](examples/data/library/CheckUsersSavedTracksExample.java)
270-
- [Get Current User's Saved Albums](examples/data/library/GetCurrentUsersSavedAlbumsExample.java)
271-
- [Get User's Saved Episodes](examples/data/library/GetUsersSavedEpisodesExample.java)
272-
- [Get User's Saved Shows](examples/data/library/GetUsersSavedShowsExample.java)
273-
- [Get User's Saved Tracks](examples/data/library/GetUsersSavedTracksExample.java)
274-
- [Remove Albums for Current User](examples/data/library/RemoveAlbumsForCurrentUserExample.java)
275-
- [Remove User's Saved Episodes](examples/data/library/RemoveUsersSavedEpisodesExample.java)
276-
- [Remove User's Saved Shows](examples/data/library/RemoveUsersSavedShowsExample.java)
277-
- [Remove User's Saved Tracks](examples/data/library/RemoveUsersSavedTracksExample.java)
278-
- [Save Albums for Current User](examples/data/library/SaveAlbumsForCurrentUserExample.java)
279-
- [Save Episodes for Current User](examples/data/library/SaveEpisodesForCurrentUserExample.java)
280-
- [Save Shows for Current User](examples/data/library/SaveShowsForCurrentUserExample.java)
281-
- [Save Tracks for User](examples/data/library/SaveTracksForUserExample.java)
269+
- [Check User's Saved Episodes](examples/data/episodes/CheckUsersSavedEpisodesExample.java)
270+
- [Get User's Saved Episodes](examples/data/episodes/GetUsersSavedEpisodesExample.java)
271+
272+
273+
- **Library (Unified Save/Remove/Check API)**
274+
- [Save Items to Library](examples/data/library/SaveToLibraryExample.java)
275+
- [Remove Items from Library](examples/data/library/RemoveFromLibraryExample.java)
282276

283277

284278
- **Personalization**
279+
- [Get a User's Top Artists and Tracks](examples/data/users/GetUsersTopArtistsAndTracksExample.java)
285280
- Simplified
286-
- [Get a User's Top Artists](examples/data/personalization/simplified/GetUsersTopArtistsExample.java)
287-
- [Get a User's Top Tracks](examples/data/personalization/simplified/GetUsersTopTracksExample.java)
288-
- [Get a User's Top Artists and Tracks](examples/data/personalization/GetUsersTopArtistsAndTracksExample.java)
281+
- [Get a User's Top Artists](examples/data/users/simplified/GetUsersTopArtistsExample.java)
282+
- [Get a User's Top Tracks](examples/data/users/simplified/GetUsersTopTracksExample.java)
289283

290284

291285
- **Player**
292-
- [Add Item to User's Playback Queue](examples/data/player/AddItemToUsersPlaybackQueueExample.java)
293-
- [Get a User's Available Devices](examples/data/player/GetUsersAvailableDevicesExample.java)
294-
- [Get Information About The User's Current Playback](examples/data/player/GetInformationAboutUsersCurrentPlaybackExample.java)
295-
- [Get Current User's Recently Played Tracks](examples/data/player/GetCurrentUsersRecentlyPlayedTracksExample.java)
296-
- [Get the User's Currently Playing Track](examples/data/player/GetUsersCurrentlyPlayingTrackExample.java)
297-
- [Pause a User's Playback](examples/data/player/PauseUsersPlaybackExample.java)
298-
- [Seek To Position In Currently Playing Track](examples/data/player/SeekToPositionInCurrentlyPlayingTrackExample.java)
299-
- [Set Repeat Mode On User's Playback](examples/data/player/SetRepeatModeOnUsersPlaybackExample.java)
300-
- [Set Volume For User's Playback](examples/data/player/SetVolumeForUsersPlaybackExample.java)
301-
- [Skip User's Playback To Next Track](examples/data/player/SkipUsersPlaybackToNextTrackExample.java)
302-
- [Skip User's Playback To Previous Track](examples/data/player/SkipUsersPlaybackToPreviousTrackExample.java)
303-
- [Start/Resume a User's Playback](examples/data/player/StartResumeUsersPlaybackExample.java)
304-
- [Toggle Shuffle For User's Playback](examples/data/player/ToggleShuffleForUsersPlaybackExample.java)
305-
- [Transfer a User's Playback](examples/data/player/TransferUsersPlaybackExample.java)
286+
- [Get Available Devices](examples/data/player/GetUsersAvailableDevicesExample.java)
287+
- [Get Current Playback State](examples/data/player/GetInformationAboutUsersCurrentPlaybackExample.java)
288+
- [Get Currently Playing Track](examples/data/player/GetUsersCurrentlyPlayingTrackExample.java)
289+
- [Get Recently Played Tracks](examples/data/player/GetCurrentUsersRecentlyPlayedTracksExample.java)
290+
- [Get User's Queue](examples/data/player/GetTheUsersQueueExample.java)
291+
- [Start/Resume Playback](examples/data/player/StartResumeUsersPlaybackExample.java)
292+
- [Pause Playback](examples/data/player/PauseUsersPlaybackExample.java)
293+
- [Skip to Next Track](examples/data/player/SkipUsersPlaybackToNextTrackExample.java)
294+
- [Skip to Previous Track](examples/data/player/SkipUsersPlaybackToPreviousTrackExample.java)
295+
- [Seek to Position](examples/data/player/SeekToPositionInCurrentlyPlayingTrackExample.java)
296+
- [Set Repeat Mode](examples/data/player/SetRepeatModeOnUsersPlaybackExample.java)
297+
- [Toggle Shuffle](examples/data/player/ToggleShuffleForUsersPlaybackExample.java)
298+
- [Set Volume](examples/data/player/SetVolumeForUsersPlaybackExample.java)
299+
- [Transfer Playback](examples/data/player/TransferUsersPlaybackExample.java)
300+
- [Add Item to Queue](examples/data/player/AddItemToUsersPlaybackQueueExample.java)
306301

307302

308303
- **Playlists**
309-
- [Add Items to a Playlist](examples/data/playlists/AddItemsToPlaylistExample.java)
310-
- [Change a Playlist's Details](examples/data/playlists/ChangePlaylistsDetailsExample.java)
311-
- [Create a Playlist](examples/data/playlists/CreatePlaylistExample.java)
312-
- [Get a List of Current User's Playlists](examples/data/playlists/GetListOfCurrentUsersPlaylistsExample.java)
313-
- [Get a List of a User's Playlists](examples/data/playlists/GetListOfUsersPlaylistsExample.java)
314304
- [Get a Playlist](examples/data/playlists/GetPlaylistExample.java)
315-
- [Get a Playlist Cover Image](examples/data/playlists/GetPlaylistCoverImageExample.java)
305+
- [Get Current User's Playlists](examples/data/playlists/GetCurrentUsersPlaylistsExample.java)
316306
- [Get a Playlist's Items](examples/data/playlists/GetPlaylistsItemsExample.java)
307+
- [Get a Playlist Cover Image](examples/data/playlists/GetPlaylistCoverImageExample.java)
308+
- [Add Items to a Playlist](examples/data/playlists/AddItemsToPlaylistExample.java)
317309
- [Remove Items from a Playlist](examples/data/playlists/RemoveItemsFromPlaylistExample.java)
318-
- [Reorder a Playlist's Items](examples/data/playlists/ReorderPlaylistsItemsExample.java)
319-
- [Replace a Playlist's Items](examples/data/playlists/ReplacePlaylistsItemsExample.java)
320-
- [Upload a Custom Playlist Cover Image](examples/data/playlists/UploadCustomPlaylistCoverImageExample.java)
310+
- [Update Playlist Details](examples/data/playlists/ChangePlaylistsDetailsExample.java)
311+
- [Reorder Playlist Items](examples/data/playlists/UpdatePlaylistsItemsReorderExample.java)
312+
- [Replace Playlist Items](examples/data/playlists/UpdatePlaylistsItemsReplaceExample.java)
313+
- [Upload Playlist Cover Image](examples/data/playlists/UploadCustomPlaylistCoverImageExample.java)
314+
- ⚠️ [Add Items (Deprecated Format)](examples/data/playlists/AddItemsToPlaylistDeprecatedExample.java)
321315

322316

323317
- **Search**
324-
- Simplified
318+
- [Search for Item](examples/data/search/SearchItemExample.java)
319+
- Simplified (Direct Type Search)
325320
- [Search Albums](examples/data/search/simplified/SearchAlbumsExample.java)
326321
- [Search Artists](examples/data/search/simplified/SearchArtistsExample.java)
322+
- [Search Tracks](examples/data/search/simplified/SearchTracksExample.java)
323+
- [Search Shows](examples/data/search/simplified/SearchShowsExample.java)
327324
- [Search Episodes](examples/data/search/simplified/SearchEpisodesExample.java)
328325
- [Search Playlists](examples/data/search/simplified/SearchPlaylistsExample.java)
329-
- [Search Shows](examples/data/search/simplified/SearchShowsExample.java)
330-
- [Search Tracks](examples/data/search/simplified/SearchTracksExample.java)
331-
- [Search Item](examples/data/search/SearchItemExample.java)
332326

333327

334328
- **Shows**
335329
- [Get a Show](examples/data/shows/GetShowExample.java)
336-
- [Get several Show](examples/data/shows/GetSeveralShowsExample.java)
337330
- [Get a Show's Episodes](examples/data/shows/GetShowsEpisodesExample.java)
331+
- [Check User's Saved Shows](examples/data/shows/CheckUsersSavedShowsExample.java)
332+
- [Get User's Saved Shows](examples/data/shows/GetUsersSavedShowsExample.java)
338333

339334

340335
- **Tracks**
341-
- [Get Audio Analysis for a Track](examples/data/tracks/GetAudioAnalysisForTrackExample.java)
336+
- [Get a Track](examples/data/tracks/GetTrackExample.java)
337+
- [Check User's Saved Tracks](examples/data/tracks/CheckUsersSavedTracksExample.java)
338+
- [Get User's Saved Tracks](examples/data/tracks/GetUsersSavedTracksExample.java)
342339
- [Get Audio Features for a Track](examples/data/tracks/GetAudioFeaturesForTrackExample.java)
343340
- [Get Audio Features for Several Tracks](examples/data/tracks/GetAudioFeaturesForSeveralTracksExample.java)
344-
- [Get Several Tracks](examples/data/tracks/GetSeveralTracksExample.java)
345-
- [Get a Track](examples/data/tracks/GetTrackExample.java)
346-
347-
348-
- **User's Profile**
349-
- [Get Current User's Profile](examples/data/users_profile/GetCurrentUsersProfileExample.java)
350-
- [Get a User's Profile](examples/data/users_profile/GetUsersProfileExample.java)
341+
- [Get Audio Analysis for a Track](examples/data/tracks/GetAudioAnalysisForTrackExample.java)
342+
- [Get Recommendations](examples/data/tracks/GetRecommendationsExample.java)
343+
344+
345+
- **User's Profile & Following**
346+
- [Get Current User's Profile](examples/data/users/GetCurrentUsersProfileExample.java)
347+
- ⚠️ [Get User's Followed Artists](examples/data/users/GetUsersFollowedArtistsExample.java)
348+
- ⚠️ [Follow Artists or Users](examples/data/users/FollowArtistsOrUsersExample.java)
349+
- ⚠️ [Unfollow Artists or Users](examples/data/users/UnfollowArtistsOrUsersExample.java)
350+
- ⚠️ [Check if User Follows Artists or Users](examples/data/users/CheckCurrentUserFollowsArtistsOrUsersExample.java)
351+
- ⚠️ [Follow a Playlist](examples/data/users/FollowPlaylistExample.java)
352+
- ⚠️ [Unfollow a Playlist](examples/data/users/UnfollowPlaylistExample.java)
353+
- ⚠️ [Check if Users Follow a Playlist](examples/data/users/CheckUsersFollowPlaylistExample.java)
351354

352355
## Contributions
353356
See [CONTRIBUTING.md](CONTRIBUTING.md).

‎examples/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The following (random) data should be used when modifying examples:
1717
### IDs
1818
- Artist: ["0LcJLqbBmaGUft1e9Mm8HV"](https://open.spotify.com/artist/0LcJLqbBmaGUft1e9Mm8HV?si=tUHw6JYdQwmE5QIla_7ZaQ)
1919
- Album: ["5zT1JLIj9E57p3e1rFm9Uq"](https://open.spotify.com/album/5zT1JLIj9E57p3e1rFm9Uq?si=PkAs2KWQTkm2b0vxg_qcRA)
20-
- Episode: ["4GI3dxEafwap1sFiTGPKd1"](https://open.spotify.com/episode/4GI3dxEafwap1sFiTGPKd1?si=p32KTdx_QTuV2YLatvYkKw)
20+
- Episode: ["046WGwFKUevqKMA4NQfYUv"](https://open.spotify.com/episode/046WGwFKUevqKMA4NQfYUv?si=p32KTdx_QTuV2YLatvYkKw)
2121
- Playlist: ["3AGOiaoRXMSjswCLtuNqv5"](https://open.spotify.com/user/abbaspotify/playlist/3AGOiaoRXMSjswCLtuNqv5?si=ru1yCc8QSueG7gHEC7E40w)
2222
- Track: ["01iyCAUm8EvOFqVWYJ3dVX"](https://open.spotify.com/track/01iyCAUm8EvOFqVWYJ3dVX?si=m0Fdh5ASScyfue6kQerIZg)
2323
- Show ["5AvwZVawapvyhJUIx71pdJ"](https://open.spotify.com/show/5AvwZVawapvyhJUIx71pdJ?si=TFUPZuTrTS2yF-LD8nIYiw)

examples/data/library/CheckUsersSavedAlbumsExample.java renamed to examples/data/albums/CheckUsersSavedAlbumsExample.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package data.library;
1+
package data.albums;
22

33
import se.michaelthelin.spotify.SpotifyApi;
44
import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
5-
import se.michaelthelin.spotify.requests.data.library.CheckUsersSavedAlbumsRequest;
5+
import se.michaelthelin.spotify.requests.data.albums.CheckUsersSavedAlbumsRequest;
6+
67
import org.apache.hc.core5.http.ParseException;
78

89
import java.io.IOException;

‎examples/data/albums/GetAlbumsTracksExample.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
55
import se.michaelthelin.spotify.model_objects.specification.Paging;
66
import se.michaelthelin.spotify.model_objects.specification.TrackSimplified;
7-
import se.michaelthelin.spotify.requests.data.albums.GetAlbumsTracksRequest;
7+
import se.michaelthelin.spotify.requests.data.albums.GetAlbumTracksRequest;
88
import org.apache.hc.core5.http.ParseException;
99

1010
import java.io.IOException;
@@ -19,7 +19,7 @@ public class GetAlbumsTracksExample {
1919
private static final SpotifyApi spotifyApi = new SpotifyApi.Builder()
2020
.setAccessToken(accessToken)
2121
.build();
22-
private static final GetAlbumsTracksRequest getAlbumsTracksRequest = spotifyApi.getAlbumsTracks(id)
22+
private static final GetAlbumTracksRequest getAlbumsTracksRequest = spotifyApi.getAlbumTracks(id)
2323
// .limit(10)
2424
// .offset(0)
2525
// .market(CountryCode.SE)

examples/data/library/GetCurrentUsersSavedAlbumsExample.java renamed to examples/data/albums/GetCurrentUsersSavedAlbumsExample.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package data.library;
1+
package data.albums;
22

33
import se.michaelthelin.spotify.SpotifyApi;
44
import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
55
import se.michaelthelin.spotify.model_objects.specification.Paging;
66
import se.michaelthelin.spotify.model_objects.specification.SavedAlbum;
7-
import se.michaelthelin.spotify.requests.data.library.GetCurrentUsersSavedAlbumsRequest;
7+
import se.michaelthelin.spotify.requests.data.albums.GetUsersSavedAlbumsRequest;
8+
89
import org.apache.hc.core5.http.ParseException;
910

1011
import java.io.IOException;
@@ -18,26 +19,26 @@ public class GetCurrentUsersSavedAlbumsExample {
1819
private static final SpotifyApi spotifyApi = new SpotifyApi.Builder()
1920
.setAccessToken(accessToken)
2021
.build();
21-
private static final GetCurrentUsersSavedAlbumsRequest getCurrentUsersSavedAlbumsRequest = spotifyApi
22-
.getCurrentUsersSavedAlbums()
22+
private static final GetUsersSavedAlbumsRequest getUsersSavedAlbumsRequest = spotifyApi
23+
.getUsersSavedAlbums()
2324
// .limit(10)
2425
// .market(CountryCode.SE)
2526
// .offset(0)
2627
.build();
2728

28-
public static void getCurrentUsersSavedAlbums_Sync() {
29+
public static void getUsersSavedAlbums_Sync() {
2930
try {
30-
final Paging<SavedAlbum> savedAlbumPaging = getCurrentUsersSavedAlbumsRequest.execute();
31+
final Paging<SavedAlbum> savedAlbumPaging = getUsersSavedAlbumsRequest.execute();
3132

3233
System.out.println("Total: " + savedAlbumPaging.getTotal());
3334
} catch (IOException | SpotifyWebApiException | ParseException e) {
3435
System.out.println("Error: " + e.getMessage());
3536
}
3637
}
3738

38-
public static void getCurrentUsersSavedAlbums_Async() {
39+
public static void getUsersSavedAlbums_Async() {
3940
try {
40-
final CompletableFuture<Paging<SavedAlbum>> pagingFuture = getCurrentUsersSavedAlbumsRequest.executeAsync();
41+
final CompletableFuture<Paging<SavedAlbum>> pagingFuture = getUsersSavedAlbumsRequest.executeAsync();
4142

4243
// Thread free to do other tasks...
4344

@@ -53,7 +54,7 @@ public static void getCurrentUsersSavedAlbums_Async() {
5354
}
5455

5556
public static void main(String[] args) {
56-
getCurrentUsersSavedAlbums_Sync();
57-
getCurrentUsersSavedAlbums_Async();
57+
getUsersSavedAlbums_Sync();
58+
getUsersSavedAlbums_Async();
5859
}
5960
}

0 commit comments

Comments
 (0)