models

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package models provides data structures and types for music service account management on Bose SoundTouch devices.

Package models provides data structures and types for the Bose SoundTouch API.

Package models provides data structures for Bose SoundTouch Web API requests and responses.

This package contains all the XML/JSON data models used to communicate with SoundTouch devices. These structures handle serialization and deserialization of API data, WebSocket events, and device state information.

Core Data Structures

The package includes models for all major SoundTouch API endpoints:

  • DeviceInfo: Device information and capabilities
  • NowPlaying: Current playback status and track information
  • Volume: Volume levels and mute status
  • Bass: Bass control settings (-9 to +9)
  • Balance: Balance control settings (-50 to +50)
  • Sources: Available audio sources (Spotify, Bluetooth, etc.)
  • Presets: Configured preset buttons
  • Zone: Multiroom zone configuration
  • ClockTime/ClockDisplay: Device clock settings
  • NetworkInfo: Network connectivity information

Example Usage

Working with device information:

var info models.DeviceInfo
err := xml.Unmarshal(responseData, &info)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("Device: %s (Type: %s)\n", info.Name, info.Type)

Volume control:

volume := models.Volume{
	ActualVolume:  50,
	TargetVolume:  50,
	Muted:        false,
}

Creating zone configurations:

zone := models.Zone{
	Master: "192.168.1.100",
	Members: []models.ZoneMember{
		{IPAddress: "192.168.1.101"},
		{IPAddress: "192.168.1.102"},
	},
}

WebSocket Events

The package includes models for real-time WebSocket events:

  • NowPlayingUpdated: Track changes and playback status
  • VolumeUpdated: Volume and mute state changes
  • ConnectionStateUpdated: Network connectivity changes
  • ZoneUpdated: Multiroom zone configuration changes

Example WebSocket event handling:

switch event := event.(type) {
case *models.NowPlayingUpdated:
	fmt.Printf("Now playing: %s by %s\n", event.Track, event.Artist)
case *models.VolumeUpdated:
	fmt.Printf("Volume: %d (Muted: %t)\n", event.ActualVolume, event.Muted)
}

XML Serialization

Most models support XML marshaling/unmarshaling for API communication:

// Marshal to XML for API requests
data, err := xml.Marshal(volume)
if err != nil {
	log.Fatal(err)
}

// Unmarshal from XML responses
var response models.DeviceInfo
err = xml.Unmarshal(xmlData, &response)
if err != nil {
	log.Fatal(err)
}

Discovery Models

Device discovery structures:

device := models.DiscoveredDevice{
	Name:     "Living Room",
	Host:     "192.168.1.100",
	Port:     8090,
	SerialNo: "AA123456789",
	Location: "/device.xml",
}

Validation and Constraints

Many models include validation logic and constraints:

  • Volume: 0-100 range with mute support
  • Bass: -9 to +9 range
  • Balance: -50 (left) to +50 (right)
  • Keys: Predefined key constants (PLAY, PAUSE, etc.)

Thread Safety

All model structures are safe for concurrent read access. For write access in concurrent environments, appropriate synchronization should be used.

Compatibility

These models are compatible with all SoundTouch device types including:

  • SoundTouch 10, 20, 30 series
  • SoundTouch Portable
  • Wave SoundTouch music systems
  • Other SoundTouch-enabled Bose speakers

Package models defines data structures used for Bose SoundTouch API communication and service management. It includes types for BMX (Bose Media eXchange) services, device information, presets, recents, and other core data models.

Index

Examples

Constants

View Source
const (
	AudioModeNormal   = "NORMAL"
	AudioModeDialog   = "DIALOG"
	AudioModeSurround = "SURROUND"
	AudioModeMusic    = "MUSIC"
	AudioModeMovie    = "MOVIE"
	AudioModeSport    = "SPORT"
	AudioModeNight    = "NIGHT"
	AudioModeStandard = "STANDARD"
	AudioModeVivid    = "VIVID"
	AudioModeWarm     = "WARM"
	AudioModeBright   = "BRIGHT"
)

Audio mode constants

View Source
const (
	BalanceLevelMin     = -50
	BalanceLevelMax     = 50
	BalanceLevelDefault = 0
)

Balance level constants

View Source
const (
	BassLevelMin     = -9
	BassLevelMax     = 9
	BassLevelDefault = 0
)

Bass level constants

View Source
const (
	KeyStatePress   = "press"
	KeyStateRelease = "release"
)

KeyState constants for key press states

View Source
const (
	// Playback Controls
	KeyPlay      = "PLAY"
	KeyPause     = "PAUSE"
	KeyStop      = "STOP"
	KeyPrevTrack = "PREV_TRACK"
	KeyNextTrack = "NEXT_TRACK"

	// Rating and Bookmark Controls
	KeyThumbsUp   = "THUMBS_UP"
	KeyThumbsDown = "THUMBS_DOWN"
	KeyBookmark   = "BOOKMARK"

	// Power and System Controls
	KeyPower = "POWER"
	KeyMute  = "MUTE"

	// Volume Controls
	KeyVolumeUp   = "VOLUME_UP"
	KeyVolumeDown = "VOLUME_DOWN"

	// Preset Controls
	KeyPreset1 = "PRESET_1"
	KeyPreset2 = "PRESET_2"
	KeyPreset3 = "PRESET_3"
	KeyPreset4 = "PRESET_4"
	KeyPreset5 = "PRESET_5"
	KeyPreset6 = "PRESET_6"

	// Input Controls
	KeyAuxInput = "AUX_INPUT"

	// Shuffle Controls
	KeyShuffleOff = "SHUFFLE_OFF"
	KeyShuffleOn  = "SHUFFLE_ON"

	// Repeat Controls
	KeyRepeatOff = "REPEAT_OFF"
	KeyRepeatOne = "REPEAT_ONE"
	KeyRepeatAll = "REPEAT_ALL"
)

KeyValue constants for available keys

View Source
const (
	InterfaceTypeWiFi     = "WIFI_INTERFACE"
	InterfaceTypeEthernet = "ETHERNET_INTERFACE"
)

Interface types

View Source
const (
	StateWiFiConnected        = "NETWORK_WIFI_CONNECTED"
	StateWiFiDisconnected     = "NETWORK_WIFI_DISCONNECTED"
	StateEthernetConnected    = "NETWORK_ETHERNET_CONNECTED"
	StateEthernetDisconnected = "NETWORK_ETHERNET_DISCONNECTED"
)

Interface states

View Source
const (
	SignalExcellent = "EXCELLENT_SIGNAL"
	SignalGood      = "GOOD_SIGNAL"
	SignalFair      = "FAIR_SIGNAL"
	SignalPoor      = "POOR_SIGNAL"
)

Signal strength levels

View Source
const (
	ModeStation     = "STATION"
	ModeAccessPoint = "ACCESS_POINT"
)

WiFi modes

View Source
const (
	VolumeMin    = 0
	VolumeMax    = 100
	VolumeMute   = 0
	VolumeQuiet  = 10
	VolumeLow    = 25
	VolumeMedium = 50
	VolumeHigh   = 75
	VolumeLoud   = 100
)

Volume level constants

View Source
const (
	ZoneErrorDeviceNotFound    = "device not found"
	ZoneErrorDeviceOffline     = "device offline"
	ZoneErrorIncompatible      = "incompatible device type"
	ZoneErrorAlreadyInZone     = "device already in zone"
	ZoneErrorNotInZone         = "device not in zone"
	ZoneErrorMasterRequired    = "master device required"
	ZoneErrorNetworkError      = "network communication error"
	ZoneErrorUnsupported       = "operation not supported by device"
	ZoneErrorMaxMembersReached = "maximum zone members reached"
)

Common zone error reasons

Variables

View Source
var (
	ErrInvalidURL     = errors.New("URL cannot be empty")
	ErrInvalidAppKey  = errors.New("app key cannot be empty")
	ErrInvalidService = errors.New("service cannot be empty")
	ErrInvalidVolume  = errors.New("volume must be between 0 and 100")
)

Error constants for speaker validation

Functions

func ClampBalanceLevel

func ClampBalanceLevel(level int) int

ClampBalanceLevel clamps a balance level to the valid range

func ClampBassLevel

func ClampBassLevel(level int) int

ClampBassLevel clamps a bass level to the valid range

func ClampVolumeLevel

func ClampVolumeLevel(level int) int

ClampVolumeLevel ensures a volume level is within valid range

Example
clamped1 := ClampVolumeLevel(150)
clamped2 := ClampVolumeLevel(-10)
clamped3 := ClampVolumeLevel(50)

fmt.Printf("150 clamped: %d\n", clamped1)
fmt.Printf("-10 clamped: %d\n", clamped2)
fmt.Printf("50 clamped: %d\n", clamped3)
Output:
150 clamped: 100
-10 clamped: 0
50 clamped: 50

func GetAllValidKeys

func GetAllValidKeys() []string

GetAllValidKeys returns a slice of all valid key values

func GetBalanceLevelCategory

func GetBalanceLevelCategory(level int) string

GetBalanceLevelCategory returns the balance category

func GetBalanceLevelName

func GetBalanceLevelName(level int) string

GetBalanceLevelName returns a descriptive name for the balance level

func GetBassLevelCategory

func GetBassLevelCategory(level int) string

GetBassLevelCategory returns the bass category

func GetBassLevelName

func GetBassLevelName(level int) string

GetBassLevelName returns a descriptive name for the bass level

func GetVolumeLevelName

func GetVolumeLevelName(level int) string

GetVolumeLevelName returns a descriptive name for volume levels

Example
fmt.Printf("Volume 0: %s\n", GetVolumeLevelName(0))
fmt.Printf("Volume 25: %s\n", GetVolumeLevelName(25))
fmt.Printf("Volume 50: %s\n", GetVolumeLevelName(50))
fmt.Printf("Volume 100: %s\n", GetVolumeLevelName(100))
Output:
Volume 0: Mute
Volume 25: Quiet
Volume 50: Medium
Volume 100: Loud

func IsValidKey

func IsValidKey(keyValue string) bool

IsValidKey checks if the key value is valid

func ParseTypedEvent

func ParseTypedEvent[T any](event *WebSocketEvent, eventType WebSocketEventType) (T, error)

ParseTypedEvent attempts to parse a WebSocket event into a specific typed event

func ValidateBalanceLevel

func ValidateBalanceLevel(level int) bool

ValidateBalanceLevel validates that a balance level is within the allowed range

func ValidateBassLevel

func ValidateBassLevel(level int) bool

ValidateBassLevel validates that a bass level is within the allowed range

func ValidateVolumeLevel

func ValidateVolumeLevel(level int) bool

ValidateVolumeLevel checks if a volume level is valid (0-100)

Example

Example tests

valid := ValidateVolumeLevel(50)
invalid := ValidateVolumeLevel(150)

fmt.Printf("Volume 50 is valid: %v\n", valid)
fmt.Printf("Volume 150 is valid: %v\n", invalid)
Output:
Volume 50 is valid: true
Volume 150 is valid: false

Types

type APIError

type APIError struct {
	Code    int    `xml:"code,attr"`
	Message string `xml:",chardata"`
}

APIError represents an error response from the API

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface

type AccountDevice added in v0.45.0

type AccountDevice struct {
	DeviceID           string               `json:"device_id" xml:"deviceid,attr"`
	AttachedProduct    *AttachedProduct     `json:"attached_product" xml:"attachedProduct"`
	CreatedOn          string               `json:"created_on" xml:"createdOn"`
	FirmwareVersion    string               `json:"firmware_version" xml:"firmwareVersion"`
	IPAddress          string               `json:"ip_address" xml:"ipaddress"`
	Name               string               `json:"name" xml:"name"`
	Presets            []FullResponsePreset `json:"presets" xml:"presets>preset,omitempty"`
	ProductCode        string               `json:"product_code" xml:"-"`
	Recents            []FullResponseRecent `json:"recents" xml:"recents>recent,omitempty"`
	SerialNumber       string               `json:"serial_number" xml:"serialNumber,omitempty"`
	DeviceSerialNumber string               `json:"device_serial_number,omitempty" xml:"-"`
	MacAddress         string               `json:"mac_address,omitempty" xml:"-"`
	DiscoveryMethod    string               `json:"discovery_method,omitempty" xml:"-"`
	UpdatedOn          string               `json:"updated_on" xml:"updatedOn"`
}

AccountDevice represents a device in the account response.

type AccountDevicesResponse added in v0.56.0

type AccountDevicesResponse struct {
	XMLName          xml.Name             `xml:"devices"`
	Devices          []MargeAccountDevice `xml:"device"`
	ProviderSettings []ProviderSetting    `xml:"providerSettings>providerSetting"`
}

AccountDevicesResponse represents the response from /streaming/account/{accountId}/devices.

type AccountFullResponse added in v0.45.0

type AccountFullResponse struct {
	XMLName           xml.Name             `xml:"account"`
	ID                string               `xml:"id,attr"`
	AccountStatus     string               `xml:"accountStatus"`
	Devices           []AccountDevice      `xml:"devices>device"`
	Mode              string               `xml:"mode"`
	PreferredLanguage string               `xml:"preferredLanguage"`
	ProviderSettings  []ProviderSetting    `xml:"providerSettings>providerSetting"`
	Sources           []FullResponseSource `xml:"sources>source"`
}

AccountFullResponse represents the complete account XML structure.

type AccountProfileResponse added in v0.24.0

type AccountProfileResponse struct {
	XMLName        xml.Name `xml:"customer"`
	AccountID      string   `xml:"accountID"`
	Email          string   `xml:"email"`
	FirstName      string   `xml:"firstName"`
	LastName       string   `xml:"lastName"`
	CountryCode    string   `xml:"countryCode"`
	LanguageCode   string   `xml:"languageCode"`
	Street         string   `xml:"street"`
	City           string   `xml:"city"`
	PostalCode     string   `xml:"postalCode"`
	State          string   `xml:"state"`
	Phone          string   `xml:"phone"`
	MarketingOptIn bool     `xml:"marketingOptIn"`
}

AccountProfileResponse represents a customer account profile.

type AccountSourcesResponse added in v0.56.0

type AccountSourcesResponse struct {
	XMLName xml.Name             `xml:"sources"`
	Sources []FullResponseSource `xml:"source"`
}

AccountSourcesResponse represents the response from /streaming/account/{accountId}/sources.

type AddStationRequest added in v0.7.0

type AddStationRequest struct {
	XMLName       xml.Name `xml:"addStation"`
	Source        string   `xml:"source,attr"`
	SourceAccount string   `xml:"sourceAccount,attr,omitempty"`
	Token         string   `xml:"token,attr,omitempty"`
	Name          string   `xml:"name"`
}

AddStationRequest represents a request to add a station

func NewAddStationRequest added in v0.7.0

func NewAddStationRequest(source, sourceAccount, token, name string) *AddStationRequest

NewAddStationRequest creates a new add station request

type AllInterfaces

type AllInterfaces struct{}

AllInterfaces represents all network interfaces support

type Art

type Art struct {
	ArtImageStatus string `xml:"artImageStatus,attr"`
	URL            string `xml:",chardata"`
}

Art represents album artwork information

type Asset added in v0.10.0

type Asset struct {
	Color            string  `json:"color" xml:"color"`
	Description      string  `json:"description" xml:"description"`
	Icons            IconSet `json:"icons" xml:"icons"`
	Name             string  `json:"name" xml:"name"`
	ShortDescription string  `json:"shortDescription,omitempty" xml:"shortDescription,omitempty"`
}

Asset represents a media asset with URL and content type information.

type AttachedProduct added in v0.45.0

type AttachedProduct struct {
	ProductCode  string             `json:"product_code" xml:"product_code,attr"`
	Components   []ServiceComponent `json:"components" xml:"components>component,omitempty"`
	ProductLabel string             `json:"product_label" xml:"productlabel"`
	SerialNumber string             `json:"serial_number" xml:"serialnumber"`
	UpdatedOn    string             `json:"updated_on" xml:"updatedOn"`
}

AttachedProduct represents product information for a device.

type Audio added in v0.10.0

type Audio struct {
	HasPlaylist bool     `json:"hasPlaylist" xml:"hasPlaylist"`
	IsRealtime  bool     `json:"isRealtime" xml:"isRealtime"`
	MaxTimeout  int      `json:"maxTimeout,omitempty" xml:"maxTimeout,omitempty"`
	StreamUrl   string   `json:"streamUrl" xml:"streamUrl"`
	Streams     []Stream `json:"streams" xml:"streams>stream"`
}

Audio represents audio content metadata including format and quality information.

type AudioCapabilities added in v0.6.0

type AudioCapabilities struct {
	DSPControls          bool `json:"dspControls"`
	ProductToneControls  bool `json:"productToneControls"`
	ProductLevelControls bool `json:"productLevelControls"`
}

AudioCapabilities represents the combined audio capabilities

func (*AudioCapabilities) GetAvailableControls added in v0.6.0

func (ac *AudioCapabilities) GetAvailableControls() []string

GetAvailableControls returns a list of available advanced audio controls

func (*AudioCapabilities) HasAdvancedAudioControls added in v0.6.0

func (ac *AudioCapabilities) HasAdvancedAudioControls() bool

HasAdvancedAudioControls returns true if any advanced audio controls are available

func (*AudioCapabilities) String added in v0.6.0

func (ac *AudioCapabilities) String() string

String returns a human-readable string representation of audio capabilities

type AudioDSPControls added in v0.6.0

type AudioDSPControls struct {
	XMLName             xml.Name `xml:"audiodspcontrols"`
	AudioMode           string   `xml:"audiomode,attr"`
	VideoSyncAudioDelay int      `xml:"videosyncaudiodelay,attr"`
	SupportedAudioModes string   `xml:"supportedaudiomodes,attr"`
}

AudioDSPControls represents the response from GET /audiodspcontrols endpoint

func (*AudioDSPControls) GetSupportedAudioModes added in v0.6.0

func (adsp *AudioDSPControls) GetSupportedAudioModes() []string

GetSupportedAudioModes returns a slice of supported audio modes

func (*AudioDSPControls) IsAudioModeSupported added in v0.6.0

func (adsp *AudioDSPControls) IsAudioModeSupported(mode string) bool

IsAudioModeSupported checks if the given audio mode is supported

func (*AudioDSPControls) String added in v0.6.0

func (adsp *AudioDSPControls) String() string

String returns a human-readable string representation of DSP controls

type AudioDSPControlsRequest added in v0.6.0

type AudioDSPControlsRequest struct {
	XMLName             xml.Name `xml:"audiodspcontrols"`
	AudioMode           string   `xml:"audiomode,attr,omitempty"`
	VideoSyncAudioDelay int      `xml:"videosyncaudiodelay,attr,omitempty"`
}

AudioDSPControlsRequest represents the request for POST /audiodspcontrols endpoint

func (*AudioDSPControlsRequest) Validate added in v0.6.0

func (req *AudioDSPControlsRequest) Validate(capabilities *AudioDSPControls) error

Validate validates the DSP controls request

type AudioProductLevelControls added in v0.6.0

type AudioProductLevelControls struct {
	XMLName                   xml.Name                 `xml:"audioproductlevelcontrols"`
	FrontCenterSpeakerLevel   FrontCenterLevelSetting  `xml:"frontCenterSpeakerLevel"`
	RearSurroundSpeakersLevel RearSurroundLevelSetting `xml:"rearSurroundSpeakersLevel"`
}

AudioProductLevelControls represents the response from GET /audioproductlevelcontrols endpoint

func (*AudioProductLevelControls) String added in v0.6.0

func (alc *AudioProductLevelControls) String() string

String returns a human-readable string representation of level controls

type AudioProductLevelControlsRequest added in v0.6.0

type AudioProductLevelControlsRequest struct {
	XMLName                   xml.Name                  `xml:"audioproductlevelcontrols"`
	FrontCenterSpeakerLevel   *FrontCenterControlValue  `xml:"frontCenterSpeakerLevel,omitempty"`
	RearSurroundSpeakersLevel *RearSurroundControlValue `xml:"rearSurroundSpeakersLevel,omitempty"`
}

AudioProductLevelControlsRequest represents the request for POST /audioproductlevelcontrols endpoint

func (*AudioProductLevelControlsRequest) Validate added in v0.6.0

Validate validates the level controls request

type AudioProductToneControls added in v0.6.0

type AudioProductToneControls struct {
	XMLName xml.Name             `xml:"audioproducttonecontrols"`
	Bass    BassControlSetting   `xml:"bass"`
	Treble  TrebleControlSetting `xml:"treble"`
}

AudioProductToneControls represents the response from GET /audioproducttonecontrols endpoint

func (*AudioProductToneControls) String added in v0.6.0

func (atc *AudioProductToneControls) String() string

String returns a human-readable string representation of tone controls

type AudioProductToneControlsRequest added in v0.6.0

type AudioProductToneControlsRequest struct {
	XMLName xml.Name            `xml:"audioproducttonecontrols"`
	Bass    *BassControlValue   `xml:"bass,omitempty"`
	Treble  *TrebleControlValue `xml:"treble,omitempty"`
}

AudioProductToneControlsRequest represents the request for POST /audioproducttonecontrols endpoint

func (*AudioProductToneControlsRequest) Validate added in v0.6.0

func (req *AudioProductToneControlsRequest) Validate(capabilities *AudioProductToneControls) error

Validate validates the tone controls request

type Balance

type Balance struct {
	XMLName       xml.Name `xml:"balance"`
	DeviceID      string   `xml:"deviceID,attr"`
	TargetBalance int      `xml:"targetbalance"`
	ActualBalance int      `xml:"actualbalance"`
}

Balance represents the response from /balance endpoint

func (*Balance) GetActualLevel

func (b *Balance) GetActualLevel() int

GetActualLevel returns the actual balance level

func (*Balance) GetBalanceChangeNeeded

func (b *Balance) GetBalanceChangeNeeded() int

GetBalanceChangeNeeded returns the amount of change needed to reach target from actual

func (*Balance) GetLeftRightPercentage

func (b *Balance) GetLeftRightPercentage() (left, right int)

GetLeftRightPercentage returns the balance as left/right percentages

func (*Balance) GetLevel

func (b *Balance) GetLevel() int

GetLevel returns the target balance level

func (*Balance) IsAtTarget

func (b *Balance) IsAtTarget() bool

IsAtTarget returns true if actual balance matches target balance

func (*Balance) IsBalanced

func (b *Balance) IsBalanced() bool

IsBalanced returns true if balance is centered (zero level)

func (*Balance) IsLeftBalance

func (b *Balance) IsLeftBalance() bool

IsLeftBalance returns true if balance favors left channel (negative level)

func (*Balance) IsRightBalance

func (b *Balance) IsRightBalance() bool

IsRightBalance returns true if balance favors right channel (positive level)

func (*Balance) MarshalXML

func (b *Balance) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements custom XML marshaling

func (*Balance) String

func (b *Balance) String() string

String returns a human-readable string representation

func (*Balance) UnmarshalXML

func (b *Balance) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling with validation

type BalanceRequest

type BalanceRequest struct {
	XMLName xml.Name `xml:"balance"`
	Level   int      `xml:",chardata"`
}

BalanceRequest represents the request for POST /balance endpoint

func NewBalanceRequest

func NewBalanceRequest(level int) (*BalanceRequest, error)

NewBalanceRequest creates a new balance request with validation

type Bass

type Bass struct {
	XMLName    xml.Name `xml:"bass"`
	DeviceID   string   `xml:"deviceID,attr"`
	TargetBass int      `xml:"targetbass"`
	ActualBass int      `xml:"actualbass"`
}

Bass represents the response from /bass endpoint

func (*Bass) GetActualLevel

func (b *Bass) GetActualLevel() int

GetActualLevel returns the actual bass level

func (*Bass) GetBassChangeNeeded

func (b *Bass) GetBassChangeNeeded() int

GetBassChangeNeeded returns the amount of change needed to reach target from actual

func (*Bass) GetLevel

func (b *Bass) GetLevel() int

GetLevel returns the target bass level

func (*Bass) IsAtTarget

func (b *Bass) IsAtTarget() bool

IsAtTarget returns true if actual bass matches target bass

func (*Bass) IsBassBoost

func (b *Bass) IsBassBoost() bool

IsBassBoost returns true if bass is boosted (positive level)

func (*Bass) IsBassCut

func (b *Bass) IsBassCut() bool

IsBassCut returns true if bass is cut (negative level)

func (*Bass) IsFlat

func (b *Bass) IsFlat() bool

IsFlat returns true if bass is neutral (zero level)

func (*Bass) MarshalXML

func (b *Bass) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements custom XML marshaling

func (*Bass) String

func (b *Bass) String() string

String returns a human-readable string representation

func (*Bass) UnmarshalXML

func (b *Bass) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling with validation

type BassCapabilities

type BassCapabilities struct {
	XMLName       xml.Name `xml:"bassCapabilities"`
	DeviceID      string   `xml:"deviceID,attr"`
	BassAvailable bool     `xml:"bassAvailable"`
	BassMin       int      `xml:"bassMin"`
	BassMax       int      `xml:"bassMax"`
	BassDefault   int      `xml:"bassDefault"`
}

BassCapabilities represents the response from /bassCapabilities endpoint

func (*BassCapabilities) ClampLevel

func (bc *BassCapabilities) ClampLevel(level int) int

ClampLevel clamps a level to the supported range

func (*BassCapabilities) GetDefaultLevel

func (bc *BassCapabilities) GetDefaultLevel() int

GetDefaultLevel returns the default bass level

func (*BassCapabilities) GetMaxLevel

func (bc *BassCapabilities) GetMaxLevel() int

GetMaxLevel returns the maximum bass level

func (*BassCapabilities) GetMinLevel

func (bc *BassCapabilities) GetMinLevel() int

GetMinLevel returns the minimum bass level

func (*BassCapabilities) IsBassSupported

func (bc *BassCapabilities) IsBassSupported() bool

IsBassSupported returns true if bass control is supported

func (*BassCapabilities) String

func (bc *BassCapabilities) String() string

String returns a human-readable string representation

func (*BassCapabilities) ValidateLevel

func (bc *BassCapabilities) ValidateLevel(level int) bool

ValidateLevel returns true if the level is within supported range

type BassControlSetting added in v0.6.0

type BassControlSetting struct {
	XMLName  xml.Name `xml:"bass"`
	Value    int      `xml:"value,attr"`
	MinValue int      `xml:"minValue,attr"`
	MaxValue int      `xml:"maxValue,attr"`
	Step     int      `xml:"step,attr"`
}

BassControlSetting represents a bass control setting with constraints

func (*BassControlSetting) ClampValue added in v0.6.0

func (bc *BassControlSetting) ClampValue(value int) int

ClampValue clamps a value to the valid range

func (*BassControlSetting) ValidateBass added in v0.6.0

func (bc *BassControlSetting) ValidateBass(value int) error

ValidateBass validates the bass value within constraints

type BassControlValue added in v0.6.0

type BassControlValue struct {
	XMLName xml.Name `xml:"bass"`
	Value   int      `xml:"value,attr"`
}

BassControlValue represents a bass control value for requests

func NewBassControlValue added in v0.6.0

func NewBassControlValue(value int) *BassControlValue

NewBassControlValue creates a new bass control value for requests

type BassRequest

type BassRequest struct {
	XMLName xml.Name `xml:"bass"`
	Level   int      `xml:",chardata"`
}

BassRequest represents the request for POST /bass endpoint

func NewBassRequest

func NewBassRequest(level int) (*BassRequest, error)

NewBassRequest creates a new bass request with validation

type BassUpdatedEvent

type BassUpdatedEvent struct {
	XMLName  xml.Name `xml:"bassUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Bass     Bass     `xml:"bass"`
}

BassUpdatedEvent represents a bass setting update event

type BearerToken added in v0.7.0

type BearerToken struct {
	XMLName xml.Name `xml:"bearertoken"`
	Value   string   `xml:"value,attr"`
}

BearerToken represents a bearer token response from the device

func NewBearerToken added in v0.7.0

func NewBearerToken(token string) *BearerToken

NewBearerToken creates a new BearerToken with the given token value

func (*BearerToken) GetAuthHeader added in v0.7.0

func (b *BearerToken) GetAuthHeader() string

GetAuthHeader returns the token formatted for use in Authorization headers

func (*BearerToken) GetToken added in v0.7.0

func (b *BearerToken) GetToken() string

GetToken returns the bearer token value

func (*BearerToken) GetTokenWithoutPrefix added in v0.7.0

func (b *BearerToken) GetTokenWithoutPrefix() string

GetTokenWithoutPrefix returns the bearer token value without the "Bearer " prefix

func (*BearerToken) IsValid added in v0.7.0

func (b *BearerToken) IsValid() bool

IsValid returns true if the bearer token has a valid value

func (*BearerToken) String added in v0.7.0

func (b *BearerToken) String() string

String returns a string representation of the bearer token

type BmxNavItem added in v0.60.0

type BmxNavItem struct {
	Links    *Links `json:"_links,omitempty"`
	ImageUrl string `json:"imageUrl,omitempty"`
	Name     string `json:"name"`
	Subtitle string `json:"subtitle"`
}

BmxNavItem represents a single item in a TuneIn browse or search result.

type BmxNavResponse added in v0.60.0

type BmxNavResponse struct {
	Links       *Links          `json:"_links,omitempty"`
	BmxSections []BmxNavSection `json:"bmx_sections"`
	Layout      string          `json:"layout"`
}

BmxNavResponse is the top-level response for TuneIn navigate and search endpoints.

type BmxNavSection added in v0.60.0

type BmxNavSection struct {
	Links  *Links       `json:"_links,omitempty"`
	Items  []BmxNavItem `json:"items"`
	Layout string       `json:"layout,omitempty"`
	Name   string       `json:"name"`
}

BmxNavSection represents a group of navigation items with a layout hint.

type BmxPlaybackResponse added in v0.10.0

type BmxPlaybackResponse struct {
	Links  *Links `json:"_links,omitempty" xml:"links,omitempty"`
	Artist struct {
		Name string `json:"name,omitempty" xml:"name,omitempty"`
	} `json:"artist,omitempty" xml:"artist,omitempty"`
	Audio           Audio  `json:"audio" xml:"audio"`
	ImageUrl        string `json:"imageUrl" xml:"imageUrl"`
	IsFavorite      *bool  `json:"isFavorite,omitempty" xml:"isFavorite,omitempty"`
	Name            string `json:"name" xml:"name"`
	StreamType      string `json:"streamType" xml:"streamType"`
	Duration        int    `json:"duration,omitempty" xml:"duration,omitempty"`
	ShuffleDisabled bool   `json:"shuffle_disabled,omitempty" xml:"shuffleDisabled,omitempty"`
	RepeatDisabled  bool   `json:"repeat_disabled,omitempty" xml:"repeatDisabled,omitempty"`
}

BmxPlaybackResponse represents a playback response from BMX services.

type BmxPodcastInfoResponse added in v0.10.0

type BmxPodcastInfoResponse struct {
	Links           *Links  `json:"_links,omitempty" xml:"links,omitempty"`
	Name            string  `json:"name" xml:"name"`
	ShuffleDisabled bool    `json:"shuffleDisabled" xml:"shuffleDisabled"`
	RepeatDisabled  bool    `json:"repeatDisabled" xml:"repeatDisabled"`
	StreamType      string  `json:"streamType" xml:"streamType"`
	Tracks          []Track `json:"tracks" xml:"tracks>track"`
}

BmxPodcastInfoResponse represents podcast information from BMX services.

type BmxResponse added in v0.10.0

type BmxResponse struct {
	Links         *Links    `json:"_links,omitempty" xml:"links,omitempty"`
	AskAgainAfter int       `json:"askAgainAfter" xml:"askAgainAfter"`
	BmxServices   []Service `json:"bmx_services" xml:"bmx_services>service"`
}

BmxResponse represents a response from BMX services.

type BmxService added in v0.10.0

type BmxService struct {
	Links               *Links                 `json:"_links,omitempty" xml:"links,omitempty"`
	AskAdapter          bool                   `json:"askAdapter" xml:"askAdapter"`
	Assets              Asset                  `json:"assets" xml:"assets"`
	BaseUrl             string                 `json:"baseUrl" xml:"baseUrl"`
	SignupUrl           string                 `json:"signupUrl,omitempty" xml:"signupUrl,omitempty"`
	StreamTypes         []string               `json:"streamTypes" xml:"streamTypes>streamType"`
	AuthenticationModel map[string]interface{} `json:"authenticationModel" xml:"authenticationModel"`
	ID                  Id                     `json:"id" xml:"id"`
}

BmxService represents a Bose Media eXchange service configuration.

type CachedPlaybackRequest added in v0.9.0

type CachedPlaybackRequest struct {
	XMLName xml.Name `xml:"cachedPlaybackRequest"`
}

CachedPlaybackRequest represents cached playback request information

type Capabilities

type Capabilities struct {
	XMLName       xml.Name       `xml:"capabilities"`
	DeviceID      string         `xml:"deviceID,attr"`
	NetworkConfig *NetworkConfig `xml:"networkConfig,omitempty"`
	DSPConfig     *DSPConfig     `xml:"dspCapabilities,omitempty"`
	Lightswitch   bool           `xml:"lightswitch,omitempty"`
	ClockDisplay  bool           `xml:"clockDisplay,omitempty"`
	Capability    []Capability   `xml:"capability,omitempty"`
	LRStereo      bool           `xml:"lrStereoCapable,omitempty"`
	BCOReset      bool           `xml:"bcoresetCapable,omitempty"`
	PowerSaving   bool           `xml:"disablePowerSaving,omitempty"`
}

Capabilities represents the response from /capabilities endpoint

func (*Capabilities) GetAudioCapabilities

func (c *Capabilities) GetAudioCapabilities() []string

GetAudioCapabilities returns a summary of audio capabilities

func (*Capabilities) GetCapabilityByName

func (c *Capabilities) GetCapabilityByName(name string) *Capability

GetCapabilityByName returns a capability by name

func (*Capabilities) GetCapabilityNames

func (c *Capabilities) GetCapabilityNames() []string

GetCapabilityNames returns a list of all capability names

func (*Capabilities) GetHostedWifiHostedBy

func (c *Capabilities) GetHostedWifiHostedBy() string

GetHostedWifiHostedBy returns who hosts the wifi configuration

func (*Capabilities) GetHostedWifiPort

func (c *Capabilities) GetHostedWifiPort() string

GetHostedWifiPort returns the hosted wifi configuration port

func (*Capabilities) GetNetworkCapabilities

func (c *Capabilities) GetNetworkCapabilities() []string

GetNetworkCapabilities returns a summary of network capabilities

func (*Capabilities) GetSystemCapabilities

func (c *Capabilities) GetSystemCapabilities() []string

GetSystemCapabilities returns a summary of system capabilities

func (*Capabilities) HasBCOResetCapability

func (c *Capabilities) HasBCOResetCapability() bool

HasBCOResetCapability returns true if the device supports BCO reset

func (*Capabilities) HasCapability

func (c *Capabilities) HasCapability(name string) bool

HasCapability returns true if the device has the specified capability

func (*Capabilities) HasClockDisplay

func (c *Capabilities) HasClockDisplay() bool

HasClockDisplay returns true if the device has a clock display

func (*Capabilities) HasDSPMonoStereo

func (c *Capabilities) HasDSPMonoStereo() bool

HasDSPMonoStereo returns true if DSP mono/stereo is available

func (*Capabilities) HasDualModeNetwork

func (c *Capabilities) HasDualModeNetwork() bool

HasDualModeNetwork returns true if the device supports dual mode networking

func (*Capabilities) HasHostedWifiConfig

func (c *Capabilities) HasHostedWifiConfig() bool

HasHostedWifiConfig returns true if the device supports hosted wifi configuration

func (*Capabilities) HasLRStereoCapability

func (c *Capabilities) HasLRStereoCapability() bool

HasLRStereoCapability returns true if the device supports left/right stereo

func (*Capabilities) HasLightswitch

func (c *Capabilities) HasLightswitch() bool

HasLightswitch returns true if the device has a light switch

func (*Capabilities) HasPowerSavingDisabled

func (c *Capabilities) HasPowerSavingDisabled() bool

HasPowerSavingDisabled returns true if power saving is disabled

func (*Capabilities) HasWSAPIProxy

func (c *Capabilities) HasWSAPIProxy() bool

HasWSAPIProxy returns true if the device supports WSAPI proxy

type Capability

type Capability struct {
	Name string `xml:"name,attr"`
	URL  string `xml:"url,attr"`
	Info string `xml:"info,attr"`
}

Capability represents an individual device capability

type ChangePasswordRequest added in v0.24.0

type ChangePasswordRequest struct {
	XMLName     xml.Name `xml:"passwordChange"`
	OldPassword string   `xml:"oldPassword"`
	NewPassword string   `xml:"newPassword"`
}

ChangePasswordRequest represents a request to change the account password.

type ClockDisplay

type ClockDisplay struct {
	XMLName    xml.Name `xml:"clockDisplay"`
	DeviceID   string   `xml:"deviceID,attr,omitempty"`
	Enabled    bool     `xml:"enabled,attr,omitempty"`
	Format     string   `xml:"format,attr,omitempty"`
	Brightness int      `xml:"brightness,attr,omitempty"`
	AutoDim    bool     `xml:"autoDim,attr,omitempty"`
	TimeZone   string   `xml:"timeZone,attr,omitempty"`
	Value      string   `xml:",chardata"`
}

ClockDisplay represents the device's clock display settings

func (*ClockDisplay) GetBrightness

func (c *ClockDisplay) GetBrightness() int

GetBrightness returns the display brightness level (0-100)

func (*ClockDisplay) GetBrightnessLevel

func (c *ClockDisplay) GetBrightnessLevel() string

GetBrightnessLevel returns a descriptive brightness level

func (*ClockDisplay) GetDeviceID

func (c *ClockDisplay) GetDeviceID() string

GetDeviceID returns the device ID

func (*ClockDisplay) GetFormat

func (c *ClockDisplay) GetFormat() string

GetFormat returns the clock display format (12/24 hour)

func (*ClockDisplay) GetFormatDescription

func (c *ClockDisplay) GetFormatDescription() string

GetFormatDescription returns a human-readable format description

func (*ClockDisplay) GetTimeZone

func (c *ClockDisplay) GetTimeZone() string

GetTimeZone returns the timezone setting

func (*ClockDisplay) IsAutoDimEnabled

func (c *ClockDisplay) IsAutoDimEnabled() bool

IsAutoDimEnabled returns true if auto-dim is enabled

func (*ClockDisplay) IsEmpty

func (c *ClockDisplay) IsEmpty() bool

IsEmpty returns true if the clock display has no configuration

func (*ClockDisplay) IsEnabled

func (c *ClockDisplay) IsEnabled() bool

IsEnabled returns true if the clock display is enabled

type ClockDisplayRequest

type ClockDisplayRequest struct {
	XMLName    xml.Name `xml:"clockDisplay"`
	Enabled    *bool    `xml:"enabled,attr,omitempty"`
	Format     string   `xml:"format,attr,omitempty"`
	Brightness *int     `xml:"brightness,attr,omitempty"`
	AutoDim    *bool    `xml:"autoDim,attr,omitempty"`
	TimeZone   string   `xml:"timeZone,attr,omitempty"`
}

ClockDisplayRequest represents a request to configure clock display settings

func NewClockDisplayRequest

func NewClockDisplayRequest() *ClockDisplayRequest

NewClockDisplayRequest creates a new clock display configuration request

func (*ClockDisplayRequest) HasChanges

func (r *ClockDisplayRequest) HasChanges() bool

HasChanges returns true if the request has any configuration changes

func (*ClockDisplayRequest) SetAutoDim

func (r *ClockDisplayRequest) SetAutoDim(autoDim bool) *ClockDisplayRequest

SetAutoDim sets whether auto-dim is enabled

func (*ClockDisplayRequest) SetBrightness

func (r *ClockDisplayRequest) SetBrightness(brightness int) *ClockDisplayRequest

SetBrightness sets the display brightness (0-100)

func (*ClockDisplayRequest) SetEnabled

func (r *ClockDisplayRequest) SetEnabled(enabled bool) *ClockDisplayRequest

SetEnabled sets whether the clock display is enabled

func (*ClockDisplayRequest) SetFormat

func (r *ClockDisplayRequest) SetFormat(format ClockFormat) *ClockDisplayRequest

SetFormat sets the clock display format (12/24 hour)

func (*ClockDisplayRequest) SetTimeZone

func (r *ClockDisplayRequest) SetTimeZone(timeZone string) *ClockDisplayRequest

SetTimeZone sets the timezone

func (*ClockDisplayRequest) Validate

func (r *ClockDisplayRequest) Validate() error

Validate checks if the clock display request is valid

type ClockDisplayUpdatedEvent

type ClockDisplayUpdatedEvent struct {
	XMLName      xml.Name     `xml:"clockDisplayUpdated"`
	DeviceID     string       `xml:"deviceID,attr"`
	ClockDisplay ClockDisplay `xml:"clockDisplay"`
}

ClockDisplayUpdatedEvent represents a clock display setting update event

type ClockFormat

type ClockFormat string

ClockFormat represents supported clock display formats

const (
	// ClockFormat12Hour represents 12-hour clock format
	ClockFormat12Hour ClockFormat = "12"
	// ClockFormat24Hour represents 24-hour clock format
	ClockFormat24Hour ClockFormat = "24"
	// ClockFormatAuto represents automatic clock format selection
	ClockFormatAuto ClockFormat = "auto"
)

type ClockTime

type ClockTime struct {
	XMLName     xml.Name   `xml:"clockTime"`
	UTCTime     int64      `xml:"utcTime,attr,omitempty"`
	CueMusic    int        `xml:"cueMusic,attr,omitempty"`
	TimeFormat  string     `xml:"timeFormat,attr,omitempty"`
	Brightness  int        `xml:"brightness,attr,omitempty"`
	ClockError  int        `xml:"clockError,attr,omitempty"`
	UTCSyncTime int64      `xml:"utcSyncTime,attr,omitempty"`
	LocalTime   *LocalTime `xml:"localTime,omitempty"`
	Zone        string     `xml:"zone,attr,omitempty"`
	UTC         int64      `xml:"utc,attr,omitempty"`
	Value       string     `xml:",chardata"`
}

ClockTime represents the device's system time

func (*ClockTime) GetBrightness added in v0.7.0

func (c *ClockTime) GetBrightness() int

GetBrightness returns the clock brightness setting

func (*ClockTime) GetClockError added in v0.7.0

func (c *ClockTime) GetClockError() int

GetClockError returns the clock error status

func (*ClockTime) GetLocalTime added in v0.7.0

func (c *ClockTime) GetLocalTime() *LocalTime

GetLocalTime returns the local time component

func (*ClockTime) GetTime

func (c *ClockTime) GetTime() (time.Time, error)

GetTime returns the clock time as a time.Time object Priority: LocalTime > UTCTime > UTC > Value

func (*ClockTime) GetTimeFormat added in v0.7.0

func (c *ClockTime) GetTimeFormat() string

GetTimeFormat returns the time format setting

func (*ClockTime) GetTimeString

func (c *ClockTime) GetTimeString() string

GetTimeString returns a formatted time string

func (*ClockTime) GetUTC

func (c *ClockTime) GetUTC() int64

GetUTC returns the UTC timestamp if available

func (*ClockTime) GetUTCSyncTime added in v0.7.0

func (c *ClockTime) GetUTCSyncTime() int64

GetUTCSyncTime returns the UTC sync time

func (*ClockTime) GetZone

func (c *ClockTime) GetZone() string

GetZone returns the timezone if available

func (*ClockTime) IsEmpty

func (c *ClockTime) IsEmpty() bool

IsEmpty returns true if the clock time has no data

func (*ClockTime) SetTime

func (c *ClockTime) SetTime(t time.Time)

SetTime sets the clock time from a time.Time object

func (*ClockTime) SetUTC

func (c *ClockTime) SetUTC(utc int64)

SetUTC sets the clock time from a UTC timestamp

type ClockTimeRequest

type ClockTimeRequest struct {
	XMLName xml.Name `xml:"clockTime"`
	Zone    string   `xml:"zone,attr,omitempty"`
	UTC     int64    `xml:"utc,attr,omitempty"`
	Value   string   `xml:",chardata"`
}

ClockTimeRequest represents a request to set the device time

func NewClockTimeRequest

func NewClockTimeRequest(t time.Time) *ClockTimeRequest

NewClockTimeRequest creates a new clock time request from a time.Time

func NewClockTimeRequestUTC

func NewClockTimeRequestUTC(utc int64) *ClockTimeRequest

NewClockTimeRequestUTC creates a new clock time request from UTC timestamp

func (*ClockTimeRequest) Validate

func (r *ClockTimeRequest) Validate() error

Validate checks if the clock time request is valid

type ClockTimeUpdatedEvent

type ClockTimeUpdatedEvent struct {
	XMLName   xml.Name  `xml:"clockTimeUpdated"`
	DeviceID  string    `xml:"deviceID,attr"`
	ClockTime ClockTime `xml:"clockTime"`
}

ClockTimeUpdatedEvent represents a clock time update event

type Component

type Component struct {
	ComponentCategory string `xml:"componentCategory"`
	SoftwareVersion   string `xml:"softwareVersion"`
	SerialNumber      string `xml:"serialNumber"`
}

Component represents a device component

type ConfiguredSource added in v0.10.0

type ConfiguredSource struct {
	XMLName     xml.Name `json:"-" xml:"source"`
	DisplayName string   `json:"display_name" xml:"displayName,attr,omitempty"`
	ID          string   `json:"id" xml:"id,attr,omitempty"`
	Secret      string   `json:"secret" xml:"secret,attr,omitempty"`
	SecretType  string   `json:"secret_type" xml:"secretType,attr,omitempty"`
	Credential  struct {
		Type  string `xml:"type,attr"`
		Value string `xml:",chardata"`
	} `json:"-" xml:"credential"`
	SourceKey struct {
		Type    string `xml:"type,attr"`
		Account string `xml:"account,attr"`
	} `json:"source_key" xml:"sourceKey"`
	Type string `xml:"type,attr,omitempty"`

	// Parity fields
	CreatedOn        string `json:"created_on,omitempty" xml:"createdOn,omitempty"`
	UpdatedOn        string `json:"updated_on,omitempty" xml:"updatedOn,omitempty"`
	SourceProviderID string `json:"sourceproviderid,omitempty" xml:"sourceproviderid,omitempty"`
	Username         string `json:"username,omitempty" xml:"username,omitempty"`
	SourceName       string `json:"source_name,omitempty" xml:"sourcename,omitempty"`
	Name             string `json:"name,omitempty" xml:"name,omitempty"`
	SourceSettings   string `json:"-" xml:"sourceSettings,omitempty"`
	Status           string `json:"status,omitempty" xml:"-"`

	// Legacy fields for backward compatibility in code if needed,
	// though it's better to update the code to use SourceKey.
	SourceKeyType    string `json:"source_key_type" xml:"-"`
	SourceKeyAccount string `json:"source_key_account" xml:"-"`
}

ConfiguredSource represents a configured media source with authentication details.

func (ConfiguredSource) MarshalXML added in v0.45.0

func (s ConfiguredSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for custom XML encoding of ConfiguredSource.

type ConnectionState

type ConnectionState struct {
	XMLName xml.Name `xml:"connectionState"`
	State   string   `xml:"state,attr"`
	Signal  string   `xml:"signal,attr"`
}

ConnectionState represents the device's network connection state

func (*ConnectionState) GetSignalStrength

func (cs *ConnectionState) GetSignalStrength() string

GetSignalStrength returns the signal strength as a string

func (*ConnectionState) IsConnected

func (cs *ConnectionState) IsConnected() bool

IsConnected returns true if the device is connected

type ConnectionStateType

type ConnectionStateType string

ConnectionStateType represents connection state values

const (
	// ConnectionStateConnected indicates the device is connected
	ConnectionStateConnected ConnectionStateType = "CONNECTED"
	// ConnectionStateDisconnected indicates the device is disconnected
	ConnectionStateDisconnected ConnectionStateType = "DISCONNECTED"
)

type ConnectionStateUpdatedEvent

type ConnectionStateUpdatedEvent struct {
	XMLName         xml.Name        `xml:"connectionStateUpdated"`
	DeviceID        string          `xml:"deviceID,attr"`
	ConnectionState ConnectionState `xml:"connectionState"`
}

ConnectionStateUpdatedEvent represents a connection state update event

type ContentItem

type ContentItem struct {
	Source        string `xml:"source,attr"`
	Type          string `xml:"type,attr"`
	Location      string `xml:"location,attr"`
	SourceAccount string `xml:"sourceAccount,attr"`
	IsPresetable  bool   `xml:"isPresetable,attr"`
	ItemName      string `xml:"itemName,omitempty"`
	ContainerArt  string `xml:"containerArt,omitempty"`
}

ContentItem represents metadata about the currently playing content

type ContentItemHistory added in v0.9.0

type ContentItemHistory struct {
	XMLName xml.Name `xml:"contentItemHistory"`
	MaxSize int      `xml:"maxSize,attr"`
}

ContentItemHistory represents the content item history

type CustomerSupportDevice added in v0.10.0

type CustomerSupportDevice struct {
	ID              string `xml:"id,attr"`
	SerialNumber    string `xml:"serialnumber"`
	FirmwareVersion string `xml:"firmware-version"`
	Product         struct {
		ProductCode  string `xml:"product_code,attr"`
		Type         string `xml:"type,attr"`
		SerialNumber string `xml:"serialnumber"`
	} `xml:"product"`
}

CustomerSupportDevice represents device information for customer support purposes.

type CustomerSupportRequest added in v0.10.0

type CustomerSupportRequest struct {
	XMLName        xml.Name              `xml:"device-data"`
	Device         CustomerSupportDevice `xml:"device"`
	DiagnosticData struct {
		DeviceLandscape struct {
			RSSI                  string   `xml:"rssi"`
			GatewayIP             string   `xml:"gateway-ip-address"`
			IPAddress             string   `xml:"ip-address"`
			NetworkConnectionType string   `xml:"network-connection-type"`
			MacAddresses          []string `xml:"macaddresses>macaddress"`
		} `xml:"device-landscape"`
	} `xml:"diagnostic-data"`
}

CustomerSupportRequest represents a customer support request with device and configuration details.

type DSPConfig

type DSPConfig struct {
	DSPMonoStereo *DSPMonoStereo `xml:"dspMonoStereo,omitempty"`
}

DSPConfig represents DSP capabilities

type DSPMonoStereo

type DSPMonoStereo struct {
	Available bool `xml:"available,attr"`
}

DSPMonoStereo represents mono/stereo DSP capability

type DeviceError added in v0.57.0

type DeviceError struct {
	Value   int    `xml:"value,attr"`
	Name    string `xml:"name,attr"`
	Message string `xml:",chardata"`
}

DeviceError represents a single error in an ErrorsResponse

type DeviceEvent added in v0.10.0

type DeviceEvent struct {
	Type     string                 `json:"type"`
	Time     string                 `json:"time"`
	MonoTime int64                  `json:"monoTime"`
	Data     map[string]interface{} `json:"data"`
}

DeviceEvent represents an event that occurred on a device.

type DeviceEventsRequest added in v0.24.0

type DeviceEventsRequest struct {
	Envelope struct {
		MonoTime               int64  `json:"monoTime"`
		PayloadProtocolVersion string `json:"payloadProtocolVersion"`
		PayloadType            string `json:"payloadType"`
		ProtocolVersion        string `json:"protocolVersion"`
		Time                   string `json:"time"`
		UniqueID               string `json:"uniqueId"`
	} `json:"envelope"`
	Payload struct {
		DeviceInfo struct {
			BoseID          string `json:"boseID"`
			DeviceID        string `json:"deviceID"`
			DeviceType      string `json:"deviceType"`
			SoftwareVersion string `json:"softwareVersion"`
		} `json:"deviceInfo"`
		Events []struct {
			Data map[string]interface{} `json:"data"`
			Time string                 `json:"time"`
			Type string                 `json:"type"`
		} `json:"events"`
	} `json:"payload"`
}

DeviceEventsRequest represents a request containing multiple device events (stapp/scmudc).

type DeviceInfo

type DeviceInfo struct {
	XMLName          xml.Name      `xml:"info"`
	DeviceID         string        `xml:"deviceID,attr"`
	Name             string        `xml:"name"`
	Type             string        `xml:"type"`
	MargeAccountUUID string        `xml:"margeAccountUUID"`
	Components       []Component   `xml:"components>component"`
	MargeURL         string        `xml:"margeURL"`
	NetworkInfo      []NetworkInfo `xml:"networkInfo"`
	ModuleType       string        `xml:"moduleType"`
	Variant          string        `xml:"variant"`
	VariantMode      string        `xml:"variantMode"`
	CountryCode      string        `xml:"countryCode"`
	RegionCode       string        `xml:"regionCode"`
}

DeviceInfo represents the response from GET /info endpoint

type DeviceSetting added in v0.24.0

type DeviceSetting struct {
	Name  string `xml:"name"`
	Value string `xml:"value"`
}

DeviceSetting represents a single device setting.

type DeviceSettingsResponse added in v0.24.0

type DeviceSettingsResponse struct {
	XMLName  xml.Name        `xml:"deviceSettings"`
	Settings []DeviceSetting `xml:"deviceSetting"`
}

DeviceSettingsResponse represents device settings.

type DiscoveredDevice

type DiscoveredDevice struct {
	Name            string    `json:"name"`
	Host            string    `json:"host"`
	Port            int       `json:"port"`
	ModelID         string    `json:"model_id"`
	SerialNo        string    `json:"serial_no"`
	LastSeen        time.Time `json:"last_seen"`
	DiscoveryMethod string    `json:"discovery_method"`

	// Standard URLs
	APIBaseURL string `json:"api_base_url"` // http://host:port/
	InfoURL    string `json:"info_url"`     // http://host:port/info

	// Protocol-specific details
	UPnPLocation string `json:"upnp_location,omitempty"` // UPnP device description XML URL
	UPnPUSN      string `json:"upnp_usn,omitempty"`      // UPnP Unique Service Name
	UPnPSerial   string `json:"upnp_serial,omitempty"`   // Serial number from UPnP (MAC address)
	MDNSHostname string `json:"mdns_hostname,omitempty"` // mDNS hostname (e.g., "device.local.")
	MDNSService  string `json:"mdns_service,omitempty"`  // mDNS service name
	ConfigName   string `json:"config_name,omitempty"`   // Original name from config

	// Additional metadata
	Metadata map[string]string `json:"metadata,omitempty"`
}

DiscoveredDevice represents a device found through network discovery

func (*DiscoveredDevice) GetProtocolSpecificData added in v0.5.3

func (d *DiscoveredDevice) GetProtocolSpecificData() map[string]interface{}

GetProtocolSpecificData returns protocol-specific information

func (*DiscoveredDevice) GetStandardURLs added in v0.5.3

func (d *DiscoveredDevice) GetStandardURLs() map[string]string

GetStandardURLs returns the standard API URLs for this device

type EligibilityResponse added in v0.56.0

type EligibilityResponse struct {
	XMLName    xml.Name `xml:"eligibility"`
	IsEligible bool     `xml:"isEligible"`
}

EligibilityResponse represents the XML response for music provider eligibility.

type EmailAddressResponse added in v0.24.0

type EmailAddressResponse struct {
	XMLName xml.Name `xml:"emailAddress"`
	Email   string   `xml:",chardata"`
}

EmailAddressResponse represents the account email address.

type EndpointFeature added in v0.7.0

type EndpointFeature struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Endpoints   []string `json:"endpoints"`
	Category    string   `json:"category"`
	Essential   bool     `json:"essential"`   // Required for basic operation
	CLICommand  string   `json:"cli_command"` // Corresponding CLI command
}

EndpointFeature represents a feature that maps to one or more endpoints

func GetEndpointFeatureMap added in v0.7.0

func GetEndpointFeatureMap() []EndpointFeature

GetEndpointFeatureMap returns a comprehensive mapping of endpoints to implemented features

type Error

type Error struct {
	XMLName xml.Name `xml:"error"`
	Value   string   `xml:"value,attr"`
	Name    string   `xml:"name,attr"`
	Text    string   `xml:",chardata"`
}

Error represents an error state

type ErrorStats added in v0.10.0

type ErrorStats struct {
	DeviceID     string `json:"deviceId" xml:"deviceId"`
	ErrorCode    string `json:"errorCode" xml:"errorCode"`
	ErrorMessage string `json:"errorMessage" xml:"errorMessage"`
	Timestamp    string `json:"timestamp" xml:"timestamp"`
	Details      string `json:"details,omitempty" xml:"details,omitempty"`
}

ErrorStats represents error statistics for monitoring and debugging.

type ErrorUpdatedEvent

type ErrorUpdatedEvent struct {
	XMLName  xml.Name `xml:"errorUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Error    Error    `xml:"error"`
}

ErrorUpdatedEvent represents an error state update event

type ErrorsResponse added in v0.57.0

type ErrorsResponse struct {
	XMLName  xml.Name      `xml:"errors"`
	DeviceID string        `xml:"deviceID,attr"`
	Errors   []DeviceError `xml:"error"`
}

ErrorsResponse represents a multi-error response from the API (common in some firmware versions)

func (*ErrorsResponse) Error added in v0.57.0

func (e *ErrorsResponse) Error() string

Error implements the error interface for ErrorsResponse

type EventHandler

type EventHandler func(event *WebSocketEvent)

EventHandler represents a function that handles WebSocket events

type FavoriteEnabled

type FavoriteEnabled struct{}

FavoriteEnabled indicates if favorite functionality is enabled

type FrontCenterControlValue added in v0.6.0

type FrontCenterControlValue struct {
	XMLName xml.Name `xml:"frontCenterSpeakerLevel"`
	Value   int      `xml:"value,attr"`
}

FrontCenterControlValue represents a front-center speaker level control value for requests

func NewFrontCenterLevelValue added in v0.6.0

func NewFrontCenterLevelValue(value int) *FrontCenterControlValue

NewFrontCenterLevelValue creates a new level control value for front-center speaker

type FrontCenterLevelSetting added in v0.6.0

type FrontCenterLevelSetting struct {
	XMLName  xml.Name `xml:"frontCenterSpeakerLevel"`
	Value    int      `xml:"value,attr"`
	MinValue int      `xml:"minValue,attr"`
	MaxValue int      `xml:"maxValue,attr"`
	Step     int      `xml:"step,attr"`
}

FrontCenterLevelSetting represents a front-center speaker level control setting with constraints

func (*FrontCenterLevelSetting) ClampLevel added in v0.6.0

func (fc *FrontCenterLevelSetting) ClampLevel(value int) int

ClampLevel clamps a front-center speaker level value to the valid range

func (*FrontCenterLevelSetting) ValidateLevel added in v0.6.0

func (fc *FrontCenterLevelSetting) ValidateLevel(value int) error

ValidateLevel validates the front-center speaker level value within constraints

type FullResponsePreset added in v0.45.0

type FullResponsePreset struct {
	ButtonNumber    string             `json:"button_number" xml:"buttonNumber,attr"`
	ContainerArt    string             `json:"container_art" xml:"containerArt"`
	ContentItemType string             `json:"content_item_type" xml:"contentItemType"`
	CreatedOn       string             `json:"created_on" xml:"createdOn"`
	Location        string             `json:"location" xml:"location"`
	Name            string             `json:"name" xml:"name"`
	Source          FullResponseSource `json:"source" xml:"source"`
	UpdatedOn       string             `json:"updated_on" xml:"updatedOn"`
	Username        string             `json:"username" xml:"username"`
}

FullResponsePreset represents a preset specifically for the /full response.

type FullResponseRecent added in v0.45.0

type FullResponseRecent struct {
	ID              string             `json:"id" xml:"id,attr"`
	ContentItemType string             `json:"content_item_type" xml:"contentItemType"`
	CreatedOn       string             `json:"created_on" xml:"createdOn"`
	LastPlayedAt    string             `json:"last_played_at" xml:"lastplayedat"`
	Location        string             `json:"location" xml:"location"`
	Name            string             `json:"name" xml:"name"`
	Source          FullResponseSource `json:"source" xml:"source"`
	SourceID        string             `json:"source_id" xml:"sourceid"`
	UpdatedOn       string             `json:"updated_on" xml:"updatedOn"`
	Username        string             `json:"username" xml:"username"`
}

FullResponseRecent represents a recent item specifically for the /full response.

type FullResponseSource added in v0.45.0

type FullResponseSource struct {
	ID          string `json:"id" xml:"id,attr"`
	Type        string `json:"type" xml:"type,attr"`
	DisplayName string `json:"display_name" xml:"displayName,attr,omitempty"`
	CreatedOn   string `json:"created_on" xml:"createdOn"`
	Credential  struct {
		Type  string `json:"type" xml:"type,attr"`
		Value string `json:"value" xml:",chardata"`
	} `json:"credential" xml:"credential"`
	Name             string `json:"name" xml:"name"`
	SourceProviderID string `json:"sourceproviderid" xml:"sourceproviderid"`
	SourceName       string `json:"source_name" xml:"sourcename"`
	SourceSettings   string `json:"source_settings" xml:"sourceSettings"`
	UpdatedOn        string `json:"updated_on" xml:"updatedOn"`
	Username         string `json:"username" xml:"username"`
	Account          string `json:"account,omitempty" xml:"account,attr,omitempty"`
	SourceLabel      string `json:"source_label" xml:"-"`
	ProviderLabel    string `json:"provider_label,omitempty" xml:"-"`
}

FullResponseSource represents a configured media source specifically for the /full response. It follows the specific XML structure and field order of the upstream /full response.

type HostedWifiConfig

type HostedWifiConfig struct {
	HostedBy   string `xml:"hostedBy,attr,omitempty"`
	Generation string `xml:"generation,attr,omitempty"`
	Port       string `xml:"port,attr,omitempty"`
	Enabled    bool   `xml:",chardata"`
}

HostedWifiConfig represents hosted wifi configuration settings

type IconSet added in v0.10.0

type IconSet struct {
	DefaultAlbumArt string `json:"defaultAlbumArt,omitempty" xml:"defaultAlbumArt,omitempty"`
	LargeSvg        string `json:"largeSvg" xml:"largeSvg"`
	MonochromePng   string `json:"monochromePng" xml:"monochromePng"`
	MonochromeSvg   string `json:"monochromeSvg" xml:"monochromeSvg"`
	SmallSvg        string `json:"smallSvg" xml:"smallSvg"`
}

IconSet represents a collection of icons with different sizes for media content.

type Id added in v0.10.0

type Id struct {
	Name  string `json:"name" xml:"name"`
	Value int    `json:"value" xml:"value"`
}

Id represents an identifier structure used in various API responses.

type IntrospectNowPlaying added in v0.9.0

type IntrospectNowPlaying struct {
	XMLName               xml.Name `xml:"nowPlaying"`
	SkipPreviousSupported bool     `xml:"skipPreviousSupported,attr"`
	SeekSupported         bool     `xml:"seekSupported,attr"`
	ResumeSupported       bool     `xml:"resumeSupported,attr"`
	CollectData           bool     `xml:"collectData,attr"`
}

IntrospectNowPlaying represents now playing information in introspect response

type IntrospectRequest added in v0.9.0

type IntrospectRequest struct {
	XMLName       xml.Name `xml:"introspect"`
	Source        string   `xml:"source,attr"`
	SourceAccount string   `xml:"sourceAccount,attr,omitempty"`
}

IntrospectRequest represents a request to get introspect data for a music service

func NewIntrospectRequest added in v0.9.0

func NewIntrospectRequest(source, sourceAccount string) *IntrospectRequest

NewIntrospectRequest creates a new introspect request

type IntrospectResponse added in v0.9.0

type IntrospectResponse struct {
	XMLName                          xml.Name               `xml:""`
	State                            string                 `xml:"state,attr,omitempty"`
	User                             string                 `xml:"user,attr,omitempty"`
	IsPlaying                        bool                   `xml:"isPlaying,attr,omitempty"`
	TokenLastChangedTimeSeconds      int64                  `xml:"tokenLastChangedTimeSeconds,attr,omitempty"`
	TokenLastChangedTimeMicroseconds int64                  `xml:"tokenLastChangedTimeMicroseconds,attr,omitempty"`
	ShuffleMode                      string                 `xml:"shuffleMode,attr,omitempty"`
	PlayStatusState                  string                 `xml:"playStatusState,attr,omitempty"`
	CurrentURI                       string                 `xml:"currentUri,attr,omitempty"`
	ReceivedPlaybackRequest          bool                   `xml:"receivedPlaybackRequest,attr,omitempty"`
	SubscriptionType                 string                 `xml:"subscriptionType,attr,omitempty"`
	CachedPlaybackRequest            *CachedPlaybackRequest `xml:"cachedPlaybackRequest,omitempty"`
	NowPlaying                       *IntrospectNowPlaying  `xml:"nowPlaying,omitempty"`
	ContentItemHistory               *ContentItemHistory    `xml:"contentItemHistory,omitempty"`
}

IntrospectResponse represents a generic introspect response The actual XML name will vary based on the source (e.g., spotifyAccountIntrospectResponse)

func (*IntrospectResponse) CollectsData added in v0.9.0

func (ir *IntrospectResponse) CollectsData() bool

CollectsData returns true if the service collects usage data

func (*IntrospectResponse) GetMaxHistorySize added in v0.9.0

func (ir *IntrospectResponse) GetMaxHistorySize() int

GetMaxHistorySize returns the maximum size of the content item history

func (*IntrospectResponse) GetShuffleMode added in v0.9.0

func (ir *IntrospectResponse) GetShuffleMode() ShuffleMode

GetShuffleMode returns the shuffle mode as a typed value

func (*IntrospectResponse) GetState added in v0.9.0

func (ir *IntrospectResponse) GetState() IntrospectState

GetState returns the introspect state as a typed value

func (*IntrospectResponse) GetTokenAge added in v0.9.0

func (ir *IntrospectResponse) GetTokenAge() int64

GetTokenAge returns the age of the token in seconds since last change

func (*IntrospectResponse) HasCurrentContent added in v0.9.0

func (ir *IntrospectResponse) HasCurrentContent() bool

HasCurrentContent returns true if there is current content playing

func (*IntrospectResponse) HasSubscription added in v0.9.0

func (ir *IntrospectResponse) HasSubscription() bool

HasSubscription returns true if the user has a subscription

func (*IntrospectResponse) HasUser added in v0.9.0

func (ir *IntrospectResponse) HasUser() bool

HasUser returns true if a user is associated with the service

func (*IntrospectResponse) IsActive added in v0.9.0

func (ir *IntrospectResponse) IsActive() bool

IsActive returns true if the service is in an active state

func (*IntrospectResponse) IsInactive added in v0.9.0

func (ir *IntrospectResponse) IsInactive() bool

IsInactive returns true if the service is in an inactive state

func (*IntrospectResponse) IsShuffleEnabled added in v0.9.0

func (ir *IntrospectResponse) IsShuffleEnabled() bool

IsShuffleEnabled returns true if shuffle mode is enabled

func (*IntrospectResponse) SupportsResume added in v0.9.0

func (ir *IntrospectResponse) SupportsResume() bool

SupportsResume returns true if the service supports resuming playback

func (*IntrospectResponse) SupportsSeek added in v0.9.0

func (ir *IntrospectResponse) SupportsSeek() bool

SupportsSeek returns true if the service supports seeking within tracks

func (*IntrospectResponse) SupportsSkipPrevious added in v0.9.0

func (ir *IntrospectResponse) SupportsSkipPrevious() bool

SupportsSkipPrevious returns true if the service supports skipping to previous track

type IntrospectState added in v0.9.0

type IntrospectState string

IntrospectState represents possible introspect states

const (
	// IntrospectStateInactiveUnselected indicates the service is inactive and unselected
	IntrospectStateInactiveUnselected IntrospectState = "InactiveUnselected"
	// IntrospectStateActive indicates the service is active
	IntrospectStateActive IntrospectState = "Active"
	// IntrospectStateInactive indicates the service is inactive
	IntrospectStateInactive IntrospectState = "Inactive"
)

type Key

type Key struct {
	XMLName xml.Name `xml:"key"`
	State   string   `xml:"state,attr"`
	Sender  string   `xml:"sender,attr"`
	Value   string   `xml:",chardata"`
}

Key represents a key press command for the /key endpoint

func NewKey

func NewKey(keyValue string) *Key

NewKey creates a new key press command Note: For proper key simulation, use client.SendKey() which sends both press and release

func NewKeyPress

func NewKeyPress(keyValue string) *Key

NewKeyPress creates a new key press command (alias for NewKey) Note: This creates only the press state. For complete key simulation, use client.SendKey()

func NewKeyRelease

func NewKeyRelease(keyValue string) *Key

NewKeyRelease creates a new key release command Note: This creates only the release state. For complete key simulation, use client.SendKey()

type Language

type Language struct {
	XMLName xml.Name `xml:"language"`
	Value   string   `xml:",chardata"`
}

Language represents language settings

type LanguageUpdatedEvent

type LanguageUpdatedEvent struct {
	XMLName  xml.Name `xml:"languageUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Language Language `xml:"language"`
}

LanguageUpdatedEvent represents a language setting update event

type Link struct {
	Href              string      `json:"href" xml:"href,attr"`
	UseInternalClient string      `json:"useInternalClient,omitempty" xml:"useInternalClient,attr,omitempty"`
	ContainerArt      string      `json:"containerArt,omitempty" xml:"-"`
	Filters           interface{} `json:"filters,omitempty" xml:"-"`
	Name              string      `json:"name,omitempty" xml:"-"`
	Templated         *bool       `json:"templated,omitempty" xml:"-"`
	Type              string      `json:"type,omitempty" xml:"-"`
}

Link represents a navigational link with URL and client usage preferences.

type Links struct {
	BmxLogout               *Link `json:"bmx_logout,omitempty" xml:"bmx_logout,omitempty"`
	BmxNavigate             *Link `json:"bmx_navigate,omitempty" xml:"bmx_navigate,omitempty"`
	BmxServicesAvailability *Link `json:"bmx_services_availability,omitempty" xml:"bmx_services_availability,omitempty"`
	BmxToken                *Link `json:"bmx_token,omitempty" xml:"bmx_token,omitempty"`
	Self                    *Link `json:"self,omitempty" xml:"self,omitempty"`
	BmxAvailability         *Link `json:"bmx_availability,omitempty" xml:"bmx_availability,omitempty"`
	BmxReporting            *Link `json:"bmx_reporting,omitempty" xml:"bmx_reporting,omitempty"`
	BmxFavorite             *Link `json:"bmx_favorite,omitempty" xml:"bmx_favorite,omitempty"`
	BmxNowPlaying           *Link `json:"bmx_nowplaying,omitempty" xml:"bmx_nowplaying,omitempty"`
	BmxTrack                *Link `json:"bmx_track,omitempty" xml:"bmx_track,omitempty"`
	BmxSearch               *Link `json:"bmx_search,omitempty" xml:"-"`
	BmxPlayback             *Link `json:"bmx_playback,omitempty" xml:"-"`
	BmxPreset               *Link `json:"bmx_preset,omitempty" xml:"-"`
}

Links contains various navigation links used by BMX services.

type LocalTime added in v0.7.0

type LocalTime struct {
	XMLName    xml.Name `xml:"localTime"`
	Year       int      `xml:"year,attr"`
	Month      int      `xml:"month,attr"`
	DayOfMonth int      `xml:"dayOfMonth,attr"`
	DayOfWeek  int      `xml:"dayOfWeek,attr"`
	Hour       int      `xml:"hour,attr"`
	Minute     int      `xml:"minute,attr"`
	Second     int      `xml:"second,attr"`
}

LocalTime represents the local time component of ClockTime

type MargeAPI added in v0.56.0

type MargeAPI struct {
	Type string `xml:"type,attr"`
	XML  string `xml:"xml"`
	JSON string `xml:"json"`
}

MargeAPI represents a single API entry in MargeAPIVersionsResponse.

type MargeAPIVersionsResponse added in v0.56.0

type MargeAPIVersionsResponse struct {
	XMLName      xml.Name   `xml:"marge"`
	Version      string     `xml:"version,attr"`
	Project      string     `xml:"project,attr"`
	Apis         []MargeAPI `xml:"apis>api"`
	Dependencies string     `xml:"dependencies"`
}

MargeAPIVersionsResponse represents the XML response for Marge API versions.

type MargeAccountCreateRequest added in v0.53.0

type MargeAccountCreateRequest struct {
	XMLName           xml.Name `xml:"account"`
	ID                string   `xml:"id,attr,omitempty"` // Optional ID for testing/overrides
	FirstName         string   `xml:"firstName"`
	LastName          string   `xml:"lastName"`
	Email             string   `xml:"email"`
	Password          string   `xml:"password"`
	CountryCode       string   `xml:"countryCode"`
	PreferredLanguage string   `xml:"preferredLanguage"`
}

MargeAccountCreateRequest represents an account creation request from Stockholm.

type MargeAccountDevice added in v0.56.0

type MargeAccountDevice struct {
	DeviceID        string           `json:"device_id" xml:"deviceid,attr"`
	AttachedProduct *AttachedProduct `json:"attached_product" xml:"attachedProduct"`
	CreatedOn       string           `json:"created_on" xml:"createdOn"`
	IPAddress       string           `json:"ip_address" xml:"ipaddress"`
	Name            string           `json:"name" xml:"name"`
	UpdatedOn       string           `json:"updated_on" xml:"updatedOn"`
}

MargeAccountDevice represents a device specifically for the /devices response. It matches the structure in 06_orig.xml, which is a subset of AccountDevice.

type MargeAddSourceResponse added in v0.54.0

type MargeAddSourceResponse struct {
	XMLName          xml.Name `xml:"source"`
	SourceID         string   `xml:"sourceID"`
	SourceProviderID string   `xml:"sourceProviderID"`
	CreatedOn        string   `xml:"createdOn"`
	UpdatedOn        string   `xml:"updatedOn"`
}

MargeAddSourceResponse represents the response after adding a source to Marge.

type MargeLoginRequest added in v0.53.0

type MargeLoginRequest struct {
	XMLName  xml.Name `xml:"login"`
	Username string   `xml:"username"`
	Password string   `xml:"password"`
}

MargeLoginRequest represents a login request from Stockholm.

type MediaItemContainer added in v0.7.0

type MediaItemContainer struct {
	XMLName     xml.Name     `xml:"mediaItemContainer"`
	Offset      int          `xml:"offset,attr"`
	ContentItem *ContentItem `xml:"ContentItem,omitempty"`
}

MediaItemContainer represents a media container within a navigate item

type Member

type Member struct {
	XMLName  xml.Name `xml:"member"`
	DeviceID string   `xml:",chardata"`
	IP       string   `xml:"ipaddress,attr"`
}

Member represents a device member in a multiroom zone

type MemberEntry

type MemberEntry struct {
	XMLName  xml.Name `xml:"member"`
	DeviceID string   `xml:",chardata"`
	IP       string   `xml:"ipaddress,attr,omitempty"`
}

MemberEntry represents a member entry in zone configuration requests

type MusicServiceAccountResponse added in v0.9.0

type MusicServiceAccountResponse struct {
	XMLName xml.Name `xml:"status"`
	Status  string   `xml:",chardata"`
}

MusicServiceAccountResponse represents the response from account management operations

func (*MusicServiceAccountResponse) IsSuccess added in v0.9.0

func (resp *MusicServiceAccountResponse) IsSuccess() bool

IsSuccess returns true if the account operation was successful

type MusicServiceCredentials added in v0.9.0

type MusicServiceCredentials struct {
	XMLName     xml.Name `xml:"credentials"`
	Source      string   `xml:"source,attr"`
	DisplayName string   `xml:"displayName,attr,omitempty"`
	User        string   `xml:"user"`
	Pass        string   `xml:"pass"`
}

MusicServiceCredentials represents credentials for music service account operations

func NewAmazonMusicCredentials added in v0.9.0

func NewAmazonMusicCredentials(user, pass string) *MusicServiceCredentials

NewAmazonMusicCredentials creates credentials for Amazon Music service

func NewDeezerCredentials added in v0.9.0

func NewDeezerCredentials(user, pass string) *MusicServiceCredentials

NewDeezerCredentials creates credentials for Deezer service

func NewIHeartRadioCredentials added in v0.9.0

func NewIHeartRadioCredentials(user, pass string) *MusicServiceCredentials

NewIHeartRadioCredentials creates credentials for iHeartRadio service

func NewMusicServiceCredentials added in v0.9.0

func NewMusicServiceCredentials(source, displayName, user, pass string) *MusicServiceCredentials

NewMusicServiceCredentials creates new music service credentials

func NewPandoraCredentials added in v0.9.0

func NewPandoraCredentials(user, pass string) *MusicServiceCredentials

NewPandoraCredentials creates credentials for Pandora service

func NewSpotifyCredentials added in v0.9.0

func NewSpotifyCredentials(user, pass string) *MusicServiceCredentials

NewSpotifyCredentials creates credentials for Spotify service

func NewStoredMusicCredentials added in v0.9.0

func NewStoredMusicCredentials(user, displayName string) *MusicServiceCredentials

NewStoredMusicCredentials creates credentials for STORED_MUSIC (NAS/UPnP) service

func (*MusicServiceCredentials) GetDescription added in v0.9.0

func (cred *MusicServiceCredentials) GetDescription() string

GetDescription returns a human-readable description of the service

func (*MusicServiceCredentials) HasPassword added in v0.9.0

func (cred *MusicServiceCredentials) HasPassword() bool

HasPassword returns true if credentials include a password

func (*MusicServiceCredentials) IsForRemoval added in v0.9.0

func (cred *MusicServiceCredentials) IsForRemoval() bool

IsForRemoval returns true if these credentials are for removing an account (empty password)

func (*MusicServiceCredentials) Validate added in v0.9.0

func (cred *MusicServiceCredentials) Validate() error

Validate ensures the credentials have required fields

type Name

type Name struct {
	XMLName xml.Name `xml:"name"`
	Value   string   `xml:",chardata"`
}

Name represents the response from /name endpoint

func (*Name) GetName

func (n *Name) GetName() string

GetName returns the device name

func (*Name) IsEmpty

func (n *Name) IsEmpty() bool

IsEmpty returns true if the name is empty

func (*Name) String

func (n *Name) String() string

String returns the device name as a string

type NameUpdatedEvent

type NameUpdatedEvent struct {
	XMLName  xml.Name `xml:"nameUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Name     Name     `xml:"name"`
}

NameUpdatedEvent represents a device name update event

type NavigateItem struct {
	XMLName            xml.Name            `xml:"item"`
	Playable           int                 `xml:"Playable,attr,omitempty"`
	Name               string              `xml:"name"`
	Type               string              `xml:"type"`
	ContentItem        *ContentItem        `xml:"ContentItem,omitempty"`
	MediaItemContainer *MediaItemContainer `xml:"mediaItemContainer,omitempty"`
	ArtistName         string              `xml:"artistName,omitempty"`
	AlbumName          string              `xml:"albumName,omitempty"`
}

NavigateItem represents a single item in a navigate response

func (ni *NavigateItem) GetArtwork() string

GetArtwork returns the artwork URL if available

func (ni *NavigateItem) GetContentItem() *ContentItem

GetContentItem returns the ContentItem for this navigate item

func (ni *NavigateItem) GetDisplayName() string

GetDisplayName returns the display name for a navigate item

func (ni *NavigateItem) IsDirectory() bool

IsDirectory returns true if the navigate item is a directory/container

func (ni *NavigateItem) IsPlayable() bool

IsPlayable returns true if the navigate item can be played directly

func (ni *NavigateItem) IsStation() bool

IsStation returns true if the navigate item is a radio station

func (ni *NavigateItem) IsTrack() bool

IsTrack returns true if the navigate item is a track

type NavigateRequest struct {
	XMLName       xml.Name      `xml:"navigate"`
	Source        string        `xml:"source,attr"`
	SourceAccount string        `xml:"sourceAccount,attr,omitempty"`
	Menu          string        `xml:"menu,attr,omitempty"`
	Sort          string        `xml:"sort,attr,omitempty"`
	StartItem     int           `xml:"startItem"`
	NumItems      int           `xml:"numItems"`
	Item          *NavigateItem `xml:"item,omitempty"`
}

NavigateRequest represents a request to navigate content sources

func NewNavigateRequest added in v0.7.0

func NewNavigateRequest(source, sourceAccount string, startItem, numItems int) *NavigateRequest

NewNavigateRequest creates a new navigate request for browsing content

func NewNavigateRequestWithItem added in v0.7.0

func NewNavigateRequestWithItem(source, sourceAccount string, startItem, numItems int, item *ContentItem) *NavigateRequest

NewNavigateRequestWithItem creates a navigate request to browse a specific container item

func NewNavigateRequestWithMenu added in v0.7.0

func NewNavigateRequestWithMenu(source, sourceAccount, menu, sort string, startItem, numItems int) *NavigateRequest

NewNavigateRequestWithMenu creates a navigate request with menu and sort parameters

type NavigateResponse struct {
	XMLName       xml.Name       `xml:"navigateResponse"`
	Source        string         `xml:"source,attr"`
	SourceAccount string         `xml:"sourceAccount,attr,omitempty"`
	TotalItems    int            `xml:"totalItems"`
	Items         []NavigateItem `xml:"items>item"`
}

NavigateResponse represents the response from a navigate request

func (nr *NavigateResponse) GetDirectories() []NavigateItem

GetDirectories returns only the directory items from the navigate response

func (nr *NavigateResponse) GetPlayableItems() []NavigateItem

GetPlayableItems returns only the playable items from the navigate response

func (nr *NavigateResponse) GetStations() []NavigateItem

GetStations returns only the station items from the navigate response

func (nr *NavigateResponse) GetTracks() []NavigateItem

GetTracks returns only the track items from the navigate response

func (nr *NavigateResponse) IsEmpty() bool

IsEmpty returns true if the navigate response contains no items

type NetworkConfig

type NetworkConfig struct {
	HostedWifiConfig    *HostedWifiConfig `xml:"hostedWifiConfigWebPage,omitempty"`
	DualMode            bool              `xml:"dualMode,omitempty"`
	WSAPIProxy          bool              `xml:"wsapiproxy,omitempty"`
	AllInterfaceSupport *AllInterfaces    `xml:"allInterfacesSupported,omitempty"`
	WLANInterfaces      *WLANInterfaces   `xml:"wlanInterfaces,omitempty"`
	Security            *Security         `xml:"security,omitempty"`
}

NetworkConfig represents network configuration capabilities

type NetworkInfo

type NetworkInfo struct {
	Type       string `xml:"type,attr"`
	MacAddress string `xml:"macAddress"`
	IPAddress  string `xml:"ipAddress"`
}

NetworkInfo represents network information for the device

type NetworkInformation

type NetworkInformation struct {
	XMLName          xml.Name          `xml:"networkInfo"`
	WifiProfileCount int               `xml:"wifiProfileCount,attr,omitempty"`
	Interfaces       NetworkInterfaces `xml:"interfaces"`
}

NetworkInformation represents network information from the /networkInfo endpoint

func (*NetworkInformation) GetActiveInterfaces

func (n *NetworkInformation) GetActiveInterfaces() []NetworkInterface

GetActiveInterfaces returns only active/connected interfaces

func (*NetworkInformation) GetConnectedEthernetInterface

func (n *NetworkInformation) GetConnectedEthernetInterface() *NetworkInterface

GetConnectedEthernetInterface returns the connected Ethernet interface if available

func (*NetworkInformation) GetConnectedWiFiInterface

func (n *NetworkInformation) GetConnectedWiFiInterface() *NetworkInterface

GetConnectedWiFiInterface returns the connected WiFi interface if available

func (*NetworkInformation) GetInterfaceByType

func (n *NetworkInformation) GetInterfaceByType(interfaceType string) *NetworkInterface

GetInterfaceByType returns the first interface of the specified type

func (*NetworkInformation) GetInterfaces

func (n *NetworkInformation) GetInterfaces() []NetworkInterface

GetInterfaces returns all network interfaces

func (*NetworkInformation) GetWifiProfileCount

func (n *NetworkInformation) GetWifiProfileCount() int

GetWifiProfileCount returns the number of WiFi profiles

func (*NetworkInformation) HasEthernet

func (n *NetworkInformation) HasEthernet() bool

HasEthernet returns true if the device has Ethernet connectivity

func (*NetworkInformation) HasWiFi

func (n *NetworkInformation) HasWiFi() bool

HasWiFi returns true if the device has WiFi connectivity

func (*NetworkInformation) IsEmpty

func (n *NetworkInformation) IsEmpty() bool

IsEmpty returns true if there's no network information

type NetworkInterface

type NetworkInterface struct {
	XMLName      xml.Name `xml:"interface"`
	Type         string   `xml:"type,attr"`
	Name         string   `xml:"name,attr,omitempty"`
	MacAddress   string   `xml:"macAddress,attr,omitempty"`
	IPAddress    string   `xml:"ipAddress,attr,omitempty"`
	SSID         string   `xml:"ssid,attr,omitempty"`
	FrequencyKHz int      `xml:"frequencyKHz,attr,omitempty"`
	State        string   `xml:"state,attr,omitempty"`
	Signal       string   `xml:"signal,attr,omitempty"`
	Mode         string   `xml:"mode,attr,omitempty"`
}

NetworkInterface represents a single network interface

func (*NetworkInterface) FormatFrequency

func (ni *NetworkInterface) FormatFrequency() string

FormatFrequency returns a formatted frequency string

func (*NetworkInterface) GetFrequencyBand

func (ni *NetworkInterface) GetFrequencyBand() string

GetFrequencyBand returns the WiFi frequency band (2.4GHz or 5GHz)

func (*NetworkInterface) GetFrequencyGHz

func (ni *NetworkInterface) GetFrequencyGHz() float64

GetFrequencyGHz returns the WiFi frequency in GHz

func (*NetworkInterface) GetFrequencyKHz

func (ni *NetworkInterface) GetFrequencyKHz() int

GetFrequencyKHz returns the WiFi frequency in kHz

func (*NetworkInterface) GetIPAddress

func (ni *NetworkInterface) GetIPAddress() string

GetIPAddress returns the IP address

func (*NetworkInterface) GetMacAddress

func (ni *NetworkInterface) GetMacAddress() string

GetMacAddress returns the MAC address

func (*NetworkInterface) GetMode

func (ni *NetworkInterface) GetMode() string

GetMode returns the WiFi mode

func (*NetworkInterface) GetModeDescription

func (ni *NetworkInterface) GetModeDescription() string

GetModeDescription returns a user-friendly mode description

func (*NetworkInterface) GetName

func (ni *NetworkInterface) GetName() string

GetName returns the interface name

func (*NetworkInterface) GetNetworkSummary

func (ni *NetworkInterface) GetNetworkSummary() string

GetNetworkSummary returns a summary string of the network interface

func (*NetworkInterface) GetSSID

func (ni *NetworkInterface) GetSSID() string

GetSSID returns the WiFi SSID (only for WiFi interfaces)

func (*NetworkInterface) GetSignal

func (ni *NetworkInterface) GetSignal() string

GetSignal returns the signal strength

func (*NetworkInterface) GetSignalDescription

func (ni *NetworkInterface) GetSignalDescription() string

GetSignalDescription returns a user-friendly signal description

func (*NetworkInterface) GetSignalQuality

func (ni *NetworkInterface) GetSignalQuality() int

GetSignalQuality returns a normalized signal quality percentage (0-100)

func (*NetworkInterface) GetState

func (ni *NetworkInterface) GetState() string

GetState returns the interface state

func (*NetworkInterface) GetStateDescription

func (ni *NetworkInterface) GetStateDescription() string

GetStateDescription returns a user-friendly state description

func (*NetworkInterface) GetType

func (ni *NetworkInterface) GetType() string

GetType returns the interface type

func (*NetworkInterface) HasWiFiInfo

func (ni *NetworkInterface) HasWiFiInfo() bool

HasWiFiInfo returns true if the interface has WiFi-specific information

func (*NetworkInterface) IsConnected

func (ni *NetworkInterface) IsConnected() bool

IsConnected returns true if the interface is connected

func (*NetworkInterface) IsDisconnected

func (ni *NetworkInterface) IsDisconnected() bool

IsDisconnected returns true if the interface is disconnected

func (*NetworkInterface) IsEthernet

func (ni *NetworkInterface) IsEthernet() bool

IsEthernet returns true if this is an Ethernet interface

func (*NetworkInterface) IsWiFi

func (ni *NetworkInterface) IsWiFi() bool

IsWiFi returns true if this is a WiFi interface

func (*NetworkInterface) String

func (ni *NetworkInterface) String() string

String returns a string representation of the network interface

func (*NetworkInterface) ValidateIP

func (ni *NetworkInterface) ValidateIP() bool

ValidateIP returns true if the IP address is valid

func (*NetworkInterface) ValidateMAC

func (ni *NetworkInterface) ValidateMAC() bool

ValidateMAC returns true if the MAC address is valid

type NetworkInterfaces

type NetworkInterfaces struct {
	XMLName    xml.Name           `xml:"interfaces"`
	Interfaces []NetworkInterface `xml:"interface"`
}

NetworkInterfaces represents the interfaces container

type NowPlaying

type NowPlaying struct {
	XMLName             xml.Name             `xml:"nowPlaying"`
	DeviceID            string               `xml:"deviceID,attr"`
	Source              string               `xml:"source,attr"`
	SourceAccount       string               `xml:"sourceAccount,attr,omitempty"`
	ContentItem         *ContentItem         `xml:"ContentItem,omitempty"`
	Track               string               `xml:"track,omitempty"`
	Artist              string               `xml:"artist,omitempty"`
	Album               string               `xml:"album,omitempty"`
	StationName         string               `xml:"stationName,omitempty"`
	Art                 *Art                 `xml:"art,omitempty"`
	Time                *Time                `xml:"time,omitempty"`
	SkipEnabled         *SkipEnabled         `xml:"skipEnabled,omitempty"`
	FavoriteEnabled     *FavoriteEnabled     `xml:"favoriteEnabled,omitempty"`
	PlayStatus          PlayStatus           `xml:"playStatus,omitempty"`
	ShuffleSetting      ShuffleSetting       `xml:"shuffleSetting,omitempty"`
	RepeatSetting       RepeatSetting        `xml:"repeatSetting,omitempty"`
	SkipPreviousEnabled *SkipPreviousEnabled `xml:"skipPreviousEnabled,omitempty"`
	SeekSupported       *SeekSupported       `xml:"seekSupported,omitempty"`
	StreamType          string               `xml:"streamType,omitempty"`
	TrackID             string               `xml:"trackID,omitempty"`
	Position            *Position            `xml:"position,omitempty"`
	Description         string               `xml:"description,omitempty"`
	StationLocation     string               `xml:"stationLocation,omitempty"`
}

NowPlaying represents the current playback information from /now_playing endpoint

func (*NowPlaying) CanFavorite

func (np *NowPlaying) CanFavorite() bool

CanFavorite returns true if favorite functionality is available

func (*NowPlaying) CanSkip

func (np *NowPlaying) CanSkip() bool

CanSkip returns true if skip functionality is available

func (*NowPlaying) CanSkipPrevious

func (np *NowPlaying) CanSkipPrevious() bool

CanSkipPrevious returns true if skip previous functionality is available

func (*NowPlaying) FormatDuration

func (np *NowPlaying) FormatDuration() string

FormatDuration returns a formatted duration string (MM:SS) including total time

func (*NowPlaying) FormatPosition

func (np *NowPlaying) FormatPosition() string

FormatPosition returns a formatted position string (MM:SS)

func (*NowPlaying) GetArtworkURL

func (np *NowPlaying) GetArtworkURL() string

GetArtworkURL returns the artwork URL if available

func (*NowPlaying) GetDisplayArtist

func (np *NowPlaying) GetDisplayArtist() string

GetDisplayArtist returns the best available artist for display

func (*NowPlaying) GetDisplayTitle

func (np *NowPlaying) GetDisplayTitle() string

GetDisplayTitle returns the best available title for display

func (*NowPlaying) GetPositionDuration

func (np *NowPlaying) GetPositionDuration() time.Duration

GetPositionDuration returns position as a time.Duration

func (*NowPlaying) GetTotalDuration

func (np *NowPlaying) GetTotalDuration() time.Duration

GetTotalDuration returns total duration as a time.Duration

func (*NowPlaying) HasTimeInfo

func (np *NowPlaying) HasTimeInfo() bool

HasTimeInfo returns true if time/duration information is available

func (*NowPlaying) HasTrackInfo

func (np *NowPlaying) HasTrackInfo() bool

HasTrackInfo returns true if the playing content has track metadata

func (*NowPlaying) IsEmpty

func (np *NowPlaying) IsEmpty() bool

IsEmpty returns true if no content is currently playing

func (*NowPlaying) IsRadio

func (np *NowPlaying) IsRadio() bool

IsRadio returns true if the current source appears to be radio/streaming

func (*NowPlaying) IsSeekSupported

func (np *NowPlaying) IsSeekSupported() bool

IsSeekSupported returns true if seeking is supported

type NowPlayingUpdatedEvent

type NowPlayingUpdatedEvent struct {
	XMLName    xml.Name   `xml:"nowPlayingUpdated"`
	DeviceID   string     `xml:"deviceID,attr"`
	NowPlaying NowPlaying `xml:"nowPlaying"`
}

NowPlayingUpdatedEvent represents a now playing update event

type OAuthCredentials added in v0.57.0

type OAuthCredentials struct {
	XMLName     xml.Name `xml:"OAuthCredentials"`
	Source      string   `xml:"source,attr"`
	DisplayName string   `xml:"displayName,attr,omitempty"`
	User        string   `xml:"user"`
	Code        string   `xml:"code"`
	Version     string   `xml:"version"`
}

OAuthCredentials represents the credentials sent to /setMusicServiceOAuthAccount

func NewSpotifyOAuthCredentials added in v0.57.0

func NewSpotifyOAuthCredentials(user, code, displayName string) *OAuthCredentials

NewSpotifyOAuthCredentials creates OAuth credentials for Spotify

type PairDeviceWithAccount added in v0.53.0

type PairDeviceWithAccount struct {
	XMLName       xml.Name `xml:"PairDeviceWithAccount"`
	AccountID     string   `xml:"accountId"`
	UserAuthToken string   `xml:"userAuthToken"`
}

PairDeviceWithAccount represents a device pairing request message

type PlayInfo added in v0.8.0

type PlayInfo struct {
	XMLName xml.Name `xml:"play_info"`
	URL     string   `xml:"url"`
	AppKey  string   `xml:"app_key"`
	Service string   `xml:"service"`
	Message string   `xml:"message"`
	Reason  string   `xml:"reason"`
	Volume  *int     `xml:"volume,omitempty"`
}

PlayInfo represents the request body for the /speaker endpoint to play TTS or URL content

func NewPlayInfo added in v0.8.0

func NewPlayInfo(url, appKey, service, message, reason string) *PlayInfo

NewPlayInfo creates a new PlayInfo instance for TTS or URL playback

func NewTTSPlayInfo added in v0.8.0

func NewTTSPlayInfo(text, appKey, language string, volume ...int) *PlayInfo

NewTTSPlayInfo creates a PlayInfo for Google TTS playback

func NewURLPlayInfo added in v0.8.0

func NewURLPlayInfo(url, appKey, service, message, reason string, volume ...int) *PlayInfo

NewURLPlayInfo creates a PlayInfo for URL content playback

func (*PlayInfo) SetVolume added in v0.8.0

func (p *PlayInfo) SetVolume(volume int) *PlayInfo

SetVolume sets the volume level for playback

func (*PlayInfo) String added in v0.8.0

func (p *PlayInfo) String() string

String returns a string representation of the PlayInfo

func (*PlayInfo) Validate added in v0.8.0

func (p *PlayInfo) Validate() error

Validate validates the PlayInfo request

type PlayStatus

type PlayStatus string

PlayStatus represents the current playback state

const (
	// PlayStatusPlaying indicates the device is currently playing content
	PlayStatusPlaying PlayStatus = "PLAY_STATE"
	// PlayStatusPaused indicates the device is paused
	PlayStatusPaused PlayStatus = "PAUSE_STATE"
	// PlayStatusStopped indicates the device is stopped
	PlayStatusStopped PlayStatus = "STOP_STATE"
	// PlayStatusBuffering indicates the device is buffering content
	PlayStatusBuffering PlayStatus = "BUFFERING_STATE"
	// PlayStatusInvalidPlay indicates an invalid play state
	PlayStatusInvalidPlay PlayStatus = "INVALID_PLAY_STATE"
	// PlayStatusStandby indicates the device is in standby mode
	PlayStatusStandby PlayStatus = "STANDBY"
)

func (PlayStatus) IsPaused

func (ps PlayStatus) IsPaused() bool

IsPaused returns true if the device is paused

func (PlayStatus) IsPlaying

func (ps PlayStatus) IsPlaying() bool

IsPlaying returns true if the device is currently playing

func (PlayStatus) IsStopped

func (ps PlayStatus) IsStopped() bool

IsStopped returns true if the device is stopped

func (PlayStatus) String

func (ps PlayStatus) String() string

String returns a human-readable string representation

func (*PlayStatus) UnmarshalXML

func (ps *PlayStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling with validation

type Position

type Position struct {
	Position int `xml:",chardata"` // Position in seconds
}

Position represents playback position information (legacy field)

type Preset

type Preset struct {
	XMLName     xml.Name     `xml:"preset"`
	ID          int          `xml:"id,attr"`
	CreatedOn   *int64       `xml:"createdOn,attr,omitempty"`
	UpdatedOn   *int64       `xml:"updatedOn,attr,omitempty"`
	ContentItem *ContentItem `xml:"ContentItem,omitempty"`
}

Preset represents an individual preset Presets are read-only via the API and can only be created/modified through the SoundTouch app or physical device controls.

func (*Preset) GetArtworkURL

func (p *Preset) GetArtworkURL() string

GetArtworkURL returns the artwork URL if available

func (*Preset) GetContentType

func (p *Preset) GetContentType() string

GetContentType returns the content type of the preset

func (*Preset) GetCreatedTime

func (p *Preset) GetCreatedTime() time.Time

GetCreatedTime returns the creation time as a time.Time

func (*Preset) GetDisplayName

func (p *Preset) GetDisplayName() string

GetDisplayName returns the best available display name for the preset

func (*Preset) GetLocation

func (p *Preset) GetLocation() string

GetLocation returns the content location/URL

func (*Preset) GetSource

func (p *Preset) GetSource() string

GetSource returns the source of the preset content

func (*Preset) GetSourceAccount

func (p *Preset) GetSourceAccount() string

GetSourceAccount returns the source account of the preset content

func (*Preset) GetUpdatedTime

func (p *Preset) GetUpdatedTime() time.Time

GetUpdatedTime returns the last updated time as a time.Time

func (*Preset) HasTimestamps

func (p *Preset) HasTimestamps() bool

HasTimestamps returns true if the preset has creation/update timestamps

func (*Preset) IsEmpty

func (p *Preset) IsEmpty() bool

IsEmpty returns true if the preset has no content

func (*Preset) IsPresetable

func (p *Preset) IsPresetable() bool

IsPresetable returns true if the content can be saved as a preset

func (*Preset) IsSpotifyPreset

func (p *Preset) IsSpotifyPreset() bool

IsSpotifyPreset returns true if this is a Spotify preset

type PresetUpdatedEvent

type PresetUpdatedEvent struct {
	XMLName  xml.Name `xml:"presetsUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Presets  Presets  `xml:"presets"`
}

PresetUpdatedEvent represents a preset update event

type Presets

type Presets struct {
	XMLName xml.Name `xml:"presets"`
	Preset  []Preset `xml:"preset"`
}

Presets represents the response from /presets endpoint Note: POST /presets is officially not supported by the SoundTouch API. Presets can only be read, not created or modified via the API.

func (*Presets) GetEmptyPresetSlots

func (ps *Presets) GetEmptyPresetSlots() []int

GetEmptyPresetSlots returns preset IDs that are empty (1-6)

func (*Presets) GetMostRecentPreset

func (ps *Presets) GetMostRecentPreset() *Preset

GetMostRecentPreset returns the most recently updated preset

func (*Presets) GetOldestPreset

func (ps *Presets) GetOldestPreset() *Preset

GetOldestPreset returns the oldest preset

func (*Presets) GetPresetByID

func (ps *Presets) GetPresetByID(id int) *Preset

GetPresetByID returns a preset by its ID

func (*Presets) GetPresetCount

func (ps *Presets) GetPresetCount() int

GetPresetCount returns the total number of presets

func (*Presets) GetPresetsBySource

func (ps *Presets) GetPresetsBySource(source string) []Preset

GetPresetsBySource returns presets filtered by source

func (*Presets) GetPresetsSummary

func (ps *Presets) GetPresetsSummary() map[string]int

GetPresetsSummary returns a summary of preset usage

func (*Presets) GetSpotifyPresets

func (ps *Presets) GetSpotifyPresets() []Preset

GetSpotifyPresets returns all Spotify presets

func (*Presets) GetUsedPresetSlots

func (ps *Presets) GetUsedPresetSlots() []int

GetUsedPresetSlots returns preset IDs that have content

func (*Presets) HasPresets

func (ps *Presets) HasPresets() bool

HasPresets returns true if there are any presets configured

type ProviderSetting added in v0.45.0

type ProviderSetting struct {
	BoseID       string `json:"bose_id" xml:"boseId"`
	KeyName      string `json:"key_name" xml:"keyName"`
	Value        string `json:"value" xml:"value"`
	ProviderID   string `json:"provider_id" xml:"providerId"`
	ProviderName string `json:"provider_name,omitempty" xml:"-"`
}

ProviderSetting represents a single provider setting.

type RearSurroundControlValue added in v0.6.0

type RearSurroundControlValue struct {
	XMLName xml.Name `xml:"rearSurroundSpeakersLevel"`
	Value   int      `xml:"value,attr"`
}

RearSurroundControlValue represents a rear-surround speakers level control value for requests

func NewRearSurroundLevelValue added in v0.6.0

func NewRearSurroundLevelValue(value int) *RearSurroundControlValue

NewRearSurroundLevelValue creates a new level control value for rear-surround speakers

type RearSurroundLevelSetting added in v0.6.0

type RearSurroundLevelSetting struct {
	XMLName  xml.Name `xml:"rearSurroundSpeakersLevel"`
	Value    int      `xml:"value,attr"`
	MinValue int      `xml:"minValue,attr"`
	MaxValue int      `xml:"maxValue,attr"`
	Step     int      `xml:"step,attr"`
}

RearSurroundLevelSetting represents a rear-surround speakers level control setting with constraints

func (*RearSurroundLevelSetting) ClampLevel added in v0.6.0

func (rs *RearSurroundLevelSetting) ClampLevel(value int) int

ClampLevel clamps a rear-surround speaker level value to the valid range

func (*RearSurroundLevelSetting) ValidateLevel added in v0.6.0

func (rs *RearSurroundLevelSetting) ValidateLevel(value int) error

ValidateLevel validates the rear-surround speaker level value within constraints

type RecentItem

type RecentItem struct {
	XMLName     xml.Name    `xml:"recent"`
	DeviceID    string      `xml:"deviceID,attr"`
	CreatedOn   int64       `xml:"createdOn,attr"`
	ID          string      `xml:"id,attr"`
	ContentItem ContentItem `xml:"ContentItem"`
}

RecentItem represents a recently played item

type RecentItemParity added in v0.54.0

type RecentItemParity struct {
	XMLName         xml.Name                `xml:"recent"`
	ID              string                  `xml:"id,attr"`
	ContentItemType string                  `xml:"contentItemType"`
	CreatedOn       string                  `xml:"createdOn"`
	LastPlayedAt    string                  `xml:"lastplayedat"`
	Location        string                  `xml:"location"`
	Name            string                  `xml:"name"`
	Source          *RecentItemParitySource `xml:"source,omitempty"`
	SourceID        string                  `xml:"sourceid"`
	UpdatedOn       string                  `xml:"updatedOn"`
}

RecentItemParity represents recently played media content for web API responses (flat format).

type RecentItemParityCredential added in v0.54.0

type RecentItemParityCredential struct {
	Type  string `xml:"type,attr"`
	Value string `xml:",chardata"`
}

RecentItemParityCredential represents the credential in a RecentItemParitySource.

type RecentItemParitySource added in v0.54.0

type RecentItemParitySource struct {
	ID               string                      `xml:"id,attr"`
	Type             string                      `xml:"type,attr"`
	CreatedOn        string                      `xml:"createdOn"`
	Credential       *RecentItemParityCredential `xml:"credential"`
	Name             string                      `xml:"name"`
	SourceProviderID string                      `xml:"sourceproviderid"`
	SourceName       string                      `xml:"sourcename"`
	SourceSettings   string                      `xml:"sourceSettings"`
	UpdatedOn        string                      `xml:"updatedOn"`
	Username         string                      `xml:"username"`
}

RecentItemParitySource represents the source in a RecentItemParity.

type Recents

type Recents struct {
	XMLName xml.Name     `xml:"recents"`
	Items   []RecentItem `xml:"recent"`
}

Recents represents recently played items

type RecentsResponse added in v0.9.0

type RecentsResponse struct {
	XMLName xml.Name              `xml:"recents"`
	Items   []RecentsResponseItem `xml:"recent"`
}

RecentsResponse represents the response from the /recents endpoint

func (*RecentsResponse) GetItemCount added in v0.9.0

func (r *RecentsResponse) GetItemCount() int

GetItemCount returns the number of recent items

func (*RecentsResponse) GetItemsBySource added in v0.9.0

func (r *RecentsResponse) GetItemsBySource(source string) []RecentsResponseItem

GetItemsBySource returns recent items filtered by source type

func (*RecentsResponse) GetItemsByType added in v0.9.0

func (r *RecentsResponse) GetItemsByType(contentType string) []RecentsResponseItem

GetItemsByType returns recent items filtered by content type

func (*RecentsResponse) GetLocalMusicItems added in v0.9.0

func (r *RecentsResponse) GetLocalMusicItems() []RecentsResponseItem

GetLocalMusicItems returns only local music recent items

func (*RecentsResponse) GetMostRecent added in v0.9.0

func (r *RecentsResponse) GetMostRecent() *RecentsResponseItem

GetMostRecent returns the most recently played item (first in the list)

func (*RecentsResponse) GetPandoraItems added in v0.9.0

func (r *RecentsResponse) GetPandoraItems() []RecentsResponseItem

GetPandoraItems returns only Pandora recent items

func (*RecentsResponse) GetPlaylistsAndAlbums added in v0.9.0

func (r *RecentsResponse) GetPlaylistsAndAlbums() []RecentsResponseItem

GetPlaylistsAndAlbums returns playlist and album-type recent items

func (*RecentsResponse) GetPresetableItems added in v0.9.0

func (r *RecentsResponse) GetPresetableItems() []RecentsResponseItem

GetPresetableItems returns recent items that can be saved as presets

func (*RecentsResponse) GetSpotifyItems added in v0.9.0

func (r *RecentsResponse) GetSpotifyItems() []RecentsResponseItem

GetSpotifyItems returns only Spotify recent items

func (*RecentsResponse) GetStations added in v0.9.0

func (r *RecentsResponse) GetStations() []RecentsResponseItem

GetStations returns only station-type recent items

func (*RecentsResponse) GetStoredMusicItems added in v0.9.0

func (r *RecentsResponse) GetStoredMusicItems() []RecentsResponseItem

GetStoredMusicItems returns only stored music recent items

func (*RecentsResponse) GetTracks added in v0.9.0

func (r *RecentsResponse) GetTracks() []RecentsResponseItem

GetTracks returns only track-type recent items

func (*RecentsResponse) GetTuneInItems added in v0.9.0

func (r *RecentsResponse) GetTuneInItems() []RecentsResponseItem

GetTuneInItems returns only TuneIn radio recent items

func (*RecentsResponse) IsEmpty added in v0.9.0

func (r *RecentsResponse) IsEmpty() bool

IsEmpty returns true if there are no recent items

type RecentsResponseItem added in v0.9.0

type RecentsResponseItem struct {
	XMLName     xml.Name     `xml:"recent"`
	DeviceID    string       `xml:"deviceID,attr"`
	UTCTime     int64        `xml:"utcTime,attr"`
	ID          string       `xml:"id,attr,omitempty"`
	ContentItem *ContentItem `xml:"contentItem"`
}

RecentsResponseItem represents a recently played item from the /recents API endpoint

func (*RecentsResponseItem) GetArtwork added in v0.9.0

func (ri *RecentsResponseItem) GetArtwork() string

GetArtwork returns the artwork URL if available

func (*RecentsResponseItem) GetContentType added in v0.9.0

func (ri *RecentsResponseItem) GetContentType() string

GetContentType returns the content type

func (*RecentsResponseItem) GetDisplayName added in v0.9.0

func (ri *RecentsResponseItem) GetDisplayName() string

GetDisplayName returns the display name for the recent item

func (*RecentsResponseItem) GetID added in v0.9.0

func (ri *RecentsResponseItem) GetID() string

GetID returns the recent item ID

func (*RecentsResponseItem) GetLocation added in v0.9.0

func (ri *RecentsResponseItem) GetLocation() string

GetLocation returns the content location

func (*RecentsResponseItem) GetSource added in v0.9.0

func (ri *RecentsResponseItem) GetSource() string

GetSource returns the content source

func (*RecentsResponseItem) GetSourceAccount added in v0.9.0

func (ri *RecentsResponseItem) GetSourceAccount() string

GetSourceAccount returns the source account

func (*RecentsResponseItem) GetUTCTime added in v0.9.0

func (ri *RecentsResponseItem) GetUTCTime() int64

GetUTCTime returns the UTC timestamp when the item was played

func (*RecentsResponseItem) HasArtwork added in v0.9.0

func (ri *RecentsResponseItem) HasArtwork() bool

HasArtwork returns true if artwork is available

func (*RecentsResponseItem) HasContent added in v0.9.0

func (ri *RecentsResponseItem) HasContent() bool

HasContent returns true if the recent item has content information

func (*RecentsResponseItem) HasID added in v0.9.0

func (ri *RecentsResponseItem) HasID() bool

HasID returns true if the recent item has an ID

func (*RecentsResponseItem) IsAlbum added in v0.9.0

func (ri *RecentsResponseItem) IsAlbum() bool

IsAlbum returns true if the recent item is an album

func (*RecentsResponseItem) IsContainer added in v0.9.0

func (ri *RecentsResponseItem) IsContainer() bool

IsContainer returns true if the recent item is a container (folder/collection)

func (*RecentsResponseItem) IsLocalContent added in v0.9.0

func (ri *RecentsResponseItem) IsLocalContent() bool

IsLocalContent returns true if the recent item is from local sources

func (*RecentsResponseItem) IsPlaylist added in v0.9.0

func (ri *RecentsResponseItem) IsPlaylist() bool

IsPlaylist returns true if the recent item is a playlist

func (*RecentsResponseItem) IsPresetable added in v0.9.0

func (ri *RecentsResponseItem) IsPresetable() bool

IsPresetable returns true if the item can be saved as a preset

func (*RecentsResponseItem) IsSpotifyContent added in v0.9.0

func (ri *RecentsResponseItem) IsSpotifyContent() bool

IsSpotifyContent returns true if the recent item is from Spotify

func (*RecentsResponseItem) IsStation added in v0.9.0

func (ri *RecentsResponseItem) IsStation() bool

IsStation returns true if the recent item is a radio station

func (*RecentsResponseItem) IsStreamingContent added in v0.9.0

func (ri *RecentsResponseItem) IsStreamingContent() bool

IsStreamingContent returns true if the recent item is from streaming services

func (*RecentsResponseItem) IsTrack added in v0.9.0

func (ri *RecentsResponseItem) IsTrack() bool

IsTrack returns true if the recent item is a track

type RecentsUpdatedEvent

type RecentsUpdatedEvent struct {
	XMLName  xml.Name `xml:"recentsUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Recents  Recents  `xml:"recents"`
}

RecentsUpdatedEvent represents a recent items update event

type RemoveStationRequest added in v0.7.0

type RemoveStationRequest = ContentItem

RemoveStationRequest represents a request to remove a station Note: For removeStation, we send the ContentItem directly, not wrapped

func NewRemoveStationRequest added in v0.7.0

func NewRemoveStationRequest(contentItem *ContentItem) *RemoveStationRequest

NewRemoveStationRequest creates a new remove station request

type RepeatSetting

type RepeatSetting string

RepeatSetting represents repeat mode state

const (
	// RepeatOff indicates no repeat mode
	RepeatOff RepeatSetting = "REPEAT_OFF"
	// RepeatOne indicates repeat current track
	RepeatOne RepeatSetting = "REPEAT_ONE"
	// RepeatAll indicates repeat all tracks
	RepeatAll RepeatSetting = "REPEAT_ALL"
)

func (RepeatSetting) IsEnabled

func (rs RepeatSetting) IsEnabled() bool

IsEnabled returns true if any repeat mode is enabled

func (RepeatSetting) String

func (rs RepeatSetting) String() string

String returns a human-readable string representation

func (*RepeatSetting) UnmarshalXML

func (rs *RepeatSetting) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling

type SearchResult added in v0.7.0

type SearchResult struct {
	XMLName       xml.Name `xml:"searchResult"`
	Source        string   `xml:"source,attr"`
	SourceAccount string   `xml:"sourceAccount,attr,omitempty"`
	Token         string   `xml:"token,attr"`
	Name          string   `xml:"name"`
	Artist        string   `xml:"artist,omitempty"`
	Album         string   `xml:"album,omitempty"`
	Description   string   `xml:"description,omitempty"`
}

SearchResult represents a single search result (song, artist, or station)

func (*SearchResult) GetArtworkURL added in v0.7.0

func (sr *SearchResult) GetArtworkURL() string

GetArtworkURL returns the logo/artwork URL if available

func (*SearchResult) GetDisplayName added in v0.7.0

func (sr *SearchResult) GetDisplayName() string

GetDisplayName returns the display name for a search result

func (*SearchResult) GetFullTitle added in v0.7.0

func (sr *SearchResult) GetFullTitle() string

GetFullTitle returns a full title with artist if available

func (*SearchResult) IsArtist added in v0.7.0

func (sr *SearchResult) IsArtist() bool

IsArtist returns true if this is an artist result

func (*SearchResult) IsSong added in v0.7.0

func (sr *SearchResult) IsSong() bool

IsSong returns true if this is a song result

func (*SearchResult) IsStation added in v0.7.0

func (sr *SearchResult) IsStation() bool

IsStation returns true if this is a station result

type SearchStationRequest added in v0.7.0

type SearchStationRequest struct {
	XMLName       xml.Name `xml:"search"`
	Source        string   `xml:"source,attr"`
	SourceAccount string   `xml:"sourceAccount,attr,omitempty"`
	SearchTerm    string   `xml:",chardata"`
}

SearchStationRequest represents a request to search for stations

func NewSearchStationRequest added in v0.7.0

func NewSearchStationRequest(source, sourceAccount, searchTerm string) *SearchStationRequest

NewSearchStationRequest creates a new search station request

type SearchStationResponse added in v0.7.0

type SearchStationResponse struct {
	XMLName       xml.Name       `xml:"results"`
	DeviceID      string         `xml:"deviceID,attr"`
	Source        string         `xml:"source,attr"`
	SourceAccount string         `xml:"sourceAccount,attr,omitempty"`
	Songs         []SearchResult `xml:"songs>searchResult"`
	Artists       []SearchResult `xml:"artists>searchResult"`
	Stations      []SearchResult `xml:"stations>searchResult"`
}

SearchStationResponse represents the response from a station search

func (*SearchStationResponse) GetAllResults added in v0.7.0

func (sr *SearchStationResponse) GetAllResults() []SearchResult

GetAllResults returns all search results regardless of type

func (*SearchStationResponse) GetArtists added in v0.7.0

func (sr *SearchStationResponse) GetArtists() []SearchResult

GetArtists returns only artist results

func (*SearchStationResponse) GetResultCount added in v0.7.0

func (sr *SearchStationResponse) GetResultCount() int

GetResultCount returns the total number of results

func (*SearchStationResponse) GetSongs added in v0.7.0

func (sr *SearchStationResponse) GetSongs() []SearchResult

GetSongs returns only song results

func (*SearchStationResponse) GetStations added in v0.7.0

func (sr *SearchStationResponse) GetStations() []SearchResult

GetStations returns only station results

func (*SearchStationResponse) HasResults added in v0.7.0

func (sr *SearchStationResponse) HasResults() bool

HasResults returns true if the search response contains any results

func (*SearchStationResponse) IsEmpty added in v0.7.0

func (sr *SearchStationResponse) IsEmpty() bool

IsEmpty returns true if the search response contains no results

type Security

type Security struct{}

Security represents security configuration

type SeekSupported

type SeekSupported struct {
	Value bool `xml:"value,attr"`
}

SeekSupported indicates if seek functionality is supported

type Service added in v0.7.0

type Service struct {
	Type        string `xml:"type,attr"`
	IsAvailable bool   `xml:"isAvailable,attr"`
	Reason      string `xml:"reason,attr,omitempty"`
}

Service represents an individual service availability status

func (*Service) GetReason added in v0.7.0

func (s *Service) GetReason() string

GetReason returns the reason why a service is unavailable (if any)

func (*Service) IsType added in v0.7.0

func (s *Service) IsType(serviceType ServiceType) bool

IsType checks if the service is of a specific type

type ServiceAccountInfo added in v0.51.0

type ServiceAccountInfo struct {
	AccountID         string            `json:"account_id"`
	PreferredLanguage string            `json:"preferred_language"`
	ProviderSettings  []ProviderSetting `json:"provider_settings"`
	IsPlaceholder     bool              `json:"is_placeholder,omitempty"`
}

ServiceAccountInfo represents account-level metadata.

type ServiceAvailability added in v0.7.0

type ServiceAvailability struct {
	XMLName  xml.Name     `xml:"serviceAvailability"`
	Services *ServiceList `xml:"services"`
}

ServiceAvailability represents the response from /serviceAvailability endpoint

func (*ServiceAvailability) GetAvailableServiceCount added in v0.7.0

func (sa *ServiceAvailability) GetAvailableServiceCount() int

GetAvailableServiceCount returns the number of available services

func (*ServiceAvailability) GetAvailableServices added in v0.7.0

func (sa *ServiceAvailability) GetAvailableServices() []Service

GetAvailableServices returns only services that are available

func (*ServiceAvailability) GetLocalServices added in v0.7.0

func (sa *ServiceAvailability) GetLocalServices() []Service

GetLocalServices returns all local service types

func (*ServiceAvailability) GetServiceByType added in v0.7.0

func (sa *ServiceAvailability) GetServiceByType(serviceType ServiceType) *Service

GetServiceByType returns the service information for a specific type

func (*ServiceAvailability) GetServiceCount added in v0.7.0

func (sa *ServiceAvailability) GetServiceCount() int

GetServiceCount returns the total number of services

func (*ServiceAvailability) GetStreamingServices added in v0.7.0

func (sa *ServiceAvailability) GetStreamingServices() []Service

GetStreamingServices returns all streaming service types

func (*ServiceAvailability) GetUnavailableServiceCount added in v0.7.0

func (sa *ServiceAvailability) GetUnavailableServiceCount() int

GetUnavailableServiceCount returns the number of unavailable services

func (*ServiceAvailability) GetUnavailableServices added in v0.7.0

func (sa *ServiceAvailability) GetUnavailableServices() []Service

GetUnavailableServices returns only services that are unavailable

func (*ServiceAvailability) HasAirPlay added in v0.7.0

func (sa *ServiceAvailability) HasAirPlay() bool

HasAirPlay returns true if AirPlay service is available

func (*ServiceAvailability) HasAlexa added in v0.7.0

func (sa *ServiceAvailability) HasAlexa() bool

HasAlexa returns true if Alexa service is available

func (*ServiceAvailability) HasBluetooth added in v0.7.0

func (sa *ServiceAvailability) HasBluetooth() bool

HasBluetooth returns true if Bluetooth service is available

func (*ServiceAvailability) HasLocalMusic added in v0.7.0

func (sa *ServiceAvailability) HasLocalMusic() bool

HasLocalMusic returns true if Local Music service is available

func (*ServiceAvailability) HasPandora added in v0.7.0

func (sa *ServiceAvailability) HasPandora() bool

HasPandora returns true if Pandora service is available

func (*ServiceAvailability) HasSpotify added in v0.7.0

func (sa *ServiceAvailability) HasSpotify() bool

HasSpotify returns true if Spotify service is available

func (*ServiceAvailability) HasTuneIn added in v0.7.0

func (sa *ServiceAvailability) HasTuneIn() bool

HasTuneIn returns true if TuneIn service is available

func (*ServiceAvailability) IsServiceAvailable added in v0.7.0

func (sa *ServiceAvailability) IsServiceAvailable(serviceType ServiceType) bool

IsServiceAvailable checks if a specific service type is available

type ServiceComponent added in v0.42.0

type ServiceComponent struct {
	Type            string `json:"type" xml:"type,attr"`
	Category        string `json:"category,omitempty" xml:"category,attr,omitempty"`
	SoftwareVersion string `json:"firmware_version" xml:"firmware-version"`
	SerialNumber    string `json:"serial_number" xml:"serialnumber"`
	Label           string `json:"label,omitempty" xml:"componentlabel"`
}

ServiceComponent represents a hardware or software component of a device.

type ServiceContentItem added in v0.10.0

type ServiceContentItem struct {
	ID              string `json:"id" xml:"id,attr"`
	Name            string `json:"name" xml:"name"`
	Source          string `json:"source,omitempty" xml:"source,attr,omitempty"`
	Type            string `json:"type,omitempty" xml:"type,attr,omitempty"`
	ContentItemType string `json:"content_item_type,omitempty" xml:"contentItemType,omitempty"`
	Location        string `json:"location,omitempty" xml:"location,attr,omitempty"`
	SourceAccount   string `json:"source_account,omitempty" xml:"sourceAccount,attr,omitempty"`
	SourceID        string `json:"source_id,omitempty" xml:"sourceid"`
	IsPresetable    string `json:"is_presetable,omitempty" xml:"isPresetable,attr,omitempty"`
	Username        string `json:"username,omitempty" xml:"username,omitempty"`
	ContainerArt    string `json:"container_art,omitempty" xml:"containerArt,omitempty"`
}

ServiceContentItem represents a media content item with source and location details.

type ServiceDeviceInfo added in v0.10.0

type ServiceDeviceInfo struct {
	DeviceID            string             `json:"device_id" xml:"deviceID,attr"`
	ProductCode         string             `json:"product_code" xml:"type"`
	DeviceSerialNumber  string             `json:"device_serial_number" xml:"serialnumber"`
	ProductSerialNumber string             `json:"product_serial_number" xml:"product_serial_number"`
	FirmwareVersion     string             `json:"firmware_version" xml:"softwareVersion"`
	IPAddress           string             `json:"ip_address" xml:"ipAddress"`
	Name                string             `json:"name" xml:"name"`
	MacAddress          string             `json:"mac_address,omitempty" xml:"-"`
	DiscoveryMethod     string             `json:"discovery_method,omitempty"`
	AccountID           string             `json:"account_id,omitempty"`
	Components          []ServiceComponent `json:"components,omitempty" xml:"-"`
}

ServiceDeviceInfo represents information about a SoundTouch device.

type ServiceList added in v0.7.0

type ServiceList struct {
	Service []Service `xml:"service"`
}

ServiceList contains the list of available services

type ServicePreset added in v0.10.0

type ServicePreset struct {
	ServiceContentItem
	ID           string `json:"id,omitempty" xml:"id,attr,omitempty"`
	ContainerArt string `json:"container_art" xml:"containerArt"`
	CreatedOn    string `json:"created_on" xml:"createdOn"`
	UpdatedOn    string `json:"updated_on" xml:"updatedOn"`
	ButtonNumber string `json:"button_number,omitempty" xml:"buttonNumber,attr,omitempty"`
	Username     string `json:"-" xml:"username,omitempty"`
}

ServicePreset represents a user-defined preset for quick access to media content.

func (ServicePreset) MarshalXML added in v0.54.0

func (p ServicePreset) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for ServicePreset to match upstream parity.

type ServiceRecent added in v0.10.0

type ServiceRecent struct {
	XMLName xml.Name `json:"-" xml:"recent"`
	ServiceContentItem
	DeviceID     string `json:"device_id" xml:"deviceID,attr,omitempty"`
	UtcTime      string `json:"utc_time" xml:"utcTime,attr,omitempty"`
	CreatedOn    string `json:"created_on,omitempty" xml:"createdOn,omitempty"`
	UpdatedOn    string `json:"updated_on,omitempty" xml:"updatedOn,omitempty"`
	LastPlayedAt string `json:"last_played_at,omitempty" xml:"lastplayedat,omitempty"`
}

ServiceRecent represents recently played media content as stored in Recents.xml.

func (ServiceRecent) MarshalXML added in v0.51.0

func (r ServiceRecent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for custom XML encoding of ServiceRecent (nested format).

func (*ServiceRecent) UnmarshalXML added in v0.51.0

func (r *ServiceRecent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface to handle both nested and flat formats for ServiceRecent.

type ServiceType added in v0.7.0

type ServiceType string

ServiceType represents known service types

const (
	// ServiceTypeAirPlay represents Apple AirPlay streaming service
	ServiceTypeAirPlay ServiceType = "AIRPLAY"
	// ServiceTypeAlexa represents Amazon Alexa voice assistant integration
	ServiceTypeAlexa ServiceType = "ALEXA"
	// ServiceTypeAmazon represents Amazon Music streaming service
	ServiceTypeAmazon ServiceType = "AMAZON"
	// ServiceTypeBluetooth represents Bluetooth audio connectivity
	ServiceTypeBluetooth ServiceType = "BLUETOOTH"
	// ServiceTypeBMX represents BMX streaming service
	ServiceTypeBMX ServiceType = "BMX"
	// ServiceTypeDeezer represents Deezer music streaming service
	ServiceTypeDeezer ServiceType = "DEEZER"
	// ServiceTypeIHeart represents iHeartRadio streaming service
	ServiceTypeIHeart ServiceType = "IHEART"
	// ServiceTypeLocalInternetRadio represents local internet radio stations
	ServiceTypeLocalInternetRadio ServiceType = "LOCAL_INTERNET_RADIO"
	// ServiceTypeLocalMusic represents local music library
	ServiceTypeLocalMusic ServiceType = "LOCAL_MUSIC"
	// ServiceTypeNotification represents system notifications
	ServiceTypeNotification ServiceType = "NOTIFICATION"
	// ServiceTypePandora represents Pandora music streaming service
	ServiceTypePandora ServiceType = "PANDORA"
	// ServiceTypeSpotify represents Spotify music streaming service
	ServiceTypeSpotify ServiceType = "SPOTIFY"
	// ServiceTypeTuneIn represents TuneIn internet radio service
	ServiceTypeTuneIn ServiceType = "TUNEIN"
)

type ShuffleMode added in v0.9.0

type ShuffleMode string

ShuffleMode represents possible shuffle modes

const (
	// ShuffleModeOff indicates shuffle is disabled
	ShuffleModeOff ShuffleMode = "OFF"
	// ShuffleModeOn indicates shuffle is enabled
	ShuffleModeOn ShuffleMode = "ON"
)

type ShuffleSetting

type ShuffleSetting string

ShuffleSetting represents shuffle mode state

const (
	// ShuffleOff indicates shuffle is disabled
	ShuffleOff ShuffleSetting = "SHUFFLE_OFF"
	// ShuffleOn indicates shuffle is enabled
	ShuffleOn ShuffleSetting = "SHUFFLE_ON"
)

func (ShuffleSetting) IsEnabled

func (ss ShuffleSetting) IsEnabled() bool

IsEnabled returns true if shuffle is enabled

func (ShuffleSetting) String

func (ss ShuffleSetting) String() string

String returns a human-readable string representation

func (*ShuffleSetting) UnmarshalXML

func (ss *ShuffleSetting) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling

type SkipEnabled

type SkipEnabled struct{}

SkipEnabled indicates if skip functionality is enabled

type SkipPreviousEnabled

type SkipPreviousEnabled struct{}

SkipPreviousEnabled indicates if skip previous functionality is enabled

type SoundTouchSdkInfo added in v0.5.4

type SoundTouchSdkInfo struct {
	XMLName       xml.Name `xml:"SoundTouchSdkInfo"`
	ServerVersion string   `xml:"serverVersion,attr"`
	ServerBuild   string   `xml:"serverBuild,attr"`
}

SoundTouchSdkInfo represents the SDK info message sent on connection

type SourceItem

type SourceItem struct {
	Source           string       `xml:"source,attr"`
	SourceAccount    string       `xml:"sourceAccount,attr,omitempty"`
	Status           SourceStatus `xml:"status,attr"`
	IsLocal          bool         `xml:"isLocal,attr"`
	MultiroomAllowed bool         `xml:"multiroomallowed,attr"`
	DisplayName      string       `xml:",chardata"`
}

SourceItem represents an individual audio source

func (*SourceItem) GetDisplayName

func (si *SourceItem) GetDisplayName() string

GetDisplayName returns the best available display name for the source

func (*SourceItem) IsAuxSource

func (si *SourceItem) IsAuxSource() bool

IsAuxSource returns true if this is an AUX input source

func (*SourceItem) IsBluetoothSource

func (si *SourceItem) IsBluetoothSource() bool

IsBluetoothSource returns true if this is a Bluetooth source

func (*SourceItem) IsLocalSource

func (si *SourceItem) IsLocalSource() bool

IsLocalSource returns true if this is a local input source

func (*SourceItem) IsSpotify

func (si *SourceItem) IsSpotify() bool

IsSpotify returns true if this is a Spotify source

func (*SourceItem) IsStreamingService

func (si *SourceItem) IsStreamingService() bool

IsStreamingService returns true if this is an online streaming service

func (*SourceItem) SupportsMultiroom

func (si *SourceItem) SupportsMultiroom() bool

SupportsMultiroom returns true if this source supports multiroom playback

type SourceProvider added in v0.10.0

type SourceProvider struct {
	ID        int    `json:"id" xml:"id,attr"`
	CreatedOn string `json:"created_on" xml:"createdOn"`
	Name      string `json:"name" xml:"name"`
	UpdatedOn string `json:"updated_on" xml:"updatedOn"`
}

SourceProvider represents a media source provider configuration.

type SourceStatus

type SourceStatus string

SourceStatus represents the availability status of a source

const (
	// SourceStatusReady indicates the source is ready for use
	SourceStatusReady SourceStatus = "READY"
	// SourceStatusUnavailable indicates the source is not available
	SourceStatusUnavailable SourceStatus = "UNAVAILABLE"
	// SourceStatusError indicates an error with the source
	SourceStatusError SourceStatus = "ERROR"
)

func (SourceStatus) IsReady

func (ss SourceStatus) IsReady() bool

IsReady returns true if the source is ready for use

func (SourceStatus) IsUnavailable

func (ss SourceStatus) IsUnavailable() bool

IsUnavailable returns true if the source is unavailable

func (SourceStatus) String

func (ss SourceStatus) String() string

String returns a human-readable string representation

func (*SourceStatus) UnmarshalXML

func (ss *SourceStatus) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom XML unmarshaling with validation

type Sources

type Sources struct {
	XMLName    xml.Name     `xml:"sources"`
	DeviceID   string       `xml:"deviceID,attr"`
	SourceItem []SourceItem `xml:"sourceItem"`
}

Sources represents the response from /sources endpoint

func (*Sources) GetAvailableSources

func (s *Sources) GetAvailableSources() []SourceItem

GetAvailableSources returns only sources that are ready for use

func (*Sources) GetLocalSources

func (s *Sources) GetLocalSources() []SourceItem

GetLocalSources returns all local input sources

func (*Sources) GetMultiroomSources

func (s *Sources) GetMultiroomSources() []SourceItem

GetMultiroomSources returns sources that support multiroom playback

func (*Sources) GetReadySourceCount

func (s *Sources) GetReadySourceCount() int

GetReadySourceCount returns the number of ready sources

func (*Sources) GetReadySpotifySources

func (s *Sources) GetReadySpotifySources() []SourceItem

GetReadySpotifySources returns only ready Spotify sources

func (*Sources) GetSourceCount

func (s *Sources) GetSourceCount() int

GetSourceCount returns the total number of sources

func (*Sources) GetSourcesByType

func (s *Sources) GetSourcesByType(sourceType string) []SourceItem

GetSourcesByType returns sources filtered by source type

func (*Sources) GetSpotifySources

func (s *Sources) GetSpotifySources() []SourceItem

GetSpotifySources returns all Spotify sources (there can be multiple accounts)

func (*Sources) GetStreamingSources

func (s *Sources) GetStreamingSources() []SourceItem

GetStreamingSources returns all streaming service sources

func (*Sources) HasAux

func (s *Sources) HasAux() bool

HasAux returns true if AUX input is ready

func (*Sources) HasBluetooth

func (s *Sources) HasBluetooth() bool

HasBluetooth returns true if Bluetooth source is ready

func (*Sources) HasSource

func (s *Sources) HasSource(sourceType string) bool

HasSource returns true if the specified source type is available

func (*Sources) HasSpotify

func (s *Sources) HasSpotify() bool

HasSpotify returns true if any Spotify source is ready

type SourcesUpdatedNotification added in v0.57.0

type SourcesUpdatedNotification struct {
	XMLName  xml.Name `xml:"updates"`
	DeviceID string   `xml:"deviceID,attr"`
	Sources  struct {
		XMLName xml.Name `xml:"sourcesUpdated"`
	} `xml:"sourcesUpdated"`
}

SourcesUpdatedNotification represents the notification XML sent to the device

func NewSourcesUpdatedNotification added in v0.57.0

func NewSourcesUpdatedNotification(deviceID string) *SourcesUpdatedNotification

NewSourcesUpdatedNotification creates a new sources updated notification

type SourcesUpdatedResponse added in v0.57.0

type SourcesUpdatedResponse struct {
	XMLName xml.Name `xml:"status"`
	Status  string   `xml:",chardata"`
}

SourcesUpdatedResponse represents the response from /notification

type SpeakerPlayStatus added in v0.8.0

type SpeakerPlayStatus struct {
	Service string `json:"service"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
	Volume  int    `json:"volume,omitempty"`
}

SpeakerPlayStatus represents the status during speaker playback

type SpeakerResponse added in v0.8.0

type SpeakerResponse struct {
	XMLName xml.Name `xml:"status"`
	Value   string   `xml:",chardata"`
}

SpeakerResponse represents the response from the /speaker endpoint

type SpecialMessage added in v0.5.4

type SpecialMessage struct {
	Type      SpecialMessageType
	DeviceID  string
	Data      interface{}
	RawData   []byte
	Timestamp time.Time
}

SpecialMessage represents non-updates WebSocket messages

func ParseSpecialMessage added in v0.5.4

func ParseSpecialMessage(data []byte) (*SpecialMessage, error)

ParseSpecialMessage parses non-updates WebSocket messages

func (*SpecialMessage) GetSdkInfo added in v0.5.4

func (sm *SpecialMessage) GetSdkInfo() *SoundTouchSdkInfo

GetSdkInfo returns the parsed SdkInfo data if the message is of that type

func (*SpecialMessage) GetUserActivity added in v0.5.4

func (sm *SpecialMessage) GetUserActivity() *UserActivityUpdate

GetUserActivity returns the parsed UserActivity data if the message is of that type

func (*SpecialMessage) GetUserInactivity added in v0.33.0

func (sm *SpecialMessage) GetUserInactivity() *UserInactivityUpdate

GetUserInactivity returns the parsed UserInactivity data if the message is of that type

func (*SpecialMessage) String added in v0.5.4

func (sm *SpecialMessage) String() string

String returns a string representation of the special message

type SpecialMessageHandler added in v0.5.4

type SpecialMessageHandler func(message *SpecialMessage)

SpecialMessageHandler defines the signature for special message handlers

type SpecialMessageType added in v0.5.4

type SpecialMessageType string

SpecialMessageType represents message types that are not part of <updates>

const (
	MessageTypeSdkInfo        SpecialMessageType = "sdkInfo"
	MessageTypeUserActivity   SpecialMessageType = "userActivity"
	MessageTypeUserInactivity SpecialMessageType = "userInactivity"
)

Constants for special message types

type SpotifyIntrospectResponse added in v0.9.0

type SpotifyIntrospectResponse struct {
	XMLName                          xml.Name               `xml:"spotifyAccountIntrospectResponse"`
	State                            string                 `xml:"state,attr"`
	User                             string                 `xml:"user,attr"`
	IsPlaying                        bool                   `xml:"isPlaying,attr"`
	TokenLastChangedTimeSeconds      int64                  `xml:"tokenLastChangedTimeSeconds,attr"`
	TokenLastChangedTimeMicroseconds int64                  `xml:"tokenLastChangedTimeMicroseconds,attr"`
	ShuffleMode                      string                 `xml:"shuffleMode,attr"`
	PlayStatusState                  string                 `xml:"playStatusState,attr"`
	CurrentURI                       string                 `xml:"currentUri,attr"`
	ReceivedPlaybackRequest          bool                   `xml:"receivedPlaybackRequest,attr"`
	SubscriptionType                 string                 `xml:"subscriptionType,attr"`
	CachedPlaybackRequest            *CachedPlaybackRequest `xml:"cachedPlaybackRequest"`
	NowPlaying                       *IntrospectNowPlaying  `xml:"nowPlaying"`
	ContentItemHistory               *ContentItemHistory    `xml:"contentItemHistory"`
}

SpotifyIntrospectResponse represents a Spotify-specific introspect response

func (*SpotifyIntrospectResponse) CollectsData added in v0.9.0

func (sir *SpotifyIntrospectResponse) CollectsData() bool

CollectsData returns true if the service collects usage data

func (*SpotifyIntrospectResponse) GetMaxHistorySize added in v0.9.0

func (sir *SpotifyIntrospectResponse) GetMaxHistorySize() int

GetMaxHistorySize returns the maximum size of the content item history

func (*SpotifyIntrospectResponse) GetShuffleMode added in v0.9.0

func (sir *SpotifyIntrospectResponse) GetShuffleMode() ShuffleMode

GetShuffleMode returns the shuffle mode as a typed value

func (*SpotifyIntrospectResponse) GetState added in v0.9.0

GetState returns the introspect state as a typed value

func (*SpotifyIntrospectResponse) GetTokenAge added in v0.9.0

func (sir *SpotifyIntrospectResponse) GetTokenAge() int64

GetTokenAge returns the age of the token in seconds since last change

func (*SpotifyIntrospectResponse) HasCurrentContent added in v0.9.0

func (sir *SpotifyIntrospectResponse) HasCurrentContent() bool

HasCurrentContent returns true if there is current content playing

func (*SpotifyIntrospectResponse) HasSubscription added in v0.9.0

func (sir *SpotifyIntrospectResponse) HasSubscription() bool

HasSubscription returns true if the user has a subscription

func (*SpotifyIntrospectResponse) HasUser added in v0.9.0

func (sir *SpotifyIntrospectResponse) HasUser() bool

HasUser returns true if a user is associated with the service

func (*SpotifyIntrospectResponse) IsActive added in v0.9.0

func (sir *SpotifyIntrospectResponse) IsActive() bool

IsActive returns true if the service is in an active state

func (*SpotifyIntrospectResponse) IsInactive added in v0.9.0

func (sir *SpotifyIntrospectResponse) IsInactive() bool

IsInactive returns true if the service is in an inactive state

func (*SpotifyIntrospectResponse) IsShuffleEnabled added in v0.9.0

func (sir *SpotifyIntrospectResponse) IsShuffleEnabled() bool

IsShuffleEnabled returns true if shuffle mode is enabled

func (*SpotifyIntrospectResponse) SupportsResume added in v0.9.0

func (sir *SpotifyIntrospectResponse) SupportsResume() bool

SupportsResume returns true if the service supports resuming playback

func (*SpotifyIntrospectResponse) SupportsSeek added in v0.9.0

func (sir *SpotifyIntrospectResponse) SupportsSeek() bool

SupportsSeek returns true if the service supports seeking within tracks

func (*SpotifyIntrospectResponse) SupportsSkipPrevious added in v0.9.0

func (sir *SpotifyIntrospectResponse) SupportsSkipPrevious() bool

SupportsSkipPrevious returns true if the service supports skipping to previous track

type StationResponse added in v0.7.0

type StationResponse struct {
	XMLName xml.Name `xml:"status"`
	Status  string   `xml:",chardata"`
}

StationResponse represents the response from add/remove station operations

type Stream added in v0.10.0

type Stream struct {
	Links             *Links `json:"_links,omitempty" xml:"links,omitempty"`
	BufferingTimeout  int    `json:"bufferingTimeout,omitempty" xml:"bufferingTimeout,omitempty"`
	ConnectingTimeout int    `json:"connectingTimeout,omitempty" xml:"connectingTimeout,omitempty"`
	HasPlaylist       bool   `json:"hasPlaylist" xml:"hasPlaylist"`
	IsRealtime        bool   `json:"isRealtime" xml:"isRealtime"`
	StreamUrl         string `json:"streamUrl" xml:"streamUrl"`
}

Stream represents audio stream information including URL and format details.

type SupportedURLsResponse added in v0.7.0

type SupportedURLsResponse struct {
	XMLName  xml.Name `xml:"supportedURLs"`
	DeviceID string   `xml:"deviceID,attr"`
	URLs     []URL    `xml:"URL"`
}

SupportedURLsResponse represents the response from the /supportedURLs endpoint

func (*SupportedURLsResponse) GetAdvancedURLs added in v0.7.0

func (s *SupportedURLsResponse) GetAdvancedURLs() []string

GetAdvancedURLs returns URLs for advanced audio and system functionality

func (*SupportedURLsResponse) GetCoreURLs added in v0.7.0

func (s *SupportedURLsResponse) GetCoreURLs() []string

GetCoreURLs returns URLs for core device functionality

func (*SupportedURLsResponse) GetFeatureCompleteness added in v0.7.0

func (s *SupportedURLsResponse) GetFeatureCompleteness() (int, int, int)

GetFeatureCompleteness returns a completeness score (0-100) based on supported features

func (*SupportedURLsResponse) GetFeaturesByCategory added in v0.7.0

func (s *SupportedURLsResponse) GetFeaturesByCategory() map[string][]EndpointFeature

GetFeaturesByCategory returns features grouped by category

func (*SupportedURLsResponse) GetMissingEssentialFeatures added in v0.7.0

func (s *SupportedURLsResponse) GetMissingEssentialFeatures() []EndpointFeature

GetMissingEssentialFeatures returns essential features that are not supported

func (*SupportedURLsResponse) GetNetworkURLs added in v0.7.0

func (s *SupportedURLsResponse) GetNetworkURLs() []string

GetNetworkURLs returns URLs for network and connectivity functionality

func (*SupportedURLsResponse) GetPartiallyImplementedFeatures added in v0.7.0

func (s *SupportedURLsResponse) GetPartiallyImplementedFeatures() []EndpointFeature

GetPartiallyImplementedFeatures returns features where only some endpoints are supported

func (*SupportedURLsResponse) GetStreamingURLs added in v0.7.0

func (s *SupportedURLsResponse) GetStreamingURLs() []string

GetStreamingURLs returns URLs for streaming service functionality

func (*SupportedURLsResponse) GetSupportedFeatures added in v0.7.0

func (s *SupportedURLsResponse) GetSupportedFeatures() []EndpointFeature

GetSupportedFeatures returns all features supported by this device

func (*SupportedURLsResponse) GetURLCount added in v0.7.0

func (s *SupportedURLsResponse) GetURLCount() int

GetURLCount returns the total number of supported URLs

func (*SupportedURLsResponse) GetURLs added in v0.7.0

func (s *SupportedURLsResponse) GetURLs() []string

GetURLs returns a slice of all supported URL locations

func (*SupportedURLsResponse) GetUnsupportedFeatures added in v0.7.0

func (s *SupportedURLsResponse) GetUnsupportedFeatures() []EndpointFeature

GetUnsupportedFeatures returns features not supported by this device

func (*SupportedURLsResponse) GetUnsupportedURLs added in v0.7.0

func (s *SupportedURLsResponse) GetUnsupportedURLs(checkList []string) []string

GetUnsupportedURLs returns a list of common URLs that this device doesn't support

func (*SupportedURLsResponse) HasAdvancedAudioSupport added in v0.7.0

func (s *SupportedURLsResponse) HasAdvancedAudioSupport() bool

HasAdvancedAudioSupport checks if device supports advanced audio controls

func (*SupportedURLsResponse) HasCorePlaybackSupport added in v0.7.0

func (s *SupportedURLsResponse) HasCorePlaybackSupport() bool

HasCorePlaybackSupport checks if device supports basic playback functionality

func (*SupportedURLsResponse) HasMultiroomSupport added in v0.7.0

func (s *SupportedURLsResponse) HasMultiroomSupport() bool

HasMultiroomSupport checks if device supports multiroom/zone functionality

func (*SupportedURLsResponse) HasPresetSupport added in v0.7.0

func (s *SupportedURLsResponse) HasPresetSupport() bool

HasPresetSupport checks if device supports preset functionality

func (*SupportedURLsResponse) HasStreamingSupport added in v0.7.0

func (s *SupportedURLsResponse) HasStreamingSupport() bool

HasStreamingSupport checks if device supports streaming service navigation

func (*SupportedURLsResponse) HasURL added in v0.7.0

func (s *SupportedURLsResponse) HasURL(location string) bool

HasURL checks if a specific URL location is supported

type Time

type Time struct {
	Total    int `xml:"total,attr"` // Total duration in seconds
	Position int `xml:",chardata"`  // Current position in seconds
}

Time represents playback time information with total duration and current position

type Track added in v0.10.0

type Track struct {
	Links      *Links `json:"_links,omitempty" xml:"links,omitempty"`
	IsSelected bool   `json:"isSelected" xml:"isSelected"`
	Name       string `json:"name" xml:"name"`
}

Track represents track information for media playback.

type TrebleControlSetting added in v0.6.0

type TrebleControlSetting struct {
	XMLName  xml.Name `xml:"treble"`
	Value    int      `xml:"value,attr"`
	MinValue int      `xml:"minValue,attr"`
	MaxValue int      `xml:"maxValue,attr"`
	Step     int      `xml:"step,attr"`
}

TrebleControlSetting represents a treble control setting with constraints

func (*TrebleControlSetting) ClampValue added in v0.6.0

func (tc *TrebleControlSetting) ClampValue(value int) int

ClampValue clamps a value to the valid range

func (*TrebleControlSetting) ValidateTreble added in v0.6.0

func (tc *TrebleControlSetting) ValidateTreble(value int) error

ValidateTreble validates the treble value within constraints

type TrebleControlValue added in v0.6.0

type TrebleControlValue struct {
	XMLName xml.Name `xml:"treble"`
	Value   int      `xml:"value,attr"`
}

TrebleControlValue represents a treble control value for requests

func NewTrebleControlValue added in v0.6.0

func NewTrebleControlValue(value int) *TrebleControlValue

NewTrebleControlValue creates a new treble control value for requests

type TypedEventHandler

type TypedEventHandler[T any] func(event T)

TypedEventHandler represents a function that handles specific event types

type URL added in v0.7.0

type URL struct {
	Location string `xml:"location,attr"`
}

URL represents a single supported URL endpoint

type UnPairDeviceWithAccount added in v0.53.0

type UnPairDeviceWithAccount struct {
	XMLName xml.Name `xml:"UnPairDeviceWithAccount"`
}

UnPairDeviceWithAccount represents a device unpairing request message

type UsageStats added in v0.10.0

type UsageStats struct {
	DeviceID   string                 `json:"deviceId" xml:"deviceId"`
	AccountID  string                 `json:"accountId" xml:"accountId"`
	Timestamp  string                 `json:"timestamp" xml:"timestamp"`
	EventType  string                 `json:"eventType" xml:"eventType"`
	Parameters map[string]interface{} `json:"parameters" xml:"parameters"`
}

UsageStats represents usage statistics for the service.

type UserActivityUpdate added in v0.5.4

type UserActivityUpdate struct {
	XMLName  xml.Name `xml:"userActivityUpdate"`
	DeviceID string   `xml:"deviceID,attr"`
}

UserActivityUpdate represents user activity notifications

type UserInactivityUpdate added in v0.33.0

type UserInactivityUpdate struct {
	XMLName  xml.Name `xml:"userInactivityUpdate"`
	DeviceID string   `xml:"deviceID,attr"`
}

UserInactivityUpdate represents user inactivity notifications

type Volume

type Volume struct {
	XMLName      xml.Name `xml:"volume"`
	DeviceID     string   `xml:"deviceID,attr"`
	TargetVolume int      `xml:"targetvolume"`
	ActualVolume int      `xml:"actualvolume"`
	MuteEnabled  bool     `xml:"muteenabled"`
}

Volume represents the response from GET /volume endpoint

func (*Volume) GetLevel

func (v *Volume) GetLevel() int

GetLevel returns the current actual volume level

func (*Volume) GetTargetLevel

func (v *Volume) GetTargetLevel() int

GetTargetLevel returns the target volume level

func (*Volume) GetVolumeString

func (v *Volume) GetVolumeString() string

GetVolumeString returns a formatted string representation

func (*Volume) IsMuted

func (v *Volume) IsMuted() bool

IsMuted returns whether the device is muted

func (*Volume) IsVolumeSync

func (v *Volume) IsVolumeSync() bool

IsVolumeSync returns true if target and actual volumes match

type VolumeRequest

type VolumeRequest struct {
	XMLName xml.Name `xml:"volume"`
	Value   int      `xml:",chardata"`
}

VolumeRequest represents the request for POST /volume endpoint

func NewVolumeRequest

func NewVolumeRequest(volume int) *VolumeRequest

NewVolumeRequest creates a new volume set request

type VolumeUpdatedEvent

type VolumeUpdatedEvent struct {
	XMLName  xml.Name `xml:"volumeUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Volume   Volume   `xml:"volume"`
}

VolumeUpdatedEvent represents a volume update event

type WLANInterfaces

type WLANInterfaces struct{}

WLANInterfaces represents WLAN interfaces configuration

type WebSocketEvent

type WebSocketEvent struct {
	XMLName                xml.Name                     `xml:"updates"`
	DeviceID               string                       `xml:"deviceID,attr"`
	NowPlayingUpdated      *NowPlayingUpdatedEvent      `xml:"nowPlayingUpdated,omitempty"`
	VolumeUpdated          *VolumeUpdatedEvent          `xml:"volumeUpdated,omitempty"`
	ConnectionStateUpdated *ConnectionStateUpdatedEvent `xml:"connectionStateUpdated,omitempty"`
	PresetUpdated          *PresetUpdatedEvent          `xml:"presetsUpdated,omitempty"`
	ZoneUpdated            *ZoneUpdatedEvent            `xml:"zoneUpdated,omitempty"`
	BassUpdated            *BassUpdatedEvent            `xml:"bassUpdated,omitempty"`
	ClockTimeUpdated       *ClockTimeUpdatedEvent       `xml:"clockTimeUpdated,omitempty"`
	ClockDisplayUpdated    *ClockDisplayUpdatedEvent    `xml:"clockDisplayUpdated,omitempty"`
	NameUpdated            *NameUpdatedEvent            `xml:"nameUpdated,omitempty"`
	ErrorUpdated           *ErrorUpdatedEvent           `xml:"errorUpdated,omitempty"`
	RecentsUpdated         *RecentsUpdatedEvent         `xml:"recentsUpdated,omitempty"`
	LanguageUpdated        *LanguageUpdatedEvent        `xml:"languageUpdated,omitempty"`
	Timestamp              time.Time                    `json:"timestamp"` // Added by client for tracking
}

WebSocketEvent represents a generic WebSocket event from SoundTouch device

func ParseWebSocketEvent

func ParseWebSocketEvent(data []byte) (*WebSocketEvent, error)

ParseWebSocketEvent attempts to parse a WebSocket message into a specific event type

func (*WebSocketEvent) GetEventTypes

func (e *WebSocketEvent) GetEventTypes() []WebSocketEventType

GetEventTypes returns all event types present in this WebSocket event

func (*WebSocketEvent) GetEvents

func (e *WebSocketEvent) GetEvents() []interface{}

GetEvents returns all events present in this WebSocket event

func (*WebSocketEvent) HasEventType

func (e *WebSocketEvent) HasEventType(eventType WebSocketEventType) bool

HasEventType checks if the WebSocket event contains a specific event type

func (*WebSocketEvent) String

func (e *WebSocketEvent) String() string

String returns a human-readable string representation of the WebSocket event

type WebSocketEventHandlers

type WebSocketEventHandlers struct {
	OnNowPlaying          TypedEventHandler[*NowPlayingUpdatedEvent]
	OnVolumeUpdated       TypedEventHandler[*VolumeUpdatedEvent]
	OnConnectionState     TypedEventHandler[*ConnectionStateUpdatedEvent]
	OnPresetUpdated       TypedEventHandler[*PresetUpdatedEvent]
	OnZoneUpdated         TypedEventHandler[*ZoneUpdatedEvent]
	OnBassUpdated         TypedEventHandler[*BassUpdatedEvent]
	OnClockTimeUpdated    TypedEventHandler[*ClockTimeUpdatedEvent]
	OnClockDisplayUpdated TypedEventHandler[*ClockDisplayUpdatedEvent]
	OnNameUpdated         TypedEventHandler[*NameUpdatedEvent]
	OnErrorUpdated        TypedEventHandler[*ErrorUpdatedEvent]
	OnRecentsUpdated      TypedEventHandler[*RecentsUpdatedEvent]
	OnLanguageUpdated     TypedEventHandler[*LanguageUpdatedEvent]
	OnUnknownEvent        EventHandler
	OnSpecialMessage      SpecialMessageHandler
}

WebSocketEventHandlers contains handlers for different types of WebSocket events

type WebSocketEventType

type WebSocketEventType string

WebSocketEventType represents the type of WebSocket event

const (
	// EventTypeNowPlaying indicates a now playing status update
	EventTypeNowPlaying WebSocketEventType = "nowPlayingUpdated"
	// EventTypeVolumeUpdated indicates a volume level change
	EventTypeVolumeUpdated WebSocketEventType = "volumeUpdated"
	// EventTypeConnectionState indicates a connection state change
	EventTypeConnectionState WebSocketEventType = "connectionStateUpdated"
	// EventTypePresetUpdated indicates a preset configuration change
	EventTypePresetUpdated WebSocketEventType = "presetsUpdated"
	// EventTypeZoneUpdated indicates a zone configuration change
	EventTypeZoneUpdated WebSocketEventType = "zoneUpdated"
	// EventTypeBassUpdated indicates a bass level change
	EventTypeBassUpdated WebSocketEventType = "bassUpdated"
	// EventTypeClockTimeUpdated indicates a clock time change
	EventTypeClockTimeUpdated WebSocketEventType = "clockTimeUpdated"
	// EventTypeClockDisplayUpdated indicates a clock display setting change
	EventTypeClockDisplayUpdated WebSocketEventType = "clockDisplayUpdated"
	// EventTypeNameUpdated indicates a device name change
	EventTypeNameUpdated WebSocketEventType = "nameUpdated"
	// EventTypeErrorUpdated indicates an error status change
	EventTypeErrorUpdated WebSocketEventType = "errorUpdated"
	// EventTypeRecentsUpdated indicates a recent items list change
	EventTypeRecentsUpdated WebSocketEventType = "recentsUpdated"
	// EventTypeLanguageUpdated indicates a language setting change
	EventTypeLanguageUpdated WebSocketEventType = "languageUpdated"
	// EventTypePairDeviceWithAccount indicates a device pairing request
	EventTypePairDeviceWithAccount WebSocketEventType = "PairDeviceWithAccount"
	// EventTypeUnPairDeviceWithAccount indicates a device unpairing request
	EventTypeUnPairDeviceWithAccount WebSocketEventType = "UnPairDeviceWithAccount"
	// EventTypeUnknown indicates an unrecognized event type
	EventTypeUnknown WebSocketEventType = "unknown"
)

func (WebSocketEventType) String

func (e WebSocketEventType) String() string

String returns a human-readable string representation

type XMLResponse

type XMLResponse struct {
	XMLName xml.Name
	Error   *APIError `xml:"error,omitempty"`
}

XMLResponse is a generic wrapper for API responses

type Zone

type Zone struct {
	XMLName xml.Name     `xml:"zone"`
	Master  string       `xml:"master,attr"`
	Members []ZoneMember `xml:"member"`
}

Zone represents multiroom zone information

type ZoneBuilder

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

ZoneBuilder provides a fluent interface for building zone configurations

func NewZoneBuilder

func NewZoneBuilder(masterDeviceID string) *ZoneBuilder

NewZoneBuilder creates a new zone builder with the specified master device

func (*ZoneBuilder) Build

func (zb *ZoneBuilder) Build() (*ZoneRequest, error)

Build returns the constructed zone request

func (*ZoneBuilder) WithMember

func (zb *ZoneBuilder) WithMember(deviceID, ipAddress string) *ZoneBuilder

WithMember adds a member to the zone configuration

func (*ZoneBuilder) WithMemberByDeviceID

func (zb *ZoneBuilder) WithMemberByDeviceID(deviceID string) *ZoneBuilder

WithMemberByDeviceID adds a member by device ID only

type ZoneCapabilities

type ZoneCapabilities struct {
	CanBeMaster       bool `json:"canBeMaster"`
	CanBeMember       bool `json:"canBeMember"`
	MaxZoneMembers    int  `json:"maxZoneMembers"`
	SupportsMultiroom bool `json:"supportsMultiroom"`
}

ZoneCapabilities represents zone-related capabilities of a device

func DefaultZoneCapabilities

func DefaultZoneCapabilities() ZoneCapabilities

DefaultZoneCapabilities returns default zone capabilities

func (*ZoneCapabilities) CanCreateZone

func (zc *ZoneCapabilities) CanCreateZone() bool

CanCreateZone returns true if the device can create zones

func (*ZoneCapabilities) CanJoinZone

func (zc *ZoneCapabilities) CanJoinZone() bool

CanJoinZone returns true if the device can join zones

type ZoneError

type ZoneError struct {
	Operation ZoneOperation
	DeviceID  string
	Reason    string
}

ZoneError represents zone-specific errors

func NewZoneError

func NewZoneError(op ZoneOperation, deviceID, reason string) *ZoneError

NewZoneError creates a new zone error

func (*ZoneError) Error

func (ze *ZoneError) Error() string

Error implements the error interface

type ZoneInfo

type ZoneInfo struct {
	XMLName xml.Name `xml:"zone"`
	Master  string   `xml:"master,attr"`
	Members []Member `xml:"member"`
}

ZoneInfo represents the response from GET /getZone endpoint

func (*ZoneInfo) GetAllDeviceIDs

func (zi *ZoneInfo) GetAllDeviceIDs() []string

GetAllDeviceIDs returns all device IDs in the zone (master + members)

func (*ZoneInfo) GetMemberByDeviceID

func (zi *ZoneInfo) GetMemberByDeviceID(deviceID string) (*Member, bool)

GetMemberByDeviceID returns the member with the given device ID

func (*ZoneInfo) GetMemberByIP

func (zi *ZoneInfo) GetMemberByIP(ipAddress string) (*Member, bool)

GetMemberByIP returns the member with the given IP address

func (*ZoneInfo) GetTotalDeviceCount

func (zi *ZoneInfo) GetTotalDeviceCount() int

GetTotalDeviceCount returns the total number of devices in the zone

func (*ZoneInfo) GetZoneStatus

func (zi *ZoneInfo) GetZoneStatus(deviceID string) ZoneStatus

GetZoneStatus returns the zone status for a given device ID

func (*ZoneInfo) IsInZone

func (zi *ZoneInfo) IsInZone(deviceID string) bool

IsInZone returns true if the given device ID is in the zone (master or member)

func (*ZoneInfo) IsMaster

func (zi *ZoneInfo) IsMaster(deviceID string) bool

IsMaster returns true if the given device ID is the zone master

func (*ZoneInfo) IsMember

func (zi *ZoneInfo) IsMember(deviceID string) bool

IsMember returns true if the given device ID is a zone member (not master)

func (*ZoneInfo) IsStandalone

func (zi *ZoneInfo) IsStandalone() bool

IsStandalone returns true if this is a standalone (single device) configuration

func (*ZoneInfo) String

func (zi *ZoneInfo) String() string

String returns a human-readable string representation of the zone

func (*ZoneInfo) ToZoneRequest

func (zi *ZoneInfo) ToZoneRequest() *ZoneRequest

ToZoneRequest converts ZoneInfo to a ZoneRequest for modification

type ZoneMember

type ZoneMember struct {
	XMLName  xml.Name `xml:"member"`
	DeviceID string   `xml:",chardata"`
	IP       string   `xml:"ipaddress,attr"`
}

ZoneMember represents a member of a multiroom zone

type ZoneOperation

type ZoneOperation string

ZoneOperation represents different types of zone operations

const (
	// ZoneOpCreate indicates creating a new zone
	ZoneOpCreate ZoneOperation = "CREATE"
	// ZoneOpModify indicates modifying an existing zone
	ZoneOpModify ZoneOperation = "MODIFY"
	// ZoneOpAddMember indicates adding a member to a zone
	ZoneOpAddMember ZoneOperation = "ADD_MEMBER"
	// ZoneOpRemove indicates removing a member from a zone
	ZoneOpRemove ZoneOperation = "REMOVE_MEMBER"
	// ZoneOpDissolve indicates dissolving a zone
	ZoneOpDissolve ZoneOperation = "DISSOLVE"
)

func (ZoneOperation) String

func (zo ZoneOperation) String() string

String returns a human-readable string representation

type ZoneRequest

type ZoneRequest struct {
	XMLName xml.Name      `xml:"zone"`
	Master  string        `xml:"master,attr"`
	Members []MemberEntry `xml:"member"`
}

ZoneRequest represents the request for POST /setZone endpoint

func NewZoneRequest

func NewZoneRequest(masterDeviceID string) *ZoneRequest

NewZoneRequest creates a new zone configuration request

func (*ZoneRequest) AddMember

func (zr *ZoneRequest) AddMember(deviceID, ipAddress string)

AddMember adds a device to the zone configuration

func (*ZoneRequest) AddMemberByDeviceID

func (zr *ZoneRequest) AddMemberByDeviceID(deviceID string)

AddMemberByDeviceID adds a device to the zone by device ID only

func (*ZoneRequest) ClearMembers

func (zr *ZoneRequest) ClearMembers()

ClearMembers removes all members from the zone (creates standalone configuration)

func (*ZoneRequest) GetMemberCount

func (zr *ZoneRequest) GetMemberCount() int

GetMemberCount returns the number of members in the zone

func (*ZoneRequest) HasMember

func (zr *ZoneRequest) HasMember(deviceID string) bool

HasMember checks if a device is in the zone configuration

func (*ZoneRequest) RemoveMember

func (zr *ZoneRequest) RemoveMember(deviceID string)

RemoveMember removes a device from the zone configuration

func (*ZoneRequest) Validate

func (zr *ZoneRequest) Validate() error

Validate validates the zone request

type ZoneSlaveEntry added in v0.6.0

type ZoneSlaveEntry struct {
	XMLName  xml.Name `xml:"member"`
	DeviceID string   `xml:",chardata"`
	IP       string   `xml:"ipaddress,attr,omitempty"`
}

ZoneSlaveEntry represents a single member entry in zone slave operations

type ZoneSlaveRequest added in v0.6.0

type ZoneSlaveRequest struct {
	XMLName xml.Name         `xml:"zone"`
	Master  string           `xml:"master,attr"`
	Members []ZoneSlaveEntry `xml:"member"`
}

ZoneSlaveRequest represents the request for /addZoneSlave and /removeZoneSlave endpoints

func NewZoneSlaveRequest added in v0.6.0

func NewZoneSlaveRequest(masterDeviceID string) *ZoneSlaveRequest

NewZoneSlaveRequest creates a new zone slave operation request

func (*ZoneSlaveRequest) AddSlave added in v0.6.0

func (zsr *ZoneSlaveRequest) AddSlave(deviceID, ipAddress string)

AddSlave adds a single slave to the request

func (*ZoneSlaveRequest) GetSlaveDeviceID added in v0.6.0

func (zsr *ZoneSlaveRequest) GetSlaveDeviceID() string

GetSlaveDeviceID returns the device ID of the slave being added/removed

func (*ZoneSlaveRequest) GetSlaveIP added in v0.6.0

func (zsr *ZoneSlaveRequest) GetSlaveIP() string

GetSlaveIP returns the IP address of the slave being added/removed

func (*ZoneSlaveRequest) String added in v0.6.0

func (zsr *ZoneSlaveRequest) String() string

String returns a human-readable string representation

func (*ZoneSlaveRequest) Validate added in v0.6.0

func (zsr *ZoneSlaveRequest) Validate() error

Validate validates the zone slave request

type ZoneStatus

type ZoneStatus string

ZoneStatus represents possible zone states

const (
	// ZoneStatusStandalone indicates the device is operating independently
	ZoneStatusStandalone ZoneStatus = "STANDALONE"
	// ZoneStatusMaster indicates the device is the master in a zone
	ZoneStatusMaster ZoneStatus = "MASTER"
	// ZoneStatusSlave indicates the device is a slave in a zone
	ZoneStatusSlave ZoneStatus = "SLAVE"
)

func (ZoneStatus) String

func (zs ZoneStatus) String() string

String returns a human-readable string representation

type ZoneUpdatedEvent

type ZoneUpdatedEvent struct {
	XMLName  xml.Name `xml:"zoneUpdated"`
	DeviceID string   `xml:"deviceID,attr"`
	Zone     Zone     `xml:"zone"`
}

ZoneUpdatedEvent represents a multiroom zone update event

Jump to

Keyboard shortcuts

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