Skip to content

Commit 7af222e

Browse files
julius-ddargmuesli
andauthored
feat: add include_groups parameter to GetArtistsAlbumsRequest (#419)
* feat: add include_groups filter to GetArtistsAlbumsRequest and deprecate album_type The `album_type` param has no effect and also the documentation (https://developer.spotify.com/documentation/web-api/reference/get-an-artists-albums) only mentions `include_groups` * ci: trigger --------- Co-authored-by: Jonas Thelemann <e-mail@jonas-thelemann.de>
1 parent 7f0aa3e commit 7af222e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/main/java/se/michaelthelin/spotify/requests/data/artists/GetArtistsAlbumsRequest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,30 @@ public Builder id(final String id) {
7575
* supplied, all album types will be returned. Valid values are: {@code album}, {@code single},
7676
* {@code appears_on} and {@code compilation}.
7777
* @return A {@link GetArtistsAlbumsRequest.Builder}.
78+
* @deprecated Use {@link #include_groups(String)} instead.
7879
*/
80+
@Deprecated
7981
public Builder album_type(final String album_type) {
8082
assert (album_type != null);
8183
assert (album_type.matches("((^|,)(single|album|appears_on|compilation))+$"));
8284
return setQueryParameter("album_type", album_type);
8385
}
8486

87+
/**
88+
* The include groups filter setter.
89+
*
90+
* @param include_groups Optional. A comma-separated list of keywords that will be used to filter the response. If not
91+
* supplied, all album types will be returned. Valid values are: {@code album}, {@code single},
92+
* {@code appears_on} and {@code compilation}.
93+
* @return A {@link GetArtistsAlbumsRequest.Builder}.
94+
* @see <a href="https://developer.spotify.com/documentation/web-api/reference/get-an-artists-albums">Spotify Web API References / Get Artist's Albums</a>
95+
*/
96+
public Builder include_groups(final String include_groups) {
97+
assert (include_groups != null);
98+
assert (include_groups.matches("((^|,)(single|album|appears_on|compilation))+$"));
99+
return setQueryParameter("include_groups", include_groups);
100+
}
101+
85102
/**
86103
* The market filter setter.
87104
*

src/test/java/se/michaelthelin/spotify/requests/data/artists/GetArtistsAlbumsRequestTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GetArtistsAlbumsRequestTest extends AbstractDataTest<Paging<AlbumSi
2222
.setHttpManager(
2323
TestUtil.MockedHttpManager.returningJson(
2424
"requests/data/artists/GetArtistsAlbumsRequest.json"))
25-
.album_type(ITest.ALBUM_TYPE)
25+
.include_groups(ITest.ALBUM_TYPE)
2626
.limit(ITest.LIMIT)
2727
.market(ITest.MARKET)
2828
.offset(ITest.OFFSET)
@@ -35,7 +35,7 @@ public GetArtistsAlbumsRequestTest() throws Exception {
3535
public void shouldComplyWithReference() {
3636
assertHasAuthorizationHeader(defaultRequest);
3737
assertEquals(
38-
"https://api.spotify.com:443/v1/artists/0LcJLqbBmaGUft1e9Mm8HV/albums?album_type=album&limit=10&market=SE&offset=0",
38+
"https://api.spotify.com:443/v1/artists/0LcJLqbBmaGUft1e9Mm8HV/albums?include_groups=album&limit=10&market=SE&offset=0",
3939
defaultRequest.getUri().toString());
4040
}
4141

0 commit comments

Comments
 (0)