Documentation
¶
Index ¶
- Variables
- func New(ctx context.Context, spotifyAppClientID string, spotifyAppClientSecret string, ...) spotify.Spotifier
- type Spotify
- func (s *Spotify) AuthStatus(ctx context.Context) (bool, error)
- func (s *Spotify) GetNewUserToken(ctx context.Context) (string, error)
- func (s *Spotify) GetPlaylist(ctx context.Context, playlistID string) (*spotify.Playlist, error)
- func (s *Spotify) GetShow(ctx context.Context, showID string) (*spotify.Show, error)
- func (s *Spotify) Login(ctx context.Context) error
- func (s *Spotify) Logout(ctx context.Context)
- func (s *Spotify) UpdatePlaylistFilter(ctx context.Context, filterConfig *spotify.PlaylistFilterConfig) error
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 ¶
Types ¶
type Spotify ¶
type Spotify struct {
// contains filtered or unexported fields
}
func (*Spotify) AuthStatus ¶ added in v1.1.0
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 ¶
GetNewUserToken returns a new user token, using the refresh token if present or running the full authorization flow otherwise.
func (*Spotify) GetPlaylist ¶
func (*Spotify) Login ¶ added in v1.1.0
Login forces a new OAuth authorization flow, clearing any existing tokens first.
func (*Spotify) Logout ¶ added in v1.1.0
Logout removes all tokens from memory and the cache file. It never fails, even if the user is not logged in.
func (*Spotify) UpdatePlaylistFilter ¶
Click to show internal directories.
Click to hide internal directories.