spotify

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatedClient

type AuthenticatedClient struct {
	spotify.Client
}

type SpotifyClient

type SpotifyClient struct {
	Auth                *spotifyauth.Authenticator
	AuthenticatedClient AuthenticatedClient
	Logger              logger.LoggerInterface
}

func (*SpotifyClient) AddTracksToPlaylist

func (c *SpotifyClient) AddTracksToPlaylist(
	ctx context.Context,
	input entities.AddTracksToPlaylistClientInput,
) error

func (*SpotifyClient) CreatePlaylist

func (c *SpotifyClient) CreatePlaylist(
	ctx context.Context,
	title string,
	description string,
) (*entities.CreatePlaylistOutput, error)

func (*SpotifyClient) CurrentSession

func (c *SpotifyClient) CurrentSession() (*oauth2.Token, error)

func (*SpotifyClient) CurrentUser

func (c *SpotifyClient) CurrentUser(ctx context.Context) (*spotify.PrivateUser, error)

func (*SpotifyClient) FindAllSongsByName

func (c *SpotifyClient) FindAllSongsByName(
	ctx context.Context,
	name []string,
	artist string,
) (*entities.FindAllSongsOutput, error)

func (*SpotifyClient) GetAuthURL

func (c *SpotifyClient) GetAuthURL(state string, genCodes oauth2util.GenerateOutput) string

func (*SpotifyClient) GetToken

func (c *SpotifyClient) GetToken(
	ctx context.Context,
	r *http.Request,
	state string,
	genCodes oauth2util.GenerateOutput,
) (*oauth2.Token, error)

func (*SpotifyClient) NewAPIClient

func (c *SpotifyClient) NewAPIClient(ctx context.Context, tok *oauth2.Token) *spotify.Client

func (*SpotifyClient) RefreshToken

func (c *SpotifyClient) RefreshToken(
	ctx context.Context,
	tok *oauth2.Token,
) (*oauth2.Token, error)

func (*SpotifyClient) SetAuthenticatedClient

func (c *SpotifyClient) SetAuthenticatedClient(ch chan AuthenticatedClient)

func (*SpotifyClient) SetAuthenticatedClientFromInstance

func (c *SpotifyClient) SetAuthenticatedClientFromInstance(client AuthenticatedClient)

type SpotifyClientInterface

type SpotifyClientInterface interface {
	GetToken(ctx context.Context, r *http.Request, state string, genCodes oauth2util.GenerateOutput) (*oauth2.Token, error)
	GetAuthURL(state string, genCodes oauth2util.GenerateOutput) string
	NewAPIClient(ctx context.Context, tok *oauth2.Token) *spotify.Client
	SetAuthenticatedClient(ch chan AuthenticatedClient)
	SetAuthenticatedClientFromInstance(client AuthenticatedClient)
	CurrentUser(ctx context.Context) (*spotify.PrivateUser, error)
	CurrentSession() (*oauth2.Token, error)
	RefreshToken(ctx context.Context, tok *oauth2.Token) (*oauth2.Token, error)
	FindAllSongsByName(ctx context.Context, name []string, artist string) (*entities.FindAllSongsOutput, error)
	CreatePlaylist(ctx context.Context, title string, description string) (*entities.CreatePlaylistOutput, error)
	AddTracksToPlaylist(ctx context.Context, input entities.AddTracksToPlaylistClientInput) error
}

func NewSpotifyClient

func NewSpotifyClient(
	logger logger.LoggerInterface,
	redirURL string,
	clientID string,
	clientSecret string,
) SpotifyClientInterface

Jump to

Keyboard shortcuts

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