Documentation
¶
Index ¶
- type Artist
- type AuthManager
- type Authorizer
- type Client
- type Config
- type Credentials
- type ExternalUrls
- type Followers
- type Image
- type NamedNode
- type Node
- type Page
- type Restrictions
- type SearchClient
- type SearchRequest
- type SearchResponse
- type SimpleAlbum
- type SimpleArtist
- type SimplePlaylist
- type Token
- type TopItemsRequest
- type TopItemsResponse
- type TopItemsType
- type Track
- type User
- type UserClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
type AuthManager struct {
// contains filtered or unexported fields
}
func NewAuthManager ¶
func NewAuthManager(cfg *Config) *AuthManager
func (*AuthManager) Server ¶
func (manager *AuthManager) Server() Authorizer
func (*AuthManager) User ¶
func (manager *AuthManager) User(code string) Authorizer
type Authorizer ¶
type Client ¶
type Client struct {
http.Client
Authorizer Authorizer
}
type Config ¶
type Config struct {
Credentials `yaml:",inline"`
RedirectURI string `yaml:"redirect_uri"`
}
type Credentials ¶
type Credentials struct {
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
}
func (Credentials) Userinfo ¶
func (c Credentials) Userinfo() string
type ExternalUrls ¶
type ExternalUrls struct {
Spotify string `json:"spotify"`
}
type Restrictions ¶
type Restrictions struct {
Reason string `json:"reason"`
}
type SearchClient ¶
type SearchClient struct{ Client }
func (*SearchClient) Search ¶
func (c *SearchClient) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
type SearchRequest ¶
type SearchResponse ¶
type SimpleAlbum ¶
type SimpleAlbum struct {
NamedNode
AlbumType string `json:"album_type"`
Artists []SimpleArtist `json:"artists"`
AvailableMarkets []string `json:"available_markets"`
ExternalUrls ExternalUrls `json:"external_urls"`
Images []Image `json:"images"`
ReleaseDate string `json:"release_date"`
ReleaseDatePrecision string `json:"release_date_precision"`
Restrictions Restrictions `json:"restrictions"`
TotalTracks int `json:"total_tracks"`
}
type SimpleArtist ¶
type SimpleArtist struct {
NamedNode
ExternalUrls ExternalUrls `json:"external_urls"`
}
type SimplePlaylist ¶
type SimplePlaylist struct {
NamedNode
Collaborative bool `json:"collaborative"`
Description string `json:"description"`
ExternalUrls ExternalUrls `json:"external_urls"`
Images []Image `json:"images"`
Public bool `json:"public"`
SnapshotId string `json:"snapshot_id"`
Owner struct {
Node
ExternalUrls ExternalUrls `json:"external_urls"`
Followers Followers `json:"followers"`
DisplayName *string `json:"display_name"`
} `json:"owner"`
Tracks struct {
Href string `json:"href"`
Total int `json:"total"`
} `json:"tracks"`
}
type Token ¶
type Token struct {
AccessToken string
RefreshToken string
TokenType string
ExpiresIn time.Time
Scope string
}
func (*Token) UnmarshalJSON ¶
type TopItemsRequest ¶
type TopItemsResponse ¶
type TopItemsType ¶
type TopItemsType interface{ Track | Artist }
type Track ¶
type Track struct {
NamedNode
Album SimpleAlbum `json:"album"`
Artists []Artist `json:"artists"`
AvailableMarkets []string `json:"available_markets"`
DiscNumber int `json:"disc_number"`
DurationMs int `json:"duration_ms"`
Explicit bool `json:"explicit"`
ExternalUrls ExternalUrls `json:"external_urls"`
IsPlayable bool `json:"is_playable"`
LinkedFrom struct{} `json:"linked_from"`
Popularity int `json:"popularity"`
PreviewUrl *string `json:"preview_url"`
Restrictions Restrictions `json:"restrictions"`
TrackNumber int `json:"track_number"`
IsLocal bool `json:"is_local"`
ExternalIds struct {
Isrc string `json:"isrc"`
Ean string `json:"ean"`
Upc string `json:"upc"`
} `json:"external_ids"`
}
type UserClient ¶
type UserClient struct{ Client }
func (*UserClient) TopArtists ¶
func (c *UserClient) TopArtists(ctx context.Context, req TopItemsRequest) (*TopItemsResponse[Artist], error)
func (*UserClient) TopTracks ¶
func (c *UserClient) TopTracks(ctx context.Context, req TopItemsRequest) (*TopItemsResponse[Track], error)
Click to show internal directories.
Click to hide internal directories.