Skip to content

A fast, minimal Go wrapper for Spotify's Web API

Notifications You must be signed in to change notification settings

omegastreamtv/Spotify

Repository files navigation

Spotify

Coverage

Spotify is a Go wrapper for Spotify's web API.

Install

go get github.com/omegastreamtv/spotify
client, err := spotify.NewClient(
	spotify.WithClientID(os.Getenv("SPOTIFY_ID")),
	spotify.WithClientSecret(os.Getenv("SPOTIFY_SECRET")),
	spotify.WithRedirectURI("http://localhost:8080/callback"),
)

client.SetAppAccessToken(token.AccessToken)

album, err := client.GetAlbum("382ObEPsp2rxGrnsizN5TX", "es")

if err != nil {
	if spotifyErr, ok := err.(*spotify.SpotifyError); ok {
		fmt.Println(spotifyErr.Err.Status, spotifyErr.Err.Message)
	}
}

fmt.Println(album.Name)

Endpoints

All Params, Body, and Response types are named exactly the same as their functions.

Albums

Artists

Audiobooks

Categories

Chapters

Episodes

Genres

Markets

Player

Playlists

Search

Shows

Tracks

Users