spotifydefault

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigCacheFilePath = filepath.Join(os.TempDir(), ".spotify-tools-cache.json")

DefaultConfigCacheFilePath is the default path where auth tokens are cached on disk.

Functions

func New

func New(
	ctx context.Context,
	spotifyAppClientID string,
	spotifyAppClientSecret string,
	publicAPIEndpoint string,
	serverListenPort uint16,
	configCacheFilePath string,
) spotify.Spotifier

Types

type Spotify

type Spotify struct {
	// contains filtered or unexported fields
}

func (*Spotify) AuthStatus added in v1.1.0

func (s *Spotify) AuthStatus(ctx context.Context) (bool, error)

AuthStatus checks if the user has a refresh token and whether it is still valid. Returns (loggedIn bool, err error):

  • loggedIn=false, err=nil: not logged in (no refresh token present)
  • loggedIn=true, err=nil: logged in and refresh token is valid
  • loggedIn=true, err!=nil: tokens present but refresh failed

func (*Spotify) GetNewUserToken

func (s *Spotify) GetNewUserToken(ctx context.Context) (string, error)

GetNewUserToken returns a new user token, using the refresh token if present or running the full authorization flow otherwise.

func (*Spotify) GetPlaylist

func (s *Spotify) GetPlaylist(ctx context.Context, playlistID string) (*spotify.Playlist, error)

func (*Spotify) GetShow

func (s *Spotify) GetShow(ctx context.Context, showID string) (*spotify.Show, error)

func (*Spotify) Login added in v1.1.0

func (s *Spotify) Login(ctx context.Context) error

Login forces a new OAuth authorization flow, clearing any existing tokens first.

func (*Spotify) Logout added in v1.1.0

func (s *Spotify) Logout(ctx context.Context)

Logout removes all tokens from memory and the cache file. It never fails, even if the user is not logged in.

func (*Spotify) UpdatePlaylistFilter

func (s *Spotify) UpdatePlaylistFilter(ctx context.Context, filterConfig *spotify.PlaylistFilterConfig) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL