session

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: GPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOAuth2Server

func NewOAuth2Server(ctx context.Context, log librespot.Logger, callbackPort int) (int, chan string, error)

Types

type BlobCredentials

type BlobCredentials struct {
	Username string
	Blob     []byte
}

type InteractiveCredentials

type InteractiveCredentials struct {
	CallbackPort int
}

type Options

type Options struct {
	// Log is the base logger entry to use.
	Log librespot.Logger

	// DeviceType is the Spotify showed device type, required.
	DeviceType devicespb.DeviceType
	// DeviceId is the Spotify device ID, required.
	DeviceId string
	// Credentials is the credentials to be used for authentication, required.
	Credentials any

	// ClientToken is the Spotify client token, leave empty to let the server generate one.
	ClientToken string
	// Resolver is an instance of apresolve.ApResolver, leave nil to use the default one.
	Resolver *apresolve.ApResolver

	// Client is the HTTP client to use for the session, leave empty for a new one.
	Client *http.Client
}

type Session

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

func NewSessionFromOptions

func NewSessionFromOptions(ctx context.Context, opts *Options) (*Session, error)

func (*Session) Accesspoint

func (s *Session) Accesspoint() *ap.Accesspoint

func (*Session) AudioKey

func (s *Session) AudioKey() *audio.KeyProvider

func (*Session) Close

func (s *Session) Close()

func (*Session) Dealer

func (s *Session) Dealer() *dealer.Dealer

func (*Session) Spclient

func (s *Session) Spclient() *spclient.Spclient

func (*Session) StoredCredentials

func (s *Session) StoredCredentials() []byte

func (*Session) Username

func (s *Session) Username() string

func (*Session) WebApi

func (s *Session) WebApi(ctx context.Context, method string, path string, query url.Values, header http.Header, body []byte) (*http.Response, error)

type SpotifyTokenCredentials

type SpotifyTokenCredentials struct {
	Username string
	Token    string
}

type StoredCredentials

type StoredCredentials struct {
	Username string
	Data     []byte
}

Jump to

Keyboard shortcuts

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