spotify

package
v0.0.0-...-d9e7967 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiClient = InitApi()
View Source
var BadRequest = errors.New("bad request")
View Source
var NotFoundError = errors.New("not found")
View Source
var NotValidTokenError = errors.New("not valid token")
View Source
var OAuthClient = InitOAuth()
View Source
var TokenNotExpired = errors.New("token not expired")

Functions

This section is empty.

Types

type Album

type Album struct {
	ID   string
	Name string
}

type ApiContext

type ApiContext struct {
	requests.RequestClient
	// contains filtered or unexported fields
}

func InitApi

func InitApi() ApiContext

func (*ApiContext) AddQueue

func (c *ApiContext) AddQueue(spotifyUri string) error

func (*ApiContext) AddTracks

func (c *ApiContext) AddTracks(ID string) error

func (*ApiContext) GetAllHistory

func (c *ApiContext) GetAllHistory() ([]History, error)

func (*ApiContext) GetHistory

func (c *ApiContext) GetHistory(limit int) (spotify_type.RecentlyPlayed, error)

GetHistory docs ApiContext: https://developer.spotify.com/documentation/web-api/reference/player/get-recently-played/

func (*ApiContext) GetPlayNow

func (c *ApiContext) GetPlayNow() (spotify_type.CurrentlyPlaying, error)

GetPlayNow docs ApiContext: https://developer.spotify.com/documentation/web-api/reference/player/get-the-users-currently-playing-track/

func (*ApiContext) GetPlayer

func (c *ApiContext) GetPlayer() (spotify_type.Player, error)

func (*ApiContext) Next

func (c *ApiContext) Next() error

func (*ApiContext) Play

func (c *ApiContext) Play(spotifyUri string) error

func (ApiContext) SetUserToken

func (c ApiContext) SetUserToken(token string) ApiContext

type Artists

type Artists struct {
	ID   string
	Name string
	Href string
}

type History

type History struct {
	ID         string
	PlayNow    bool
	URL        string
	Name       string
	PreviewURL string
	Img        string
	Album      Album
	Artists    []Artists
}

type OAuth

type OAuth struct {
	requests.RequestClient

	AuthorizationUrl *url.URL
	AccessTokenUrl   string
	ApiUrl           string

	RedirectUri string
	OAuthScope  string
	// contains filtered or unexported fields
}

func InitOAuth

func InitOAuth() OAuth

func (*OAuth) GetAccessOrRefreshToken

func (c *OAuth) GetAccessOrRefreshToken(code string) (spotify_type.TokenOrRefreshReq, error)

func (*OAuth) GetOAthUrl

func (c *OAuth) GetOAthUrl(state string) string

func (*OAuth) RefreshToken

func (c *OAuth) RefreshToken(token string) (spotify_type.TokenReq, error)

type QueryError

type QueryError struct {
	Query string
	Err   error
}

type RefreshTokenRes

type RefreshTokenRes struct {
	AccessToken string
	Expired     int64
}

func RefreshToken

func RefreshToken(refreshToken string, expired int64) (RefreshTokenRes, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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