Skip to content

Blad3Mak3r/Kotify

Repository files navigation

Kotify Maven Central GitHub release (latest by date)

Advanced coroutine-based Spotify API wrapper for Kotlin.

Contens

TODO

  • Rate limits handling.
  • Kotify Http Proxy.
  • Better documentation.

Authentication

  • Client Credentials Flow (used to authenticate Kotify).
  • Authorization Code Flow (used by HUGE).
  • Token Refresh (used by HUGE).

Albums

  • Get Album. Used by HUGE
  • Get Several Albums.
  • Get Album Tracks. Used by HUGE
  • Get Saved Albums.
  • Save Albums.
  • Remove Albums.
  • Check Saved Albums.
  • Get New Releases.

Artists

  • Get Artist. Used by HUGE
  • Get Several Artists.
  • Get Artist's Albums.
  • Get Artist's Top Tracks. Used by HUGE
  • Get Artist's Related Artists.

Shows

  • Get Shows.
  • Get Several Shows.
  • Get Show Episodes.
  • Get User's Saved Shows.
  • Save Shows for Current User.
  • Remove User's Saved Shows.
  • Check User's Saved Shows.

Episodes

  • Get Episode.
  • Get Several Episodes.
  • Get User's Saved Episodes.
  • Save Episodes for User.
  • Remove User's Saved Episodes.
  • Check User's Saved Episodes.

Tracks

  • Get Track. Used by HUGE
  • Get Several Tracks.
  • Get User's Saved Tracks. Used by HUGE
  • Save Tracks for Current User.
  • Remove Tracks for Current User.
  • Check User's Saved Tracks.
  • Get Track's Audio Features.
  • Get Track's Audio Analysis.
  • Get Recommendations. Used by HUGE

Search

  • Search for Item.

Users:

  • Get Current User's Profile.
  • Get User's Top Items. Used by HUGE
  • Get User's Profile
  • Follow Playlist.
  • Unfollow Playlist.
  • Get Followed Artists.
  • Follow Artists or Users.
  • Unfollow Artists or Users.
  • Check If User Follows Artists or Users.
  • Check if Users Follow Playlist.

Playlists:

  • Get Playlist. Used by HUGE
  • Change Playlist Details.
  • Get Playlist Items. Used by HUGE
  • Add Items to Playlist.
  • Update Playlist Items.
  • Remove Playlist Items.
  • Get Current User's Playlists. Used by HUGE
  • Get User's Playlist.
  • Create Playlist.
  • Get Featured Playlists. Used by HUGE
  • Get Category's Playlists.
  • Get Playlist Cover Image.
  • Add Custom Playlist Cover Image.

Categories

  • Get Several Brows Categories.
  • Get Single Brows Category.

Genres

  • Get Available Genre Seeds.

Player

  • Get Playback State.
  • Transfer Playback.
  • Get Available Devices.
  • Get Currently Playing Track.
  • Start/Resume Playback.
  • Pause Playback.
  • Skip To Next.
  • Skip To Previous.
  • Seek To Position.
  • Set Repeat Mode.
  • Set Playback Volume.
  • Toggle Playback Shuffle.
  • Get Recently Played Tracks.
  • Add Item to Playback Queue.

Markets

  • Get Available Markets.

Prerequisites

This package has the following requirements:

Getting started

Configure the Kotify instance and execute requests:

suspend fun main() {

    val kotify = Kotify(
        clientId = "Spotify Client ID",
        clientSecret = "Spotify Client Secret"
    )

    // Fetch "This Is Arcane" playlist.
    val playlist: Playlist = kotify.playlists.get("37i9dQZF1DZ06evO30uMeI")
    
    // This will retrieve all the items inside the playlist
    // If the playlist have less than 100 tracks this is not required.
    val items: List<Item> = kotify.playlists.retrieveAllTracks(playlist)
    val tracks: List<Track> = items.map { it.track }
    
    // Fetch "Burn It All Down" track
    val track = kotify.tracks.get("0ked784BOZ1JtRVHux98jE")
}

Download

repositories {
    mavenCentral()
}

dependencies {
    implementation("tv.blademaker:kotify:${VERSION}")
}