Documentation ¶
Index ¶
- Constants
- func WithStrideSongsAccessToken() requestConfigOption
- type AddTracksToPlaylistRequest
- type AnalyzedTrack
- type AuthResponse
- type Client
- func (c *Client) AddTracksToPlaylist(ctx context.Context, inp AddTracksToPlaylistRequest, ...) error
- func (c *Client) AllUserTracks(ctx context.Context) ([]Track, error)
- func (c *Client) AnalyzedTracks(ctx context.Context, tracks []Track) ([]AnalyzedTrack, error)
- func (c *Client) Auth(ctx context.Context, authorizationCode string) (*AuthResponse, error)
- func (c *Client) CreatePlaylist(ctx context.Context, inp CreatePlaylistRequest, opts ...requestConfigOption) (*Playlist, error)
- func (c *Client) Me(ctx context.Context) (*User, error)
- func (c *Client) Play(ctx context.Context, inp PlayRequest, opts ...requestConfigOption) error
- func (c *Client) SetRepeatMode(ctx context.Context, mode repeatMode, opts ...requestConfigOption) error
- func (c *Client) ToggleShuffle(ctx context.Context, shuffle bool, opts ...requestConfigOption) error
- func (c *Client) WithStrideSongsAccessToken(ctx context.Context) (context.Context, error)
- func (c *Client) WithUserAccessToken(ctx context.Context, refreshToken string) (context.Context, error)
- func (c *Client) WithUserAccessTokenDirect(ctx context.Context, accessToken string) (context.Context, error)
- type ClientOption
- func WithBaseAuthUrl(baseAuthURL string) ClientOption
- func WithBaseUrl(baseURL string) ClientOption
- func WithClientID(clientID string) ClientOption
- func WithClientSecret(clientSecret string) ClientOption
- func WithRedirectURI(redirectURI string) ClientOption
- func WithStrideSongsRefreshToken(refreshToken string) ClientOption
- type CreatePlaylistRequest
- type CurrentPlayback
- type MockSpotify
- func (s *MockSpotify) AddTracks(tracks []AnalyzedTrack)
- func (s *MockSpotify) AddUser(userID string)
- func (s *MockSpotify) AddUserTracks(userID string, trackIDs []string) error
- func (s *MockSpotify) Clear()
- func (s *MockSpotify) Mux() http.Handler
- func (s *MockSpotify) Track(trackID string) (*AnalyzedTrack, bool)
- func (s *MockSpotify) User(userID string) (*mockUser, bool)
- type PlayRequest
- type Playlist
- type SpotifyContext
- type Track
- type User
Constants ¶
View Source
const ( ScopePlaylistModifyPrivate = scope("playlist-modify-private") ScopePlaylistModifyPublic = scope("playlist-modify-public") ScopeUserReadPlaybackState = scope("user-read-playback-state") ScopeUserModifyPlaybackState = scope("user-modify-playback-state") ScopeUserLibraryRead = scope("user-library-read") ScopeUserReadRecentlyPlayed = scope("user-read-recently-played") ScopeUserReadEmail = scope("user-read-email") ScopeUserReadPrivate = scope("user-read-private") )
View Source
const ( RepeatModeTrack = repeatMode("track") RepeatModeContext = repeatMode("context") RepeatModeOff = repeatMode("off") )
View Source
const ( ItemTypeTrack = itemType("track") ItemTypeAlbum = itemType("album") ItemTypePlaylist = itemType("playlist") )
Variables ¶
This section is empty.
Functions ¶
func WithStrideSongsAccessToken ¶
func WithStrideSongsAccessToken() requestConfigOption
Types ¶
type AnalyzedTrack ¶
type AuthResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
func (*Client) AddTracksToPlaylist ¶
func (c *Client) AddTracksToPlaylist(ctx context.Context, inp AddTracksToPlaylistRequest, opts ...requestConfigOption) error
func (*Client) AllUserTracks ¶
https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/
func (*Client) AnalyzedTracks ¶
func (*Client) CreatePlaylist ¶
func (*Client) Play ¶
func (c *Client) Play(ctx context.Context, inp PlayRequest, opts ...requestConfigOption) error
func (*Client) SetRepeatMode ¶
func (*Client) ToggleShuffle ¶
func (*Client) WithStrideSongsAccessToken ¶
note: at some point it may make more sense to have a goroutine that fetches a new access token whenever the previous access token expires, and use that kept-fresh access token for all requests across the Client.
func (*Client) WithUserAccessToken ¶
type ClientOption ¶
type ClientOption func(c *Client)
func WithBaseAuthUrl ¶
func WithBaseAuthUrl(baseAuthURL string) ClientOption
func WithBaseUrl ¶
func WithBaseUrl(baseURL string) ClientOption
func WithClientID ¶
func WithClientID(clientID string) ClientOption
func WithClientSecret ¶
func WithClientSecret(clientSecret string) ClientOption
func WithRedirectURI ¶
func WithRedirectURI(redirectURI string) ClientOption
func WithStrideSongsRefreshToken ¶
func WithStrideSongsRefreshToken(refreshToken string) ClientOption
type CreatePlaylistRequest ¶
type CurrentPlayback ¶
type CurrentPlayback struct { IsPlaying bool `json:"is_playing"` ShuffleState bool `json:"shuffle_state"` RepeatState repeatMode `json:"repeat_state"` Context SpotifyContext `json:"context"` }
type MockSpotify ¶
type MockSpotify struct { Tracks []AnalyzedTrack Users []mockUser }
func NewMockSpotify ¶
func NewMockSpotify() *MockSpotify
func (*MockSpotify) AddTracks ¶
func (s *MockSpotify) AddTracks(tracks []AnalyzedTrack)
func (*MockSpotify) AddUser ¶
func (s *MockSpotify) AddUser(userID string)
func (*MockSpotify) AddUserTracks ¶
func (s *MockSpotify) AddUserTracks(userID string, trackIDs []string) error
func (*MockSpotify) Clear ¶
func (s *MockSpotify) Clear()
func (*MockSpotify) Mux ¶
func (s *MockSpotify) Mux() http.Handler
func (*MockSpotify) Track ¶
func (s *MockSpotify) Track(trackID string) (*AnalyzedTrack, bool)
func (*MockSpotify) User ¶
func (s *MockSpotify) User(userID string) (*mockUser, bool)
type PlayRequest ¶
type PlayRequest struct { ItemType itemType ItemID string }
func (*PlayRequest) ToRequestPayload ¶
func (p *PlayRequest) ToRequestPayload() *playRequest
type SpotifyContext ¶
type SpotifyContext struct {
URI string `json:"uri"`
}
Click to show internal directories.
Click to hide internal directories.