Versions in this module Expand all Collapse all v0 v0.19.0 Jan 2, 2026 Changes in this version + var ErrExpiredToken = errors.New("token expired") + var ErrInvalidClientID = fmt.Errorf("data store contains invalid client ID") + var ErrJWKMissing = errors.New("jwk missing. no public key to verify jwt request") + var ErrNoTokenSource = errors.New("no token source provided") + var ErrTooManyRequests = errors.New("too many requests") + var ErrUnauthorized = errors.New("user could not be authenticated") + func ContextWithHTTPClient(ctx context.Context, httpClient *http.Client) context.Context + func ParsePlexError(r *http.Response) error + type Client struct + func (c Client) MediaServers(ctx context.Context) ([]RegisteredDevice, error) + func (c Client) RegisteredDevices(ctx context.Context) ([]RegisteredDevice, error) + func (c Client) User(ctx context.Context) (User, error) + type Config struct + ClientID string + Device Device + Scopes []string + URL string + V2URL string + func DefaultConfig() Config + func (c Config) Client(ctx context.Context, src TokenSource) Client + func (c Config) GenerateAndUploadPublicKey(ctx context.Context, token Token) (ed25519.PrivateKey, string, error) + func (c Config) JWTToken(ctx context.Context, privateKey ed25519.PrivateKey, keyID string) (Token, error) + func (c Config) PINRequest(ctx context.Context) (PINResponse, string, error) + func (c Config) RegisterWithCredentials(ctx context.Context, username, password string) (Token, error) + func (c Config) RegisterWithPIN(ctx context.Context, callback func(PINResponse, string), ...) (token Token, err error) + func (c Config) TokenSource(opts ...TokenSourceOption) TokenSource + func (c Config) UploadPublicKey(ctx context.Context, publicKey ed25519.PublicKey, token Token) (string, error) + func (c Config) ValidatePIN(ctx context.Context, id int) (Token, ValidatePINResponse, error) + func (c Config) WithClientID(clientID string) Config + func (c Config) WithDevice(device Device) Config + type Connection struct + URI string + type Device struct + Device string + DeviceName string + DeviceVendor string + Model string + Platform string + PlatformVersion string + Product string + Provides string + Version string + type ErrInvalidToken struct + func (e *ErrInvalidToken) Error() string + func (e *ErrInvalidToken) Unwrap() error + type JWTSecureData struct + ClientID string + KeyID string + PrivateKey ed25519.PrivateKey + type JWTSecureDataStore interface + Load func() (JWTSecureData, error) + Save func(data JWTSecureData) error + type PINResponse struct + AuthToken interface{} + ClientIdentifier string + Code string + CreatedAt time.Time + ExpiresAt time.Time + ExpiresIn int + Id int + Location struct{ ... } + NewRegistration interface{} + Product string + Qr string + Trusted bool + type PlexError struct + Body []byte + Status string + StatusCode int + func (e *PlexError) Error() string + func (e *PlexError) Unwrap() error + type PlexTVDevice struct + ClientIdentifier string + Connections []struct{ ... } + CreatedAt time.Time + Device *string + Id int + LastSeenAt time.Time + Model *string + Name string + Platform *string + PlatformVersion *string + Presence bool + Product string + Provides *string + PublicAddress string + ScreenDensity *int + ScreenResolution string + SyncLists []struct{ ... } + Token string + Vendor *string + type PlexTimestamp time.Time + func (t *PlexTimestamp) UnmarshalXMLAttr(attr xml.Attr) error + type RegisteredDevice struct + ClientID string + Connections []Connection + CreatedAt PlexTimestamp + Device string + ID string + LastSeenAt PlexTimestamp + Model string + Name string + Platform string + PlatformVersion string + Product string + ProductVersion string + Provides string + PublicAddress string + ScreenDensity string + ScreenRes string + SyncList *SyncList + Token string + Vendor string + Version string + type Resource struct + AccessToken string + ClientIdentifier string + Connections []struct{ ... } + CreatedAt time.Time + Device string + DnsRebindingProtection bool + Home bool + HttpsRequired bool + LastSeenAt time.Time + Name string + NatLoopbackSupported bool + Owned bool + OwnerId interface{} + Platform string + PlatformVersion string + Presence bool + Product string + ProductVersion string + Provides string + PublicAddress string + PublicAddressMatches bool + Relay bool + SearchEnabled bool + SourceTitle interface{} + Synced bool + type SyncList struct + ItemsComplete int + TotalSize int + Version int + type Token string + func (t Token) IsJWT() bool + func (t Token) IsLegacy() bool + func (t Token) IsValid() error + func (t Token) String() string + type TokenSource interface + Token func(ctx context.Context) (Token, error) + type TokenSourceOption func(*tokenSourceConfiguration) + func WithCredentials(username, password string) TokenSourceOption + func WithJWT(store JWTSecureDataStore) TokenSourceOption + func WithLogger(logger *slog.Logger) TokenSourceOption + func WithPIN(cb func(PINResponse, string), pollInterval time.Duration) TokenSourceOption + func WithToken(token Token) TokenSourceOption + type User struct + AdsConsent bool + AdsConsentReminderAt int + AdsConsentSetAt int + Anonymous bool + AttributionPartner interface{} + AuthToken string + BackupCodesCreated bool + Confirmed bool + Country string + Email string + EmailOnlyAuth bool + Entitlements []string + ExperimentalFeatures bool + FriendlyName string + Guest bool + HasPassword bool + Home bool + HomeAdmin bool + HomeSize int + Id int + JoinedAt int + Locale interface{} + MailingListActive bool + MailingListStatus string + MaxHomeSize int + Profile struct{ ... } + Protected bool + RememberExpiresAt int + Restricted bool + Roles []string + ScrobbleTypes string + Services []struct{ ... } + Subscription struct{ ... } + SubscriptionDescription string + Thumb string + Title string + TwoFactorEnabled bool + Username string + Uuid string + type ValidatePINResponse struct + AuthToken *string + ClientIdentifier string + Code string + CreatedAt time.Time + ExpiresAt time.Time + ExpiresIn int + Id int + Location struct{ ... } + NewRegistration any + Product string + Qr string + Trusted bool v0.19.0-rc4 Jan 2, 2026 v0.19.0-rc3 Jan 1, 2026 v0.19.0-rc2 Dec 28, 2025