package dev.fyloz.musicplayer.modules.spotify import dev.fyloz.musicplayer.core.http.HttpProvider import dev.fyloz.musicplayer.modules.spotify.api.SearchResponse import dev.fyloz.musicplayer.modules.spotify.api.Track class SpotifyApiProvider : HttpProvider("https://api.spotify.com/v1") { suspend fun search(query: String, type: String, accessToken: String): Collection = get("search", accessToken) { url { parameters.append("q", query) parameters.append("type", type) parameters.append("include_external", "audio") parameters.append("limit", "50") parameters.append("offset", "0") } }.tracks.items suspend fun getSongById(songId: String, accessToken: String): Track = get("tracks/$songId", accessToken) }