I am trying to get new-releases from Spotify API, but it returns only object with null fields
Here's my retrfofit interface :
interface SpotifyApiService {
@GET("browse/new-releases")
suspend fun getAlbums(
@Query("limit") limit: Int,
@Header("Authorization") authorization: String
): Albums
// gets authorization token
@POST("api/token")
@FormUrlEncoded
suspend fun getToken(
@Header("Authorization") auth: String,
@Header("Content-Type") content: String,
@Field("grant_type") grantType: String
): TokenResponse
}
Albums data class:
@kotlinx.serialization.Serializable
data class Albums(
val limit: Int,
val next: String,
val previous: String,
val total: Int,
val items: List<Album>
)
What can I do? I've tried add all required parameters as spotify api reference says but it didn't help
Solution: i declared new class with albums field of type Albums and make it as returned type of request function type