SpotifyService

Spotify service interface provides all the methods to fetch data from the Spotify API.

Each API returns SpotifyApiResponse.

Functions

Link copied to clipboard
abstract suspend fun getAlbum(id: String, market: String? = null): SpotifyApiResponse<Album, ErrorBody>

Get album API returns the details about an album.

Link copied to clipboard
abstract suspend fun getAlbumTracks(id: String, market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<AlbumTracks, ErrorBody>

Get album tracks API returns all the tracks in an album. This is a paginated API.

Link copied to clipboard
abstract suspend fun getArtist(id: String): SpotifyApiResponse<Artist, ErrorBody>

Get artist API returns the information about the artist.

Link copied to clipboard
abstract suspend fun getArtistAlbums(id: String, includeGroups: List<String> = listOf("album"), market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Albums, ErrorBody>

Get artist albums API returns all the albums of the artist. This is a paginated API.

Link copied to clipboard
abstract suspend fun getArtistTopTracks(id: String, market: String? = null): SpotifyApiResponse<ArtistTopTracks, ErrorBody>

Get artist top tracks API returns the top tracks of the artist.

Link copied to clipboard
abstract suspend fun getCategories(locale: String = "en_US", limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Categories, ErrorBody>

Get categories API returns all available categories. This is a paginated API.

Link copied to clipboard
abstract suspend fun getFeaturedPlaylists(locale: String = "en_US", limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Playlists, ErrorBody>

Get featured playlists API returns the featured playlists. This is a paginated API.

Link copied to clipboard
abstract suspend fun getGenres(): SpotifyApiResponse<Genres, ErrorBody>

Get genres API returns all available genres.

Link copied to clipboard
abstract suspend fun getNewAlbumReleases(limit: Int = 20, offset: Int = 0): SpotifyApiResponse<NewAlbumReleases, ErrorBody>

Get new album releases API returns all the new album releases. This is a paginated API.

Link copied to clipboard
abstract suspend fun getPlaylist(id: String, market: String? = null, fields: List<String>? = null, additionalTypes: List<String> = listOf("track")): SpotifyApiResponse<Playlist, ErrorBody>

Get playlist API returns information about the current playlist.

Link copied to clipboard
abstract suspend fun getPlaylistTracks(id: String, market: String? = null, fields: List<String>? = null, additionalTypes: List<String> = listOf("track"), limit: Int = 20, offset: Int = 0): SpotifyApiResponse<PlaylistTracks, ErrorBody>

Get playlist tracks API returns all the tracks for a particular playlist. This is a paginated API.

Link copied to clipboard

Get recommendations API returns a list of recommended tracks.

Link copied to clipboard

Get related artists API returns the artists similar to the given artist.

Link copied to clipboard
abstract suspend fun searchAlbum(query: String, market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Albums, ErrorBody>

Search album API searches for a album from the given query. This is a paginated API.

Link copied to clipboard
abstract suspend fun searchArtist(query: String, market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Artists, ErrorBody>

Search artist API searches for an artist from the given query. This is a paginated API.

Link copied to clipboard
abstract suspend fun searchPlaylist(query: String, market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Playlists, ErrorBody>

Search playlist API searches for a playlist from the given query. This is a paginated API.

Link copied to clipboard
abstract suspend fun searchTrack(query: String, market: String? = null, limit: Int = 20, offset: Int = 0): SpotifyApiResponse<Tracks, ErrorBody>

Search track API searches for a track from the given query. This is a paginated API.