Versions in this module Expand all Collapse all v0 v0.1.0 Jun 16, 2026 Changes in this version + var ErrCountryCodeNotSet = errors.New("country code not set") + var ErrDeviceAuthorizationPending = errors.New("device authorization pending") + var ErrDeviceCodeExpired = errors.New("device code expired") + var ErrNoOpenAuthSession = errors.New("no open auth session") + var ErrNoTokenProvided = errors.New("no token provided") + var ErrResourceNotFound = errors.New("resource not found") + var ErrTokenExpired = errors.New("token expired") + func ParseTrackID(id string) (uint64, error) + type Artist struct + Handle *string + ID int + Name string + Picture string + Type string + type AudioMode string + const DolbyAtmos + const Stereo + type AudioQuality string + const HiResLossless + const High + const Lossless + const Low + type AuthRequest struct + DeviceCode string + Expires time.Time + Interval time.Duration + UserCode string + VerificationUri *url.URL + VerificationUriComplete *url.URL + func (a *AuthRequest) UnmarshalJSON(data []byte) error + type AuthResult struct + ClientName string + Token *oauth2.Token + User User + UserID int + func (a *AuthResult) UnmarshalJSON(data []byte) error + type BTSManifest struct + Codecs string + EncryptionType string + MimeType string + URLs []string + func (b BTSManifest) GetCodecs() string + func (b BTSManifest) GetURLs() []string + type Client struct + CountryCode string + func NewClient(opts ...Option) (*Client, error) + func (c *Client) Close() error + func (c *Client) DownloadTrackStream(ctx context.Context, stream Stream) (io.ReadCloser, error) + func (c *Client) GetSession(ctx context.Context) (Session, error) + func (c *Client) GetTrack(ctx context.Context, trackID uint64) (Track, error) + func (c *Client) GetTrackStream(ctx context.Context, trackID uint64, quality AudioQuality, immersiveAudio bool) (Stream, error) + func (c *Client) GetVideo(ctx context.Context, videoID uint64) (Video, error) + func (c *Client) GetVideoStream(ctx context.Context, videoID uint64, videoQuality VideoQuality) (VideoStream, error) + func (c *Client) InitiateDeviceAuth(ctx context.Context) (AuthRequest, error) + func (c *Client) RefreshAuth(ctx context.Context, refreshToken string) (AuthResult, error) + func (c *Client) RevokeAuth(ctx context.Context) error + func (c *Client) SetToken(token *oauth2.Token) + func (c *Client) SetTokenChanged(f TokenChangedFunc) + func (c *Client) Token() (*oauth2.Token, error) + func (c *Client) VerifyDeviceAuth(ctx context.Context, deviceCode string) (AuthResult, error) + func (c *Client) WaitForDeviceAuth(ctx context.Context, req AuthRequest) (AuthResult, error) + type DASHManifest struct + Codecs string + URLs []string + func (d DASHManifest) GetCodecs() string + func (d DASHManifest) GetURLs() []string + type Manifest interface + GetCodecs func() string + GetURLs func() []string + type MimeType string + const MimeTypeBTS + const MimeTypeDASH + type Option func(*config) + func WithAuth(token string) Option + func WithAuthToken(token *oauth2.Token) Option + func WithBaseURL(baseURL *url.URL) Option + func WithClient(id, secret string) Option + func WithContext(ctx context.Context) Option + func WithCountryCode(countryCode string) Option + func WithHTTPClient(httpClient *http.Client) Option + func WithLogger(logger *slog.Logger) Option + func WithTokenChanged(f TokenChangedFunc) Option + type Session struct + ChannelID int + Client struct{ ... } + CountryCode string + PartnerID int + SessionID string + UserID int + type Stream struct + AssetPresentation string + AudioMode AudioMode + AudioQuality AudioQuality + Info *StreamInfo + Manifest Manifest + ManifestHash string + ManifestMimeType MimeType + TrackID int + func (s *Stream) UnmarshalJSON(data []byte) error + type StreamInfo struct + AlbumPeakAmplitude float64 + AlbumReplayGain float64 + BitDepth int + SampleRate int + TrackPeakAmplitude float64 + TrackReplayGain float64 + type Tag string + const TagHiResLossless + const TagLossless + func (t Tag) Quality() AudioQuality + type TokenChangedFunc func(*oauth2.Token) + type Track struct + AccessType string + AdSupportedStreamReady bool + Ai bool + Album struct{ ... } + AllowStreaming bool + Artist Artist + Artists []Artist + AudioModes []string + AudioQuality string + Bpm int + Copyright string + DjReady bool + Duration int + Editable bool + Explicit bool + ID int + Isrc string + Key string + KeyScale string + MediaMetadata struct{ ... } + Mixes struct{ ... } + PayToStream bool + Peak float64 + Popularity int + PremiumStreamingOnly bool + ReplayGain float64 + Spotlighted bool + StemReady bool + StreamReady bool + StreamStartDate string + Title string + TrackNumber int + URL string + Upload bool + Version *string + VolumeNumber int + func (t *Track) BestQuality() AudioQuality + type User struct + AcceptedEULA bool + AccountLinkCreated bool + Address *string + AppleUID *string + Birthday time.Time + ChannelID int + City *string + CountryCode string + Created time.Time + Email string + EmailVerified bool + FirstName *string + FullName *string + GoogleUID *string + LastName *string + NewUser bool + Nickname *string + ParentID int + PhoneNumber *string + PostalCode *string + USState *string + Updated time.Time + UserID int + Username string + func (u *User) UnmarshalJSON(data []byte) error + type Video struct + AdSupportedStreamReady bool + AdsPrePaywallOnly bool + AdsURL *string + Album *string + AllowStreaming bool + Artist Artist + Artists []Artist + DjReady bool + Duration time.Duration + Explicit bool + ID int + ImageID string + ImagePath *string + Popularity int + Quality VideoQuality + ReleaseDate time.Time + StemReady bool + StreamReady bool + StreamStartDate time.Time + Title string + TrackNumber int + Type string + VibrantColor string + VolumeNumber int + func (v *Video) UnmarshalJSON(data []byte) error + type VideoManifest struct + MimeType string + URLs []string + type VideoQuality string + const VideoAudioOnly + const VideoHigh + const VideoLow + const VideoMedium + type VideoStream struct + AssetPresentation string + Manifest VideoManifest + ManifestHash string + ManifestMimeType string + StreamType string + VideoID int + VideoQuality string + func (vs *VideoStream) UnmarshalJSON(data []byte) error