Skip to content

Commit c47454a

Browse files
committed
Update to new category groups
1 parent 5e5af0c commit c47454a

File tree

56 files changed

+388
-412
lines changed

Some content is hidden

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

56 files changed

+388
-412
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
- Adjust the categories of some endpoints to match with the official [Spotify Web API Reference](https://developer.spotify.com/documentation/web-api). No endpoint have been removed, they just got moved to other categories.
9+
- Added `CategoriesApi` and `GenresApi` category
10+
- Removed `BrowseApe`, `LibraryApi` and `PersonalizationApi`
11+
- Renamed `UsersProfileApi` to `UsersApi`
812
- Add "Get an Audiobook's Chapters" endpoint
913
- Add "Get User's Saved Audiobooks" endpoint
1014
- Add "Save Audiobooks for Current User" endpoint
1115
- Add "Remove User's Saved Audiobooks" endpoint
1216
- Add "Check User's Saved Audiobooks" endpoint
1317
- Fix type of `shuffleState` in `CurrentlyPlayingContext` to `boolean`
14-
- Bump jackson to `2.14.1`
18+
- Fix return type of "Get Category's Playlists request" from `PagedPlaylists` to `PagingFeaturedPlaylist`
19+
- Fix return type of "Get Featured Playlists request" from `PagedPlaylistsAndMessage` to `PagingFeaturedPlaylist`
20+
- Fix type of `narrators` field in `AudiobookBase` from `Narrator` to `List<Narrator>`
21+
- Bump jackson to `2.15.2`
22+
- Bump okhttp to `4.10.0`
1523

1624
## [3.1.0]
1725
- Change the API of the recommendations request. All `seed*` parameters are now considered optional because not all of them are always required. It must be at least one `seed*` parameter present.

spotify-web-api-java-generator/src/main/java/de/sonallux/spotify/generator/java/generators/ObjectModelCreator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ public SpotifyWebApi createSpotifyWebApiModel(OpenAPI openAPI) {
3232
}
3333

3434
private void visitPathItem(String path, PathItem pathItem) {
35-
var categoryName = JavaUtils.getCategoryName(pathItem);
36-
var category = spotifyWebApi.getCategory(categoryName);
37-
38-
pathItem.readOperationsMap().forEach((httpMethod, operation) -> visitOperation(category, httpMethod, path, operation));
35+
pathItem.readOperationsMap().forEach((httpMethod, operation) -> {
36+
var categoryName = JavaUtils.getCategoryName(operation);
37+
var category = spotifyWebApi.getCategory(categoryName);
38+
visitOperation(category, httpMethod, path, operation);
39+
});
3940
}
4041

4142
private void visitOperation(ApiCategory category, PathItem.HttpMethod method, String path, Operation operation) {

spotify-web-api-java-generator/src/main/java/de/sonallux/spotify/generator/java/generators/SpotifyWebApiGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ private Map<String, Object> createContext(OpenAPI openAPI, JavaPackage javaPacka
2929
context.put("endpointUrl", openAPI.getServers().get(0).getUrl());
3030

3131
var apis = openAPI.getPaths().values().stream()
32+
.flatMap(pathItem -> pathItem.readOperationsMap().values().stream())
33+
.map(JavaUtils::getCategoryName)
3234
.map(JavaUtils::getCategoryClassName)
3335
.distinct()
3436
.sorted()

spotify-web-api-java-generator/src/main/java/de/sonallux/spotify/generator/java/util/JavaUtils.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.google.common.base.CaseFormat;
44
import de.sonallux.spotify.generator.java.generators.BaseObjectGenerator;
55
import io.swagger.v3.oas.models.Operation;
6-
import io.swagger.v3.oas.models.PathItem;
76
import io.swagger.v3.oas.models.media.ArraySchema;
87
import io.swagger.v3.oas.models.media.ComposedSchema;
98
import io.swagger.v3.oas.models.media.MapSchema;
@@ -143,12 +142,8 @@ public static Optional<String> getTypeOfSchema(Schema<?> schema) {
143142
return Optional.empty();
144143
}
145144

146-
public static String getCategoryName(PathItem pathItem) {
147-
return (String)pathItem.getExtensions().get("x-spotify-docs-category");
148-
}
149-
150-
public static String getCategoryClassName(PathItem pathItem) {
151-
return getCategoryClassName(getCategoryName(pathItem));
145+
public static String getCategoryName(Operation operation) {
146+
return operation.getTags().get(0);
152147
}
153148

154149
public static String getCategoryClassName(String categoryName) {

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/SpotifyWebApi.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,33 @@ public class SpotifyWebApi {
1212
private final AlbumsApi albumsApi;
1313
private final ArtistsApi artistsApi;
1414
private final AudiobooksApi audiobooksApi;
15-
private final BrowseApi browseApi;
15+
private final CategoriesApi categoriesApi;
1616
private final ChaptersApi chaptersApi;
1717
private final EpisodesApi episodesApi;
18-
private final FollowApi followApi;
19-
private final LibraryApi libraryApi;
18+
private final GenresApi genresApi;
2019
private final MarketsApi marketsApi;
21-
private final PersonalizationApi personalizationApi;
2220
private final PlayerApi playerApi;
2321
private final PlaylistsApi playlistsApi;
2422
private final SearchApi searchApi;
2523
private final ShowsApi showsApi;
2624
private final TracksApi tracksApi;
27-
private final UsersProfileApi usersProfileApi;
25+
private final UsersApi usersApi;
2826

2927
SpotifyWebApi(ApiClient apiClient) {
3028
this.albumsApi = new AlbumsApi(apiClient);
3129
this.artistsApi = new ArtistsApi(apiClient);
3230
this.audiobooksApi = new AudiobooksApi(apiClient);
33-
this.browseApi = new BrowseApi(apiClient);
31+
this.categoriesApi = new CategoriesApi(apiClient);
3432
this.chaptersApi = new ChaptersApi(apiClient);
3533
this.episodesApi = new EpisodesApi(apiClient);
36-
this.followApi = new FollowApi(apiClient);
37-
this.libraryApi = new LibraryApi(apiClient);
34+
this.genresApi = new GenresApi(apiClient);
3835
this.marketsApi = new MarketsApi(apiClient);
39-
this.personalizationApi = new PersonalizationApi(apiClient);
4036
this.playerApi = new PlayerApi(apiClient);
4137
this.playlistsApi = new PlaylistsApi(apiClient);
4238
this.searchApi = new SearchApi(apiClient);
4339
this.showsApi = new ShowsApi(apiClient);
4440
this.tracksApi = new TracksApi(apiClient);
45-
this.usersProfileApi = new UsersProfileApi(apiClient);
41+
this.usersApi = new UsersApi(apiClient);
4642
}
4743

4844
public static SpotifyWebApiBuilder builder() {

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/apis/AlbumsApi.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
public class AlbumsApi {
1212
private final ApiClient apiClient;
1313

14+
/**
15+
* <h4>Check User's Saved Albums</h4>
16+
* <p>Check if one or more albums is already saved in the current Spotify user's 'Your Music' library.</p>
17+
* @param ids <p>A comma-separated list of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a> for the albums. Maximum: 20 IDs.</p>
18+
* @return a {@link CheckUsersSavedAlbumsRequest} object to build and execute the request
19+
*/
20+
public CheckUsersSavedAlbumsRequest checkUsersSavedAlbums(String ids) {
21+
return new CheckUsersSavedAlbumsRequest(apiClient, ids);
22+
}
23+
1424
/**
1525
* <h4>Get Album</h4>
1626
* <p>Get Spotify catalog information for a single album.</p>
@@ -40,4 +50,42 @@ public GetAlbumsTracksRequest getAlbumsTracks(String id) {
4050
public GetMultipleAlbumsRequest getMultipleAlbums(String ids) {
4151
return new GetMultipleAlbumsRequest(apiClient, ids);
4252
}
53+
54+
/**
55+
* <h4>Get New Releases</h4>
56+
* <p>Get a list of new album releases featured in Spotify (shown, for example, on a Spotify player’s “Browse” tab).</p>
57+
* @return a {@link GetNewReleasesRequest} object to build and execute the request
58+
*/
59+
public GetNewReleasesRequest getNewReleases() {
60+
return new GetNewReleasesRequest(apiClient);
61+
}
62+
63+
/**
64+
* <h4>Get User's Saved Albums</h4>
65+
* <p>Get a list of the albums saved in the current Spotify user's 'Your Music' library.</p>
66+
* @return a {@link GetUsersSavedAlbumsRequest} object to build and execute the request
67+
*/
68+
public GetUsersSavedAlbumsRequest getUsersSavedAlbums() {
69+
return new GetUsersSavedAlbumsRequest(apiClient);
70+
}
71+
72+
/**
73+
* <h4>Remove Users' Saved Albums</h4>
74+
* <p>Remove one or more albums from the current user's 'Your Music' library.</p>
75+
* @param ids <p>A JSON array of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a>. For example: <code>[&quot;4iV5W9uYEdYUVa79Axb7Rh&quot;, &quot;1301WleyT98MSxVHPZCA6M&quot;]</code><br/>A maximum of 50 items can be specified in one request. <em><strong>Note</strong>: if the <code>ids</code> parameter is present in the query string, any IDs listed here in the body will be ignored.</em></p>
76+
* @return a {@link RemoveAlbumsUserRequest} object to build and execute the request
77+
*/
78+
public RemoveAlbumsUserRequest removeAlbumsUser(java.util.List<String> ids) {
79+
return new RemoveAlbumsUserRequest(apiClient, ids);
80+
}
81+
82+
/**
83+
* <h4>Save Albums for Current User</h4>
84+
* <p>Save one or more albums to the current user's 'Your Music' library.</p>
85+
* @param ids <p>A JSON array of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a>. For example: <code>[&quot;4iV5W9uYEdYUVa79Axb7Rh&quot;, &quot;1301WleyT98MSxVHPZCA6M&quot;]</code><br/>A maximum of 50 items can be specified in one request. <em><strong>Note</strong>: if the <code>ids</code> parameter is present in the query string, any IDs listed here in the body will be ignored.</em></p>
86+
* @return a {@link SaveAlbumsUserRequest} object to build and execute the request
87+
*/
88+
public SaveAlbumsUserRequest saveAlbumsUser(java.util.List<String> ids) {
89+
return new SaveAlbumsUserRequest(apiClient, ids);
90+
}
4391
}

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/apis/AudiobooksApi.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
public class AudiobooksApi {
1212
private final ApiClient apiClient;
1313

14+
/**
15+
* <h4>Check User's Saved Audiobooks</h4>
16+
* <p>Check if one or more audiobooks are already saved in the current Spotify user's library.</p>
17+
* @param ids <p>A comma-separated list of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a>. For example: <code>ids=18yVqkdbdRvS24c0Ilj2ci,1HGw3J3NxZO1TP1BTtVhpZ</code>. Maximum: 50 IDs.</p>
18+
* @return a {@link CheckUsersSavedAudiobooksRequest} object to build and execute the request
19+
*/
20+
public CheckUsersSavedAudiobooksRequest checkUsersSavedAudiobooks(String ids) {
21+
return new CheckUsersSavedAudiobooksRequest(apiClient, ids);
22+
}
23+
1424
/**
1525
* <h4>Get an Audiobook</h4>
1626
* <p>Get Spotify catalog information for a single audiobook.<br><strong>Note: Audiobooks are only available for the US, UK, Ireland, New Zealand and Australia markets.</strong></p>
@@ -40,4 +50,33 @@ public GetAudiobookChaptersRequest getAudiobookChapters(String id) {
4050
public GetMultipleAudiobooksRequest getMultipleAudiobooks(String ids) {
4151
return new GetMultipleAudiobooksRequest(apiClient, ids);
4252
}
53+
54+
/**
55+
* <h4>Get User's Saved Audiobooks</h4>
56+
* <p>Get a list of the audiobooks saved in the current Spotify user's 'Your Music' library.</p>
57+
* @return a {@link GetUsersSavedAudiobooksRequest} object to build and execute the request
58+
*/
59+
public GetUsersSavedAudiobooksRequest getUsersSavedAudiobooks() {
60+
return new GetUsersSavedAudiobooksRequest(apiClient);
61+
}
62+
63+
/**
64+
* <h4>Remove User's Saved Audiobooks</h4>
65+
* <p>Remove one or more audiobooks from the Spotify user's library.</p>
66+
* @param ids <p>A comma-separated list of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a>. For example: <code>ids=18yVqkdbdRvS24c0Ilj2ci,1HGw3J3NxZO1TP1BTtVhpZ</code>. Maximum: 50 IDs.</p>
67+
* @return a {@link RemoveAudiobooksUserRequest} object to build and execute the request
68+
*/
69+
public RemoveAudiobooksUserRequest removeAudiobooksUser(String ids) {
70+
return new RemoveAudiobooksUserRequest(apiClient, ids);
71+
}
72+
73+
/**
74+
* <h4>Save Audiobooks for Current User</h4>
75+
* <p>Save one or more audiobooks to the current Spotify user's library.</p>
76+
* @param ids <p>A comma-separated list of the <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify IDs</a>. For example: <code>ids=18yVqkdbdRvS24c0Ilj2ci,1HGw3J3NxZO1TP1BTtVhpZ</code>. Maximum: 50 IDs.</p>
77+
* @return a {@link SaveAudiobooksUserRequest} object to build and execute the request
78+
*/
79+
public SaveAudiobooksUserRequest saveAudiobooksUser(String ids) {
80+
return new SaveAudiobooksUserRequest(apiClient, ids);
81+
}
4382
}

spotify-web-api-java/src/main/generated/de/sonallux/spotify/api/apis/BrowseApi.java

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package de.sonallux.spotify.api.apis;
2+
3+
import de.sonallux.spotify.api.http.ApiClient;
4+
import de.sonallux.spotify.api.apis.categories.*;
5+
import lombok.RequiredArgsConstructor;
6+
7+
/**
8+
* Categories
9+
*/
10+
@RequiredArgsConstructor
11+
public class CategoriesApi {
12+
private final ApiClient apiClient;
13+
14+
/**
15+
* <h4>Get Several Browse Categories</h4>
16+
* <p>Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).</p>
17+
* @return a {@link GetCategoriesRequest} object to build and execute the request
18+
*/
19+
public GetCategoriesRequest getCategories() {
20+
return new GetCategoriesRequest(apiClient);
21+
}
22+
23+
/**
24+
* <h4>Get Single Browse Category</h4>
25+
* <p>Get a single category used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).</p>
26+
* @param categoryId <p>The <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify category ID</a> for the category.</p>
27+
* @return a {@link GetCategoryRequest} object to build and execute the request
28+
*/
29+
public GetCategoryRequest getCategory(String categoryId) {
30+
return new GetCategoryRequest(apiClient, categoryId);
31+
}
32+
}

0 commit comments

Comments
 (0)