Documentation ¶
Index ¶
- func GetAccessTokenFromRefreshToken(refreshToken string, clientId string, clientSecret string) (string, error)
- func GetRedirectLink(callbackUrl string, clientId string, scope string) (string, error)
- type Actions
- type Album
- type AlbumPaging
- type AlbumSimple
- type Artist
- type ArtistPaging
- type ArtistSimple
- type AudioFeatures
- type Category
- type Client
- func (c *Client) GetAlbum(albumId string) (Album, error)
- func (c *Client) GetAlbumTracks(albumId string) (TrackPaging, error)
- func (c *Client) GetCurrentPlayback() (CurrentlyPlayingContext, error)
- func (c *Client) GetCurrentUserProfile() (UserPrivate, error)
- func (c *Client) GetDevices() ([]Device, error)
- func (c *Client) GetRecentlyPlayedTracks() (PlayHistoryCursorBasedPaging, error)
- func (c *Client) GetRecentlyPlayedTracksAfter(after string) (PlayHistoryCursorBasedPaging, error)
- func (c *Client) GetRecentlyPlayedTracksBefore(before string) (PlayHistoryCursorBasedPaging, error)
- func (c *Client) GetUserProfile(userId string) (User, error)
- func (c *Client) Pause() error
- func (c *Client) Play() error
- func (c *Client) PlayTrack(track Track) error
- func (c *Client) PlayTracks(tracks []Track) error
- func (c *Client) RefreshAccessToken() error
- func (c *Client) Search(options SearchOptions) (SearchResult, error)
- type Context
- type Copyright
- type CurrentlyPlayingContext
- type Cursor
- type CursorBasedPaging
- type Device
- type DevicesPayload
- type Disallows
- type Error
- type ExternalIds
- type ExternalUrls
- type Followers
- type Image
- type Paging
- type PlayHistory
- type PlayHistoryCursorBasedPaging
- type PlayerError
- type Playlist
- type PlaylistPaging
- type PlaylistSimple
- type PlaylistTrack
- type RecommendationSeed
- type Recommendations
- type Restrictions
- type SavedAlbum
- type SavedTrack
- type SearchOptions
- type SearchResult
- type State
- type Timestamp
- type Track
- type TrackLink
- type TrackPaging
- type TrackSimple
- type User
- type UserPrivate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Album ¶
type Album struct { AlbumType string `json:"album_type"` Artists []ArtistSimple `json:"artists"` AvailableMarkets []string `json:"available_markets"` Copyrights []Copyright `json:"copyrights"` ExternalIds map[string]string `json:"external_ids"` ExternalUrls map[string]string `json:"external_urls"` Genres []string `json:"genres"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Label string `json:"label"` Name string `json:"name"` Popularity int `json:"popularity"` ReleaseDate string `json:"release_date"` ReleaseDatePrecision string `json:"release_date_precision"` Restrictions Restrictions `json:"restrictions"` Tracks []TrackSimple `json:"tracks"` Type string `json:"type"` Uri string `json:"uri"` }
type AlbumPaging ¶
type AlbumSimple ¶
type AlbumSimple struct { AlbumGroup string `json:"album_group"` AlbumType string `json:"album_type"` Artists []ArtistSimple `json:"artists"` AvailableMarkets []string `json:"available_markets"` ExternalUrls map[string]string `json:"external_url"` Genres []string `json:"genres"` 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"` Restrictions Restrictions `json:"restrictions"` Type string `json:"type"` Uri string `json:"uri"` }
type Artist ¶
type Artist struct { ExternalUrls map[string]string `json:"external_url"` Followers Followers `json:"followers"` Genres []string `json:"genres"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Name string `json:"name"` Popularity int `json:"popularity"` Uri string `json:"uri"` Type string `json:"type"` }
type ArtistPaging ¶
type ArtistSimple ¶
type AudioFeatures ¶
type AudioFeatures struct { Acousticness float32 `json:"acousticness"` AnalysisUrl string `json:"analysis_url"` Danceability float32 `json:"danceability"` DurationMs int `json:"duration_ms"` Energy float32 `json:"energy"` Id string `json:"id"` Instrumentalness float32 `json:"instrumentalness"` Key int `json:"key"` Liveness float32 `json:"liveness"` Loudness float32 `json:"loudness"` Mode int `json:"mode"` Speechiness float32 `json:"speechiness"` Tempo float32 `json:"tempo"` TimeSignature int `json:"time_signature"` TrackHref string `json:"track_href"` Type string `json:"type"` Uri string `json:"uri"` Valence float32 `json:"valence"` }
type Client ¶
func GetClientFromCallback ¶
func (*Client) GetAlbumTracks ¶
func (c *Client) GetAlbumTracks(albumId string) (TrackPaging, error)
func (*Client) GetCurrentPlayback ¶
func (c *Client) GetCurrentPlayback() (CurrentlyPlayingContext, error)
Get information about the user’s current playback state, including track, track progress, and active device.
func (*Client) GetCurrentUserProfile ¶
func (c *Client) GetCurrentUserProfile() (UserPrivate, error)
func (*Client) GetDevices ¶
Get a User's Available Devices
func (*Client) GetRecentlyPlayedTracks ¶
func (c *Client) GetRecentlyPlayedTracks() (PlayHistoryCursorBasedPaging, error)
Get tracks from the current user’s recently played tracks. Returns the most recent 20 tracks played by a user. Note that a track currently playing will not be visible in play history until it has completed. A track must be played for more than 30 seconds to be included in play history. Any tracks listened to while the user had “Private Session” enabled in their client will not be returned in the list of recently played tracks.
func (*Client) GetRecentlyPlayedTracksAfter ¶
func (c *Client) GetRecentlyPlayedTracksAfter(after string) (PlayHistoryCursorBasedPaging, error)
The endpoint uses a bidirectional cursor for paging. Follow the next field with the before parameter to move back in time, or use the after parameter to move forward in time. If you supply no before or after parameter, the endpoint will return the most recently played songs, and the next link will page back in time.
func (*Client) GetRecentlyPlayedTracksBefore ¶
func (c *Client) GetRecentlyPlayedTracksBefore(before string) (PlayHistoryCursorBasedPaging, error)
The endpoint uses a bidirectional cursor for paging. Follow the next field with the before parameter to move back in time, or use the after parameter to move forward in time. If you supply no before or after parameter, the endpoint will return the most recently played songs, and the next link will page back in time.
func (*Client) PlayTracks ¶
Start/Resume a User's Playback
func (*Client) RefreshAccessToken ¶
func (*Client) Search ¶
func (c *Client) Search(options SearchOptions) (SearchResult, error)
Search for an item
type CurrentlyPlayingContext ¶
type CurrentlyPlayingContext struct { Device Device `json:"device"` RepeatState string `json:"repeat_state"` ShuffleState bool `json:"shuffle_state"` Context Context `json:"context"` Timestamp int `json:"timestamp"` ProgressMs int `json:"progress_ms"` IsPlaying bool `json:"is_playing"` Item Track `json:"item"` CurrentlyPlayingType string `json:"currently_playing_type"` Actions Actions `json:"actions"` }
type CursorBasedPaging ¶
type DevicesPayload ¶
type DevicesPayload struct {
Devices []Device `json:"devices"`
}
type ExternalIds ¶
type ExternalUrls ¶
type PlayHistory ¶
type PlayHistory struct { Track TrackSimple `json:"track"` PlayedAt string `json:"played_at"` Context Context `json:"context"` }
type PlayerError ¶
type Playlist ¶
type Playlist struct { Collaborative bool `json:"collaborative"` Descriptions string `json:"descriptions"` ExternalUrls map[string]string `json:"external_urls"` Followers Followers `json:"followers"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Name string `json:"name"` Owner User `json:"owner"` Public bool `json:"public"` SnapshotId string `json:"snapshot_id"` Tracks Paging `json:"tracks"` Type string `json:"type"` Uri string `json:"uri"` }
type PlaylistPaging ¶
type PlaylistSimple ¶
type PlaylistSimple struct { Collaborative bool `json:"collaborative"` Descriptions string `json:"descriptions"` ExternalUrls map[string]string `json:"external_urls"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Name string `json:"name"` Owner User `json:"owner"` Public bool `json:"public"` SnapshotId string `json:"snapshot_id"` Tracks Paging `json:"tracks"` Type string `json:"type"` Uri string `json:"uri"` }
type PlaylistTrack ¶
type RecommendationSeed ¶
type Recommendations ¶
type Recommendations struct { Seeds []RecommendationSeed `json:"seeds"` Tracks []TrackSimple `json:"tracks"` }
type Restrictions ¶
type Restrictions interface{}
type SavedAlbum ¶
type SavedTrack ¶
type SearchOptions ¶
type SearchOptions struct { // Required. // Search query keywords and optional field filters and operators. // Example: "One Dance Drake" Query string `url:"q"` // Required. // A comma-separated list of item types to search across. // Valid types are: album, artist, playlist, and track. // Example: "album,track" returns both albums and tracks. Type string `url:"type"` // Optional. // An ISO 3166-1 alpha-2 country code or the string from_token. // If a country code is specified, only artists, albums, and tracks with content that is playable in that market is returned. Market string `url:"market,omitempty"` // Optional. // Maximum number of results to return. // Default: 20 // Minimum: 1 // Maximum: 50 // The limit is applied within each type, not on the total response. // For example, if the limit value is 3 and the type is artist, album, the response contains 3 artists and 3 albums. Limit int `url:"limit,omitempty"` // Optional. // The index of the first result to return. // Default: 0 (the first result). // Maximum offset (including limit): 10,000. // Use with limit to get the next page of search results. Offset int `url:"offset,omitempty"` // Optional. // Possible values: audio // If include_external=audio is specified the response will include any relevant audio content that is hosted externally. // By default external content is filtered out from responses. IncludeExternal string `url:"include_external,omitempty"` }
type SearchResult ¶
type SearchResult struct { Tracks TrackPaging `json:"tracks"` Albums AlbumPaging `json:"albums"` Artists ArtistPaging `json:"artists"` Playlists PlaylistPaging `json:"playlists"` }
Data structure for a response from a search
type Track ¶
type Track struct { Album AlbumSimple `json:"album"` Artists []ArtistSimple `json:"artists"` AvailableMarkets []string `json:"available_markets"` DiscNumber int `json:"disc_number"` DurationMs int `json:"duration_ms"` Explicit bool `json:"explicit"` ExternalIds map[string]string `json:"external_ids"` Href string `json:"href"` Id string `json:"id"` IsPlayable bool `json:"is_playable"` LinkedFrom TrackLink `json:"linked_from"` Restrictions Restrictions `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"` }
type TrackPaging ¶
type TrackSimple ¶
type TrackSimple struct { Artists []ArtistSimple `json:"artists"` AvailableMarkets []string `json:"available_markets"` DiscNumber int `json:"disc_number"` DurationMs int `json:"duration_ms"` Explicit bool `json:"explicit"` ExternalIds map[string]string `json:"external_ids"` Href string `json:"href"` Id string `json:"id"` IsPlayable bool `json:"is_playable"` LinkedFrom TrackLink `json:"linked_from"` Restrictions Restrictions `json:"restrictions"` Name string `json:"name"` PreviewUrl string `json:"preview_url"` TrackNumber int `json:"track_number"` Type string `json:"type"` Uri string `json:"uri"` IsLocal bool `json:"is_local"` }
type UserPrivate ¶
type UserPrivate struct { Country string `json:"country"` DisplayName string `json:"display_name"` Email string `json:"email"` ExternalUrls map[string]string `json:"external_urls"` Followers Followers `json:"followers"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Product string `json:"product"` Type string `json:"type"` Uri string `json:"uri"` }