Skip to content

Commit

Permalink
Add include parameter to album and artist endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
stevesoltys committed Dec 25, 2020
1 parent 06e1080 commit 4394944
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
14 changes: 10 additions & 4 deletions src/main/kotlin/com/stevesoltys/applemusic/AppleMusic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,21 @@ class AppleMusic(
/**
* Get an artist.
*/
fun getArtistById(id: String): ArtistResponse {
return call(appleMusicService.getArtistById(id))
fun getArtistById(
id: String,
include: Set<String>? = null
): ArtistResponse {
return call(appleMusicService.getArtistById(id, include?.toTypedArray()))
}

/**
* Get an album.
*/
fun getAlbumById(id: String): AlbumResponse {
return call(appleMusicService.getAlbumById(id))
fun getAlbumById(
id: String,
include: Set<String>? = null
): AlbumResponse {
return call(appleMusicService.getAlbumById(id, include?.toTypedArray()))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.stevesoltys.applemusic.net
import com.stevesoltys.applemusic.model.album.AlbumResponse
import com.stevesoltys.applemusic.model.artist.ArtistResponse
import com.stevesoltys.applemusic.model.search.SearchResponse
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.Path
Expand All @@ -23,13 +22,19 @@ interface AppleMusicService {
): Call<SearchResponse>

@GET("artists/{id}")
fun getArtistById(@Path("id") id: String): Call<ArtistResponse>
fun getArtistById(
@Path("id") id: String,
@Query("include") types: Array<String>? = null
): Call<ArtistResponse>

@GET("artists")
fun getArtistsById(@Query("ids") ids: Array<String>): Call<ArtistResponse>

@GET("albums/{id}")
fun getAlbumById(@Path("id") id: String): Call<AlbumResponse>
fun getAlbumById(
@Path("id") id: String,
@Query("include") types: Array<String>? = null
): Call<AlbumResponse>

@GET("albums")
fun getAlbumsById(@Query("ids") ids: Array<String>): Call<AlbumResponse>
Expand Down

0 comments on commit 4394944

Please sign in to comment.