Documentation ¶
Index ¶
- type Actions
- type AudioAnalysis
- type AudioFeature
- type AudioRecording
- type AudioResumePoint
- type Author
- type BaseAudioAnalysis
- type Category
- type CategoryChunk
- type Chunk
- type Context
- type Copyright
- type Cursors
- type DescribedPlaylist
- type Device
- type Error
- type ExplicitContent
- type ExternalId
- type ExternalURL
- type Follower
- type FullAlbum
- type FullArtist
- type FullArtistChunk
- type FullAudiobook
- type FullChapter
- type FullEpisode
- type FullPlaylist
- type FullShow
- type FullTrack
- type FullTrackChunk
- type Image
- type Interval
- type Item
- type ItemType
- type Linked
- type Meta
- type Narrator
- type Param
- func AdditionalTypes(types string) Param
- func After(num int) Param
- func Before(num int) Param
- func DeviceId(id string) Param
- func Fields(names string) Param
- func IncludeExternal(external string) Param
- func IncludeGroups(keywords string) Param
- func Limit(num int) Param
- func Locale(name string) Param
- func Market(name string) Param
- func MaxAcousticness(num float64) Param
- func MaxDanceability(num float64) Param
- func MaxDurationMs(num int) Param
- func MaxEnergy(num float64) Param
- func MaxInstrumentalness(num float64) Param
- func MaxKey(num int) Param
- func MaxLiveness(num float64) Param
- func MaxLoudness(num float64) Param
- func MaxMode(num int) Param
- func MaxPopularity(num int) Param
- func MaxSpeechiness(num float64) Param
- func MaxTempo(num float64) Param
- func MaxTimeSignature(num int) Param
- func MaxValence(num float64) Param
- func MinAcousticness(num float64) Param
- func MinDanceability(num float64) Param
- func MinDurationMs(num int) Param
- func MinEnergy(num float64) Param
- func MinInstrumentalness(num float64) Param
- func MinKey(num int) Param
- func MinLiveness(num float64) Param
- func MinLoudness(num float64) Param
- func MinMode(num int) Param
- func MinPopularity(num int) Param
- func MinSpeechiness(num float64) Param
- func MinTempo(num float64) Param
- func MinTimeSignature(num int) Param
- func MinValence(num float64) Param
- func Offset(num int) Param
- func Position(num int) Param
- func SeedArtists(ids string) Param
- func SeedGenres(names string) Param
- func SeedTracks(ids string) Param
- func TargetAcousticness(num float64) Param
- func TargetDanceability(num float64) Param
- func TargetDurationMs(num int) Param
- func TargetEnergy(num float64) Param
- func TargetInstrumentalness(num float64) Param
- func TargetKey(num int) Param
- func TargetLiveness(num float64) Param
- func TargetLoudness(num float64) Param
- func TargetMode(num int) Param
- func TargetPopularity(num int) Param
- func TargetSpeechiness(num float64) Param
- func TargetTempo(num float64) Param
- func TargetTimeSignature(num int) Param
- func TargetValence(num float64) Param
- func URIs(ids string) Param
- type PlayHistory
- type Playback
- type PlaylistOwner
- type PlaylistTrack
- type PlaylistTrackChunk
- type Property
- func Collaborative(state bool) Property
- func ContextURI(uri string) Property
- func Description(description string) Property
- func DeviceIds(ids []string) Property
- func InsertBefore(num int) Property
- func Name(name string) Property
- func Play(state bool) Property
- func PositionMs(num int) Property
- func PropertyOffset(v interface{}) Property
- func PropertyPosition(num int) Property
- func PropertyURIs(uris []string) Property
- func Public(state bool) Property
- func RangeLength(num int) Property
- func RangeStart(num int) Property
- func SnapshotId(id string) Property
- func Tracks(v []interface{}) Property
- type RecentlyPlayedTracks
- type Recommendation
- type RecommendationSeed
- type Restriction
- type SavedAlbum
- type SavedAlbumChunk
- type SavedEpisode
- type SavedEpisodeChunk
- type SavedTrack
- type SavedTrackChunk
- type SearchResult
- type Sections
- type Segments
- type SimplifiedAlbum
- type SimplifiedAlbumChunk
- type SimplifiedArtist
- type SimplifiedAudiobook
- type SimplifiedAudiobookChunk
- type SimplifiedChapter
- type SimplifiedChapterChunk
- type SimplifiedEpisode
- type SimplifiedEpisodeChunk
- type SimplifiedPlaylist
- type SimplifiedPlaylistChunk
- type SimplifiedShow
- type SimplifiedShowChunk
- type SimplifiedTrack
- type SimplifiedTrackChunk
- type Snapshot
- type Spotify
- func (s *Spotify) AddCustomPlaylistCoverImage(id, data string) error
- func (s *Spotify) AddItemToPlaybackQueue(URI string, params ...Param) error
- func (s *Spotify) AddItemsToPlaylist(id string, properties []Property, params ...Param) (*Snapshot, error)
- func (s *Spotify) ChangePlaylistDetails(id string, properties []Property) error
- func (s *Spotify) CheckIfUserFollowsArtistsOrUsers(idType string, ids []string) ([]bool, error)
- func (s *Spotify) CheckIfUsersFollowPlaylist(playlistId string, ids []string) ([]bool, error)
- func (s *Spotify) CheckUserSavedAlbums(ids []string) ([]bool, error)
- func (s *Spotify) CheckUserSavedAudiobooks(ids []string) ([]bool, error)
- func (s *Spotify) CheckUserSavedEpisodes(ids []string) ([]bool, error)
- func (s *Spotify) CheckUserSavedShows(ids []string) ([]bool, error)
- func (s *Spotify) CheckUserSavedTracks(ids []string) ([]bool, error)
- func (s *Spotify) CreatePlaylist(userId string, name Property, properties []Property) error
- func (s *Spotify) Delete(response interface{}, endpoint string, body []byte, params ...Param) error
- func (s *Spotify) FollowArtistsOrUsers(idType string, ids []string) error
- func (s *Spotify) FollowPlaylist(playlistId string, properties []Property) error
- func (s *Spotify) Get(response interface{}, endpoint string, params ...Param) error
- func (s *Spotify) GetAlbum(id string, params ...Param) (*FullAlbum, error)
- func (s *Spotify) GetAlbumTracks(id string, params ...Param) (*SimplifiedTrackChunk, error)
- func (s *Spotify) GetAlbums(ids []string, params ...Param) ([]*FullAlbum, error)
- func (s *Spotify) GetArtist(id string) (*FullArtist, error)
- func (s *Spotify) GetArtistAlbums(id string, params ...Param) (*SimplifiedAlbumChunk, error)
- func (s *Spotify) GetArtistRelatedArtists(id string) ([]*FullArtist, error)
- func (s *Spotify) GetArtistTopTracks(id string, params ...Param) ([]*FullTrack, error)
- func (s *Spotify) GetArtists(ids []string) ([]*FullArtist, error)
- func (s *Spotify) GetAudiobook(id string, params ...Param) (*FullAudiobook, error)
- func (s *Spotify) GetAudiobookChapters(id string, params ...Param) (*SimplifiedChapterChunk, error)
- func (s *Spotify) GetAudiobooks(ids []string, params ...Param) ([]*FullAudiobook, error)
- func (s *Spotify) GetAvailableDevices() ([]*Device, error)
- func (s *Spotify) GetAvailableGenreSeeds() (*[]string, error)
- func (s *Spotify) GetAvailableMarkets() (*[]string, error)
- func (s *Spotify) GetBrowseCategories(params ...Param) (*CategoryChunk, error)
- func (s *Spotify) GetBrowseCategory(id string, params ...Param) (*Category, error)
- func (s *Spotify) GetCategoryPlaylists(categoryId string, params ...Param) (*DescribedPlaylist, error)
- func (s *Spotify) GetChapter(id string, params ...Param) (*FullChapter, error)
- func (s *Spotify) GetChapters(ids []string, params ...Param) ([]*FullChapter, error)
- func (s *Spotify) GetCurrentUserPlaylists(params ...Param) (*SimplifiedPlaylistChunk, error)
- func (s *Spotify) GetCurrentUserProfile() (*User, error)
- func (s *Spotify) GetCurrentlyPlayingTrack(params ...Param) (*Playback, error)
- func (s *Spotify) GetEpisode(id string, params ...Param) (*FullEpisode, error)
- func (s *Spotify) GetEpisodes(ids []string, params ...Param) ([]*FullEpisode, error)
- func (s *Spotify) GetFeaturedPlaylists(params ...Param) (*DescribedPlaylist, error)
- func (s *Spotify) GetFollowedArtists(idType string, params ...Param) (*FullArtistChunk, error)
- func (s *Spotify) GetNewReleases(params ...Param) (*SimplifiedAlbumChunk, error)
- func (s *Spotify) GetPlaybackState(params ...Param) (*Playback, error)
- func (s *Spotify) GetPlaylist(id string, params ...Param) (*FullPlaylist, error)
- func (s *Spotify) GetPlaylistCoverImage(id string) ([]*Image, error)
- func (s *Spotify) GetPlaylistItems(id string, params ...Param) (*PlaylistTrackChunk, error)
- func (s *Spotify) GetRecentlyPlayedTracks(params ...Param) (*RecentlyPlayedTracks, error)
- func (s *Spotify) GetRecommendations(params ...Param) (*Recommendation, error)
- func (s *Spotify) GetShow(id string, params ...Param) (*FullShow, error)
- func (s *Spotify) GetShowEpisodes(id string, params ...Param) (*SimplifiedEpisodeChunk, error)
- func (s *Spotify) GetShows(ids []string, params ...Param) ([]*FullShow, error)
- func (s *Spotify) GetTrack(id string, params ...Param) (*FullTrack, error)
- func (s *Spotify) GetTrackAudioAnalysis(id string) (*AudioAnalysis, error)
- func (s *Spotify) GetTrackAudioFeatures(id string) (*AudioFeature, error)
- func (s *Spotify) GetTracks(ids []string, params ...Param) ([]*FullTrack, error)
- func (s *Spotify) GetTracksAudioFeatures(ids []string) ([]*AudioFeature, error)
- func (s *Spotify) GetUserPlaylists(userId string, params ...Param) (*SimplifiedPlaylistChunk, error)
- func (s *Spotify) GetUserProfile(id string) (*User, error)
- func (s *Spotify) GetUserQueue() (*UserQueue, error)
- func (s *Spotify) GetUserSavedAlbums(params ...Param) (*SavedAlbumChunk, error)
- func (s *Spotify) GetUserSavedAudiobooks(params ...Param) (*SimplifiedAudiobookChunk, error)
- func (s *Spotify) GetUserSavedEpisodes(params ...Param) (*SavedEpisodeChunk, error)
- func (s *Spotify) GetUserSavedShows(params ...Param) (*SimplifiedShowChunk, error)
- func (s *Spotify) GetUserSavedTracks(params ...Param) (*SavedTrackChunk, error)
- func (s *Spotify) GetUserTopItems(itemsType string, params ...Param) (*UserItemChunk, error)
- func (s *Spotify) PausePlayback(params ...Param) error
- func (s *Spotify) Post(response interface{}, endpoint string, body []byte, params ...Param) error
- func (s *Spotify) Put(response interface{}, endpoint string, body []byte, params ...Param) error
- func (s *Spotify) PutImage(response interface{}, endpoint, body string, params ...Param) error
- func (s *Spotify) RemovePlaylistItem(id string, properties []Property) (*Snapshot, error)
- func (s *Spotify) RemoveUserSavedAlbums(ids []string) error
- func (s *Spotify) RemoveUserSavedAudiobooks(ids []string) error
- func (s *Spotify) RemoveUserSavedEpisodes(ids []string) error
- func (s *Spotify) RemoveUserSavedShows(ids []string, params ...Param) error
- func (s *Spotify) RemoveUserSavedTracks(ids []string) error
- func (s *Spotify) SaveAlbumsForCurrentUser(ids []string) error
- func (s *Spotify) SaveAudiobooksForCurrentUser(ids []string) error
- func (s *Spotify) SaveEpisodesForCurrentUser(ids []string) error
- func (s *Spotify) SaveShowsForCurrentUser(ids []string) error
- func (s *Spotify) SaveTracksForCurrentUser(ids []string) error
- func (s *Spotify) Search(q string, types []string, params ...Param) (*SearchResult, error)
- func (s *Spotify) SeekToPosition(positionMs int, params ...Param) error
- func (s *Spotify) SetPlaybackVolume(volumePercent int, params ...Param) error
- func (s *Spotify) SetRepeatMode(state string, params ...Param) error
- func (s *Spotify) SkipToNext(params ...Param) error
- func (s *Spotify) SkipToPrevious(params ...Param) error
- func (s *Spotify) StartResumePlayback(properties []Property, params ...Param) error
- func (s *Spotify) TogglePlaybackShuffle(state bool, params ...Param) error
- func (s *Spotify) TransferPlayback(deviceIds Property, properties []Property) error
- func (s *Spotify) UnfollowArtistsOrUsers(idType string, ids []string) error
- func (s *Spotify) UnfollowPlaylist(playlistId string) error
- func (s *Spotify) UpdatePlaylistItems(id string, properties []Property, params ...Param) (*Snapshot, error)
- type TrackAnalysis
- type User
- type UserItemChunk
- type UserQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions struct { // Interrupting playback. Optional field. InterruptingPlayback bool `json:"interrupting_playback"` // Pausing. Optional field. Pausing bool `json:"pausing"` // Resuming. Optional field. Resuming bool `json:"resuming"` // Seeking playback location. Optional field. Seeking bool `json:"seeking"` // Skipping to the next context. Optional field. SkippingNext bool `json:"skipping_next"` // Skipping to the previous context. Optional field. SkippingPrev bool `json:"skipping_prev"` // Toggling repeat context flag. Optional field. TogglingRepeatContext bool `json:"toggling_repeat_context"` // Toggling shuffle flag. Optional field. TogglingShuffle bool `json:"toggling_shuffle"` // Toggling repeat track flag. Optional field. TogglingRepeatTrack bool `json:"toggling_repeat_track"` // Transfering playback between devices. Optional field. TransferingPlayback bool `json:"transfering_playback"` }
Actions allows to update the user interface based on which playback actions are available within the current context.
type AudioAnalysis ¶
type AudioAnalysis struct { Meta Meta `json:"meta"` Track TrackAnalysis `json:"track"` // The time intervals of the bars throughout the track. // A bar (or measure) is a segment of time defined as a given number of beats. Bars []Interval `json:"bars"` // The time intervals of beats throughout the track. // A beat is the basic time unit of a piece of music; // for example, each tick of a metronome. // Beats are typically multiples of tatums. Beats []Interval `json:"beats"` // Sections are defined by large variations in rhythm or timbre, // e.g. chorus, verse, bridge, guitar solo, etc. // Each section contains its own descriptions of tempo, key, mode, time_signature, and loudness. Sections []Sections `json:"sections"` // Each segment contains a roughly conisistent sound throughout its duration. Segments []Segments `json:"segments"` // A tatum represents the lowest regular pulse train that // a listener intuitively infers from the timing of perceived musical events (segments). Tatums []Interval `json:"tatums"` }
AudioAnalysis contains audio analysis data for one track that can be returned from the Spotify API
type AudioFeature ¶
type AudioFeature struct { // A confidence measure from 0.0 to 1.0 of whether the track is acoustic. // 1.0 represents high confidence the track is acoustic. Accousticness float32 `json:"accousticness"` // A URL to access the full audio analysis of this track. // An access token is required to access this data. AnalysisUrl string `json:"analysis_url"` // Danceability describes how suitable a track is for dancing based on // a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. // A value of 0.0 is least danceable and 1.0 is most danceable. Danceability float32 `json:"danceability"` // The duration of the track in milliseconds. DurationMs int `json:"duration_ms"` // Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. // Typically, energetic tracks feel fast, loud, and noisy. // For example, death metal has high energy, while a Bach prelude scores low on the scale. // Perceptual features contributing to this attribute include // dynamic range, perceived loudness, timbre, onset rate, and general entropy. Energy float32 `json:"energy"` // The Spotify ID for the track. Id string `json:"id"` // Predicts whether a track contains no vocals. // "Ooh" and "aah" sounds are treated as instrumental in this context. // Rap or spoken word tracks are clearly "vocal". // The closer the instrumentalness value is to 1.0, // the greater likelihood the track contains no vocal content. // Values above 0.5 are intended to represent instrumental tracks, // but confidence is higher as the value approaches 1.0. Instrumentalness float32 `json:"instrumentalness"` // The key the track is in. // Integers map to pitches using standard Pitch Class notation. // E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. // If no key was detected, the value is -1. Key int `json:"key"` // Detects the presence of an audience in the recording. // Higher liveness values represent an increased probability that the track was performed live. // A value above 0.8 provides strong likelihood that the track is live. Liveness float32 `json:"liveness"` // The overall loudness of a track in decibels (dB). // Loudness values are averaged across the entire track and // are useful for comparing relative loudness of tracks. // Loudness is the quality of a sound that is // the primary psychological correlate of physical strength (amplitude). // Values typically range between -60 and 0 db. Loudness float32 `json:"loudness"` // Mode indicates the modality (major or minor) of a track, // the type of scale from which its melodic content is derived. // Major is represented by 1 and minor is 0. Mode int `json:"mode"` // Speechiness detects the presence of spoken words in a track. // The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), // the closer to 1.0 the attribute value. // Values above 0.66 describe tracks that are probably made entirely of spoken words. // Values between 0.33 and 0.66 describe tracks that may contain both music and speech, // either in sections or layered, including such cases as rap music. // Values below 0.33 most likely represent music and other non-speech-like tracks. Speechiness float32 `json:"speechiness"` // The overall estimated tempo of a track in beats per minute (BPM). // In musical terminology, tempo is the speed or pace of a given piece and // derives directly from the average beat duration. Tempo float32 `json:"tempo"` // An estimated time signature. The time signature (meter) is // a notational convention to specify how many beats are in each bar (or measure). // The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4". TimeSignature int `json:"time_signature"` // A link to the Web API endpoint providing full details of the track. TrackHref string `json:"track_href"` // The object type. Type string `json:"type"` // The Spotify URI for the track. URI string `json:"uri"` // A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. // Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), // while tracks with low valence sound more negative (e.g. sad, depressed, angry). Valence float32 `json:"valence"` }
AudioFeature contains data about all the audio features for one track that can be returned from the Spotify API
type AudioRecording ¶
type AudioRecording struct { // The audio recording length in milliseconds. DurationMs int `json:"duration_ms"` // Whether or not the audio recording has explicit content (true = yes it does; false = no it does not OR unknown). Explicit bool `json:"explicit"` // External URLs for this audio recording. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the audio recording. Href string `json:"href"` // The Spotify ID for the audio recording. Id string `json:"id"` // True if the audio recording is playable in the given market. Otherwise false. IsPlayable bool `json:"is_playable"` // The name of the audio recording. Name string `json:"name"` // Included in the response when a content restriction is applied. Restrictions Restriction `json:"restrictions"` }
AudioRecording contains common fields for Spotify API audio recordings, such as
- Chatper
- Episode
- Track
type AudioResumePoint ¶
type AudioResumePoint struct { // Whether or not the episode has been fully played by the user. FullyPlayed bool `json:"fully_played"` // The user's most recent position in the episode in milliseconds. ResumePositionMs int `json:"resume_position_ms"` }
AudioResumePoint contains the user's most recent position
type Author ¶
type Author struct { // The name of the author. Name string `json:"name"` }
Author represents the author(s) for the audiobook.
type BaseAudioAnalysis ¶
type BaseAudioAnalysis struct { // The overall loudness of a track/section in decibels (dB). // Loudness values are averaged across the entire track/section and // are useful for comparing relative loudness of tracks/sections. // Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). // Values typically range between -60 and 0 db. Loudness float32 `json:"loudness"` // The overall estimated tempo of a track/section in beats per minute (BPM). // In musical terminology, tempo is the speed or pace of a given piece and // derives directly from the average beat duration. Tempo float32 `json:"tempo"` // The confidence, from 0.0 to 1.0, of the reliability of the tempo. TempoConfidence float32 `json:"tempo_confidence"` // The key the track/section is in. // Integers map to pitches using standard Pitch Class notation. // E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. // If no key was detected, the value is -1. Key int `json:"key"` // The confidence, from 0.0 to 1.0, of the reliability of the key. KeyConfidence float32 `json:"key_confidence"` // Mode indicates the modality (major or minor) of a track/section, // the type of scale from which its melodic content is derived. // Major is represented by 1 and minor is 0. Mode int `json:"mode"` // The confidence, from 0.0 to 1.0, of the reliability of the mode. ModeConfidence float32 `json:"mode_confidence"` // An estimated time signature. // The time signature (meter) is a notational convention to specify // how many beats are in each bar (or measure). // The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4". TimeSignature int `json:"time_signature"` // The confidence, from 0.0 to 1.0, of the reliability of the time_signature. TimeSignatureConfidence float32 `json:"time_signature_confidence"` }
BaseAudioAnalysis contains base audio analysis results contained in some of the analysis parts
type Category ¶
type Category struct { // A link to the Web API endpoint returning full details of the category. Href string `json:"href"` // The category icon, in various sizes. Icons []Image `json:"icons"` // The Spotify category ID of the category. Id string `json:"id"` // The name of the category. Name string `json:"name"` }
Category contains the category data that can be returned by the Spotify API It is used to tag items in Spotify.
type CategoryChunk ¶
CategoryChunk represents a paged set of Category items
type Chunk ¶
type Chunk struct { // A link to the Web API endpoint returning the full result of the request Href string `json:"href"` // The maximum number of items in the response (as set in the query or by default). Limit int `json:"limit"` // URL to the next page of items. ( null if none) Next string `json:"next"` // The offset of the items returned (as set in the query or by default) Offset int `json:"offset"` // URL to the previous page of items. ( null if none) Previous string `json:"previous"` // The total number of items available to return. Total int `json:"total"` }
Chunk represents paged set of data
type Context ¶
type Context struct { // The object type, e.g. "artist", "playlist", "album", "show". Type string `json:"type"` // A link to the Web API endpoint providing full details of the track. Href string `json:"href"` // External URLs for this context. ExternalURLs ExternalURL `json:"external_urls"` // The Spotify URI for the context. URI string `json:"uri"` }
Context containts the playback context data that can be returned by the Spotify API.
type Copyright ¶
type Copyright struct { // The copyright text for this content. Text string `json:"text"` // The type of copyright: C = the copyright, P = the sound recording (performance) copyright. Type string `json:"type"` }
Copyright represents the copyright statements.
type Cursors ¶
type Cursors struct { // The cursor to use as key to find the next page of items. After string `json:"after"` // The cursor to use as key to find the previous page of items. Before string `json:"before"` }
Cursors used to find the next set of items.
type DescribedPlaylist ¶
type DescribedPlaylist struct { // The localized message of a playlist. Message string `json:"message"` Playlists SimplifiedPlaylistChunk `json:"playlists"` }
DescribedPlaylist represents a paged set of SimplifiedPlaylist items
type Device ¶
type Device struct { // The device ID. This ID is unique and persistent to some extent. // However, this is not guaranteed and any cached device_id should // periodically be cleared out and refetched as necessary. Id string `json:"id"` // If this device is the currently active device. IsActive bool `json:"is_active"` // If this device is currently in a private session. IsPrivateSession bool `json:"is_private_session"` // Whether controlling this device is restricted. // At present if this is "true" then no Web API commands will be accepted by this device. IsRestricted bool `json:"is_restricted"` // A human-readable name for the device. // Some devices have a name that the user can configure (e.g. "Loudest speaker") // and some devices have a generic name associated with the manufacturer or device model. Name string `json:"name"` // Device type, such as "computer", "smartphone" or "speaker". Type string `json:"type"` // The current volume in percent. VolumePercent int `json:"volume_percent"` // If this device can be used to set the volume. SupportsVolume bool `json:"supports_volume"` }
Deivce contains the device data that can be returned by the Spotify API.
type Error ¶
Error contains the status and message that can be received from the Spotify API if the request fails.
type ExplicitContent ¶
type ExplicitContent struct { // When true, indicates that explicit content should not be played. FilterEnabled bool `json:"filter_enabled"` // When true, indicates that the explicit content setting is locked and can't be changed by the user. FilterLocked bool `json:"filter_locked"` }
The user's explicit content settings.
type ExternalId ¶
type ExternalId struct { // International Standard Recording Code Isrc string `json:"isrc"` // International Article Number Ean string `json:"ean"` // Universal Product Code Upc string `json:"upc"` }
ExternalId contins known external IDs for the object.
type ExternalURL ¶
type ExternalURL struct { // The Spotify URL for the object. Spotify string `json:"spotify"` }
ExternalURL contains known external URLs for the object.
type Follower ¶
type Follower struct { // This will always be set to null, as the Web API does not support it at the moment. Href string `json:"href"` // The total number of followers. Total float64 `json:"total"` }
Follower contains information about the followers of the object.
type FullAlbum ¶
type FullAlbum struct { SimplifiedAlbum // The tracks of the album. Tracks SimplifiedTrackChunk `json:"tracks"` // The copyright statements of the album. Copyrights []Copyright `json:"copyrights"` // Known external IDs for the album. ExternalIds ExternalId `json:"external_ids"` // A list of the genres the album is associated with. If not yet classified, the array is empty. Genres []string `json:"genres"` // The label associated with the album. Label string `json:"label"` // The popularity of the album. The value will be between 0 and 100, with 100 being the most popular. Popularity int `json:"popularity"` }
FullAlbum contains all the data about the album that can be returned by the Spotify API. It contains all the fields of the SimplifiedAlbum struct, plus some additional fields.
type FullArtist ¶
type FullArtist struct { SimplifiedArtist // Information about the followers of the artist. Followers Follower `json:"followers"` // A list of the genres the artist is associated with. If not yet classified, the array is empty. Genres []string `json:"genres"` // Images of the artist in various sizes, widest first. Images []Image `json:"images"` // The popularity of the artist. The value will be between 0 and 100, with 100 being the most popular. // The artist's popularity is calculated from the popularity of all the artist's tracks. Popularity float64 `json:"popularity"` }
FullArtist contains all the data about the artist that can be returned by the Spotify API. It contains all the fields of the SimplifiedArtist struct, plus some additional fields.
type FullArtistChunk ¶
type FullArtistChunk struct { Chunk Items []FullArtist `json:"items"` }
FullArtistChunk represents a paged set of FullArtist items
type FullAudiobook ¶
type FullAudiobook struct { SimplifiedAudiobook // The chapters of the audiobook. Chapters SimplifiedChapterChunk `json:"chapters"` }
FullAudiobook contains all the data about the audiobook that can be returned by the Spotify API. It contains all the fields of the SimplifiedAudiobook struct, plus related chapters.
type FullChapter ¶
type FullChapter struct { SimplifiedChapter // The audiobook for which the chapter belongs. Audiobook SimplifiedAudiobook `json:"audiobook"` }
FullChapter contains all the data about the audiobook chapter that can be returned by the Spotify API. It contains all the fields of the SimplifiedChapter struct, plus related Audiobook.
type FullEpisode ¶
type FullEpisode struct { SimplifiedEpisode // The show on which the episode belongs. Show SimplifiedShow `json:"show"` }
FullEpisode contains all the data about the show episode that can be returned by the Spotify API. It contains all the fields of the SimplifiedEpisode struct, plus related Show.
type FullPlaylist ¶
type FullPlaylist struct { SimplifiedPlaylist // Information about the followers of the playlist. Followers Follower `json:"followers"` }
FullPlaylist contains all the data about the playlist that can be returned by the Spotify API. It contains all the fields of the FullPlaylist struct, plus Followers.
type FullShow ¶
type FullShow struct { SimplifiedShow // The episodes of the show. Episodes SimplifiedEpisodeChunk `json:"episodes"` }
FullShow contains all the data about the show that can be returned by the Spotify API. It contains all the fields of the SimplifiedAlbum struct, plus some additional fields.
type FullTrack ¶
type FullTrack struct { SimplifiedTrack // The album on which the track appears. // The album object includes a link in href to full information about the album. Album SimplifiedAlbum `json:"album"` // Known external IDs for the track. ExternalIds ExternalId `json:"external_ids"` }
FullTrack contains all the data about the album track that can be returned by the Spotify API. It contains all the fields of the SimplifiedTrack struct, plus related Album and ExternalIds.
type FullTrackChunk ¶
FullTrackChunk represents a paged set of FullTrack items
type Image ¶
type Image struct { // The source URL of the image. URL string `json:"url"` // The image height in pixels. Height float64 `json:"height"` // The image width in pixels. Width float64 `json:"width"` }
Image contains images of the object in various sizes, widest first.
type Interval ¶
type Interval struct { // The starting point (in seconds) of the interval Start float32 `json:"start"` // The duration (in seconds) of the interval Duration float32 `json:"duration"` // The confidence, from 0.0 to 1.0, of the reliability of the interval's "designation". Confidence float32 `json:"confidence"` }
Inteval contains data about start and duration of a audio analysis metric
type Item ¶
type Item struct { Artist FullArtist Track FullTrack Episode FullEpisode // Instead of checking every object for nil, this field can be used. // Supported Types: // // - artist // // - track // // - episode Type string }
Item struct is used to correctly parse JSON "oneOf" type.
func (*Item) UnmarshalJSON ¶
UnmarshalJson is a custom Unmarshaler implementation, used to parse "oneOf" type into one of the supported by Item struct types.
type Linked ¶
type Linked struct { // Known external URLs for this track. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the track. Href string `json:"href"` // The Spotify ID for the track. Id string `json:"id"` // The object type: "track". Type string `json:"type"` // The Spotify URI for the track. URI string `json:"uri"` }
Linked contains information about the track originally requested, but which has been replaced by another track using Track Linking.
type Meta ¶
type Meta struct { // The version of the Analyzer used to analyze this track. AnalyzerVersion string `json:"analyzer_version"` // The platform used to read the track's audio data. Platform string `json:"platform"` // A detailed status code for this track. If analysis data is missing, this code may explain why. DetailedStatus string `json:"detailed_status"` // The return code of the analyzer process. 0 if successful, 1 if any errors occurred. StatusCode int `json:"status_code"` // The Unix timestamp (in seconds) at which this track was analyzed. Timestamp int `json:"timestamp"` // The amount of time taken to analyze this track. AnalysisTime float32 `json:"analysis_time"` // The method used to read the track's audio data. InputProcess string `json:"input_process"` }
Meta contains meta data about the audio analysis that can be returned from Spotify API
type Narrator ¶
type Narrator struct { // The name of the Narrator. Name string `json:"name"` }
Narrator represents the narrator(s) for the audiobook.
type Param ¶
Param used to dynamically add Parameters to endpoint URL. Value supplied to the Param function will be added to endpoint URL during request creation
func AdditionalTypes ¶
A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode.
Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.
In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the type field of each object.
func After ¶
A Unix timestamp in milliseconds. Returns all items after (but not including) this cursor position. If after is specified, before must not be specified.
func Before ¶
A Unix timestamp in milliseconds. Returns all items before (but not including) this cursor position. If before is specified, after must not be specified.
func DeviceId ¶
The id of the device the command is targeting. If not supplied, the user's currently active device is the target.
func Fields ¶
Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the playlist”s description and URI: fields=description,uri. A dot separator can be used to specify non-reoccurring fields, while parentheses can be used to specify reoccurring fields within objects. For example, to get just the added date and user ID of the adder: fields=tracks.items(added_at,added_by.id). Use multiple parentheses to drill down into nested objects, for example:
fields=tracks.items(track(name,href,album(name,href))). Fields can be excluded by prefixing them with an exclamation mark, for example: fields=tracks.items(track(name,href,album(!name,href)))
func IncludeExternal ¶
If include_external=audio is specified it signals that the client can play externally hosted audio content, and marks the content as playable in the response. By default externally hosted audio content is marked as unplayable in the response.
func IncludeGroups ¶
A comma-separated list of keywords that will be used to filter the response. If not supplied, all album types will be returned.
Valid values are:
- album
- single
- appears_on
- compilation
For example: include_groups=album,single.
func Locale ¶
The desired language, consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code, joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)". Provide this parameter if you want the category strings returned in a particular language.
Note: if locale is not supplied, or if the specified language is not available, the category strings returned will be in the Spotify default language (American English).
func Market ¶
An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.
Note: If neither market or user country are provided, the content is considered unavailable for the client. Users can view the country that is associated with their account in the account settings.
func MaxAcousticness ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxDanceability ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxDurationMs ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxEnergy ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxInstrumentalness ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxKey ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxLiveness ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxLoudness ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxMode ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxPopularity ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxSpeechiness ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxTempo ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxTimeSignature ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MaxValence ¶
For each tunable track attribute, a hard ceiling on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, max_instrumentalness=0.35 would filter out most tracks that are likely to be instrumental.
func MinAcousticness ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinDanceability ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinDurationMs ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinEnergy ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinInstrumentalness ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinKey ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinLiveness ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinLoudness ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinMode ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinPopularity ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinSpeechiness ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinTempo ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinTimeSignature ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func MinValence ¶
For each tunable track attribute, a hard floor on the selected track attribute’s value can be provided. See tunable track attributes below for the list of available options. For example, min_tempo=140 would restrict results to only those tracks with a tempo of greater than 140 beats per minute.
func Offset ¶
The index of the first item to return. Default: 0 (the first item). Use with limit to get the next set of items.
func Position ¶
The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0; to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
func SeedArtists ¶
A comma separated list of Spotify IDs for seed artists. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.
Note: only required if seed_genres and seed_tracks are not set.
func SeedGenres ¶
A comma separated list of any genres in the set of available genre seeds. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.
Note: only required if seed_artists and seed_tracks are not set.
func SeedTracks ¶
A comma separated list of Spotify IDs for a seed track. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.
Note: only required if seed_artists and seed_genres are not set.
func TargetAcousticness ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetDanceability ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetDurationMs ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetEnergy ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetInstrumentalness ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetKey ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetLiveness ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetLoudness ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetMode ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetPopularity ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetSpeechiness ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetTempo ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetTimeSignature ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
func TargetValence ¶
For each of the tunable track attributes (below) a target value may be provided. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy=0.6 and target_danceability=0.8. All target values will be weighed equally in ranking results.
type PlayHistory ¶
type PlayHistory struct { // The track the user listened to. Track FullTrack `json:"track"` // The date and time the track was played. PlayedAt string `json:"played_at"` // The context the track was played from. Context Context `json:"context"` }
PlayHistory containts the playback history data that can be returned by the Spotify API.
type Playback ¶
type Playback struct { // The device that is currently active. Device Device `json:"device"` // off, track, context RepeatState string `json:"repeat_state"` // If shuffle is on or off. ShuffleState bool `json:"shuffle_state"` // A Context Object. Can be null. Context Context `json:"context"` // Unix Millisecond Timestamp when data was fetched. Timestamp int `json:"timestamp"` // Progress into the currently playing track or episode. Can be null. ProgressMs int `json:"progress_ms"` // If something is currently playing, return true. IsPlaying bool `json:"is_playing"` // The currently playing track or episode. Can be null. Item Item `json:"item"` // The object type of the currently playing item. Can be one of track, episode, ad or unknown. CurrentlyPlayingType string `json:"currently_playing_type"` Actions Actions `json:"actions"` }
Playback containts the playback data that can be returned by the Spotify API.
type PlaylistOwner ¶
type PlaylistOwner struct { // Known public external URLs for this user. ExternalURLs ExternalURL `json:"external_urls"` // Information about the followers of this user. Followers Follower `json:"followers"` // A link to the Web API endpoint for this user. Href string `json:"href"` // The Spotify user ID for this user. Id string `json:"id"` // The object type. Type string `json:"type"` // The Spotify URI for this user. URI string `json:"uri"` // The name displayed on the user's profile. null if not available. DisplayName string `json:"display_name"` }
PlaylistOwner contains the playlist owner data that can be returned by the Spotify API.
type PlaylistTrack ¶
type PlaylistTrack struct { // The date and time the track or episode was added. // // Note: some very old playlists may return null in this field. AddedAt string `json:"added_at"` // The Spotify user who added the track or episode. // // Note: some very old playlists may return null in this field. AddedBy PlaylistOwner `json:"added_by"` // Whether this track or episode is a local file or not. IsLocal bool `json:"is_local"` // Information about the track or episode. Track Item `json:"track"` }
PlaylistTrack contains the playlist track data that can be returned by the Spotify API.
type PlaylistTrackChunk ¶
type PlaylistTrackChunk struct { Chunk Items []PlaylistTrack `json:"items"` }
PlaylistTrackChunk represents a paged set of PlaylistTrack items
type Property ¶
type Property func(b map[string]interface{})
func Collaborative ¶
If true, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. Note: You can only set collaborative to true on non-public playlists.
func ContextURI ¶
Spotify URI of the context to play. Valid contexts are albums, artists & playlists.
{context_uri:"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"}
func Description ¶
Value for playlist description as displayed in Spotify Clients and in the Web API.
func DeviceIds ¶
A JSON array containing the ID of the device on which playback should be started/transferred.
For example:{device_ids:["74ASZWbe4lXaubB36ztrGX"]}
Note: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return 400 Bad Request
func InsertBefore ¶
The position where the items should be inserted.
To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.
Examples:
To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.
To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.
func Play ¶
true: ensure playback happens on new device.
false or not provided: keep the current playback state.
func PropertyOffset ¶
func PropertyOffset(v interface{}) Property
Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object "position" is zero based and can’t be negative. Example: "offset": {"position": 5} "uri" is a string representing the uri of the item to start at. Example: "offset": {"uri": "spotify:track:1301WleyT98MSxVHPZCA6M"}
func PropertyPosition ¶
The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0 ; to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}
func PropertyURIs ¶
A JSON array of the Spotify URIs.
For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}
func RangeLength ¶
The amount of items to be reordered. Defaults to 1 if not set.
The range of items to be reordered begins from the range_start position, and includes the range_length subsequent items.
Example:
To move the items at index 9-10 to the start of the playlist, range_start is set to 9, and range_length is set to 2.
func SnapshotId ¶
The playlist's snapshot ID against which you want to make the changes.
func Tracks ¶
func Tracks(v []interface{}) Property
An array of objects containing Spotify URIs of the tracks or episodes to remove. For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }. A maximum of 100 objects can be sent at once.
type RecentlyPlayedTracks ¶
type RecentlyPlayedTracks struct { // A link to the Web API endpoint returning the full result of the request. Href string `json:"href"` // The maximum number of items in the response (as set in the query or by default). Limit int `json:"limit"` // URL to the next page of items. ( null if none) Next string `json:"next"` Cursors Cursors `json:"cursors"` // URL to the next page of items. ( null if none) Total int `json:"total"` Items []PlayHistory `json:"items"` }
RecentlyPlayedTracks represents a paged set of PlayHistory items
type Recommendation ¶
type Recommendation struct { Seeds []RecommendationSeed `json:"seeds"` Tracks []FullTrack `json:"tracks"` }
Recommandation contains the recommendation data that can be returned from the Spotify API
type RecommendationSeed ¶
type RecommendationSeed struct { // The number of tracks available after min_* and max_* filters have been applied. AfterFilteringSize int `json:"after_filtering_size"` // The number of tracks available after relinking for regional availability. AfterRelinkingSize int `json:"after_relinking_size"` // A link to the full track or artist data for this seed. // For tracks this will be a link to a Track Object. // For artists a link to an Artist Object. // For genre seeds, this value will be null. Href string `json:"href"` // The id used to select this seed. // This will be the same as the string used in the seed_artists, seed_tracks or seed_genres parameter. Id string `json:"id"` // The number of recommended tracks available for this seed. InitialPoolSize int `json:"initial_pool_size"` // The entity type of this seed. One of artist, track or genre. Type string `json:"type"` }
RecommendationSeed contains the seed data related to the requested recommendation that can be returned from the Spotify API
type Restriction ¶
type Restriction struct { // The reason for the restriction. // Objects may be restricted if the content is not available in a given market, // to the user's subscription type, or when the user's account is set to not play explicit content. // Additional reasons may be added in the future. Reason string `json:"reason"` }
Restriction is included in the response when a content restriction is applied.
type SavedAlbum ¶
type SavedAlbum struct { // The date and time the album was saved. // Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. AddedAt string `json:"added_at"` Album FullAlbum `json:"album"` }
SavedAlbum contains all the fields of the FullAlbum, plus the time when the album was saved by the user.
type SavedAlbumChunk ¶
type SavedAlbumChunk struct { Chunk Items []SavedAlbum `json:"items"` }
SavedAlbumChunk represents a paged set of SavedAlbum items
type SavedEpisode ¶
type SavedEpisode struct { // The date and time the episode was saved. // Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. AddedAt string `json:"added_at"` Episode FullEpisode `json:"episode"` }
SavedEpisode contains all the fields of the FullEpisode, plus the time when the episode was saved by the user.
type SavedEpisodeChunk ¶
type SavedEpisodeChunk struct { Chunk Items []SavedEpisode `json:"items"` }
SavedEpisodeChunk represents a paged set of SavedEpisode items
type SavedTrack ¶
type SavedTrack struct { // The date and time the track was saved. // Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. // If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; // see for example, release_date in an album object. AddedAt string `json:"added_at"` Track FullTrack `json:"track"` }
SavedTrack contains all the fields of the FullTrack, plus the time when the track was saved by the user.
type SavedTrackChunk ¶
type SavedTrackChunk struct { Chunk Items []SavedTrack `json:"items"` }
SavedTrackChunk represents a paged set of SavedTrack items
type SearchResult ¶
type SearchResult struct { Tracks FullTrackChunk `json:"tracks"` Artists FullArtistChunk `json:"artists"` Albums SimplifiedAlbumChunk `json:"albums"` Playlists SimplifiedPlaylistChunk `json:"playlists"` Shows SimplifiedShowChunk `json:"shows"` Episodes SimplifiedEpisodeChunk `json:"episodes"` Audiobooks SimplifiedAudiobookChunk `json:"audiobooks"` }
SearchResult contains the search result data that can be returned by the Spotify API.
type Sections ¶
type Sections struct { Interval BaseAudioAnalysis }
Sections are defined by large variations in rhythm or timbre, e.g. chorus, verse, bridge, guitar solo, etc. Each section contains its own descriptions of tempo, key, mode, time_signature, and loudness.
type Segments ¶
type Segments struct { Interval `json:"interval"` // The onset loudness of the segment in decibels (dB). // Combined with loudness_max and loudness_max_time, // these components can be used to describe the "attack" of the segment. LoudnessStart float32 `json:"loudness_start"` // The peak loudness of the segment in decibels (dB). // Combined with loudness_start and loudness_max_time, // these components can be used to describe the "attack" of the segment. LoudnessMax float32 `json:"loudness_max"` // The segment-relative offset of the segment peak loudness in seconds. // Combined with loudness_start and loudness_max, // these components can be used to desctibe the "attack" of the segment. LoudnessMaxTime float32 `json:"loudness_max_time"` // The offset loudness of the segment in decibels (dB). // This value should be equivalent to the loudness_start of the following segment. LoudnessEnd float32 `json:"loudness_end"` // Pitch content is given by a “chroma” vector, // corresponding to the 12 pitch classes C, C#, D to B, // with values ranging from 0 to 1 that describe the relative dominance // of every pitch in the chromatic scale. // For example a C Major chord would likely be represented by // large values of C, E and G (i.e. classes 0, 4, and 7). // // Vectors are normalized to 1 by their strongest dimension, // therefore noisy sounds are likely represented by // values that are all close to 1, while pure tones are // described by one value at 1 (the pitch) and others near 0. Pitches []float32 `json:"pitches"` // Timbre is the quality of a musical note or sound that // distinguishes different types of sical instruments, or voices. // It is a complex notion also referred to as sound color, texture, or // tone quality, and is derived from the shape of a segment’s // spectro-temporal surface, independently of pitch and loudness. // The timbre feature is a vector that includes 12 unbounded values // roughly centered around 0. Those values are high level abstractions // of the spectral surface, ordered by degree of importance. // // For completeness however, the first dimension represents // the average loudness of the segment; second emphasizes brightness; // third is more closely correlated to the flatness of a sound; // fourth to sounds with a stronger attack; etc. // // The actual timbre of the segment is best described as // a linear combination of these 12 basis functions weighted // by the coefficient values: timbre = c1 x b1 + c2 x b2 + ... + c12 x b12, // where c1 to c12 represent the 12 coefficients and b1 to b12 the 12 basis functions. // Timbre vectors are best used in comparison with each other. Timbre []float32 `json:"timbre"` }
Each segment contains a roughly conisistent sound throughout its duration.
type SimplifiedAlbum ¶
type SimplifiedAlbum struct { // The type of the album. AlbumType string `json:"album_type"` // The number of tracks in the album. TotalTracks int `json:"total_tracks"` // The markets in which the album is available: ISO 3166-1 alpha-2 country codes. // // NOTE: an album is considered available in a market when at least 1 of its tracks // is available in that market. AvailableMarkets []string `json:"available_markets"` // Known external URLs for this album. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the album. Href string `json:"href"` // The Spotify ID for the album. Id string `json:"id"` // The cover art for the album in various sizes, widest first. Images []Image `json:"images"` // The name of the album. In case of an album takedown, the value may be an empty string. Name string `json:"name"` // The date the album was first released. ReleaseDate string `json:"release_date"` // The precision with which release_date value is known. ReleaseDatePrecision string `json:"release_date_precision"` // Included in the response when a content restriction is applied. Restrictions Restriction `json:"restrictions"` // The object type. Type string `json:"type"` // The Spotify URI for the album. Uri string `json:"uri"` // The artists of the album. Each artist object includes a link in href to more detailed information about the artist. Artists []SimplifiedArtist `json:"artists"` }
SimplifiedAlbum contains the minimum album data that can be returned by the Spotify API.
type SimplifiedAlbumChunk ¶
type SimplifiedAlbumChunk struct { Chunk Items []SimplifiedAlbum `json:"items"` }
SimplifiedAlbumChunk represents a paged set of SimplifiedAlbum items
type SimplifiedArtist ¶
type SimplifiedArtist struct { // Known external URLs for this artist. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the artist. Href string `json:"href"` // The Spotify ID for the artist. Id string `json:"id"` // The name of the artist. Name string `json:"name"` // The object type. Type string `json:"type"` // The Spotify URI for the artist. Uri string `json:"uri"` }
SimplifiedArtist contains the minimum artist data that can be returned by the Spotify API.
type SimplifiedAudiobook ¶
type SimplifiedAudiobook struct { Authors []Author `json:"authors"` // A list of the countries in which the audiobook can be played, identified by their ISO 3166-1 alpha-2 code. AvailableMarkets []string `json:"available_markets"` // The copyright statements of the audiobook. Copyrights []Copyright `json:"copyrights"` // A description of the audiobook. // HTML tags are stripped away from this field, use html_description field in case HTML tags are needed. Description string `json:"description"` // A description of the audiobook. This field may contain HTML tags. HtmlDescription string `json:"html_description"` // The edition of the audiobook. Edition string `json:"edition"` // Whether or not the audiobook has explicit content (true = yes it does; false = no it does not OR unknown). Explicit bool `json:"explicit"` // External URLs for this audiobook. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the audiobook. Href string // The Spotify ID for the audiobook. Id string // The cover art for the audiobook in various sizes, widest first. Images []Image // A list of the languages used in the audiobook, identified by their ISO 639 code. Languages []string // The media type of the audiobook. MediaType string // The name of the audiobook. Name string Narrators []Narrator // The publisher of the audiobook. Publisher string // The object type. Type string // The Spotify URI for the audiobook. URI string // The number of chapters in this audiobook. TotalChapters int }
SimplifiedAudiobook contains the minimum audiobook data that can be returned by the Spotify API.
type SimplifiedAudiobookChunk ¶
type SimplifiedAudiobookChunk struct { Chunk Items []SimplifiedAudiobook `json:"items"` }
SimplifiedAudiobookChunk represents a paged set of SimplifiedAudiobook items
type SimplifiedChapter ¶
type SimplifiedChapter struct { AudioRecording // A URL to a 30 second preview (MP3 format) of the chapter. null if not available. AudioPreviewUrl string `json:"audio_preview_url"` // A list of the countries in which the chapter can be played, identified by their ISO 3166-1 alpha-2 code. AvailableMarkets []string `json:"available_markets"` // The number of the chapter ChapterNubmer int `json:"chapter_nubmer"` // A description of the chapter. // HTML tags are stripped away from this field, use html_description field in case HTML tags are needed. Description string `json:"description"` // A description of the chapter. This field may contain HTML tags. HtmlDescription string `json:"html_description"` // The cover art for the chapter in various sizes, widest first. Images []Image `json:"images"` // A list of the languages used in the chapter, identified by their ISO 639-1 code. Languages []string `json:"languages"` // The date the chapter was first released, for example "1981-12-15". // Depending on the precision, it might be shown as "1981" or "1981-12". ReleaseDate string `json:"release_date"` // The precision with which release_date value is known. ReleaseDatePrecision string `json:"release_date_precision"` // The user's most recent position in the chapter. // Set if the supplied access token is a user token and has the scope 'user-read-playback-position'. ResumePoint AudioResumePoint `json:"resume_point"` // The object type. Type string `json:"type"` // The Spotify URI for the chapter. URI string `json:"uri"` }
SimplifiedChapter contains the minimum audiobook chapter data that can be returned by the Spotify API.
type SimplifiedChapterChunk ¶
type SimplifiedChapterChunk struct { Chunk Items []SimplifiedChapterChunk `json:"items"` }
SimplifiedChapterChunk represents a paged set of SimplifiedChapter items
type SimplifiedEpisode ¶
type SimplifiedEpisode struct { AudioRecording // A URL to a 30 second preview (MP3 format) of the episode. null if not available. AudioPreviewUrl string `json:"audio_preview_url"` // A description of the episode. // HTML tags are stripped away from this field, use html_description field in case HTML tags are needed. Description string `json:"description"` // A description of the episode. This field may contain HTML tags. HtmlDescription string `json:"html_description"` // The episode length in milliseconds. Images []Image `json:"images"` // True if the episode is hosted outside of Spotify's CDN. IsExternallyHosted bool `json:"is_externally_hosted"` // A list of the languages used in the episode, identified by their ISO 639-1 code. Languages []string `json:"languages"` // The date the episode was first released, for example "1981-12-15". // Depending on the precision, it might be shown as "1981" or "1981-12". ReleaseDate string `json:"release_date"` // The precision with which release_date value is known. ReleaseDatePrecision string `json:"release_date_precision"` // The user's most recent position in the episode. // Set if the supplied access token is a user token and has the scope 'user-read-playback-position'. ResumePoint AudioResumePoint `json:"resume_point"` // The object type. Type string `json:"type"` // The Spotify URI for the episode. URI string `json:"uri"` }
SimplifiedEpisode contains the minimum show episode data that can be returned by the Spotify API.
type SimplifiedEpisodeChunk ¶
type SimplifiedEpisodeChunk struct { Chunk Items []SimplifiedEpisode `json:"items"` }
SimplifiedEpisodeChunk represents a paged set of SimplifiedEpisode items
type SimplifiedPlaylist ¶
type SimplifiedPlaylist struct { // true if the owner allows other users to modify the playlist. Collaborative bool `json:"collaborative"` // The playlist description. Only returned for modified, verified playlists, otherwise null. Description string `json:"description"` // Known external URLs for this playlist. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the playlist. Href string `json:"href"` // The Spotify ID for the playlist. Id string `json:"id"` // Images for the playlist. The array may be empty or contain up to three images. // The images are returned by size in descending order. See Working with Playlists. // // Note: If returned, the source URL for the image (url) is temporary and will expire in less than a day. Images []Image `json:"images"` // The name of the playlist. Name string `json:"name"` // The user who owns the playlist Owner PlaylistOwner `json:"owner"` // The playlist's public/private status: true the playlist is public, // false the playlist is private, null the playlist status is not relevant. // For more about public/private status, see Working with Playlists Public bool `json:"public"` // The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version SnapshotId string `json:"snapshot_id"` // The tracks of the playlist. Tracks PlaylistTrackChunk `json:"tracks"` // The object type: "playlist" Type string `json:"type"` // The Spotify URI for the playlist. URI string `json:"uri"` }
SimplifiedPlaylist contains the playlist data that can be returned by the Spotify API.
type SimplifiedPlaylistChunk ¶
type SimplifiedPlaylistChunk struct { Chunk Items []SimplifiedPlaylist `json:"items"` }
SimplifiedPlaylistChunk represents a paged set of SimplifiedPlaylist items
type SimplifiedShow ¶
type SimplifiedShow struct { // A list of the countries in which the show can be played, identified by their ISO 3166-1 alpha-2 code. AvailableMarkets []string `json:"available_markets"` // The copyright statements of the show. Copyrights []Copyright `json:"copyrights"` // A description of the show. // HTML tags are stripped away from this field, use html_description field in case HTML tags are needed. Description string `json:"description"` // A description of the show. This field may contain HTML tags. HtmlDescription string `json:"html_description"` // Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown). Explicit bool `json:"explicit"` // External URLs for this show. ExternalURLs ExternalURL `json:"external_urls"` // A link to the Web API endpoint providing full details of the show. Href string `json:"href"` // The Spotify ID for the show. Id string `json:"id"` // The cover art for the show in various sizes, widest first. Images []Image `json:"images"` // True if all of the shows episodes are hosted outside of Spotify's CDN. // This field might be null in some cases. IsExternallyHosted bool `json:"is_externally_hosted"` // A list of the languages used in the show, identified by their ISO 639 code. Languages []string `json:"languages"` // The media type of the show. MediaType string `json:"media_type"` // The name of the episode. Name string `json:"name"` // The publisher of the show. Publisher string `json:"publisher"` // The object type. Type string `json:"type"` // The Spotify URI for the show. URI string `json:"uri"` // The total number of episodes in the show. TotalEpisodes int `json:"total_episodes"` }
SimplifiedShow contains the minimum show data that can be returned by the Spotify API.
type SimplifiedShowChunk ¶
type SimplifiedShowChunk struct { Chunk Items []SimplifiedShow `json:"items"` }
SimplifiedShowChunk represents a paged set of SimplifiedShow items
type SimplifiedTrack ¶
type SimplifiedTrack struct { AudioRecording // The artists who performed the track. // Each artist object includes a link in href to more detailed information about the artist. Artists []SimplifiedArtist `json:"artists"` // A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code. AvailableMarkets []string `json:"available_markets"` // The disc number (usually 1 unless the album consists of more than one disc). DiscNumber int `json:"disc_number"` // Part of the response when Track Relinking is applied, and the requested track has been replaced with different track. // The track in the linked_from object contains information about the originally requested track. LinkedFrom Linked `json:"linked_from"` // The popularity of the track. The value will be between 0 and 100, with 100 being the most popular. // // The popularity of a track is a value between 0 and 100, with 100 being the most popular. // The popularity is calculated by algorithm and is based, in the most part, // on the total number of plays the track has had and how recent those plays are. // // Generally speaking, songs that are being played a lot now will have a higher popularity // than songs that were played a lot in the past. // Duplicate tracks (e.g. the same track from a single and an album) are rated independently. // Artist and album popularity is derived mathematically from track popularity. // Note: the popularity value may lag actual popularity by a few days: the value is not updated in real time. Popularity int `json:"popularity"` // A link to a 30 second preview (MP3 format) of the track. Can be null PreviewURL string `json:"preview_url"` // The number of the track. If an album has several discs, the track number is the number on the specified disc. TrackNumber int `json:"track_number"` // The object type: "track". Type string `json:"type"` // The Spotify URI for the track. URI string `json:"uri"` // Whether or not the track is from a local file. IsLocal bool `json:"is_local"` }
SimplifiedTrack contains the minimum album track data that can be returned by the Spotify API.
type SimplifiedTrackChunk ¶
type SimplifiedTrackChunk struct { Chunk Items []SimplifiedTrack `json:"items"` }
SimplifiedTrackChunk represents a paged set of SimplifiedTrack items
type Snapshot ¶
type Snapshot struct {
SnapshotId string `json:"snapshot_id"`
}
Snapshot contains snapshot id of the playlist
type Spotify ¶
type Spotify struct {
// contains filtered or unexported fields
}
Spotify represents the Spotify API client, which provides all the functionality needed to communicate with the API.
func NewSpotifyClient ¶
NewSpotifyClient creates a Spotify client, with the appropriate Spotify base URL.
func (*Spotify) AddCustomPlaylistCoverImage ¶
AddCustomPlaylistCoverImage replaces the image used to represent a specific playlist.
func (*Spotify) AddItemToPlaybackQueue ¶
AddItemToPlaybackQueue adds an item to the end of the user's current playback queue. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState
func (*Spotify) AddItemsToPlaylist ¶
func (s *Spotify) AddItemsToPlaylist( id string, properties []Property, params ...Param, ) (*Snapshot, error)
AddItemsToPlaylist adds one or more items to a user's playlist.
Params: Position, URIs.
Properties: PropertyURIs, PropertyPosition.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) ChangePlaylistDetails ¶
ChangePlaylistDetails changes a playlist's name and public/private state. (The user must, of course, own the playlist.)
Properties: Name, Public, Collaborative, Description.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) CheckIfUserFollowsArtistsOrUsers ¶
CheckIfUserFollowsArtistsOrUsers checks to see if the current user is following one or more artists or other Spotify users.
Scopes: ScopeUserFollowRead.
func (*Spotify) CheckIfUsersFollowPlaylist ¶
CheckIfUsersFollowPlaylist checks to see if one or more Spotify users are following a specified playlist.
func (*Spotify) CheckUserSavedAlbums ¶
CheckUserSavedAlbums checks if one or more albums is already saved in the current Spotify user's 'Your Music' library.
Scopes: ScopeUserLibraryRead.
func (*Spotify) CheckUserSavedAudiobooks ¶
CheckUserSavedAudiobooks checks if one or more audiobooks are already saved in the current Spotify user's library.
Scopes: ScopeUserLibraryRead.
func (*Spotify) CheckUserSavedEpisodes ¶
CheckUserSavedEpisodes checks if one or more episodes is already saved in the current Spotify user's 'Your Episodes' library. This API endpoint is in beta and could change without warning.
Scopes: ScopeUserLibraryRead.
func (*Spotify) CheckUserSavedShows ¶
CheckUserSavedShows checks if one or more shows is already saved in the current Spotify user's library.
Scopes: ScopeUserLibraryRead.
func (*Spotify) CheckUserSavedTracks ¶
CheckUserSavedTracks checks if one or more tracks is already saved in the current Spotify user's 'Your Music' library.
Scopes: ScopeUserLibraryRead.
func (*Spotify) CreatePlaylist ¶
CreatePlaylist creates a playlist for a Spotify user. (The playlist will be empty until you add tracks.) Each user is generally limited to a maximum of 11000 playlists.
Properties: Public, Collaborative, Description.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) Delete ¶
func (s *Spotify) Delete( response interface{}, endpoint string, body []byte, params ...Param, ) error
Delete is responsible for sending DELETE requests with the specified endpoint, body and parameters.
func (*Spotify) FollowArtistsOrUsers ¶
FollowArtistsOrUsers adds the current user as a follower of one or more artists or other Spotify users.
Scopes: ScopeUserFollowModify.
func (*Spotify) FollowPlaylist ¶
FollowPlaylist adds the current user as a follower of a playlist.
Properties: Public.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) Get ¶
Get is responsible for sending GET requests with the specified endpoint and parameters.
func (*Spotify) GetAlbum ¶
GetAlbum obtains Spotify catalog information for a single album.
Params: Market.
func (*Spotify) GetAlbumTracks ¶
func (s *Spotify) GetAlbumTracks(id string, params ...Param) (*SimplifiedTrackChunk, error)
GetAlbumTracks obtains Spotify catalog information about an album’s tracks. Optional parameters can be used to limit the number of tracks returned.
Params: Market, Limit, Offset.
func (*Spotify) GetAlbums ¶
GetAlbums obtains Spotify catalog information for multiple albums identified by their Spotify IDs.
Params: Market.
func (*Spotify) GetArtist ¶
func (s *Spotify) GetArtist(id string) (*FullArtist, error)
GetArtist obtains Spotify catalog information for a single artist identified by their unique Spotify ID.
func (*Spotify) GetArtistAlbums ¶
func (s *Spotify) GetArtistAlbums(id string, params ...Param) (*SimplifiedAlbumChunk, error)
GetArtistAlbums obtains Spotify catalog information about an artist's albums.
Params: IncludeGroups, Market, Limit, Offset.
func (*Spotify) GetArtistRelatedArtists ¶
func (s *Spotify) GetArtistRelatedArtists(id string) ([]*FullArtist, error)
GetArtistRelatedArtists obtains Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community's listening history.
func (*Spotify) GetArtistTopTracks ¶
GetArtistTopTracks obtains Spotify catalog information about an artist's top tracks by country.
Params: Market.
func (*Spotify) GetArtists ¶
func (s *Spotify) GetArtists(ids []string) ([]*FullArtist, error)
GetArtists obtains Spotify catalog information for several artists based on their Spotify IDs.
func (*Spotify) GetAudiobook ¶
func (s *Spotify) GetAudiobook(id string, params ...Param) (*FullAudiobook, error)
GetAudiobook obtains Spotify catalog information for a single audiobook. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market.
func (*Spotify) GetAudiobookChapters ¶
func (s *Spotify) GetAudiobookChapters( id string, params ...Param, ) (*SimplifiedChapterChunk, error)
GetAudiobookChapters obtains Spotify catalog information about an audiobook's chapters. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market, Limit, Offset.
func (*Spotify) GetAudiobooks ¶
func (s *Spotify) GetAudiobooks(ids []string, params ...Param) ([]*FullAudiobook, error)
GetAudiobooks obtains Spotify catalog information for several audiobooks identified by their Spotify IDs. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market.
func (*Spotify) GetAvailableDevices ¶
GetAvailableDevices obtains information about a user’s available Spotify Connect devices. Some device models are not supported and will not be listed in the API response.
Scopes: ScopeUserReadPlaybackState.
func (*Spotify) GetAvailableGenreSeeds ¶
GetAvailableGenreSeeds obtains a list of available genres seed parameter values for recommendations.
func (*Spotify) GetAvailableMarkets ¶
GetAvailableMarkets obtains the list of markets where Spotify is available.
func (*Spotify) GetBrowseCategories ¶
func (s *Spotify) GetBrowseCategories(params ...Param) (*CategoryChunk, error)
GetBrowseCategories obtains a list of categories used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
Params: Locale, Limit, Offset.
func (*Spotify) GetBrowseCategory ¶
GetBrowseCategory obtains a single category used to tag items in Spotify (on, for example, the Spotify player’s “Browse” tab).
Params: Locale.
func (*Spotify) GetCategoryPlaylists ¶
func (s *Spotify) GetCategoryPlaylists( categoryId string, params ...Param, ) (*DescribedPlaylist, error)
GetCategoryPlaylists obtains a list of Spotify playlists tagged with a particular category.
Params: Limit, Offset.
func (*Spotify) GetChapter ¶
func (s *Spotify) GetChapter(id string, params ...Param) (*FullChapter, error)
GetChapter obtains Spotify catalog information for a single audiobook chapter. Chapters are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market.
func (*Spotify) GetChapters ¶
func (s *Spotify) GetChapters(ids []string, params ...Param) ([]*FullChapter, error)
GetChapters obtains Spotify catalog information for several audiobook chapters identified by their Spotify IDs. Chapters are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market.
func (*Spotify) GetCurrentUserPlaylists ¶
func (s *Spotify) GetCurrentUserPlaylists(params ...Param) (*SimplifiedPlaylistChunk, error)
GetCurrentUserPlaylists obtains a list of the playlists owned or followed by the current Spotify user.
Params: Limit, Offset.
Scopes: ScopePlaylistReadPrivate.
func (*Spotify) GetCurrentUserProfile ¶
GetCurrentUserProfile obtains detailed profile information about the current user (including the current user's username).
Scopes: ScopeUserReadPrivate, UserReadEmail.
func (*Spotify) GetCurrentlyPlayingTrack ¶
GetCurrentlyPlayingTrack obtains the object currently being played on the user's Spotify account.
Params: Market, AdditionalTypes.
Scopes: ScopeUserReadCurrentlyPlaying.
func (*Spotify) GetEpisode ¶
func (s *Spotify) GetEpisode(id string, params ...Param) (*FullEpisode, error)
GetEpisode obtains Spotify catalog information for a single episode identified by its unique Spotify ID.
Params: Market.
Scopes: ScopeUserReadPlaybackPosition.
func (*Spotify) GetEpisodes ¶
func (s *Spotify) GetEpisodes(ids []string, params ...Param) ([]*FullEpisode, error)
GetEpisodes obtains Spotify catalog information for several episodes based on their Spotify IDs.
Params: Market.
Scopes: ScopeUserReadPlaybackPosition.
func (*Spotify) GetFeaturedPlaylists ¶
func (s *Spotify) GetFeaturedPlaylists(params ...Param) (*DescribedPlaylist, error)
GetFeaturedPlaylists obtains a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).
Params: Locale, Limit, Offset.
func (*Spotify) GetFollowedArtists ¶
func (s *Spotify) GetFollowedArtists(idType string, params ...Param) (*FullArtistChunk, error)
GetFollowedArtists obtains the current user's followed artists.
Params: After, Limit.
Scopes: ScopeUserFollowRead.
func (*Spotify) GetNewReleases ¶
func (s *Spotify) GetNewReleases(params ...Param) (*SimplifiedAlbumChunk, error)
GetNewReleases obtains a list of new album releases featured in Spotify (shown, for example, on a Spotify player’s “Browse” tab).
Params: Limit, Offset
func (*Spotify) GetPlaybackState ¶
GetPlaybackState obtains information about the user’s current playback state, including track or episode, progress, and active device.
Params: Market, AdditionalTypes.
Scopes: ScopeUserReadPlaybackState.
func (*Spotify) GetPlaylist ¶
func (s *Spotify) GetPlaylist(id string, params ...Param) (*FullPlaylist, error)
GetPlaylist obtains a playlist owned by a Spotify user.
Params: Market, Fields, AdditionalTypes.
func (*Spotify) GetPlaylistCoverImage ¶
GetPlaylistCoverImage obtains the current image associated with a specific playlist.
func (*Spotify) GetPlaylistItems ¶
func (s *Spotify) GetPlaylistItems(id string, params ...Param) (*PlaylistTrackChunk, error)
GetPlaylistItems obtains full details of the items of a playlist owned by a Spotify user.
Params: Market, Fields, Limit, Offset, AdditionalTypes.
Scopes: PlaylistReadPrivate.
func (*Spotify) GetRecentlyPlayedTracks ¶
func (s *Spotify) GetRecentlyPlayedTracks(params ...Param) (*RecentlyPlayedTracks, error)
GetRecentlyPlayedTracks obtains tracks from the current user's recently played tracks.
Note: Currently doesn't support podcast episodes.
Params: Limit, After, Before.
Scopes: ScopeUserReadRecentlyPlayed.
func (*Spotify) GetRecommendations ¶
func (s *Spotify) GetRecommendations(params ...Param) (*Recommendation, error)
GetRecommendations obtains Spotify Recommendations. Recommendations are generated based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details.
For artists and tracks that are very new or obscure there might not be enough data to generate a list of tracks.
Params: Limit, Market, SeedArtists, SeedGenres, SeedTracks, MinAcousticness, MaxAcousticness, TargetAcousticness, MinDanceability, MaxDanceability, TargetDanceability, MinDurationMs, MaxDurationMs, TargetDurationMs, MinEnergy, MaxEnergy, TargetEnergy, MinInstrumentalness, MaxInstrumentalness, TargetInstrumentalness, MinKey, MaxKey, TargetKey, MinLiveness, MaxLiveness, TargetLiveness, MinLoudness, MaxLoudness, TargetLoudness, MinMode, MaxMode, TargetMode, MinPopularity, MaxPopularity, TargetPopularity, MinSpeechiness, MaxSpeechiness, TargetSpeechiness, MinTempo, MaxTempo, TargetTempo, MinTimeSignature, MaxTimeSignature, TargetTimeSignature, MinValence, MaxValence, TargetValence.
func (*Spotify) GetShow ¶
GetShow obtains Spotify catalog information for a single show identified by its unique Spotify ID.
Params: Market.
Scopes: ScopeUserReadPlaybackPosition.
func (*Spotify) GetShowEpisodes ¶
func (s *Spotify) GetShowEpisodes(id string, params ...Param) (*SimplifiedEpisodeChunk, error)
GetShowEpisodes obtains Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.
Params: Market, Limit, Offset.
Scopes: ScopeUserReadPlaybackPosition.
func (*Spotify) GetShows ¶
GetShows obtains Spotify catalog information for several shows based on their Spotify IDs.
Params: Market.
func (*Spotify) GetTrack ¶
GetTrack obtains Spotify catalog information for a single track identified by its unique Spotify ID.
Params: Market.
func (*Spotify) GetTrackAudioAnalysis ¶
func (s *Spotify) GetTrackAudioAnalysis(id string) (*AudioAnalysis, error)
GetTrackAudioAnalysis obtains a low-level audio analysis for a track in the Spotify catalog. The audio analysis describes the track’s structure and musical content, including rhythm, pitch, and timbre.
func (*Spotify) GetTrackAudioFeatures ¶
func (s *Spotify) GetTrackAudioFeatures(id string) (*AudioFeature, error)
GetTrackAudioFeatures obtains audio feature information for a single track identified by its unique Spotify ID.
func (*Spotify) GetTracks ¶
GetTracks obtains Spotify catalog information for multiple tracks based on their Spotify IDs.
Params: Market.
func (*Spotify) GetTracksAudioFeatures ¶
func (s *Spotify) GetTracksAudioFeatures(ids []string) ([]*AudioFeature, error)
GetTracksAudioFeatures obtains audio features for multiple tracks based on their Spotify IDs.
func (*Spotify) GetUserPlaylists ¶
func (s *Spotify) GetUserPlaylists( userId string, params ...Param, ) (*SimplifiedPlaylistChunk, error)
GetUserPlaylists obtains a list of the playlists owned or followed by a Spotify user.
Params: Limit, Offset.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) GetUserProfile ¶
GetUserProfile obtains public profile information about a Spotify user.
func (*Spotify) GetUserQueue ¶
GetUserQueue obtains the list of objects that make up the user's queue.
Scopes: UserReadCurrentlyPlaying, UserReadPlaybackState.
func (*Spotify) GetUserSavedAlbums ¶
func (s *Spotify) GetUserSavedAlbums(params ...Param) (*SavedAlbumChunk, error)
GetUserSavedAlbums obtains a list of the albums saved in the current Spotify user's 'Your Music' library.
Params: Market, Limit, Offset.
Scopes: ScopeUserLibraryRead.
func (*Spotify) GetUserSavedAudiobooks ¶
func (s *Spotify) GetUserSavedAudiobooks(params ...Param) (*SimplifiedAudiobookChunk, error)
GetUserSavedAudiobooks obtains a list of the audiobooks saved in the current Spotify user's 'Your Music' library.
Params: Limit, Offset.
Scopes: ScopeUserLibraryRead.
func (*Spotify) GetUserSavedEpisodes ¶
func (s *Spotify) GetUserSavedEpisodes(params ...Param) (*SavedEpisodeChunk, error)
GetUserSavedEpisodes obtains a list of the episodes saved in the current Spotify user's library. This API endpoint is in beta and could change without warning.
Params: Market, Limit, Offset.
Scopes: ScopeUserLibraryRead, UserReadPlaybackPosition.
func (*Spotify) GetUserSavedShows ¶
func (s *Spotify) GetUserSavedShows(params ...Param) (*SimplifiedShowChunk, error)
GetUserSavedShows obtains a list of shows saved in the current Spotify user's library. Optional parameters can be used to limit the number of shows returned.
Params: Limit, Offset.
Scopes: ScopeUserLibraryRead
func (*Spotify) GetUserSavedTracks ¶
func (s *Spotify) GetUserSavedTracks(params ...Param) (*SavedTrackChunk, error)
GetUserSavedTracks obtains a list of the songs saved in the current Spotify user's 'Your Music' library.
Params: Market, Limit, Offset.
Scopes: ScopeUserLibraryRead.
func (*Spotify) GetUserTopItems ¶
func (s *Spotify) GetUserTopItems(itemsType string, params ...Param) (*UserItemChunk, error)
GetUserTopItems obtains the current user's top artists or tracks based on calculated affinity.
Params: TimeRange, Limit, Offset.
Scopes: ScopeUserTopRead.
func (*Spotify) PausePlayback ¶
PausePlayback pauses playback on the user's account. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) Post ¶
func (s *Spotify) Post( response interface{}, endpoint string, body []byte, params ...Param, ) error
Post is responsible for sending POST requests with the specified endpoint, body and parameters.
func (*Spotify) Put ¶
Put is responsible for sending PUT requests with the specified endpoint, body and parameters.
func (*Spotify) PutImage ¶
PutImage is responsible for sending PUT requests with the specified endpoint, body containing base64 encoded image and parameters.
func (*Spotify) RemovePlaylistItem ¶
RemovePlaylistItem removes one or more items from a user's playlist.
Properties: Tracks, SnapshotId.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) RemoveUserSavedAlbums ¶
RemoveUserSavedAlbums removes one or more albums from the current user's 'Your Music' library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) RemoveUserSavedAudiobooks ¶
RemoveUserSavedAudiobooks removes one or more audiobooks from the Spotify user's library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) RemoveUserSavedEpisodes ¶
RemoveUserSavedEpisodes removes one or more episodes from the current user's library. This API endpoint is in beta and could change without warning.
Scopes: ScopeUserLibraryModify.
func (*Spotify) RemoveUserSavedShows ¶
RemoveUserSavedShows removes one or more shows from current Spotify user's library.
Params: Market.
Scopes: ScopeUserLibraryModify.
func (*Spotify) RemoveUserSavedTracks ¶
RemoveUserSavedTracks removes one or more tracks from the current user's 'Your Music' library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) SaveAlbumsForCurrentUser ¶
SaveAlbumsForCurrentUser saves one or more albums to the current user's 'Your Music' library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) SaveAudiobooksForCurrentUser ¶
SaveAudiobooksForCurrentUser saves one or more audiobooks to the current Spotify user's library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) SaveEpisodesForCurrentUser ¶
SaveEpisodesForCurrentUser saves one or more episodes to the current user's library. This API endpoint is in beta and could change without warning.
Scopes: ScopeUserLibraryModify.
func (*Spotify) SaveShowsForCurrentUser ¶
SaveShowsForCurrentUser saves one or more shows to current Spotify user's library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) SaveTracksForCurrentUser ¶
SaveTracksForCurrentUser saves one or more tracks to the current user's 'Your Music' library.
Scopes: ScopeUserLibraryModify.
func (*Spotify) Search ¶
Search obtains Spotify catalog information about albums, artists, playlists, tracks, shows, episodes or audiobooks that match a keyword string. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
Params: Market, Limit, Offset, IncludeExternal.
func (*Spotify) SeekToPosition ¶
SeekToPosition seeks o the given position in the user’s currently playing track. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) SetPlaybackVolume ¶
SetPlaybackVolume sets the volume for the user’s current playback device. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) SetRepeatMode ¶
SetRepeatMode sets the repeat mode for the user's playback. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) SkipToNext ¶
SkipToNext skips to next track in the user’s queue. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) SkipToPrevious ¶
SkipToPrevious skips to previous track in the user’s queue. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) StartResumePlayback ¶
StartResumePlayback starts a new context or resume current playback on the user's active device. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Properties: ContextURI, PropertyURIs, PropertyOffset, PositionMs.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) TogglePlaybackShuffle ¶
TogglePlaybackShuffle toggles shuffle on or off for user’s playback. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Params: DeviceId.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) TransferPlayback ¶
TransferPlayback transfers playback to a new device and optionally begin playback. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.
Properties: Play.
Scopes: ScopeUserModifyPlaybackState.
func (*Spotify) UnfollowArtistsOrUsers ¶
UnfollowArtistsOrUsers removes the current user as a follower of one or more artists or other Spotify users.
Scopes: ScopeUserFollowModify.
func (*Spotify) UnfollowPlaylist ¶
UnfollowPlaylist removes the current user as a follower of a playlist.
Scopes: ScopePlaylistModifyPublic, ScopePlaylistModifyPrivate.
func (*Spotify) UpdatePlaylistItems ¶
func (s *Spotify) UpdatePlaylistItems( id string, properties []Property, params ...Param, ) (*Snapshot, error)
UpdatePlaylistItems either reorder or replace items in a playlist depending on the request's parameters. To reorder items, include range_start, insert_before, range_length and snapshot_id in the request's body. To replace items, include uris as either a query parameter or in the request's body. Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
Note: Replace and reorder are mutually exclusive operations which share the same endpoint, but have different parameters. These operations can't be applied together in a single request.
Params: URIs.
Properties: PropertyURIs, RangeStart, InsertBefore, RangeLength, SnapshotId.
Scopes: PlaylistModifyPublic, PlaylistModifyPrivate.
type TrackAnalysis ¶
type TrackAnalysis struct { BaseAudioAnalysis // The exact number of audio samples analyzed from this track. // See also analysis_sample_rate. NumSamples int `json:"num_samples"` // Length of the track in seconds. Duration float32 `json:"duration"` // This field will always contain the empty string. SampleMd5 string `json:"sample_md_5"` // An offset to the start of the region of the track that was analyzed. // (As the entire track is analyzed, this should always be 0.) OffsetSeconds int `json:"offset_seconds"` // The length of the region of the track was analyzed, if a subset of the track was analyzed. // (As the entire track is analyzed, this should always be 0.) WindowSeconds int `json:"window_seconds"` // The sample rate used to decode and analyze this track. // May differ from the actual sample rate of this track available on Spotify. AnalysisSampleRate int `json:"analysis_sample_rate"` // The number of channels used for analysis. // If 1, all channels are summed together to mono before analysis. AnalysisChannels int `json:"analysis_channels"` // The time, in seconds, at which the track's fade-in period ends. // If the track has no fade-in, this will be 0.0. EndOfFadeIn float32 `json:"end_of_fade_in"` // The time, in seconds, at which the track's fade-out period starts. // If the track has no fade-out, this should match the track's length. StartOfFadeOut float32 `json:"start_of_fade_out"` // An Echo Nest Musical Fingerprint (ENMFP) codestring for this track. Codestring string `json:"codestring"` // A version number for the Echo Nest Musical Fingerprint format used in the codestring field. CodeVersion float32 `json:"code_version"` // An EchoPrint codestring for this track. Echoprintstring string `json:"echoprintstring"` // A version number for the EchoPrint format used in the echoprintstring field. EchoprintVersion float32 `json:"echoprint_version"` // A Synchstring for this track. Synchstring string `json:"synchstring"` // A version number for the Synchstring used in the synchstring field. SynchVersion float32 `json:"synch_version"` // A Rhythmstring for this track. The format of this string is similar to the Synchstring. Rhythmstring string `json:"rhythmstring"` // A version number for the Rhythmstring used in the rhythmstring field. RhythmVersion float32 `json:"rhythm_version"` }
TrackAnalysis contains the overall results of track analysis
type User ¶
type User struct { // The country of the user, as set in the user's account profile. // An ISO 3166-1 alpha-2 country code. // This field is only available when the current user has granted access to the user-read-private scope. Country string `json:"country"` // The name displayed on the user's profile. null if not available. DisplayName string `json:"display_name"` // The user's email address, as entered by the user when creating their account. // Important! This email address is unverified; there is no proof that it actually belongs to the user. // This field is only available when the current user has granted access to the user-read-email scope. Email string `json:"email"` // This field is only available when the current user has granted access to the user-read-private scope. ExplicitContent ExplicitContent `json:"explicit_content"` // Known external URLs for this user. ExternalURLs ExternalURL `json:"external_ur_ls"` // Information about the followers of the user. Followers Follower `json:"followers"` // A link to the Web API endpoint for this user. Href string `json:"href"` // The Spotify user ID for the user. Id string `json:"id"` // The user's profile image. Images []Image `json:"images"` // The user's Spotify subscription level: "premium", "free", etc. // (The subscription level "open" can be considered the same as "free".) // This field is only available when the current user has granted access to the user-read-private scope. Product string `json:"product"` // The object type: "user" Type string `json:"type"` // The Spotify URI for the user. URI string `json:"uri"` }
User contains the user data that can be returned by the Spotify API.
type UserItemChunk ¶
UserItemChunk represents a paged set of UserItem items
type UserQueue ¶
type UserQueue struct { // The currently playing track or episode. Can be null. CurrentlyPlaying Item `json:"currently_playing"` // The tracks or episodes in the queue. Can be empty. Queue []Item `json:"queue"` }
UserQueue containts the user queue data that can be returned by the Spotify API.