spotify: github.com/zmb3/spotify Index | Files

package spotify

import "github.com/zmb3/spotify"

Package spotify provides utilties for interfacing with Spotify's Web API.

Index

Package Files

album.go artist.go audio_analysis.go audio_features.go auth.go category.go countries.go cursor.go library.go page.go player.go playlist.go recommendation.go search.go spotify.go track.go track_attributes.go user.go

Constants

const (
    AlbumTypeAlbum       AlbumType = 1 << iota
    AlbumTypeSingle                = 1 << iota
    AlbummTypeAppearsOn            = 1 << iota
    AlbumTypeCompilation           = 1 << iota
)

AlbumType values that can be used to filter which types of albums are searched for. These are flags that can be bitwise OR'd together to search for multiple types of albums simultaneously.

const (
    // AuthURL is the URL to Spotify Accounts Service's OAuth2 endpoint.
    AuthURL = "https://accounts.spotify.com/authorize"
    // TokenURL is the URL to the Spotify Accounts Service's OAuth2
    // token endpoint.
    TokenURL = "https://accounts.spotify.com/api/token"
)
const (
    // ScopeImageUpload seeks permission to upload images to Spotify on your behalf.
    ScopeImageUpload = "ugc-image-upload"
    // ScopePlaylistReadPrivate seeks permission to read
    // a user's private playlists.
    ScopePlaylistReadPrivate = "playlist-read-private"
    // ScopePlaylistModifyPublic seeks write access
    // to a user's public playlists.
    ScopePlaylistModifyPublic = "playlist-modify-public"
    // ScopePlaylistModifyPrivate seeks write access to
    // a user's private playlists.
    ScopePlaylistModifyPrivate = "playlist-modify-private"
    // ScopePlaylistReadCollaborative seeks permission to
    // access a user's collaborative playlists.
    ScopePlaylistReadCollaborative = "playlist-read-collaborative"
    // ScopeUserFollowModify seeks write/delete access to
    // the list of artists and other users that a user follows.
    ScopeUserFollowModify = "user-follow-modify"
    // ScopeUserFollowRead seeks read access to the list of
    // artists and other users that a user follows.
    ScopeUserFollowRead = "user-follow-read"
    // ScopeUserLibraryModify seeks write/delete access to a
    // user's "Your Music" library.
    ScopeUserLibraryModify = "user-library-modify"
    // ScopeUserLibraryRead seeks read access to a user's "Your Music" library.
    ScopeUserLibraryRead = "user-library-read"
    // ScopeUserReadPrivate seeks read access to a user's
    // subsription details (type of user account).
    ScopeUserReadPrivate = "user-read-private"
    // ScopeUserReadEmail seeks read access to a user's email address.
    ScopeUserReadEmail = "user-read-email"
    // ScopeUserReadBirthdate seeks read access to a user's birthdate.
    ScopeUserReadBirthdate = "user-read-birthdate"
    // ScopeUserReadCurrentlyPlaying seeks read access to a user's currently playing track
    ScopeUserReadCurrentlyPlaying = "user-read-currently-playing"
    // ScopeUserReadPlaybackState seeks read access to the user's current playback state
    ScopeUserReadPlaybackState = "user-read-playback-state"
    // ScopeUserModifyPlaybackState seeks write access to the user's current playback state
    ScopeUserModifyPlaybackState = "user-modify-playback-state"
    // ScopeUserReadRecentlyPlayed allows access to a user's recently-played songs
    ScopeUserReadRecentlyPlayed = "user-read-recently-played"
    // ScopeUserTopRead seeks read access to a user's top tracks and artists
    ScopeUserTopRead = "user-top-read"
)

Scopes let you specify exactly which types of data your application wants to access. The set of scopes you pass in your authentication request determines what access the permissions the user is asked to grant.

const (
    CountryArgentina          = "AR"
    CountryAustralia          = "AU"
    CountryAustria            = "AT"
    CountryBelarus            = "BY"
    CountryBelgium            = "BE"
    CountryBrazil             = "BR"
    CountryCanada             = "CA"
    CountryChile              = "CL"
    CountryChina              = "CN"
    CountryGermany            = "DE"
    CountryHongKong           = "HK"
    CountryIreland            = "IE"
    CountryIndia              = "IN"
    CountryItaly              = "IT"
    CountryJapan              = "JP"
    CountrySpain              = "ES"
    CountryFinland            = "FI"
    CountryFrance             = "FR"
    CountryMexico             = "MX"
    CountryNewZealand         = "NZ"
    CountryRussia             = "RU"
    CountrySwitzerland        = "CH"
    CountryUnitedArabEmirates = "AE"
    CountryUnitedKingdom      = "GB"
    CountryUSA                = "US"
)

ISO 3166-1 alpha 2 country codes.

see: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

const (
    SearchTypeAlbum    SearchType = 1 << iota
    SearchTypeArtist              = 1 << iota
    SearchTypePlaylist            = 1 << iota
    SearchTypeTrack               = 1 << iota
)

Search type values that can be passed to the Search function. These are flags that can be bitwise OR'd together to search for multiple types of content simultaneously.

const (
    // DateLayout can be used with time.Parse to create time.Time values
    // from Spotify date strings.  For example, PrivateUser.Birthdate
    // uses this format.
    DateLayout = "2006-01-02"
    // TimestampLayout can be used with time.Parse to create time.Time
    // values from SpotifyTimestamp strings.  It is an ISO 8601 UTC timestamp
    // with a zero offset.  For example, PlaylistTrack's AddedAt field uses
    // this format.
    TimestampLayout = "2006-01-02T15:04:05Z"
)
const (
    // MarketFromToken can be used in place of the Market parameter
    // if the Client has a valid access token.  In this case, the
    // results will be limited to content that is playable in the
    // country associated with the user's account.  The user must have
    // granted access to the user-read-private scope when the access
    // token was issued.
    MarketFromToken = "from_token"
)
const MaxNumberOfSeeds = 5

MaxNumberOfSeeds allowed by Spotify for a recommendation request

const Version = "1.0.0"

Version is the version of this library.

Variables

var ErrNoMorePages = errors.New("spotify: no more pages")

ErrNoMorePages is the error returned when you attempt to get the next (or previous) set of data but you've reached the end of the data set.

type AlbumType Uses

type AlbumType int

AlbumType represents the type of an album. It can be used to filter results when searching for albums.

type AnalysisMeta Uses

type AnalysisMeta struct {
    AnalyzerVersion string  `json:"analyzer_version"`
    Platform        string  `json:"platform"`
    DetailedStatus  string  `json:"detailed_status"`
    StatusCode      int     `json:"status"`
    Timestamp       int64   `json:"timestamp"`
    AnalysisTime    float64 `json:"analysis_time"`
    InputProcess    string  `json:"input_process"`
}

AnalysisMeta describes details about Spotify's audio analysis of the track

type AnalysisTrack Uses

type AnalysisTrack struct {
    NumSamples              int64   `json:"num_samples"`
    Duration                float64 `json:"duration"`
    SampleMD5               string  `json:"sample_md5"`
    OffsetSeconds           int     `json:"offset_seconds"`
    WindowSeconds           int     `json:"window_seconds"`
    AnalysisSampleRate      int64   `json:"analysis_sample_rate"`
    AnalysisChannels        int     `json:"analysis_channels"`
    EndOfFadeIn             float64 `json:"end_of_fade_in"`
    StartOfFadeOut          float64 `json:"start_of_fade_out"`
    Loudness                float64 `json:"loudness"`
    Tempo                   float64 `json:"tempo"`
    TempoConfidence         float64 `json:"tempo_confidence"`
    TimeSignature           int     `json:"time_signature"`
    TimeSignatureConfidence float64 `json:"time_signature_confidence"`
    Key                     Key     `json:"key"`
    KeyConfidence           float64 `json:"key_confidence"`
    Mode                    Mode    `json:"mode"`
    ModeConfidence          float64 `json:"mode_confidence"`
    CodeString              string  `json:"codestring"`
    CodeVersion             float64 `json:"code_version"`
    EchoprintString         string  `json:"echoprintstring"`
    EchoprintVersion        float64 `json:"echoprint_version"`
    SynchString             string  `json:"synchstring"`
    SynchVersion            float64 `json:"synch_version"`
    RhythmString            string  `json:"rhythmstring"`
    RhythmVersion           float64 `json:"rhythm_version"`
}

AnalysisTrack contains audio analysis data about the track as a whole

type AudioAnalysis Uses

type AudioAnalysis struct {
    Bars     []Marker      `json:"bars"`
    Beats    []Marker      `json:"beats"`
    Meta     AnalysisMeta  `json:"meta"`
    Sections []Section     `json:"sections"`
    Segments []Segment     `json:"segments"`
    Tatums   []Marker      `json:"tatums"`
    Track    AnalysisTrack `json:"track"`
}

AudioAnalysis contains a detailed audio analysis for a single track identified by its unique Spotify ID. See: https://developer.spotify.com/web-api/get-audio-analysis/

type AudioFeatures Uses

type AudioFeatures struct {
    //Acousticness is a confidence measure from 0.0 to 1.0 of whether
    // the track is acoustic.  A value of 1.0 represents high confidence
    // that the track is acoustic.
    Acousticness float32 `json:"acousticness"`
    // An HTTP URL to access the full audio analysis of the track.
    // The URL is cryptographically signed and configured to expire
    // after roughly 10 minutes.  Do not store these URLs for later use.
    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 length of the track in milliseconds.
    Duration int `json:"duration_ms"`
    // Energy is a measure from 0.0 to 1.0 and represents a perceptual mesaure
    // of intensity and activity.  Typically, energetic tracks feel fast, loud,
    // and noisy.
    Energy float32 `json:"energy"`
    // The Spotify ID for the track.
    ID  ID  `json:"id"`
    // Predicts whether a track contains no vocals.  "Ooh" and "aah" sounds are
    // treated as instrumental in this context.  Rap or spoken words 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
    // (https://en.wikipedia.org/wiki/Pitch_class).
    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 likelihook 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 the relative
    // loudness of tracks.  Typical values range between -60 and 0 dB.
    Loudness float32 `json:"loudness"`
    // Mode indicates the modality (major or minor) of a track.
    Mode int `json:"mode"`
    // Detects the presence of spoken words in a track.  The more exclusively
    // speech-like the recording, the closer to 1.0 the speechiness will be.
    // 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, 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 the track in beats per minute (BPM).
    Tempo float32 `json:"tempo"`
    // An estimated overall time signature of a track.  The time signature (meter)
    // is a notational convention to specify how many beats are in each bar (or measure).
    TimeSignature int `json:"time_signature"`
    // A link to the Web API endpoint providing full details of the track.
    TrackURL string `json:"track_href"`
    // The Spotify URI for the track.
    URI URI `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"`
}

AudioFeatures contains various high-level acoustic attributes for a particular track.

type Authenticator Uses

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

Authenticator provides convenience functions for implementing the OAuth2 flow. You should always use `NewAuthenticator` to make them.

Example:

a := spotify.NewAuthenticator(redirectURL, spotify.ScopeUserLibaryRead, spotify.ScopeUserFollowRead)
// direct user to Spotify to log in
http.Redirect(w, r, a.AuthURL("state-string"), http.StatusFound)

// then, in redirect handler:
token, err := a.Token(state, r)
client := a.NewClient(token)

func NewAuthenticator Uses

func NewAuthenticator(redirectURL string, scopes ...string) Authenticator

NewAuthenticator creates an authenticator which is used to implement the OAuth2 authorization flow. The redirectURL must exactly match one of the URLs specified in your Spotify developer account.

By default, NewAuthenticator pulls your client ID and secret key from the SPOTIFY_ID and SPOTIFY_SECRET environment variables. If you'd like to provide them from some other source, you can call `SetAuthInfo(id, key)` on the returned authenticator.

func (Authenticator) AuthURL Uses

func (a Authenticator) AuthURL(state string) string

AuthURL returns a URL to the the Spotify Accounts Service's OAuth2 endpoint.

State is a token to protect the user from CSRF attacks. You should pass the same state to `Token`, where it will be validated. For more info, refer to http://tools.ietf.org/html/rfc6749#section-10.12.

func (Authenticator) Exchange Uses

func (a Authenticator) Exchange(code string) (*oauth2.Token, error)

Exchange is like Token, except it allows you to manually specify the access code instead of pulling it out of an HTTP request.

func (Authenticator) NewClient Uses

func (a Authenticator) NewClient(token *oauth2.Token) Client

NewClient creates a Client that will use the specified access token for its API requests.

func (*Authenticator) SetAuthInfo Uses

func (a *Authenticator) SetAuthInfo(clientID, secretKey string)

SetAuthInfo overwrites the client ID and secret key used by the authenticator. You can use this if you don't want to store this information in environment variables.

func (Authenticator) Token Uses

func (a Authenticator) Token(state string, r *http.Request) (*oauth2.Token, error)

Token pulls an authorization code from an HTTP request and attempts to exchange it for an access token. The standard use case is to call Token from the handler that handles requests to your application's redirect URL.

type Category Uses

type Category struct {
    // A link to the Web API endpoint returning full details of the category
    Endpoint string `json:"href"`
    // The category icon, in various sizes
    Icons []Image `json:"icons"`
    // The Spotify category ID.  This isn't a base-62 Spotify ID, its just
    // a short string that describes and identifies the category (ie "party").
    ID  string `json:"id"`
    // The name of the category
    Name string `json:"name"`
}

Category is used by Spotify to tag items in. For example, on the Spotify player's "Browse" tab.

type CategoryPage Uses

type CategoryPage struct {
    Categories []Category `json:"items"`
    // contains filtered or unexported fields
}

CategoryPage contains Category objects returned by the Web API.

type Client Uses

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

Client is a client for working with the Spotify Web API. To create an authenticated client, use the `Authenticator.NewClient` method.

func (*Client) AddTracksToLibrary Uses

func (c *Client) AddTracksToLibrary(ids ...ID) error

AddTracksToLibrary saves one or more tracks to the current user's "Your Music" library. This call requires the ScopeUserLibraryModify scope. A track can only be saved once; duplicate IDs are ignored.

func (*Client) AddTracksToPlaylist Uses

func (c *Client) AddTracksToPlaylist(playlistID ID, trackIDs ...ID) (snapshotID string, err error)

AddTracksToPlaylist adds one or more tracks to a user's playlist. This call requires ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate. A maximum of 100 tracks can be added per call. It returns a snapshot ID that can be used to identify this version (the new version) of the playlist in future requests.

func (*Client) ChangePlaylistAccess Uses

func (c *Client) ChangePlaylistAccess(playlistID ID, public bool) error

ChangePlaylistAccess modifies the public/private status of a playlist. This call requires that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes (depending on whether the playlist is currently public or private). The current user must own the playlist in order to modify it.

func (*Client) ChangePlaylistDescription Uses

func (c *Client) ChangePlaylistDescription(playlistID ID, newDescription string) error

ChangePlaylistDescription modifies the description of a playlist. This call requires that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes (depending on whether the playlist is currently public or private). The current user must own the playlist in order to modify it.

func (*Client) ChangePlaylistName Uses

func (c *Client) ChangePlaylistName(playlistID ID, newName string) error

ChangePlaylistName changes the name of a playlist. This call requires that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes (depending on whether the playlist is public or private). The current user must own the playlist in order to modify it.

func (*Client) ChangePlaylistNameAccessAndDescription Uses

func (c *Client) ChangePlaylistNameAccessAndDescription(playlistID ID, newName, newDescription string, public bool) error

ChangePlaylistNameAccessAndDescription combines ChangePlaylistName, ChangePlaylistAccess, and ChangePlaylistDescription into a single Web API call. It requires that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes (depending on whether the playlist is currently public or private). The current user must own the playlist in order to modify it.

func (*Client) ChangePlaylistNameAndAccess Uses

func (c *Client) ChangePlaylistNameAndAccess(playlistID ID, newName string, public bool) error

ChangePlaylistNameAndAccess combines ChangePlaylistName and ChangePlaylistAccess into a single Web API call. It requires that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes (depending on whether the playlist is currently public or private). The current user must own the playlist in order to modify it.

func (*Client) CreatePlaylistForUser Uses

func (c *Client) CreatePlaylistForUser(userID, playlistName, description string, public bool) (*FullPlaylist, error)

CreatePlaylistForUser creates a playlist for a Spotify user. The playlist will be empty until you add tracks to it. The playlistName does not need to be unique - a user can have several playlists with the same name.

Creating a public playlist for a user requires ScopePlaylistModifyPublic; creating a private playlist requires ScopePlaylistModifyPrivate.

On success, the newly created playlist is returned.

func (*Client) CurrentUser Uses

func (c *Client) CurrentUser() (*PrivateUser, error)

CurrentUser gets detailed profile information about the current user.

Reading the user's email address requires that the application has the ScopeUserReadEmail scope. Reading the country, display name, profile images, and product subscription level requires that the application has the ScopeUserReadPrivate scope.

Warning: The email address in the response will be the address that was entered when the user created their spotify account. This email address is unverified - do not assume that Spotify has checked that the email address actually belongs to the user.

func (*Client) CurrentUserFollows Uses

func (c *Client) CurrentUserFollows(t string, ids ...ID) ([]bool, error)

CurrentUserFollows checks to see if the current user is following one or more artists or other Spotify Users. This call requires ScopeUserFollowRead.

The t argument indicates the type of the IDs, and must be either "user" or "artist".

The result is returned as a slice of bool values in the same order in which the IDs were specified.

func (*Client) CurrentUsersAlbums Uses

func (c *Client) CurrentUsersAlbums() (*SavedAlbumPage, error)

CurrentUsersAlbums gets a list of albums saved in the current Spotify user's "Your Music" library.

func (*Client) CurrentUsersAlbumsOpt Uses

func (c *Client) CurrentUsersAlbumsOpt(opt *Options) (*SavedAlbumPage, error)

CurrentUsersAlbumsOpt is like CurrentUsersAlbums, but it accepts additional options for sorting and filtering the results.

func (*Client) CurrentUsersFollowedArtists Uses

func (c *Client) CurrentUsersFollowedArtists() (*FullArtistCursorPage, error)

CurrentUsersFollowedArtists gets the current user's followed artists. This call requires that the user has granted the ScopeUserFollowRead scope.

func (*Client) CurrentUsersFollowedArtistsOpt Uses

func (c *Client) CurrentUsersFollowedArtistsOpt(limit int, after string) (*FullArtistCursorPage, error)

CurrentUsersFollowedArtistsOpt is like CurrentUsersFollowedArtists, but it accept the optional arguments limit and after. Limit is the maximum number of items to return (1 <= limit <= 50), and after is the last artist ID retrieved from the previous request. If you don't wish to specify either of the parameters, use -1 for limit and the empty string for after.

func (*Client) CurrentUsersPlaylists Uses

func (c *Client) CurrentUsersPlaylists() (*SimplePlaylistPage, error)

CurrentUsersPlaylists gets a list of the playlists owned or followed by the current spotify user.

Private playlists require the ScopePlaylistReadPrivate scope. Note that this scope alone will not return collaborative playlists, even though they are always private. In order to retrieve collaborative playlists the user must authorize the ScopePlaylistReadCollaborative scope.

func (*Client) CurrentUsersPlaylistsOpt Uses

func (c *Client) CurrentUsersPlaylistsOpt(opt *Options) (*SimplePlaylistPage, error)

CurrentUsersPlaylistsOpt is like CurrentUsersPlaylists, but it accepts additional options for sorting and filtering the results.

func (*Client) CurrentUsersTopArtists Uses

func (c *Client) CurrentUsersTopArtists() (*FullArtistPage, error)

CurrentUsersTopArtists is like CurrentUsersTopArtistsOpt but with sensible defaults. The default limit is 20 and the default timerange is medium_term.

func (*Client) CurrentUsersTopArtistsOpt Uses

func (c *Client) CurrentUsersTopArtistsOpt(opt *Options) (*FullArtistPage, error)

CurrentUsersTopArtistsOpt gets a list of the top played artists in a given time range of the current Spotify user. It supports up to 50 artists in a single call. This call requires ScopeUserTopRead.

func (*Client) CurrentUsersTopTracks Uses

func (c *Client) CurrentUsersTopTracks() (*FullTrackPage, error)

CurrentUsersTopTracks is like CurrentUsersTopTracksOpt but with sensible defaults. The default limit is 20 and the default timerange is medium_term.

func (*Client) CurrentUsersTopTracksOpt Uses

func (c *Client) CurrentUsersTopTracksOpt(opt *Options) (*FullTrackPage, error)

CurrentUsersTopTracksOpt gets a list of the top played tracks in a given time range of the current Spotify user. It supports up to 50 tracks in a single call. This call requires ScopeUserTopRead.

func (*Client) CurrentUsersTracks Uses

func (c *Client) CurrentUsersTracks() (*SavedTrackPage, error)

CurrentUsersTracks gets a list of songs saved in the current Spotify user's "Your Music" library.

func (*Client) CurrentUsersTracksOpt Uses

func (c *Client) CurrentUsersTracksOpt(opt *Options) (*SavedTrackPage, error)

CurrentUsersTracksOpt is like CurrentUsersTracks, but it accepts additional options for sorting and filtering the results.

func (*Client) FeaturedPlaylists Uses

func (c *Client) FeaturedPlaylists() (message string, playlists *SimplePlaylistPage, e error)

FeaturedPlaylists gets a list of playlists featured by Spotify. It is equivalent to c.FeaturedPlaylistsOpt(nil).

func (*Client) FeaturedPlaylistsOpt Uses

func (c *Client) FeaturedPlaylistsOpt(opt *PlaylistOptions) (message string, playlists *SimplePlaylistPage, e error)

FeaturedPlaylistsOpt gets a list of playlists featured by Spotify. It accepts a number of optional parameters via the opt argument.

func (*Client) FollowArtist Uses

func (c *Client) FollowArtist(ids ...ID) error

FollowArtist adds the current user as a follower of one or more spotify artists, identified by their Spotify IDs.

Modifying the lists of artists or users the current user follows requires that the application has the ScopeUserFollowModify scope.

func (*Client) FollowPlaylist Uses

func (c *Client) FollowPlaylist(owner ID, playlist ID, public bool) error

FollowPlaylist adds the current user as a follower of the specified playlist. Any playlist can be followed, regardless of its private/public status, as long as you know the owner and playlist ID.

If the public argument is true, then the playlist will be included in the user's public playlists. To be able to follow playlists privately, the user must have granted the ScopePlaylistModifyPrivate scope. The ScopePlaylistModifyPublic scope is required to follow playlists publicly.

func (*Client) FollowUser Uses

func (c *Client) FollowUser(ids ...ID) error

FollowUser adds the current user as a follower of one or more spotify users, identified by their Spotify IDs.

Modifying the lists of artists or users the current user follows requires that the application has the ScopeUserFollowModify scope.

func (*Client) GetAlbum Uses

func (c *Client) GetAlbum(id ID) (*FullAlbum, error)

GetAlbum gets Spotify catalog information for a single album, given its Spotify ID.

func (*Client) GetAlbumTracks Uses

func (c *Client) GetAlbumTracks(id ID) (*SimpleTrackPage, error)

GetAlbumTracks gets the tracks for a particular album. If you only care about the tracks, this call is more efficient than GetAlbum.

func (*Client) GetAlbumTracksOpt Uses

func (c *Client) GetAlbumTracksOpt(id ID, limit, offset int) (*SimpleTrackPage, error)

GetAlbumTracksOpt behaves like GetAlbumTracks, with the exception that it allows you to specify extra parameters that limit the number of results returned. The maximum number of results to return is specified by limit. The offset argument can be used to specify the index of the first track to return. It can be used along with limit to reqeust the next set of results.

func (*Client) GetAlbums Uses

func (c *Client) GetAlbums(ids ...ID) ([]*FullAlbum, error)

GetAlbums gets Spotify Catalog information for multiple albums, given their Spotify IDs. It supports up to 20 IDs in a single call. Albums are returned in the order requested. If an album is not found, that position in the result slice will be nil.

func (*Client) GetArtist Uses

func (c *Client) GetArtist(id ID) (*FullArtist, error)

GetArtist gets Spotify catalog information for a single artist, given its Spotify ID.

func (*Client) GetArtistAlbums Uses

func (c *Client) GetArtistAlbums(artistID ID) (*SimpleAlbumPage, error)

GetArtistAlbums gets Spotify catalog information about an artist's albums. It is equivalent to GetArtistAlbumsOpt(artistID, nil).

func (*Client) GetArtistAlbumsOpt Uses

func (c *Client) GetArtistAlbumsOpt(artistID ID, options *Options, t *AlbumType) (*SimpleAlbumPage, error)

GetArtistAlbumsOpt is just like GetArtistAlbums, but it accepts optional parameters used to filter and sort the result.

The AlbumType argument can be used to find a particular type of album. Search for multiple types by OR-ing the types together.

func (*Client) GetArtists Uses

func (c *Client) GetArtists(ids ...ID) ([]*FullArtist, error)

GetArtists gets spotify catalog information for several artists based on their Spotify IDs. It supports up to 50 artists in a single call. Artists are returned in the order requested. If an artist is not found, that position in the result will be nil. Duplicate IDs will result in duplicate artists in the result.

func (*Client) GetArtistsTopTracks Uses

func (c *Client) GetArtistsTopTracks(artistID ID, country string) ([]FullTrack, error)

GetArtistsTopTracks gets Spotify catalog information about an artist's top tracks in a particular country. It returns a maximum of 10 tracks. The country is specified as an ISO 3166-1 alpha-2 country code.

func (*Client) GetAudioAnalysis Uses

func (c *Client) GetAudioAnalysis(id ID) (*AudioAnalysis, error)

GetAudioAnalysis queries the Spotify web API for an audio analysis of a single track.

func (*Client) GetAudioFeatures Uses

func (c *Client) GetAudioFeatures(ids ...ID) ([]*AudioFeatures, error)

GetAudioFeatures queries the Spotify Web API for various high-level acoustic attributes of audio tracks. Objects are returned in the order requested. If an object is not found, a nil value is returned in the appropriate position.

func (*Client) GetAvailableGenreSeeds Uses

func (c *Client) GetAvailableGenreSeeds() ([]string, error)

GetAvailableGenreSeeds retrieves a list of available genres seed parameter values for recommendations.

func (*Client) GetCategories Uses

func (c *Client) GetCategories() (*CategoryPage, error)

GetCategories gets a list of categories used to tag items in Spotify (on, for example, the Spotify player's "Browse" tab).

func (*Client) GetCategoriesOpt Uses

func (c *Client) GetCategoriesOpt(opt *Options, locale string) (*CategoryPage, error)

GetCategoriesOpt is like GetCategories, but it accepts optional parameters.

The locale option can be used to get the results in a particular language. It consists of an ISO 639 language code and an ISO 3166-1 alpha-2 country code, separated by an underscore. Specify the empty string to have results returned in the Spotify default language (American English).

func (*Client) GetCategory Uses

func (c *Client) GetCategory(id string) (Category, error)

GetCategory gets a single category used to tag items in Spotify (on, for example, the Spotify player's Browse tab).

func (*Client) GetCategoryOpt Uses

func (c *Client) GetCategoryOpt(id, country, locale string) (Category, error)

GetCategoryOpt is like GetCategory, but it accepts optional arguments. The country parameter is an ISO 3166-1 alpha-2 country code. It can be used to ensure that the category exists for a particular country. The locale argument is an ISO 639 language code and an ISO 3166-1 alpha-2 country code, separated by an underscore. It can be used to get the category strings in a particular language (for example: "es_MX" means get categories in Mexico, returned in Spanish).

This call requries authorization.

func (*Client) GetCategoryPlaylists Uses

func (c *Client) GetCategoryPlaylists(catID string) (*SimplePlaylistPage, error)

GetCategoryPlaylists gets a list of Spotify playlists tagged with a paricular category.

func (*Client) GetCategoryPlaylistsOpt Uses

func (c *Client) GetCategoryPlaylistsOpt(catID string, opt *Options) (*SimplePlaylistPage, error)

GetCategoryPlaylistsOpt is like GetCategoryPlaylists, but it accepts optional arguments.

func (*Client) GetPlaylist Uses

func (c *Client) GetPlaylist(playlistID ID) (*FullPlaylist, error)

GetPlaylist gets a playlist

func (*Client) GetPlaylistOpt Uses

func (c *Client) GetPlaylistOpt(playlistID ID, fields string) (*FullPlaylist, error)

GetPlaylistOpt is like GetPlaylist, but it accepts an optional fields parameter that can be used to filter the query.

fields is a comma-separated list of the fields to return. See the JSON tags on the FullPlaylist struct for valid field options. 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 the 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 (*Client) GetPlaylistTracks Uses

func (c *Client) GetPlaylistTracks(playlistID ID) (*PlaylistTrackPage, error)

GetPlaylistTracks gets full details of the tracks in a playlist, given the playlist's Spotify ID.

func (*Client) GetPlaylistTracksOpt Uses

func (c *Client) GetPlaylistTracksOpt(playlistID ID,
    opt *Options, fields string) (*PlaylistTrackPage, error)

GetPlaylistTracksOpt is like GetPlaylistTracks, but it accepts optional parameters for sorting and filtering the results.

The field parameter is a comma-separated list of the fields to return. See the JSON struct tags for the PlaylistTrackPage type for valid field names. For example, to get just the total number of tracks and the request limit:

fields = "total,limit"

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 = "items(added_at,added_by.id

Use multiple parentheses to drill down into nested objects. For example:

fields = "items(track(name,href,album(name,href)))"

Fields can be excluded by prefixing them with an exclamation mark. For example:

fields = "items.track.album(!external_urls,images)"

func (*Client) GetPlaylistsForUser Uses

func (c *Client) GetPlaylistsForUser(userID string) (*SimplePlaylistPage, error)

GetPlaylistsForUser gets a list of the playlists owned or followed by a particular Spotify user.

Private playlists and collaborative playlists are only retrievable for the current user. In order to read private playlists, the user must have granted the ScopePlaylistReadPrivate scope. Note that this scope alone will not return collaborative playlists, even though they are always private. In order to read collaborative playlists, the user must have granted the ScopePlaylistReadCollaborative scope.

func (*Client) GetPlaylistsForUserOpt Uses

func (c *Client) GetPlaylistsForUserOpt(userID string, opt *Options) (*SimplePlaylistPage, error)

GetPlaylistsForUserOpt is like PlaylistsForUser, but it accepts optional paramters for filtering the results.

func (*Client) GetRecommendations Uses

func (c *Client) GetRecommendations(seeds Seeds, trackAttributes *TrackAttributes, opt *Options) (*Recommendations, error)

GetRecommendations returns a list of recommended tracks based on the given seeds. 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.

func (*Client) GetRelatedArtists Uses

func (c *Client) GetRelatedArtists(id ID) ([]FullArtist, error)

GetRelatedArtists gets Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community's listening history. This function returns up to 20 artists that are considered related to the specified artist.

func (*Client) GetTrack Uses

func (c *Client) GetTrack(id ID) (*FullTrack, error)

GetTrack gets Spotify catalog information for a single track identified by its unique Spotify ID.

func (*Client) GetTracks Uses

func (c *Client) GetTracks(ids ...ID) ([]*FullTrack, error)

GetTracks gets Spotify catalog information for multiple tracks based on their Spotify IDs. It supports up to 50 tracks in a single call. Tracks are returned in the order requested. If a track is not found, that position in the result will be nil. Duplicate ids in the query will result in duplicate tracks in the result.

func (*Client) GetUsersPublicProfile Uses

func (c *Client) GetUsersPublicProfile(userID ID) (*User, error)

GetUsersPublicProfile gets public profile information about a Spotify User. It does not require authentication.

func (*Client) NewReleases Uses

func (c *Client) NewReleases() (albums *SimpleAlbumPage, err error)

NewReleases gets a list of new album releases featured in Spotify. This call requires bearer authorization.

func (*Client) NewReleasesOpt Uses

func (c *Client) NewReleasesOpt(opt *Options) (albums *SimpleAlbumPage, err error)

NewReleasesOpt is like NewReleases, but it accepts optional parameters for filtering the results.

func (*Client) Next Uses

func (c *Client) Next() error

Next skips to the next track in the user's queue in the user's currently active device. This call requires ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) NextAlbumResults Uses

func (c *Client) NextAlbumResults(s *SearchResult) error

NextAlbumResults loads the next page of albums into the specified search result.

func (*Client) NextArtistResults Uses

func (c *Client) NextArtistResults(s *SearchResult) error

NextArtistResults loads the next page of artists into the specified search result.

func (*Client) NextOpt Uses

func (c *Client) NextOpt(opt *PlayOptions) error

NextOpt is like Next but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

func (*Client) NextPlaylistResults Uses

func (c *Client) NextPlaylistResults(s *SearchResult) error

NextPlaylistResults loads the next page of playlists into the specified search result.

func (*Client) NextTrackResults Uses

func (c *Client) NextTrackResults(s *SearchResult) error

NextTrackResults loads the next page of tracks into the specified search result.

func (*Client) Pause Uses

func (c *Client) Pause() error

Pause Playback on the user's currently active device.

Requires the ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) PauseOpt Uses

func (c *Client) PauseOpt(opt *PlayOptions) error

PauseOpt is like Pause but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

func (*Client) Play Uses

func (c *Client) Play() error

Play Start a new context or resume current playback on the user's active device. This call requires ScopeUserModifyPlaybackState in order to modify the player state.

func (*Client) PlayOpt Uses

func (c *Client) PlayOpt(opt *PlayOptions) error

PlayOpt is like Play but with more options

func (*Client) PlayerCurrentlyPlaying Uses

func (c *Client) PlayerCurrentlyPlaying() (*CurrentlyPlaying, error)

PlayerCurrentlyPlaying gets information about the currently playing status for the current user.

Requires the ScopeUserReadCurrentlyPlaying scope or the ScopeUserReadPlaybackState scope in order to read information

func (*Client) PlayerCurrentlyPlayingOpt Uses

func (c *Client) PlayerCurrentlyPlayingOpt(opt *Options) (*CurrentlyPlaying, error)

PlayerCurrentlyPlayingOpt is like PlayerCurrentlyPlaying, but it accepts additional options for sorting and filtering the results.

func (*Client) PlayerDevices Uses

func (c *Client) PlayerDevices() ([]PlayerDevice, error)

PlayerDevices information about available devices for the current user.

Requires the ScopeUserReadPlaybackState scope in order to read information

func (*Client) PlayerRecentlyPlayed Uses

func (c *Client) PlayerRecentlyPlayed() ([]RecentlyPlayedItem, error)

PlayerRecentlyPlayed gets a list of recently-played tracks for the current user. This call requires ScopeUserReadRecentlyPlayed.

func (*Client) PlayerRecentlyPlayedOpt Uses

func (c *Client) PlayerRecentlyPlayedOpt(opt *RecentlyPlayedOptions) ([]RecentlyPlayedItem, error)

PlayerRecentlyPlayedOpt is like PlayerRecentlyPlayed, but it accepts additional options for sorting and filtering the results.

func (*Client) PlayerState Uses

func (c *Client) PlayerState() (*PlayerState, error)

PlayerState gets information about the playing state for the current user

Requires the ScopeUserReadPlaybackState scope in order to read information

func (*Client) PlayerStateOpt Uses

func (c *Client) PlayerStateOpt(opt *Options) (*PlayerState, error)

PlayerStateOpt is like PlayerState, but it accepts additional options for sorting and filtering the results.

func (*Client) Previous Uses

func (c *Client) Previous() error

Previous skips to the Previous track in the user's queue in the user's currently active device. This call requires ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) PreviousAlbumResults Uses

func (c *Client) PreviousAlbumResults(s *SearchResult) error

PreviousAlbumResults loads the previous page of albums into the specified search result.

func (*Client) PreviousArtistResults Uses

func (c *Client) PreviousArtistResults(s *SearchResult) error

PreviousArtistResults loads the previous page of artists into the specified search result.

func (*Client) PreviousOpt Uses

func (c *Client) PreviousOpt(opt *PlayOptions) error

PreviousOpt is like Previous but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

func (*Client) PreviousPlaylistResults Uses

func (c *Client) PreviousPlaylistResults(s *SearchResult) error

PreviousPlaylistResults loads the previous page of playlists into the specified search result.

func (*Client) PreviousTrackResults Uses

func (c *Client) PreviousTrackResults(s *SearchResult) error

PreviousTrackResults loads the previous page of tracks into the specified search result.

func (*Client) RemoveTracksFromLibrary Uses

func (c *Client) RemoveTracksFromLibrary(ids ...ID) error

RemoveTracksFromLibrary removes one or more tracks from the current user's "Your Music" library. This call requires the ScopeUserModifyLibrary scope. Trying to remove a track when you do not have the user's authorization results in a `spotify.Error` with the status code set to http.StatusUnauthorized.

func (*Client) RemoveTracksFromPlaylist Uses

func (c *Client) RemoveTracksFromPlaylist(playlistID ID, trackIDs ...ID) (newSnapshotID string, err error)

RemoveTracksFromPlaylist removes one or more tracks from a user's playlist. This call requrles that the user has authorized the ScopePlaylistModifyPublic or ScopePlaylistModifyPrivate scopes.

If the track(s) occur multiple times in the specified playlist, then all occurrences of the track will be removed. If successful, the snapshot ID returned can be used to identify the playlist version in future requests.

func (*Client) RemoveTracksFromPlaylistOpt Uses

func (c *Client) RemoveTracksFromPlaylistOpt(playlistID ID,
    tracks []TrackToRemove, snapshotID string) (newSnapshotID string, err error)

RemoveTracksFromPlaylistOpt is like RemoveTracksFromPlaylist, but it supports optional parameters that offer more fine-grained control. Instead of deleting all occurrences of a track, this function takes an index with each track URI that indicates the position of the track in the playlist.

In addition, the snapshotID parameter allows you to specify the snapshot ID against which you want to make the changes. Spotify will validate that the specified tracks exist in the specified positions and make the changes, even if more recent changes have been made to the playlist. If a track in the specified position is not found, the entire request will fail and no edits will take place. (Note: the snapshot is optional, pass the empty string if you don't care about it.)

func (*Client) ReorderPlaylistTracks Uses

func (c *Client) ReorderPlaylistTracks(playlistID ID, opt PlaylistReorderOptions) (snapshotID string, err error)

ReorderPlaylistTracks reorders a track or group of tracks in a playlist. It returns a snapshot ID that can be used to identify the [newly modified] playlist version in future requests.

See the docs for PlaylistReorderOptions for information on how the reordering works.

Reordering tracks in the current user's public playlist requires ScopePlaylistModifyPublic. Reordering tracks in the user's private playlists (including collaborative playlists) requires ScopePlaylistModifyPrivate.

func (*Client) Repeat Uses

func (c *Client) Repeat(state string) error

Repeat Set the repeat mode for the user's playback.

Options are repeat-track, repeat-context, and off.

Requires the ScopeUserModifyPlaybackState in order to modify the player state.

func (*Client) RepeatOpt Uses

func (c *Client) RepeatOpt(state string, opt *PlayOptions) error

RepeatOpt is like Repeat but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored.

func (*Client) ReplacePlaylistTracks Uses

func (c *Client) ReplacePlaylistTracks(playlistID ID, trackIDs ...ID) error

ReplacePlaylistTracks replaces all of the tracks in a playlist, overwriting its exising tracks This can be useful for replacing or reordering tracks, or for clearing a playlist.

Modifying a public playlist requires that the user has authorized the ScopePlaylistModifyPublic scope. Modifying a private playlist requires the ScopePlaylistModifyPrivate scope.

A maximum of 100 tracks is permited in this call. Additional tracks must be added via AddTracksToPlaylist.

func (*Client) Search Uses

func (c *Client) Search(query string, t SearchType) (*SearchResult, error)

Search gets Spotify catalog information about artists, albums, tracks, or playlists that match a keyword string. t is a mask containing one or more search types. For example, `Search(query, SearchTypeArtist|SearchTypeAlbum)` will search for artists or albums matching the specified keywords.

Matching

Matching of search keywords is NOT case sensitive. Keywords are matched in any order unless surrounded by double quotes. Searching for playlists will return results where the query keyword(s) match any part of the playlist's name or description. Only popular public playlists are returned.

Operators

The operator NOT can be used to exclude results. For example, query = "roadhouse NOT blues" returns items that match "roadhouse" but exludes those that also contain the keyword "blues". Similarly, the OR operator can be used to broaden the search. query = "roadhouse OR blues" returns all results that include either of the terms. Only one OR operator can be used in a query.

Operators should be specified in uppercase.

Wildcards

The asterisk (*) character can, with some limitations, be used as a wildcard (maximum of 2 per query). It will match a variable number of non-white-space characters. It cannot be used in a quoted phrase, in a field filter, or as the first character of a keyword string.

Field filters

By default, results are returned when a match is found in any field of the target object type. Searches can be made more specific by specifying an album, artist, or track field filter. For example, "album:gold artist:abba type:album" will only return results with the text "gold" in the album name and the text "abba" in the artist's name.

The field filter "year" can be used with album, artist, and track searches to limit the results to a particular year. For example "bob year:2014" or "bob year:1980-2020".

The field filter "tag:new" can be used in album searches to retrieve only albums released in the last two weeks. The field filter "tag:hipster" can be used in album searches to retrieve only albums with the lowest 10% popularity.

Other possible field filters, depending on object types being searched, include "genre", "upc", and "isrc". For example "damian genre:reggae-pop".

func (*Client) SearchOpt Uses

func (c *Client) SearchOpt(query string, t SearchType, opt *Options) (*SearchResult, error)

SearchOpt works just like Search, but it accepts additional parameters for filtering the output. See the documentation for Search more more information.

If the Country field is specified in the options, then the results will only contain artists, albums, and tracks playable in the specified country (playlist results are not affected by the Country option). Additionally, the constant MarketFromToken can be used with authenticated clients. If the client has a valid access token, then the results will only include content playable in the user's country.

func (*Client) Seek Uses

func (c *Client) Seek(position int) error

Seek to the given position in the user’s currently playing track.

The position in milliseconds to seek to. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.

Requires the ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) SeekOpt Uses

func (c *Client) SeekOpt(position int, opt *PlayOptions) error

SeekOpt is like Seek but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

func (*Client) SetPlaylistImage Uses

func (c *Client) SetPlaylistImage(playlistID ID, img io.Reader) error

SetPlaylistImage replaces the image used to represent a playlist. This action can only be performed by the owner of the playlist, and requires ScopeImageUpload as well as ScopeModifyPlaylist{Public|Private}..

func (*Client) Shuffle Uses

func (c *Client) Shuffle(shuffle bool) error

Shuffle switches shuffle on or off for user's playback.

Requires the ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) ShuffleOpt Uses

func (c *Client) ShuffleOpt(shuffle bool, opt *PlayOptions) error

ShuffleOpt is like Shuffle but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

func (*Client) Token Uses

func (c *Client) Token() (*oauth2.Token, error)

Token gets the client's current token.

func (*Client) TransferPlayback Uses

func (c *Client) TransferPlayback(deviceID ID, play bool) error

TransferPlayback transfers playback to a new device and determine if it should start playing.

Note that a value of false for the play parameter when also transferring to another device_id will not pause playback. To ensure that playback is paused on the new device you should send a pause command to the currently active device before transferring to the new device_id.

Requires the ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) UnfollowArtist Uses

func (c *Client) UnfollowArtist(ids ...ID) error

UnfollowArtist removes the current user as a follower of one or more Spotify artists.

Modifying the lists of artists or users the current user follows requires that the application has the ScopeUserFollowModify scope.

func (*Client) UnfollowPlaylist Uses

func (c *Client) UnfollowPlaylist(owner, playlist ID) error

UnfollowPlaylist removes the current user as a follower of a playlist. Unfollowing a publicly followed playlist requires ScopePlaylistModifyPublic. Unfolowing a privately followed playlist requies ScopePlaylistModifyPrivate.

func (*Client) UnfollowUser Uses

func (c *Client) UnfollowUser(ids ...ID) error

UnfollowUser removes the current user as a follower of one or more Spotify users.

Modifying the lists of artists or users the current user follows requires that the application has the ScopeUserFollowModify scope.

func (*Client) UserFollowsPlaylist Uses

func (c *Client) UserFollowsPlaylist(playlistID ID, userIDs ...string) ([]bool, error)

UserFollowsPlaylist checks if one or more (up to 5) Spotify users are following a Spotify playlist, given the playlist's owner and ID.

Checking if a user follows a playlist publicly doesn't require any scopes. Checking if the user is privately following a playlist is only possible for the current user when that user has granted access to the ScopePlaylistReadPrivate scope.

func (*Client) UserHasTracks Uses

func (c *Client) UserHasTracks(ids ...ID) ([]bool, error)

UserHasTracks checks if one or more tracks are saved to the current user's "Your Music" library.

func (*Client) Volume Uses

func (c *Client) Volume(percent int) error

Volume set the volume for the user's current playback device.

Percent is must be a value from 0 to 100 inclusive.

Requires the ScopeUserModifyPlaybackState in order to modify the player state

func (*Client) VolumeOpt Uses

func (c *Client) VolumeOpt(percent int, opt *PlayOptions) error

VolumeOpt is like Volume but with more options

Only expects PlayOptions.DeviceID, all other options will be ignored

type Copyright struct {
    // The copyright text for the album.
    Text string `json:"text"`
    // The type of copyright.
    Type string `json:"type"`
}

Copyright contains the copyright statement associated with an album.

type CurrentlyPlaying Uses

type CurrentlyPlaying struct {
    // Timestamp when data was fetched
    Timestamp int64 `json:"timestamp"`
    // PlaybackContext current context
    PlaybackContext PlaybackContext `json:"context"`
    // Progress into the currently playing track.
    Progress int `json:"progress_ms"`
    // Playing If something is currently playing.
    Playing bool `json:"is_playing"`
    // The currently playing track. Can be null.
    Item *FullTrack `json:"Item"`
}

CurrentlyPlaying contains the information about currently playing items

type Cursor Uses

type Cursor struct {
    After string `json:"after"`
}

Cursor contains a key that can be used to find the next set of items.

type Error Uses

type Error struct {
    // A short description of the error.
    Message string `json:"message"`
    // The HTTP status code.
    Status int `json:"status"`
}

Error represents an error returned by the Spotify Web API.

func (Error) Error Uses

func (e Error) Error() string

type Followers Uses

type Followers struct {
    // The total number of followers.
    Count uint `json:"total"`
    // A link to the Web API endpoint providing full details of the followers,
    // or the empty string if this data is not available.
    Endpoint string `json:"href"`
}

Followers contains information about the number of people following a particular artist or playlist.

type FullAlbum Uses

type FullAlbum struct {
    SimpleAlbum
    Artists    []SimpleArtist `json:"artists"`
    Copyrights []Copyright    `json:"copyrights"`
    Genres     []string       `json:"genres"`
    // The popularity of the album, represented as an integer between 0 and 100,
    // with 100 being the most popular.  Popularity of an album is calculated
    // from the popularify of the album's individual tracks.
    Popularity int `json:"popularity"`
    // The date the album was first released.  For example, "1981-12-15".
    // Depending on the ReleaseDatePrecision, it might be shown as
    // "1981" or "1981-12". You can use ReleaseDateTime to convert this
    // to a time.Time value.
    ReleaseDate string `json:"release_date"`
    // The precision with which ReleaseDate value is known: "year", "month", or "day"
    ReleaseDatePrecision string            `json:"release_date_precision"`
    Tracks               SimpleTrackPage   `json:"tracks"`
    ExternalIDs          map[string]string `json:"external_ids"`
}

FullAlbum provides extra album data in addition to the data provided by SimpleAlbum.

func (*FullAlbum) ReleaseDateTime Uses

func (f *FullAlbum) ReleaseDateTime() time.Time

ReleaseDateTime converts the album's ReleaseDate to a time.TimeValue. All of the fields in the result may not be valid. For example, if f.ReleaseDatePrecision is "month", then only the month and year (but not the day) of the result are valid.

type FullArtist Uses

type FullArtist struct {
    SimpleArtist
    // The popularity of the artist, expressed as an integer between 0 and 100.
    // The artist's popularity is calculated from the popularity of the artist's tracks.
    Popularity int `json:"popularity"`
    // A list of genres the artist is associated with.  For example, "Prog Rock"
    // or "Post-Grunge".  If not yet classified, the slice is empty.
    Genres    []string `json:"genres"`
    Followers Followers
    // Images of the artist in various sizes, widest first.
    Images []Image `json:"images"`
}

FullArtist provides extra artist data in addition to what is provided by SimpleArtist.

type FullArtistCursorPage Uses

type FullArtistCursorPage struct {
    Artists []FullArtist `json:"items"`
    // contains filtered or unexported fields
}

FullArtistCursorPage is a cursor-based paging object containing a set of FullArtist objects.

type FullArtistPage Uses

type FullArtistPage struct {
    Artists []FullArtist `json:"items"`
    // contains filtered or unexported fields
}

FullArtistPage contains FullArtists returned by the Web API.

type FullPlaylist Uses

type FullPlaylist struct {
    SimplePlaylist
    // The playlist description.  Only returned for modified, verified playlists.
    Description string `json:"description"`
    // Information about the followers of this playlist.
    Followers Followers         `json:"followers"`
    Tracks    PlaylistTrackPage `json:"tracks"`
}

FullPlaylist provides extra playlist data in addition to the data provided by SimplePlaylist.

type FullTrack Uses

type FullTrack struct {
    SimpleTrack
    // The album on which the track appears. The album object includes a link in href to full information about the album.
    Album SimpleAlbum `json:"album"`
    // Known external IDs for the track.
    ExternalIDs map[string]string `json:"external_ids"`
    // Popularity of the track.  The value will be between 0 and 100,
    // with 100 being the most popular.  The popularity is calculated from
    // both total plays and most recent plays.
    Popularity int `json:"popularity"`
}

FullTrack provides extra track data in addition to what is provided by SimpleTrack.

type FullTrackPage Uses

type FullTrackPage struct {
    Tracks []FullTrack `json:"items"`
    // contains filtered or unexported fields
}

FullTrackPage contains FullTracks returned by the Web API.

type ID Uses

type ID string

ID is a base-62 identifier for an artist, track, album, etc. It can be found at the end of a spotify.URI.

func (*ID) String Uses

func (id *ID) String() string

type Image Uses

type Image struct {
    // The image height, in pixels.
    Height int `json:"height"`
    // The image width, in pixels.
    Width int `json:"width"`
    // The source URL of the image.
    URL string `json:"url"`
}

Image identifies an image associated with an item.

func (Image) Download Uses

func (i Image) Download(dst io.Writer) error

Download downloads the image and writes its data to the specified io.Writer.

type Key Uses

type Key int

Key represents a pitch using Pitch Class notation.

const (
    C   Key = iota
    CSharp
    D
    DSharp
    E
    F
    FSharp
    G
    GSharp
    A
    ASharp
    B
    DFlat = CSharp
    EFlat = DSharp
    GFlat = FSharp
    AFlat = GSharp
    BFlat = ASharp
)

type Marker Uses

type Marker struct {
    Start      float64 `json:"start"`
    Duration   float64 `json:"duration"`
    Confidence float64 `json:"confidence"`
}

Marker represents beats, bars, tatums and are used in segment and section descriptions.

type Mode Uses

type Mode int

Mode indicates the modality (major or minor) of a track.

const (
    Minor Mode = iota
    Major
)

type Options Uses

type Options struct {
    // Country is an ISO 3166-1 alpha-2 country code.  Provide
    // this parameter if you want the list of returned items to
    // be relevant to a particular country.  If omitted, the
    // results will be relevant to all countries.
    Country *string
    // Limit is the maximum number of items to return.
    Limit *int
    // Offset is the index of the first item to return.  Use it
    // with Limit to get the next set of items.
    Offset *int
    // Timerange is the period of time from which to return results
    // in certain API calls. The three options are the following string
    // literals: "short", "medium", and "long"
    Timerange *string
}

Options contains optional parameters that can be provided to various API calls. Only the non-nil fields are used in queries.

type PlayOptions Uses

type PlayOptions struct {
    // DeviceID The id of the device this command is targeting. If not
    // supplied, the user's currently active device is the target.
    DeviceID *ID `json:"-"`
    // PlaybackContext Spotify URI of the context to play.
    // Valid contexts are albums, artists & playlists.
    PlaybackContext *URI `json:"context_uri,omitempty"`
    // URIs Array of the Spotify track URIs to play
    URIs []URI `json:"uris,omitempty"`
    // PlaybackOffset Indicates from where in the context playback should start.
    // Only available when context corresponds to an album or playlist
    // object, or when the URIs parameter is used.
    PlaybackOffset *PlaybackOffset `json:"offset,omitempty"`
    // PositionMs Indicates from what position to start playback.
    // Must be a positive number. Passing in a position that is greater
    // than the length of the track will cause the player to start playing the next song.
    // Defaults to 0, starting a track from the beginning.
    PositionMs int `json:"position_ms,omitempty"`
}

type PlaybackContext Uses

type PlaybackContext struct {
    // ExternalURLs of the context, or null if not available.
    ExternalURLs map[string]string `json:"external_urls"`
    // Endpoint of the context, or null if not available.
    Endpoint string `json:"href"`
    // Type of the item's context. Can be one of album, artist or playlist.
    Type string `json:"type"`
    // URI is the Spotify URI for the context.
    URI URI `json:"uri"`
}

PlaybackContext is the playback context

type PlaybackOffset Uses

type PlaybackOffset struct {
    // Position is zero based and can’t be negative.
    Position int `json:"position,omitempty"`
    // URI is a string representing the uri of the item to start at.
    URI URI `json:"uri,omitempty"`
}

PlaybackOffset can be specified either by track URI OR Position. If both are present the request will return 400 BAD REQUEST. If incorrect values are provided for position or uri, the request may be accepted but with an unpredictable resulting action on playback.

type PlayerDevice Uses

type PlayerDevice struct {
    // ID of the device. This may be empty.
    ID  ID  `json:"id"`
    // Active If this device is the currently active device.
    Active bool `json:"is_active"`
    // Restricted Whether controlling this device is restricted. At present if
    // this is "true" then no Web API commands will be accepted by this device.
    Restricted bool `json:"is_restricted"`
    // Name The name of the device.
    Name string `json:"name"`
    // Type of device, such as "Computer", "Smartphone" or "Speaker".
    Type string `json:"type"`
    // Volume The current volume in percent.
    Volume int `json:"volume_percent"`
}

PlayerDevice contains information about a device that a user can play music on

type PlayerState Uses

type PlayerState struct {
    CurrentlyPlaying
    // Device The device that is currently active
    Device PlayerDevice `json:"device"`
    // ShuffleState Shuffle is on or off
    ShuffleState bool `json:"shuffle_state"`
    // RepeatState off, track, context
    RepeatState string `json:"repeat_state"`
}

PlayerState contains information about the current playback.

type PlaylistOptions Uses

type PlaylistOptions struct {
    Options
    // The desired language, consisting of a lowercase IO 639
    // language code and an uppercase ISO 3166-1 alpha-2
    // country code, joined by an underscore.  Provide this
    // parameter if you want the results returned in a particular
    // language.  If not specified, the result will be returned
    // in the Spotify default language (American English).
    Locale *string
    // A timestamp in ISO 8601 format (yyyy-MM-ddTHH:mm:ss).
    // use this paramter to specify the user's local time to
    // get results tailored for that specific date and time
    // in the day.  If not provided, the response defaults to
    // the current UTC time.
    Timestamp *string
}

PlaylistOptions contains optional parameters that can be used when querying for featured playlists. Only the non-nil fields are used in the request.

type PlaylistReorderOptions Uses

type PlaylistReorderOptions struct {
    // The position of the first track to be reordered.
    // This field is required.
    RangeStart int `json:"range_start"`
    // The amount of tracks to be reordered.  This field is optional.  If
    // you don't set it, the value 1 will be used.
    RangeLength int `json:"range_length,omitempty"`
    // The position where the tracks should be inserted.  To reorder the
    // tracks to the end of the playlist, simply set this to the position
    // after the last track.  This field is required.
    InsertBefore int `json:"insert_before"`
    // The playlist's snapshot ID against which you wish to make the changes.
    // This field is optional.
    SnapshotID string `json:"snapshot_id,omitempty"`
}

PlaylistReorderOptions is used with ReorderPlaylistTracks to reorder a track or group of tracks in a playlist.

For example, in a playlist with 10 tracks, you can:

- move the first track to the end of the playlist by setting

RangeStart to 0 and InsertBefore to 10

- move the last track to the beginning of the playlist by setting

RangeStart to 9 and InsertBefore to 0

- Move the last 2 tracks to the beginning of the playlist by setting

RangeStart to 8 and RangeLength to 2.

type PlaylistTrack Uses

type PlaylistTrack struct {
    // The date and time the track was added to the playlist.
    // You can use the TimestampLayout constant to convert
    // this field to a time.Time value.
    // Warning: very old playlists may not populate this value.
    AddedAt string `json:"added_at"`
    // The Spotify user who added the track to the playlist.
    // Warning: vary old playlists may not populate this value.
    AddedBy User `json:"added_by"`
    // Information about the track.
    Track FullTrack `json:"track"`
}

PlaylistTrack contains info about a track in a playlist.

type PlaylistTrackPage Uses

type PlaylistTrackPage struct {
    Tracks []PlaylistTrack `json:"items"`
    // contains filtered or unexported fields
}

PlaylistTrackPage contains information about tracks in a playlist.

type PlaylistTracks Uses

type PlaylistTracks struct {
    // A link to the Web API endpoint where full details of
    // the playlist's tracks can be retrieved.
    Endpoint string `json:"href"`
    // The total number of tracks in the playlist.
    Total uint `json:"total"`
}

PlaylistTracks contains details about the tracks in a playlist.

type PrivateUser Uses

type PrivateUser struct {
    User
    // 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 acess to the ScopeUserReadPrivate scope.
    Country string `json:"country"`
    // The user's email address, as entered by the user when creating their account.
    // Note: this email 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 ScopeUserReadEmail scope.
    Email string `json:"email"`
    // 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 ScopeUserReadPrivate scope.
    Product string `json:"product"`
    // The user's date of birth, in the format 'YYYY-MM-DD'.  You can use
    // the DateLayout constant to convert this to a time.Time value.
    // This field is only available when the current user has granted
    // access to the ScopeUserReadBirthdate scope.
    Birthdate string `json:"birthdate"`
}

PrivateUser contains additional information about a user. This data is private and requires user authentication.

type RecentlyPlayedItem Uses

type RecentlyPlayedItem struct {
    // Track is the track information
    Track SimpleTrack `json:"track"`

    // PlayedAt is the time that this song was played
    PlayedAt time.Time `json:"played_at"`

    // PlaybackContext is the current playback context
    PlaybackContext PlaybackContext `json:"context"`
}

type RecentlyPlayedOptions Uses

type RecentlyPlayedOptions struct {
    // Limit is the maximum number of items to return. Must be no greater than
    // fifty.
    Limit int

    // AfterEpochMs is a Unix epoch in milliseconds that describes a time after
    // which to return songs.
    AfterEpochMs int64

    // BeforeEpochMs is a Unix epoch in milliseconds that describes a time
    // before which to return songs.
    BeforeEpochMs int64
}

RecentlyPlayedOptions describes options for the recently-played request. All fields are optional. Only one of `AfterEpochMs` and `BeforeEpochMs` may be given. Note that it seems as if Spotify only remembers the fifty most-recent tracks as of right now.

type RecentlyPlayedResult Uses

type RecentlyPlayedResult struct {
    Items []RecentlyPlayedItem `json:"items"`
}

type RecommendationSeed Uses

type RecommendationSeed struct {
    AfterFilteringSize int    `json:"afterFilteringSize"`
    AfterRelinkingSize int    `json:"afterRelinkingSize"`
    Endpoint           string `json:"href"`
    ID                 ID     `json:"id"`
    InitialPoolSize    int    `json:"initialPoolSize"`
    Type               string `json:"type"`
}

RecommendationSeed represents a recommendation seed after being processed by the Spotify API

type Recommendations Uses

type Recommendations struct {
    Seeds  []RecommendationSeed `json:"seeds"`
    Tracks []SimpleTrack        `json:"tracks"`
}

Recommendations contains a list of recommended tracks based on seeds

type SavedAlbum Uses

type SavedAlbum struct {
    // The date and time the track was saved, represented as an ISO
    // 8601 UTC timestamp with a zero offset (YYYY-MM-DDTHH:MM:SSZ).
    // You can use the TimestampLayout constant to convert this to
    // a time.Time value.
    AddedAt   string `json:"added_at"`
    FullAlbum `json:"album"`
}

SavedAlbum provides info about an album saved to an user's account.

type SavedAlbumPage Uses

type SavedAlbumPage struct {
    Albums []SavedAlbum `json:"items"`
    // contains filtered or unexported fields
}

SavedAlbumPage contains SavedAlbums returned by the Web API.

type SavedTrack Uses

type SavedTrack struct {
    // The date and time the track was saved, represented as an ISO
    // 8601 UTC timestamp with a zero offset (YYYY-MM-DDTHH:MM:SSZ).
    // You can use the TimestampLayout constant to convert this to
    // a time.Time value.
    AddedAt   string `json:"added_at"`
    FullTrack `json:"track"`
}

SavedTrack provides info about a track saved to a user's account.

type SavedTrackPage Uses

type SavedTrackPage struct {
    Tracks []SavedTrack `json:"items"`
    // contains filtered or unexported fields
}

SavedTrackPage contains SavedTracks return by the Web API.

type SearchResult Uses

type SearchResult struct {
    Artists   *FullArtistPage     `json:"artists"`
    Albums    *SimpleAlbumPage    `json:"albums"`
    Playlists *SimplePlaylistPage `json:"playlists"`
    Tracks    *FullTrackPage      `json:"tracks"`
}

SearchResult contains the results of a call to Search. Fields that weren't searched for will be nil pointers.

type SearchType Uses

type SearchType int

SearchType represents the type of a query used in the Search function.

type Section Uses

type Section struct {
    Marker
    Loudness                float64 `json:"loudness"`
    Tempo                   float64 `json:"tempo"`
    TempoConfidence         float64 `json:"tempo_confidence"`
    Key                     Key     `json:"key"`
    KeyConfidence           float64 `json:"key_confidence"`
    Mode                    Mode    `json:"mode"`
    ModeConfidence          float64 `json:"mode_confidence"`
    TimeSignature           int     `json:"time_signature"`
    TimeSignatureConfidence float64 `json:"time_signature_confidence"`
}

Section represents a large variation 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 Seeds Uses

type Seeds struct {
    Artists []ID
    Tracks  []ID
    Genres  []string
}

Seeds contains IDs of artists, genres and/or tracks to be used as seeds for recommendations

type Segment Uses

type Segment struct {
    Marker
    LoudnessStart   float64   `json:"loudness_start"`
    LoudnessMaxTime float64   `json:"loudness_max_time"`
    LoudnessMax     float64   `json:"loudness_max"`
    LoudnessEnd     float64   `json:"loudness_end"`
    Pitches         []float64 `json:"pitches"`
    Timbre          []float64 `json:"timbre"`
}

Segment is characterized by it's perceptual onset and duration in seconds, loudness (dB), pitch and timbral content.

type SimpleAlbum Uses

type SimpleAlbum struct {
    // The name of the album.
    Name string `json:"name"`
    // A slice of SimpleArtists
    Artists []SimpleArtist `json:"artists"`
    // The field is present when getting an artist’s
    // albums. Possible values are “album”, “single”,
    // “compilation”, “appears_on”. Compare to album_type
    // this field represents relationship between the artist
    // and the album.
    AlbumGroup string `json:"album_group"`
    // The type of the album: one of "album",
    // "single", or "compilation".
    AlbumType string `json:"album_type"`
    // The SpotifyID for the album.
    ID  ID  `json:"id"`
    // The SpotifyURI for the album.
    URI URI `json:"uri"`
    // The markets in which the album is available,
    // identified using ISO 3166-1 alpha-2 country
    // codes.  Note that al album is considered
    // available in a market when at least 1 of its
    // tracks is available in that market.
    AvailableMarkets []string `json:"available_markets"`
    // A link to the Web API enpoint providing full
    // details of the album.
    Endpoint string `json:"href"`
    // The cover art for the album in various sizes,
    // widest first.
    Images []Image `json:"images"`
    // Known external URLs for this album.
    ExternalURLs map[string]string `json:"external_urls"`
    // The date the album was first released.  For example, "1981-12-15".
    // Depending on the ReleaseDatePrecision, it might be shown as
    // "1981" or "1981-12". You can use ReleaseDateTime to convert this
    // to a time.Time value.
    ReleaseDate string `json:"release_date"`
    // The precision with which ReleaseDate value is known: "year", "month", or "day"
    ReleaseDatePrecision string `json:"release_date_precision"`
}

SimpleAlbum contains basic data about an album.

type SimpleAlbumPage Uses

type SimpleAlbumPage struct {
    Albums []SimpleAlbum `json:"items"`
    // contains filtered or unexported fields
}

SimpleAlbumPage contains SimpleAlbums returned by the Web API.

type SimpleArtist Uses

type SimpleArtist struct {
    Name string `json:"name"`
    ID   ID     `json:"id"`
    // The Spotify URI for the artist.
    URI URI `json:"uri"`
    // A link to the Web API enpoint providing full details of the artist.
    Endpoint     string            `json:"href"`
    ExternalURLs map[string]string `json:"external_urls"`
}

SimpleArtist contains basic info about an artist.

type SimplePlaylist Uses

type SimplePlaylist struct {
    // Indicates whether the playlist owner allows others to modify the playlist.
    // Note: only non-collaborative playlists are currently returned by Spotify's Web API.
    Collaborative bool              `json:"collaborative"`
    ExternalURLs  map[string]string `json:"external_urls"`
    // A link to the Web API endpoint providing full details of the playlist.
    Endpoint string `json:"href"`
    ID       ID     `json:"id"`
    // The playlist image.  Note: this field is only  returned for modified,
    // verified playlists. Otherwise the slice is empty.  If returned, the source
    // URL for the image is temporary and will expire in less than a day.
    Images   []Image `json:"images"`
    Name     string  `json:"name"`
    Owner    User    `json:"owner"`
    IsPublic 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"`
    // A collection to the Web API endpoint where full details of the playlist's
    // tracks can be retrieved, along with the total number of tracks in the playlist.
    Tracks PlaylistTracks `json:"tracks"`
    URI    URI            `json:"uri"`
}

SimplePlaylist contains basic info about a Spotify playlist.

type SimplePlaylistPage Uses

type SimplePlaylistPage struct {
    Playlists []SimplePlaylist `json:"items"`
    // contains filtered or unexported fields
}

SimplePlaylistPage contains SimplePlaylists returned by the Web API.

type SimpleTrack Uses

type SimpleTrack struct {
    Artists []SimpleArtist `json:"artists"`
    // A list of the countries in which the track can be played,
    // identified by their ISO 3166-1 alpha-2 codes.
    AvailableMarkets []string `json:"available_markets"`
    // The disc number (usually 1 unless the album consists of more than one disc).
    DiscNumber int `json:"disc_number"`
    // The length of the track, in milliseconds.
    Duration int `json:"duration_ms"`
    // Whether or not the track has explicit lyrics.
    // true => yes, it does; false => no, it does not.
    Explicit bool `json:"explicit"`
    // External URLs for this track.
    ExternalURLs map[string]string `json:"external_urls"`
    // A link to the Web API endpoint providing full details for this track.
    Endpoint string `json:"href"`
    ID       ID     `json:"id"`
    Name     string `json:"name"`
    // A URL to a 30 second preview (MP3) of the track.
    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
    // DiscNumber.
    TrackNumber int `json:"track_number"`
    URI         URI `json:"uri"`
}

SimpleTrack contains basic info about a track.

func (SimpleTrack) String Uses

func (st SimpleTrack) String() string

func (*SimpleTrack) TimeDuration Uses

func (t *SimpleTrack) TimeDuration() time.Duration

TimeDuration returns the track's duration as a time.Duration value.

type SimpleTrackPage Uses

type SimpleTrackPage struct {
    Tracks []SimpleTrack `json:"items"`
    // contains filtered or unexported fields
}

SimpleTrackPage contains SimpleTracks returned by the Web API.

type TrackAttributes Uses

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

TrackAttributes contains various tuneable parameters that can be used for recommendations. For each of the tuneable track attributes, target, min and max values may be provided. Target:

Tracks with the attribute values nearest to the target values will be preferred.
For example, you might request TargetEnergy=0.6 and TargetDanceability=0.8.
All target values will be weighed equally in ranking results.

Max:

A hard ceiling on the selected track attribute’s value can be provided.
For example, MaxInstrumentalness=0.35 would filter out most tracks
that are likely to be instrumental.

Min:

A hard floor on the selected track attribute’s value can be provided.
For example, min_tempo=140 would restrict results to only those tracks
with a tempo of greater than 140 beats per minute.

func NewTrackAttributes Uses

func NewTrackAttributes() *TrackAttributes

NewTrackAttributes returns a new TrackAttributes instance with no attributes set. Attributes can then be chained following a builder pattern:

ta := NewTrackAttributes().
		MaxAcousticness(0.15).
		TargetPopularity(90)

func (*TrackAttributes) MaxAcousticness Uses

func (ta *TrackAttributes) MaxAcousticness(acousticness float64) *TrackAttributes

MaxAcousticness sets the maximum acousticness Acousticness is a confidence measure from 0.0 to 1.0 of whether the track is acoustic. A value of 1.0 represents high confidence that the track is acoustic.

func (*TrackAttributes) MaxDanceability Uses

func (ta *TrackAttributes) MaxDanceability(danceability float64) *TrackAttributes

MaxDanceability sets the maximum danceability 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.

func (*TrackAttributes) MaxDuration Uses

func (ta *TrackAttributes) MaxDuration(duration int) *TrackAttributes

MaxDuration sets the maximum length of the track in milliseconds

func (*TrackAttributes) MaxEnergy Uses

func (ta *TrackAttributes) MaxEnergy(energy float64) *TrackAttributes

MaxEnergy sets the maximum energy Energy is a measure from 0.0 to 1.0 and represents a perceptual mesaure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy.

func (*TrackAttributes) MaxInstrumentalness Uses

func (ta *TrackAttributes) MaxInstrumentalness(instrumentalness float64) *TrackAttributes

MaxInstrumentalness sets the maximum instrumentalness Instrumentalness 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.

func (*TrackAttributes) MaxKey Uses

func (ta *TrackAttributes) MaxKey(key int) *TrackAttributes

MaxKey sets the maximum key Integers map to pitches using standard Pitch Class notation (https://en.wikipedia.org/wiki/Pitch_class).

func (*TrackAttributes) MaxLiveness Uses

func (ta *TrackAttributes) MaxLiveness(liveness float64) *TrackAttributes

MaxLiveness sets the maximum liveness 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 likelihook that the track is live.

func (*TrackAttributes) MaxLoudness Uses

func (ta *TrackAttributes) MaxLoudness(loudness float64) *TrackAttributes

MaxLoudness sets the maximum loudness in decibels (dB) Loudness values are averaged across the entire track and are useful for comparing the relative loudness of tracks. Typical values range between -60 and 0 dB.

func (*TrackAttributes) MaxMode Uses

func (ta *TrackAttributes) MaxMode(mode int) *TrackAttributes

MaxMode sets the maximum mode Mode indicates the modality (major or minor) of a track.

func (*TrackAttributes) MaxPopularity Uses

func (ta *TrackAttributes) MaxPopularity(popularity int) *TrackAttributes

MaxPopularity sets the maximum popularity. The value will be 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. Note: When applying track relinking via the market parameter, it is expected to find relinked tracks with popularities that do not match min_*, max_* and target_* popularities. These relinked tracks are accurate replacements for unplayable tracks with the expected popularity scores. Original, non-relinked tracks are available via the linked_from attribute of the relinked track response.

func (*TrackAttributes) MaxSpeechiness Uses

func (ta *TrackAttributes) MaxSpeechiness(speechiness float64) *TrackAttributes

MaxSpeechiness sets the maximum speechiness. Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording, the closer to 1.0 the speechiness will be. 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, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.

func (*TrackAttributes) MaxTempo Uses

func (ta *TrackAttributes) MaxTempo(tempo float64) *TrackAttributes

MaxTempo sets the maximum tempo in beats per minute (BPM).

func (*TrackAttributes) MaxTimeSignature Uses

func (ta *TrackAttributes) MaxTimeSignature(timeSignature int) *TrackAttributes

MaxTimeSignature sets the maximum time signature The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure).

func (*TrackAttributes) MaxValence Uses

func (ta *TrackAttributes) MaxValence(valence float64) *TrackAttributes

MaxValence sets the maximum valence. Valence is 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).

func (*TrackAttributes) MinAcousticness Uses

func (ta *TrackAttributes) MinAcousticness(acousticness float64) *TrackAttributes

MinAcousticness sets the minimum acousticness Acousticness is a confidence measure from 0.0 to 1.0 of whether the track is acoustic. A value of 1.0 represents high confidence that the track is acoustic.

func (*TrackAttributes) MinDanceability Uses

func (ta *TrackAttributes) MinDanceability(danceability float64) *TrackAttributes

MinDanceability sets the minimum danceability 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.

func (*TrackAttributes) MinDuration Uses

func (ta *TrackAttributes) MinDuration(duration int) *TrackAttributes

MinDuration sets the minimum length of the track in milliseconds

func (*TrackAttributes) MinEnergy Uses

func (ta *TrackAttributes) MinEnergy(energy float64) *TrackAttributes

MinEnergy sets the minimum energy Energy is a measure from 0.0 to 1.0 and represents a perceptual mesaure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy.

func (*TrackAttributes) MinInstrumentalness Uses

func (ta *TrackAttributes) MinInstrumentalness(instrumentalness float64) *TrackAttributes

MinInstrumentalness sets the minimum instrumentalness Instrumentalness 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.

func (*TrackAttributes) MinKey Uses

func (ta *TrackAttributes) MinKey(key int) *TrackAttributes

MinKey sets the minimum key Integers map to pitches using standard Pitch Class notation (https://en.wikipedia.org/wiki/Pitch_class).

func (*TrackAttributes) MinLiveness Uses

func (ta *TrackAttributes) MinLiveness(liveness float64) *TrackAttributes

MinLiveness sets the minimum liveness 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 likelihook that the track is live.

func (*TrackAttributes) MinLoudness Uses

func (ta *TrackAttributes) MinLoudness(loudness float64) *TrackAttributes

MinLoudness sets the minimum loudness in decibels (dB) Loudness values are averaged across the entire track and are useful for comparing the relative loudness of tracks. Typical values range between -60 and 0 dB.

func (*TrackAttributes) MinMode Uses

func (ta *TrackAttributes) MinMode(mode int) *TrackAttributes

MinMode sets the minimum mode Mode indicates the modality (major or minor) of a track.

func (*TrackAttributes) MinPopularity Uses

func (ta *TrackAttributes) MinPopularity(popularity int) *TrackAttributes

MinPopularity sets the minimum popularity. The value will be 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. Note: When applying track relinking via the market parameter, it is expected to find relinked tracks with popularities that do not match min_*, max_* and target_* popularities. These relinked tracks are accurate replacements for unplayable tracks with the expected popularity scores. Original, non-relinked tracks are available via the linked_from attribute of the relinked track response.

func (*TrackAttributes) MinSpeechiness Uses

func (ta *TrackAttributes) MinSpeechiness(speechiness float64) *TrackAttributes

MinSpeechiness sets the minimum speechiness. Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording, the closer to 1.0 the speechiness will be. 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, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.

func (*TrackAttributes) MinTempo Uses

func (ta *TrackAttributes) MinTempo(tempo float64) *TrackAttributes

MinTempo sets the minimum tempo in beats per minute (BPM).

func (*TrackAttributes) MinTimeSignature Uses

func (ta *TrackAttributes) MinTimeSignature(timeSignature int) *TrackAttributes

MinTimeSignature sets the minimum time signature The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure).

func (*TrackAttributes) MinValence Uses

func (ta *TrackAttributes) MinValence(valence float64) *TrackAttributes

MinValence sets the minimum valence. Valence is 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).

func (*TrackAttributes) TargetAcousticness Uses

func (ta *TrackAttributes) TargetAcousticness(acousticness float64) *TrackAttributes

TargetAcousticness sets the target acousticness Acousticness is a confidence measure from 0.0 to 1.0 of whether the track is acoustic. A value of 1.0 represents high confidence that the track is acoustic.

func (*TrackAttributes) TargetDanceability Uses

func (ta *TrackAttributes) TargetDanceability(danceability float64) *TrackAttributes

TargetDanceability sets the target danceability 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.

func (*TrackAttributes) TargetDuration Uses

func (ta *TrackAttributes) TargetDuration(duration int) *TrackAttributes

TargetDuration sets the target length of the track in milliseconds

func (*TrackAttributes) TargetEnergy Uses

func (ta *TrackAttributes) TargetEnergy(energy float64) *TrackAttributes

TargetEnergy sets the target energy Energy is a measure from 0.0 to 1.0 and represents a perceptual mesaure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy.

func (*TrackAttributes) TargetInstrumentalness Uses

func (ta *TrackAttributes) TargetInstrumentalness(instrumentalness float64) *TrackAttributes

TargetInstrumentalness sets the target instrumentalness Instrumentalness 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.

func (*TrackAttributes) TargetKey Uses

func (ta *TrackAttributes) TargetKey(key int) *TrackAttributes

TargetKey sets the target key Integers map to pitches using standard Pitch Class notation (https://en.wikipedia.org/wiki/Pitch_class).

func (*TrackAttributes) TargetLiveness Uses

func (ta *TrackAttributes) TargetLiveness(liveness float64) *TrackAttributes

TargetLiveness sets the target liveness 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 likelihook that the track is live.

func (*TrackAttributes) TargetLoudness Uses

func (ta *TrackAttributes) TargetLoudness(loudness float64) *TrackAttributes

TargetLoudness sets the target loudness in decibels (dB) Loudness values are averaged across the entire track and are useful for comparing the relative loudness of tracks. Typical values range between -60 and 0 dB.

func (*TrackAttributes) TargetMode Uses

func (ta *TrackAttributes) TargetMode(mode int) *TrackAttributes

TargetMode sets the target mode Mode indicates the modality (major or minor) of a track.

func (*TrackAttributes) TargetPopularity Uses

func (ta *TrackAttributes) TargetPopularity(popularity int) *TrackAttributes

TargetPopularity sets the target popularity. The value will be 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. Note: When applying track relinking via the market parameter, it is expected to find relinked tracks with popularities that do not match min_*, max_* and target_* popularities. These relinked tracks are accurate replacements for unplayable tracks with the expected popularity scores. Original, non-relinked tracks are available via the linked_from attribute of the relinked track response.

func (*TrackAttributes) TargetSpeechiness Uses

func (ta *TrackAttributes) TargetSpeechiness(speechiness float64) *TrackAttributes

TargetSpeechiness sets the target speechiness. Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording, the closer to 1.0 the speechiness will be. 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, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.

func (*TrackAttributes) TargetTempo Uses

func (ta *TrackAttributes) TargetTempo(tempo float64) *TrackAttributes

TargetTempo sets the target tempo in beats per minute (BPM).

func (*TrackAttributes) TargetTimeSignature Uses

func (ta *TrackAttributes) TargetTimeSignature(timeSignature int) *TrackAttributes

TargetTimeSignature sets the target time signature The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure).

func (*TrackAttributes) TargetValence Uses

func (ta *TrackAttributes) TargetValence(valence float64) *TrackAttributes

TargetValence sets the target valence. Valence is 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).

type TrackToRemove Uses

type TrackToRemove struct {
    URI       string `json:"uri"`
    Positions []int  `json:"positions"`
}

TrackToRemove specifies a track to be removed from a playlist. Positions is a slice of 0-based track indices. TrackToRemove is used with RemoveTracksFromPlaylistOpt.

func NewTrackToRemove Uses

func NewTrackToRemove(trackID string, positions []int) TrackToRemove

NewTrackToRemove creates a new TrackToRemove object with the specified track ID and playlist locations.

type URI Uses

type URI string

URI identifies an artist, album, track, or category. For example, spotify:track:6rqhFgbbKwnb9MLmUQDhG6

type User Uses

type User struct {
    // The name displayed on the user's profile.
    // Note: Spotify currently fails to populate
    // this field when querying for a playlist.
    DisplayName string `json:"display_name"`
    // Known public external URLs for the user.
    ExternalURLs map[string]string `json:"external_urls"`
    // Information about followers of the user.
    Followers Followers `json:"followers"`
    // A link to the Web API endpoint for this user.
    Endpoint string `json:"href"`
    // The Spotify user ID for the user.
    ID  string `json:"id"`
    // The user's profile image.
    Images []Image `json:"images"`
    // The Spotify URI for the user.
    URI URI `json:"uri"`
}

User contains the basic, publicly available information about a Spotify user.

Package spotify imports 16 packages (graph) and is imported by 24 packages. Updated 2019-02-10. Refresh now. Tools for package owners.