spotify

package
v0.0.0-...-3c70f01 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAPIBaseURL = "https://api.spotify.com/v1"
	RefreshTokenURL   = "https://accounts.spotify.com/api/token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	AlbumType            string      `json:"album_type"`
	Artists              []Artist    `json:"artists"`
	ExternalUrls         ExternalUrl `json:"external_urls"`
	Href                 string      `json:"href"`
	Id                   string      `json:"id"`
	Images               []Image     `json:"images"`
	Name                 string      `json:"name"`
	ReleaseDate          string      `json:"release_date"`
	ReleaseDatePrecision string      `json:"release_date_precision"`
	TotalTracks          int         `json:"total_tracks"`
	Type                 string      `json:"type"`
	Uri                  string      `json:"uri"`
}

type Artist

type Artist struct {
	ExternalUrls ExternalUrl `json:"external_urls"`
	Href         string      `json:"href"`
	Id           string      `json:"id"`
	Name         string      `json:"name"`
	Type         string      `json:"type"`
	Uri          string      `json:"uri"`
}

type Client

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

func NewClient

func NewClient(options *Options) (client *Client, err error)

func (*Client) EnqueueSong

func (c *Client) EnqueueSong(id string) (err error)

func (*Client) GetSongInfo

func (c *Client) GetSongInfo(id string) (resp *SongInfoResponse, err error)

func (*Client) RefreshUserAccessToken

func (c *Client) RefreshUserAccessToken(refreshToken string) (resp *RefreshTokenResponse, err error)

func (*Client) SetUserAccessToken

func (c *Client) SetUserAccessToken(token string)

type ExternalID

type ExternalID struct {
	Isrc string `json:"isrc"`
}

type ExternalUrl

type ExternalUrl struct {
	Spotify string `json:"spotify"`
}

type Image

type Image struct {
	Height int    `json:"height"`
	Url    string `json:"url"`
	Width  int    `json:"width"`
}

type Options

type Options struct {
	ClientID        string
	ClientSecret    string
	APIBaseURL      string
	UserAccessToken string
}

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
}

type SongInfoResponse

type SongInfoResponse struct {
	Album        Album       `json:"album"`
	Artists      []Artist    `json:"artists"`
	DiscNumber   int         `json:"disc_number"`
	DurationMs   int         `json:"duration_ms"`
	Explicit     bool        `json:"explicit"`
	ExternalIds  ExternalID  `json:"external_ids"`
	ExternalUrls ExternalUrl `json:"external_urls"`
	Href         string      `json:"href"`
	Id           string      `json:"id"`
	IsLocal      bool        `json:"is_local"`
	Name         string      `json:"name"`
	Popularity   int         `json:"popularity"`
	TrackNumber  int         `json:"track_number"`
	Type         string      `json:"type"`
	Uri          string      `json:"uri"`
}

Jump to

Keyboard shortcuts

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