Skip to content

rubenquadros/KoVibes

Repository files navigation

KoVibes

KoVibes is a Kotlin wrapper for the Spotify Web API.

Maven Central Github Actions codecov License: MIT Kotlin

Usage 💻

Include the dependency

Android:
 
implementation("io.github.rubenquadros:kovibes-android:{latest_version}")
JVM:
 
implementation("io.github.rubenquadros:kovibes-jvm:{latest_version}")

KovibesApi is the entry class.

val config: Config = Config()
val spotifyService: SpotifyService = KoVibesApi.createSpotifyService("id", "secret", config)

id is the Client ID and secret is the Client Secret.

config is used to configure the logging level. If you do not provide your config then the default one is used.

To create your Client ID and Client Secret, please follow the Spotify documentation.

The Client ID and the Client Secret is required for authentication.

SpotifyService is the interface which provides all the methods to fetch the Spotify data.

Each API in SpotifyService returns a SpotifyApiResponse.

sealed interface SpotifyApiResponse<out RESPONSE, out ERROR> {
    //returns when the underlying call to fetch data was successful
    data class Success<RESPONSE>(val result: RESPONSE): SpotifyApiResponse<RESPONSE, Nothing>

    //returns when the underlying call to fetch data was not successful
    data class Error<ERROR>(val body: ERROR): SpotifyApiResponse<Nothing, ERROR>
}

Please refer to the full API reference for the documentation.

Please refer to the Spotify Web API documentation to know more about the Spotify API.

Examples 💡

All the examples are in the example module.

To run the examples, you will have to create your app in the Spotify portal.

Once you have registered your app, you will be be able to see the Client ID and the Client Secret.

Make sure to set your Client ID and Client Secret in your local.properties as client.id and client.secret.

Future scope 🔮

I need your help! All feedback is welcome!

At the moment, only a handful of Spotify APIs are present. The end goal is to have all the Spotify APIs in the library.

  • Add more spotify APIs
  • Add support for iOS
  • Add an iOS example
  • Create a logo

Contributing ♥️

If you wish to contribute then please read the contributing guidelines.