Documentation ¶
Overview ¶
Package spotify is a generated GoMock package.
Index ¶
- type Authenticator
- type Client
- type MockAuthenticator
- func (m *MockAuthenticator) AuthURLWithOpts(state string, opts ...oauth2.AuthCodeOption) string
- func (m *MockAuthenticator) EXPECT() *MockAuthenticatorMockRecorder
- func (m *MockAuthenticator) Exchange(arg0 string, arg1 ...oauth2.AuthCodeOption) (*oauth2.Token, error)
- func (m *MockAuthenticator) NewClient(token *oauth2.Token) spotify.Client
- func (m *MockAuthenticator) SetAuthInfo(clientID, secretKey string)
- type MockAuthenticatorMockRecorder
- func (mr *MockAuthenticatorMockRecorder) AuthURLWithOpts(state interface{}, opts ...interface{}) *gomock.Call
- func (mr *MockAuthenticatorMockRecorder) Exchange(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockAuthenticatorMockRecorder) NewClient(token interface{}) *gomock.Call
- func (mr *MockAuthenticatorMockRecorder) SetAuthInfo(clientID, secretKey interface{}) *gomock.Call
- type MockClient
- func (m *MockClient) AddTracksToLibrary(ids ...spotify.ID) error
- func (m *MockClient) CurrentUser() (*spotify.PrivateUser, error)
- func (m *MockClient) CurrentUsersTracksOpt(opt *spotify.Options) (*spotify.SavedTrackPage, error)
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) SearchOpt(query string, t spotify.SearchType, opt *spotify.Options) (*spotify.SearchResult, error)
- func (m *MockClient) Token() (*oauth2.Token, error)
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) AddTracksToLibrary(ids ...interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) CurrentUser() *gomock.Call
- func (mr *MockClientMockRecorder) CurrentUsersTracksOpt(opt interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) SearchOpt(query, t, opt interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Token() *gomock.Call
- type Spotify
- func (s *Spotify) Authenticate(code string, redirectURL string) error
- func (s *Spotify) Authenticated() bool
- func (s *Spotify) Close() error
- func (s *Spotify) CodeParam() string
- func (s *Spotify) CreateAuthURL(redirectURL string) string
- func (s *Spotify) GetLovedTracks(limit int) (tracks []domain.Track, err error)
- func (s *Spotify) GetUsername() (string, error)
- func (s *Spotify) LoveTrack(track domain.Track) error
- func (s *Spotify) Name() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { SetAuthInfo(clientID, secretKey string) AuthURLWithOpts(state string, opts ...oauth2.AuthCodeOption) string Exchange(string, ...oauth2.AuthCodeOption) (*oauth2.Token, error) NewClient(token *oauth2.Token) spotify.Client }
Authenticator is our interface for a Spotify authenticator.
type Client ¶
type Client interface { CurrentUser() (*spotify.PrivateUser, error) Token() (*oauth2.Token, error) CurrentUsersTracksOpt(opt *spotify.Options) (*spotify.SavedTrackPage, error) SearchOpt(query string, t spotify.SearchType, opt *spotify.Options) (*spotify.SearchResult, error) AddTracksToLibrary(ids ...spotify.ID) error }
Client is our interface for a Spotify client.
type MockAuthenticator ¶
type MockAuthenticator struct {
// contains filtered or unexported fields
}
MockAuthenticator is a mock of Authenticator interface.
func NewMockAuthenticator ¶
func NewMockAuthenticator(ctrl *gomock.Controller) *MockAuthenticator
NewMockAuthenticator creates a new mock instance.
func (*MockAuthenticator) AuthURLWithOpts ¶
func (m *MockAuthenticator) AuthURLWithOpts(state string, opts ...oauth2.AuthCodeOption) string
AuthURLWithOpts mocks base method.
func (*MockAuthenticator) EXPECT ¶
func (m *MockAuthenticator) EXPECT() *MockAuthenticatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAuthenticator) Exchange ¶
func (m *MockAuthenticator) Exchange(arg0 string, arg1 ...oauth2.AuthCodeOption) (*oauth2.Token, error)
Exchange mocks base method.
func (*MockAuthenticator) NewClient ¶
func (m *MockAuthenticator) NewClient(token *oauth2.Token) spotify.Client
NewClient mocks base method.
func (*MockAuthenticator) SetAuthInfo ¶
func (m *MockAuthenticator) SetAuthInfo(clientID, secretKey string)
SetAuthInfo mocks base method.
type MockAuthenticatorMockRecorder ¶
type MockAuthenticatorMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthenticatorMockRecorder is the mock recorder for MockAuthenticator.
func (*MockAuthenticatorMockRecorder) AuthURLWithOpts ¶
func (mr *MockAuthenticatorMockRecorder) AuthURLWithOpts(state interface{}, opts ...interface{}) *gomock.Call
AuthURLWithOpts indicates an expected call of AuthURLWithOpts.
func (*MockAuthenticatorMockRecorder) Exchange ¶
func (mr *MockAuthenticatorMockRecorder) Exchange(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Exchange indicates an expected call of Exchange.
func (*MockAuthenticatorMockRecorder) NewClient ¶
func (mr *MockAuthenticatorMockRecorder) NewClient(token interface{}) *gomock.Call
NewClient indicates an expected call of NewClient.
func (*MockAuthenticatorMockRecorder) SetAuthInfo ¶
func (mr *MockAuthenticatorMockRecorder) SetAuthInfo(clientID, secretKey interface{}) *gomock.Call
SetAuthInfo indicates an expected call of SetAuthInfo.
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) AddTracksToLibrary ¶
func (m *MockClient) AddTracksToLibrary(ids ...spotify.ID) error
AddTracksToLibrary mocks base method.
func (*MockClient) CurrentUser ¶
func (m *MockClient) CurrentUser() (*spotify.PrivateUser, error)
CurrentUser mocks base method.
func (*MockClient) CurrentUsersTracksOpt ¶
func (m *MockClient) CurrentUsersTracksOpt(opt *spotify.Options) (*spotify.SavedTrackPage, error)
CurrentUsersTracksOpt mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) SearchOpt ¶
func (m *MockClient) SearchOpt(query string, t spotify.SearchType, opt *spotify.Options) (*spotify.SearchResult, error)
SearchOpt mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) AddTracksToLibrary ¶
func (mr *MockClientMockRecorder) AddTracksToLibrary(ids ...interface{}) *gomock.Call
AddTracksToLibrary indicates an expected call of AddTracksToLibrary.
func (*MockClientMockRecorder) CurrentUser ¶
func (mr *MockClientMockRecorder) CurrentUser() *gomock.Call
CurrentUser indicates an expected call of CurrentUser.
func (*MockClientMockRecorder) CurrentUsersTracksOpt ¶
func (mr *MockClientMockRecorder) CurrentUsersTracksOpt(opt interface{}) *gomock.Call
CurrentUsersTracksOpt indicates an expected call of CurrentUsersTracksOpt.
func (*MockClientMockRecorder) SearchOpt ¶
func (mr *MockClientMockRecorder) SearchOpt(query, t, opt interface{}) *gomock.Call
SearchOpt indicates an expected call of SearchOpt.
func (*MockClientMockRecorder) Token ¶
func (mr *MockClientMockRecorder) Token() *gomock.Call
Token indicates an expected call of Token.
type Spotify ¶
type Spotify struct {
// contains filtered or unexported fields
}
Spotify is the external Spotify service implementation.
func NewSpotify ¶
NewSpotify creates a Spotify instance.
func (*Spotify) Authenticate ¶
Authenticate takes an authorization code and authenticates the user.
func (*Spotify) Authenticated ¶
Authenticated returns whether the service is logged in.
func (*Spotify) CodeParam ¶
CodeParam is the query parameter name used in the authentication callback.
func (*Spotify) CreateAuthURL ¶
CreateAuthURL returns an authorization URL to authorize the integration.
func (*Spotify) GetLovedTracks ¶
GetLovedTracks returns loved tracks from the external service.
func (*Spotify) GetUsername ¶
GetUsername requests and returns the username of the logged in user.