Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenInBrowser ¶
OpenInBrowser opens a given url in the default browser based on each platform
Types ¶
type AlbumArt ¶
type AlbumArt struct { Height int `json:"height"` Url string `json:"url"` Width int `json:"width"` }
AlbumArt to hold images
type ExternalId ¶
type ExternalId struct { Isrc string `json:"isrc"` Ean string `json:"ean"` Upc string `json:"upc"` }
ExternalId struct for storing external urls to spotify
type ExternalUrl ¶
type ExternalUrl struct {
Spotify string `json:"spotify"`
}
ExternalUrl struct for storing external urls to spotify
type FullSoundtrack ¶
type FullSoundtrack struct { Album SimplifiedAlbum `json:"album"` Artists []SimplifiedArtist `json:"artists"` AvailableMarkets []string `json:"available_markets"` 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"` IsPlayable bool `json:"is_playable"` LinkedFrom string `json:"linked_from"` Restrictions string `json:"restrictions"` Name string `json:"name"` Popularity int `json:"popularity"` PreviewUrl string `json:"preview_url"` TrackNumber int `json:"track_number"` Type string `json:"type"` Uri string `json:"uri"` IsLocal bool `json:"is_local"` }
FullSoundtrack for working with storing full soundtrack object
type OAuthToken ¶
type OAuthToken struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
OAuthToken struct used for working with OAuth token
func TestAndSetToken ¶
func TestAndSetToken() (OAuthToken, error)
TestAndSetToken returns an OAuthToken if it can be retrieved from TOKEN_FILE
func (*OAuthToken) GetNewAccessToken ¶
func (token *OAuthToken) GetNewAccessToken() error
GetNewAccessToken returns a new access token and also writes the new tokens in TOKEN_FILE
func (*OAuthToken) SaveTokenToFile ¶
func (token *OAuthToken) SaveTokenToFile(r *http.Response, refreshed bool) error
SaveTokenToFile retrieves access-token and refresh-token from http.Response and persists them to TOKEN_FILE
func (*OAuthToken) ValidateAccessToken ¶
func (token *OAuthToken) ValidateAccessToken() error
ValidateAccessToken checks if access-token has expired or not by hitting Spotify
type RetryRequest ¶
RetryRequest is a mechanism to retry http requests after sometime
func (*RetryRequest) Backoff ¶
func (r *RetryRequest) Backoff(cooldownTime int)
Backoff sets a time.Duration after which one should retry sending an http request
type SimplifiedAlbum ¶
type SimplifiedAlbum struct { AlbumType string `json:"album_type"` Artists []SimplifiedArtist `json:"artists"` AvailableMarkets []string `json:"available_markets"` ExternalUrls ExternalUrl `json:"external_urls"` Href string `json:"href"` Id string `json:"id"` Images []AlbumArt `json:"images"` Name string `json:"name"` ReleaseDate string `json:"release_date"` ReleaseDatePrecision string `json:"release_date_precision"` Restrictions string `json:"restrictions"` Type string `json:"type"` Uri string `json:"uri"` }
AlbumItems to hold an array of Album
type SimplifiedArtist ¶
type SimplifiedArtist struct { Href string `json:"href"` Id string `json:"id"` Name string `json:"name"` Type string `json:"artist"` Uri string `json:"uri"` ExternalUrls ExternalUrl `json:"external_urls"` }
SimplifiedArtist to hold an artist's info
type SimplifiedSoundtrack ¶
Soundtrack for working with sound tracks obtained from albums