spotify

package
v0.0.0-...-de42637 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingCallbackParam = errors.New("missing code or state param")
)
View Source
var ErrSearch = errors.New("failed to receive search response")
View Source
var ErrTokenRequestFailed = errors.New("token request failed")

Functions

This section is empty.

Types

type Authorize

type Authorize struct {
	router.Route
	// contains filtered or unexported fields
}

func NewAuthorize

func NewAuthorize(opts *Options, log *slog.Logger) *Authorize

func (*Authorize) Get

func (route *Authorize) Get(c echo.Context) error

type Callback

type Callback struct {
	router.Route
	// contains filtered or unexported fields
}

func NewCallback

func NewCallback(
	handler *TokenHandler,
	sessions *session.Store,
	store *store.Store,
	log *slog.Logger,
) *Callback

func (*Callback) Get

func (route *Callback) Get(c echo.Context) error

type Client

type Client struct {
	http.Client
	api.Token
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token *api.Token, handler *TokenHandler) *Client

func (*Client) Do

func (client *Client) Do(req *http.Request) (*http.Response, error)

type Options

type Options struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	RedirectURI  string `json:"redirect_uri"`
}

type SearchClient

type SearchClient struct{ Client }

func (*SearchClient) Search

func (client *SearchClient) Search(ctx context.Context, req api.SearchRequest) (*api.SearchResponse, error)

type TokenHandler

type TokenHandler struct {
	http.Client
	// contains filtered or unexported fields
}

func NewTokenHandler

func NewTokenHandler(opts *Options) *TokenHandler

func (*TokenHandler) AuthorizeServer

func (handler *TokenHandler) AuthorizeServer(ctx context.Context) (*api.Token, error)

func (*TokenHandler) ExchangeCode

func (handler *TokenHandler) ExchangeCode(ctx context.Context, code string) (*api.Token, error)

func (*TokenHandler) Refresh

func (handler *TokenHandler) Refresh(ctx context.Context, refreshToken string) (*api.Token, error)

type UserClient

type UserClient struct{ Client }

func NewUserClient

func NewUserClient(token *api.Token, handler *TokenHandler) *UserClient

func (*UserClient) GetCurrentUser

func (client *UserClient) GetCurrentUser(ctx context.Context) (*api.User, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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