spotify

package
v0.0.0-...-ec1f93b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package spotify is a generated GoMock package.

Index

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

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.

func (*MockClient) Token

func (m *MockClient) Token() (*oauth2.Token, error)

Token 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

func NewSpotify(secrets config.Config) (*Spotify, error)

NewSpotify creates a Spotify instance.

func (*Spotify) Authenticate

func (s *Spotify) Authenticate(code string, redirectURL string) error

Authenticate takes an authorization code and authenticates the user.

func (*Spotify) Authenticated

func (s *Spotify) Authenticated() bool

Authenticated returns whether the service is logged in.

func (*Spotify) Close

func (s *Spotify) Close() error

Close persists any state before quitting the application.

func (*Spotify) CodeParam

func (s *Spotify) CodeParam() string

CodeParam is the query parameter name used in the authentication callback.

func (*Spotify) CreateAuthURL

func (s *Spotify) CreateAuthURL(redirectURL string) string

CreateAuthURL returns an authorization URL to authorize the integration.

func (*Spotify) GetLovedTracks

func (s *Spotify) GetLovedTracks(limit int) (tracks []domain.Track, err error)

GetLovedTracks returns loved tracks from the external service.

func (*Spotify) GetUsername

func (s *Spotify) GetUsername() (string, error)

GetUsername requests and returns the username of the logged in user.

func (*Spotify) LoveTrack

func (s *Spotify) LoveTrack(track domain.Track) error

LoveTrack marks a track as loved on the external service.

func (*Spotify) Name

func (s *Spotify) Name() string

Name returns the human readable service name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL