Documentation ¶
Index ¶
- Constants
- type Api
- func (a *Api) CheckSavedTracks(trackIDs []string) (*CheckSavedTracksResponse, *util.RequestError)
- func (a *Api) GetCurrentUser() (*GetCurrentUserResponse, *util.RequestError)
- func (a *Api) GetToken(code string) (*GetTokenResponse, *util.RequestError)
- func (a *Api) RefreshToken(refreshToken string) (*GetTokenResponse, *util.RequestError)
- func (a *Api) SaveTracks(trackIDs []string) *util.RequestError
- func (a *Api) SearchTracks(artist, album, track string, limit int, offset int) (*SearchResponse, *util.RequestError)
- type CheckSavedTracksResponse
- type ExternalUrls
- type GetCurrentUserResponse
- type GetTokenResponse
- type Image
- type SaveTracksRequestBody
- type SearchResponse
Constants ¶
View Source
const ApiUrl = "https://api.spotify.com/v1"
View Source
const AuthApiUrl = "https://accounts.spotify.com/api"
View Source
const CheckSavedTracksPath = "/me/tracks/contains"
View Source
const SpotifyUserIdSessionKey = "spotifyUserId"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func NewAuthenticatedApi ¶
func NewAuthenticatedApi(config *config.Config, ds *data_store.DataStore, spotifyUser *data_store.SpotifyUser, session *sessions.Session, w http.ResponseWriter, r *http.Request) *Api
func (*Api) CheckSavedTracks ¶
func (a *Api) CheckSavedTracks(trackIDs []string) (*CheckSavedTracksResponse, *util.RequestError)
https://developer.spotify.com/documentation/web-api/reference/check-users-saved-tracks
func (*Api) GetCurrentUser ¶
func (a *Api) GetCurrentUser() (*GetCurrentUserResponse, *util.RequestError)
https://developer.spotify.com/documentation/web-api/reference/get-current-users-profile
func (*Api) GetToken ¶
func (a *Api) GetToken(code string) (*GetTokenResponse, *util.RequestError)
https://developer.spotify.com/documentation/web-api/tutorials/code-flow
func (*Api) RefreshToken ¶
func (a *Api) RefreshToken(refreshToken string) (*GetTokenResponse, *util.RequestError)
https://developer.spotify.com/documentation/web-api/tutorials/refreshing-tokens
func (*Api) SaveTracks ¶
func (a *Api) SaveTracks(trackIDs []string) *util.RequestError
https://developer.spotify.com/documentation/web-api/reference/save-tracks-user
func (*Api) SearchTracks ¶
func (a *Api) SearchTracks(artist, album, track string, limit int, offset int) (*SearchResponse, *util.RequestError)
https://developer.spotify.com/documentation/web-api/reference/search
type ExternalUrls ¶
type ExternalUrls struct {
Spotify string `json:"spotify"`
}
type GetCurrentUserResponse ¶
type GetCurrentUserResponse struct { DisplayName string `json:"display_name"` Href string `json:"href"` Id string `json:"id"` ExternalUrls struct { Spotify string `json:"spotify"` } `json:"external_urls"` Images []struct { Height int `json:"height"` Url string `json:"url"` Width int `json:"width"` } `json:"images"` }
type GetTokenResponse ¶
type SaveTracksRequestBody ¶
type SaveTracksRequestBody struct {
TrackIds []string `json:"ids"`
}
type SearchResponse ¶
type SearchResponse struct { Tracks struct { Href string `json:"href"` Total int `json:"total"` Items []struct { DiscNumber int `json:"disc_number"` DurationMs int `json:"duration_ms"` Explicit bool `json:"explicit"` ExternalUrls ExternalUrls `json:"external_urls"` Href string `json:"href"` Id string `json:"id"` Name string `json:"name"` TrackNumber int `json:"track_number"` Uri string `json:"uri"` Album struct { AlbumType string `json:"album_type"` Artists []struct { ExternalUrls ExternalUrls `json:"external_urls"` Href string `json:"href"` Id string `json:"id"` Name string `json:"name"` Uri string `json:"uri"` } `json:"artists"` ExternalUrls ExternalUrls `json:"external_urls"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Name string `json:"name"` ReleaseDate string `json:"release_date"` ReleaseDatePrecision string `json:"release_date_precision"` TotalTracks int `json:"total_tracks"` Uri string `json:"uri"` } `json:"album"` Artists []struct { ExternalUrls ExternalUrls `json:"external_urls"` Genres []string `json:"genres"` Href string `json:"href"` Id string `json:"id"` Images []Image `json:"images"` Name string `json:"name"` Uri string `json:"uri"` } `json:"artists"` } `json:"items"` } `json:"tracks"` }
Click to show internal directories.
Click to hide internal directories.