Skip to content

Commit 40bb20d

Browse files
authored
Automated update of fixed-spotify-open-api.yml (#325)
* Automated update of fixed-spotify-open-api.yml * fix: add deprecation notice
1 parent a7b653b commit 40bb20d

20 files changed

+65
-25
lines changed

spotify-web-api-java-generator/fixed-spotify-open-api.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ info:
88
The base URI for all Web API requests is `https://api.spotify.com/v1`.
99
1010
Need help? See our <a href="https://developer.spotify.com/documentation/web-api/guides/">Web API guides</a> for more information, or visit the <a href="https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer">Spotify for Developers community forum</a> to ask questions and connect with other developers.
11-
version: 2024.11.2
11+
version: 2024.12.23
1212
title: Spotify Web API with fixes and improvements from sonallux
1313
termsOfService: https://developer.spotify.com/terms/
1414
contact:
@@ -211,6 +211,7 @@ paths:
211211
- oauth_2_0: []
212212
/artists/{id}/related-artists:
213213
get:
214+
deprecated: true
214215
tags:
215216
- Artists
216217
operationId: get-an-artists-related-artists
@@ -1830,6 +1831,7 @@ paths:
18301831
- playlist-modify-private
18311832
/browse/featured-playlists:
18321833
get:
1834+
deprecated: true
18331835
tags:
18341836
- Playlists
18351837
operationId: get-featured-playlists
@@ -1933,6 +1935,7 @@ paths:
19331935
- oauth_2_0: []
19341936
/browse/categories/{category_id}/playlists:
19351937
get:
1938+
deprecated: true
19361939
tags:
19371940
- Playlists
19381941
- Categories
@@ -2195,7 +2198,7 @@ paths:
21952198
items:
21962199
type: string
21972200
responses:
2198-
"200":
2201+
"204":
21992202
description: Artist or user unfollowed
22002203
"401":
22012204
$ref: "#/components/responses/Unauthorized"
@@ -2285,6 +2288,7 @@ paths:
22852288
- oauth_2_0: []
22862289
/audio-features:
22872290
get:
2291+
deprecated: true
22882292
tags:
22892293
- Tracks
22902294
operationId: get-several-audio-features
@@ -2316,6 +2320,7 @@ paths:
23162320
- oauth_2_0: []
23172321
/audio-features/{id}:
23182322
get:
2323+
deprecated: true
23192324
tags:
23202325
- Tracks
23212326
operationId: get-audio-features
@@ -2347,6 +2352,7 @@ paths:
23472352
- oauth_2_0: []
23482353
/audio-analysis/{id}:
23492354
get:
2355+
deprecated: true
23502356
tags:
23512357
- Tracks
23522358
operationId: get-audio-analysis
@@ -2378,6 +2384,7 @@ paths:
23782384
- oauth_2_0: []
23792385
/recommendations:
23802386
get:
2387+
deprecated: true
23812388
tags:
23822389
- Tracks
23832390
operationId: get-recommendations
@@ -2836,6 +2843,7 @@ paths:
28362843
- oauth_2_0: []
28372844
/recommendations/available-genre-seeds:
28382845
get:
2846+
deprecated: true
28392847
tags:
28402848
- Genres
28412849
operationId: get-recommendation-genres
@@ -5048,6 +5056,7 @@ components:
50485056
type: string
50495057
description: The name of the track.
50505058
preview_url:
5059+
deprecated: true
50515060
type: string
50525061
nullable: true
50535062
description: |
@@ -5781,6 +5790,7 @@ components:
57815790
description: |
57825791
The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.<br/>The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are.<br/>Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently. Artist and album popularity is derived mathematically from track popularity. _**Note**: the popularity value may lag actual popularity by a few days: the value is not updated in real time._
57835792
preview_url:
5793+
deprecated: true
57845794
type: string
57855795
nullable: true
57865796
description: |
@@ -5844,6 +5854,7 @@ components:
58445854
- uri
58455855
properties:
58465856
audio_preview_url:
5857+
deprecated: true
58475858
type: string
58485859
nullable: true
58495860
example: https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17
@@ -6383,6 +6394,7 @@ components:
63836394
- uri
63846395
properties:
63856396
audio_preview_url:
6397+
deprecated: true
63866398
type: string
63876399
nullable: true
63886400
example: https://p.scdn.co/mp3-preview/2f37da1d4221f40b9d1a98cd191f4d6f1646ad17
@@ -6535,11 +6547,10 @@ components:
65356547
type: array
65366548
items:
65376549
type: string
6538-
example:
6539-
- Egg punk
6540-
- Noise rock
6550+
deprecated: true
6551+
example: []
65416552
description: |
6542-
A list of the genres the album is associated with. If not yet classified, the array is empty.
6553+
**Deprecated** The array is always empty.
65436554
label:
65446555
type: string
65456556
description: |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ private Map<String, Object> buildEndpointContext(ApiEndpoint endpoint, JavaPacka
5252
var methodName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, endpoint.getEndpointId());
5353
context.put("methodName", methodName);
5454
context.put("name", endpoint.getName());
55+
context.put("deprecated", endpoint.isDeprecated());
5556
context.put("description", Markdown2Html.convertToSingleLine(endpoint.getDescription()));
5657
context.put("requestBuilder", JavaUtils.getEndpointRequestBuilderName(endpoint.getEndpointId()));
5758

@@ -77,6 +78,7 @@ private List<ApiEndpoint.Parameter> generateEndpointRequest(ApiEndpoint endpoint
7778
var context = new HashMap<String, Object>();
7879
context.put("package", javaPackage.getName());
7980
context.put("name", endpoint.getName() + " request");
81+
context.put("deprecated", endpoint.isDeprecated());
8082
context.put("className", className);
8183
context.put("httpMethod", endpoint.getHttpMethod());
8284
context.put("path", endpoint.getPath());

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,31 @@ public static void splitEndpoints(SpotifyWebApi spotifyWebApi) {
1616
}
1717

1818
var reorderEndpoint = new ApiEndpoint(
19-
"reorder-playlists-tracks",
20-
"Reorder Playlist Items",
21-
"Reorder items in a playlist",
22-
endpoint.getPath(),
23-
endpoint.getHttpMethod(),
24-
endpoint.getResponseType(),
25-
endpoint.getResponseDescription(),
26-
endpoint.getScopes()
19+
"reorder-playlists-tracks",
20+
"Reorder Playlist Items",
21+
"Reorder items in a playlist",
22+
endpoint.getPath(),
23+
endpoint.getHttpMethod(),
24+
endpoint.getResponseType(),
25+
endpoint.getResponseDescription(),
26+
endpoint.getScopes(),
27+
false
2728
);
2829
reorderEndpoint.addPathParameter(endpoint.getRequiredPathParameters().get(0), true);
2930
endpoint.getOptionalBodyParameters().stream()
3031
.filter(param -> List.of("range_start", "insert_before", "range_length", "snapshot_id").contains(param.getName()))
3132
.forEach(param -> reorderEndpoint.addBodyParameter(param, List.of("range_start", "insert_before").contains(param.getName())));
3233

3334
var replaceEndpoint = new ApiEndpoint(
34-
"replace-playlists-tracks",
35-
"Replace Playlist Items",
36-
"Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.",
37-
endpoint.getPath(),
38-
endpoint.getHttpMethod(),
39-
endpoint.getResponseType(),
40-
endpoint.getResponseDescription(),
41-
endpoint.getScopes()
35+
"replace-playlists-tracks",
36+
"Replace Playlist Items",
37+
"Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.",
38+
endpoint.getPath(),
39+
endpoint.getHttpMethod(),
40+
endpoint.getResponseType(),
41+
endpoint.getResponseDescription(),
42+
endpoint.getScopes(),
43+
false
4244
);
4345
replaceEndpoint.addPathParameter(endpoint.getRequiredPathParameters().get(0), true);
4446
endpoint.getOptionalQueryParameters().stream()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ private void visitOperation(ApiCategory category, PathItem.HttpMethod method, St
4848
var responseType = getResponseType(response);
4949
var responseDescription = generationContext.resolveResponse(response).getDescription();
5050
var scopes = JavaUtils.getScopes(operation);
51+
var deprecated = operation.getDeprecated() != null && operation.getDeprecated();
5152

52-
var endpoint = new ApiEndpoint(endpointId, name, description, path, httpMethod, responseType, responseDescription, scopes);
53+
var endpoint = new ApiEndpoint(endpointId, name, description, path, httpMethod, responseType, responseDescription, scopes, deprecated);
5354
category.addEndpoint(endpoint);
5455

5556
if (operation.getParameters() != null) {

spotify-web-api-java-generator/src/main/java/de/sonallux/spotify/generator/java/model/ApiEndpoint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class ApiEndpoint {
1818
private final String responseType;
1919
private final String responseDescription;
2020
private final List<String> scopes;
21+
private final boolean deprecated;
2122
private final List<Parameter> requiredPathParameters;
2223
private final List<Parameter> requiredQueryParameters;
2324
private final List<Parameter> requiredBodyParameters;
@@ -26,7 +27,7 @@ public class ApiEndpoint {
2627
private final List<Parameter> optionalBodyParameters;
2728
private RawBodyParameter rawBodyParameter = null;
2829

29-
public ApiEndpoint(String endpointId, String name, String description, String path, String httpMethod, String responseType, String responseDescription, List<String> scopes) {
30+
public ApiEndpoint(String endpointId, String name, String description, String path, String httpMethod, String responseType, String responseDescription, List<String> scopes, boolean deprecated) {
3031
this.endpointId = endpointId;
3132
this.name = name;
3233
this.description = description;
@@ -35,6 +36,7 @@ public ApiEndpoint(String endpointId, String name, String description, String pa
3536
this.responseType = responseType;
3637
this.responseDescription = responseDescription;
3738
this.scopes = scopes;
39+
this.deprecated = deprecated;
3840
this.requiredPathParameters = new ArrayList<>();
3941
this.requiredQueryParameters = new ArrayList<>();
4042
this.requiredBodyParameters = new ArrayList<>();

spotify-web-api-java-generator/src/main/resources/templates/api.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public class {{className}} {
1919
* {{.}}
2020
{{/javaDocParameters}}
2121
* @return a {@link {{requestBuilder}}} object to build and execute the request
22+
{{#deprecated}}
23+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
24+
{{/deprecated}}
2225
*/
2326
public {{requestBuilder}} {{methodName}}({{requiredParameters}}) {
2427
return new {{requestBuilder}}({{arguments}});

spotify-web-api-java-generator/src/main/resources/templates/request.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import de.sonallux.spotify.api.models.*;
1818
{{#responseDescription}}
1919
* {{.}}
2020
{{/responseDescription}}
21+
{{#deprecated}}
22+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
23+
{{/deprecated}}
2124
*/
2225
public class {{className}} {
2326
private static final TypeReference<{{responseType}}> RESPONSE_TYPE = new TypeReference<>() {};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public GetArtistsAlbumsRequest getArtistsAlbums(String id) {
3636
* <p>Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community's listening history.</p>
3737
* @param id <p>The <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify ID</a> of the artist.</p>
3838
* @return a {@link GetArtistsRelatedArtistsRequest} object to build and execute the request
39+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
3940
*/
4041
public GetArtistsRelatedArtistsRequest getArtistsRelatedArtists(String id) {
4142
return new GetArtistsRelatedArtistsRequest(apiClient, id);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class GenresApi {
1515
* <h4>Get Available Genre Seeds</h4>
1616
* <p>Retrieve a list of available genres seed parameter values for <a href="https://developer.spotify.com/documentation/web-api/reference/get-recommendations">recommendations</a>.</p>
1717
* @return a {@link GetRecommendationGenresRequest} object to build and execute the request
18+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
1819
*/
1920
public GetRecommendationGenresRequest getRecommendationGenres() {
2021
return new GetRecommendationGenresRequest(apiClient);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public CreatePlaylistRequest createPlaylist(String userId, String name) {
4848
* <p>Get a list of Spotify playlists tagged with a particular category.</p>
4949
* @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>
5050
* @return a {@link GetCategoriesPlaylistsRequest} object to build and execute the request
51+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
5152
*/
5253
public GetCategoriesPlaylistsRequest getCategoriesPlaylists(String categoryId) {
5354
return new GetCategoriesPlaylistsRequest(apiClient, categoryId);
@@ -57,6 +58,7 @@ public GetCategoriesPlaylistsRequest getCategoriesPlaylists(String categoryId) {
5758
* <h4>Get Featured Playlists</h4>
5859
* <p>Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).</p>
5960
* @return a {@link GetFeaturedPlaylistsRequest} object to build and execute the request
61+
* @deprecated see <a href="https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api">this blog post from Spotify</a>
6062
*/
6163
public GetFeaturedPlaylistsRequest getFeaturedPlaylists() {
6264
return new GetFeaturedPlaylistsRequest(apiClient);

0 commit comments

Comments
 (0)