helper

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(cmd *cobra.Command, viper *viper.Viper, cfgFile string, conf *Config)

Auth authenticates with Spotify and refreshes the token

func CreateConfig added in v0.5.1

func CreateConfig(cfgFile string)

CreateConfig initializes a skeleton config

func Pause

func Pause(conf *Config)

Pause wraps the spotify.Client.Pause() method for easy error checking

func Play

func Play(conf *Config)

Play wraps the spotify.Client.Play() method for easy error checking

func RefreshToken

func RefreshToken(client string, secret string, refreshToken string) *oauth2.Token

RefreshToken refreshes the auth token from Spotify TODO: #4 Replace implementation with vanilla oauth2 use

func SetClient

func SetClient(conf *Config)

SetClient sets the Client field of Config struct to a valid Spotify client The Token field in the Config struct must be set

func SetupConfig added in v0.5.1

func SetupConfig() string

SetupConfig sets up the path and type of the config for Viper and also returns the full path to the config

Types

type Config

type Config struct {
	ClientID string
	Secret   string
	Token    oauth2.Token
	Client   spotify.Client
	DeviceID spotify.ID
}

Config stores constantly accessed variables in memory

Jump to

Keyboard shortcuts

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