lastfm

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: 8 Imported by: 0

Documentation

Overview

Package lastfm is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetAuthRequestUrl(callback string) (uri string)
	LoginWithToken(token string) (err error)
	GetSessionKey() (sk string)
}

API is our interface for a Last.fm API.

type Lastfm

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

Lastfm is the external Lastfm service implementation.

func NewLastfm

func NewLastfm(secrets config.Config) (*Lastfm, error)

NewLastfm creates a Lastfm instance.

func (*Lastfm) Authenticate

func (l *Lastfm) Authenticate(oauthCode string, redirectURL string) error

Authenticate takes an authorization code and authenticates the user.

func (*Lastfm) Authenticated

func (l *Lastfm) Authenticated() bool

Authenticated returns whether the service is logged in.

func (*Lastfm) Close

func (l *Lastfm) Close() error

Close persists any state before quitting the application.

func (*Lastfm) CodeParam

func (l *Lastfm) CodeParam() string

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

func (*Lastfm) CreateAuthURL

func (l *Lastfm) CreateAuthURL(redirectURL string) string

CreateAuthURL returns an authorization URL to authorize the integration.

func (*Lastfm) GetLovedTracks

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

GetLovedTracks returns loved tracks from the external service.

func (*Lastfm) GetUsername

func (l *Lastfm) GetUsername() (string, error)

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

func (*Lastfm) LoveTrack

func (l *Lastfm) LoveTrack(track domain.Track) error

LoveTrack marks a track as loved on the external service.

func (*Lastfm) Name

func (l *Lastfm) Name() string

Name returns the human readable service name.

type MockAPI

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

MockAPI is a mock of API interface.

func NewMockAPI

func NewMockAPI(ctrl *gomock.Controller) *MockAPI

NewMockAPI creates a new mock instance.

func (*MockAPI) EXPECT

func (m *MockAPI) EXPECT() *MockAPIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAPI) GetAuthRequestUrl

func (m *MockAPI) GetAuthRequestUrl(callback string) string

GetAuthRequestUrl mocks base method.

func (*MockAPI) GetSessionKey

func (m *MockAPI) GetSessionKey() string

GetSessionKey mocks base method.

func (*MockAPI) LoginWithToken

func (m *MockAPI) LoginWithToken(token string) error

LoginWithToken mocks base method.

type MockAPIMockRecorder

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

MockAPIMockRecorder is the mock recorder for MockAPI.

func (*MockAPIMockRecorder) GetAuthRequestUrl

func (mr *MockAPIMockRecorder) GetAuthRequestUrl(callback interface{}) *gomock.Call

GetAuthRequestUrl indicates an expected call of GetAuthRequestUrl.

func (*MockAPIMockRecorder) GetSessionKey

func (mr *MockAPIMockRecorder) GetSessionKey() *gomock.Call

GetSessionKey indicates an expected call of GetSessionKey.

func (*MockAPIMockRecorder) LoginWithToken

func (mr *MockAPIMockRecorder) LoginWithToken(token interface{}) *gomock.Call

LoginWithToken indicates an expected call of LoginWithToken.

type MockTrackAPI

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

MockTrackAPI is a mock of TrackAPI interface.

func NewMockTrackAPI

func NewMockTrackAPI(ctrl *gomock.Controller) *MockTrackAPI

NewMockTrackAPI creates a new mock instance.

func (*MockTrackAPI) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTrackAPI) Love

func (m *MockTrackAPI) Love(args map[string]interface{}) error

Love mocks base method.

type MockTrackAPIMockRecorder

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

MockTrackAPIMockRecorder is the mock recorder for MockTrackAPI.

func (*MockTrackAPIMockRecorder) Love

func (mr *MockTrackAPIMockRecorder) Love(args interface{}) *gomock.Call

Love indicates an expected call of Love.

type MockUserAPI

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

MockUserAPI is a mock of UserAPI interface.

func NewMockUserAPI

func NewMockUserAPI(ctrl *gomock.Controller) *MockUserAPI

NewMockUserAPI creates a new mock instance.

func (*MockUserAPI) EXPECT

func (m *MockUserAPI) EXPECT() *MockUserAPIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUserAPI) GetInfo

func (m *MockUserAPI) GetInfo(args map[string]interface{}) (lastfm.UserGetInfo, error)

GetInfo mocks base method.

func (*MockUserAPI) GetLovedTracks

func (m *MockUserAPI) GetLovedTracks(args map[string]interface{}) (lastfm.UserGetLovedTracks, error)

GetLovedTracks mocks base method.

type MockUserAPIMockRecorder

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

MockUserAPIMockRecorder is the mock recorder for MockUserAPI.

func (*MockUserAPIMockRecorder) GetInfo

func (mr *MockUserAPIMockRecorder) GetInfo(args interface{}) *gomock.Call

GetInfo indicates an expected call of GetInfo.

func (*MockUserAPIMockRecorder) GetLovedTracks

func (mr *MockUserAPIMockRecorder) GetLovedTracks(args interface{}) *gomock.Call

GetLovedTracks indicates an expected call of GetLovedTracks.

type TrackAPI

type TrackAPI interface {
	Love(args map[string]interface{}) (err error)
}

TrackAPI is our interface for a Last.fm track API.

type UserAPI

type UserAPI interface {
	GetInfo(args map[string]interface{}) (result lastfm.UserGetInfo, err error)
	GetLovedTracks(args map[string]interface{}) (result lastfm.UserGetLovedTracks, err error)
}

UserAPI is our interface for a Last.fm user API.

Jump to

Keyboard shortcuts

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