Documentation
¶
Index ¶
- func ParseResult[T any](result interface{}) (*T, error)
- type Client
- type ClientGetStatusRequest
- type ClientGetStatusResponse
- type ClientOnConnect
- type ClientOnDisconnect
- type ClientOnLatencyChanged
- type ClientOnNameChanged
- type ClientOnVolumeChanged
- type ClientSetLatencyRequest
- type ClientSetLatencyResponse
- type ClientSetNameRequest
- type ClientSetNameResponse
- type ClientSetVolumeRequest
- type ClientSetVolumeResponse
- type Error
- type Group
- type GroupGetStatusRequest
- type GroupGetStatusResponse
- type GroupOnMute
- type GroupOnNameChanged
- type GroupOnStreamChanged
- type GroupSetClientsRequest
- type GroupSetClientsResponse
- type GroupSetMuteRequest
- type GroupSetMuteResponse
- type GroupSetNameRequest
- type GroupSetNameResponse
- type GroupSetStreamRequest
- type GroupSetStreamResponse
- type LoopStatus
- type Metadata
- type Notification
- type NotificationMethod
- type PlaybackStatus
- type Properties
- type Request
- type RequestMethod
- type Response
- type Server
- type ServerDeleteClient
- type ServerDeleteClientResponse
- type ServerGetRPCVersion
- type ServerGetRPCVersionResponse
- type ServerGetStatusRequest
- type ServerGetStatusResponse
- type ServerOnUpdate
- type Snapserver
- type Stream
- type StreamAddStream
- type StreamAddStreamResponse
- type StreamCommand
- type StreamControl
- type StreamControlResponse
- type StreamOnProperties
- type StreamOnUpdate
- type StreamRemoveStream
- type StreamRemoveStreamResponse
- type StreamSetProperty
- type StreamSetPropertyResponse
- type StreamStatus
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseResult ¶
Types ¶
type Client ¶
type Client struct {
Config struct {
Instance int `json:"instance"`
Latency int `json:"latency"`
Name string `json:"name"`
Volume Volume `json:"volume"`
} `json:"config"`
Connected bool `json:"connected"`
Host struct {
Arch string `json:"arch"`
IP string `json:"ip"`
MAC string `json:"mac"`
Name string `json:"name"`
OS string `json:"os"`
} `json:"host"`
ID string `json:"id"`
LastSeen struct {
Sec int `json:"sec"`
USec int `json:"usec"`
} `json:"lastSeen"`
Snapclient struct {
Name string `json:"name"`
ProtocolVersion int `json:"protocolVersion"`
Version string `json:"version"`
} `json:"snapclient"`
}
type ClientGetStatusRequest ¶
type ClientGetStatusRequest struct {
ID string `json:"id"`
}
Request Response
type ClientGetStatusResponse ¶
type ClientGetStatusResponse struct {
Client Client `json:"client"`
}
Request Response
type ClientOnConnect ¶
Notifications
type ClientOnDisconnect ¶
Notifications
type ClientOnLatencyChanged ¶
Notifications
type ClientOnNameChanged ¶
Notifications
type ClientOnVolumeChanged ¶
Notifications
type ClientSetLatencyRequest ¶
Request Response
type ClientSetLatencyResponse ¶
type ClientSetLatencyResponse struct {
Latency int `json:"latency"`
}
Request Response
type ClientSetNameRequest ¶
Request Response
type ClientSetNameResponse ¶
type ClientSetNameResponse struct {
Name string `json:"name"`
}
Request Response
type ClientSetVolumeRequest ¶
Request Response
type ClientSetVolumeResponse ¶
type ClientSetVolumeResponse struct {
Volume Volume `json:"volume"`
}
Request Response
type GroupGetStatusRequest ¶
type GroupGetStatusRequest struct {
ID string `json:"id"`
}
Request Response
type GroupGetStatusResponse ¶
type GroupGetStatusResponse struct {
Group Group `json:"group"`
}
Request Response
type GroupOnMute ¶
Notifications
type GroupOnNameChanged ¶
Notifications
type GroupOnStreamChanged ¶
Notifications
type GroupSetClientsRequest ¶
Request Response
type GroupSetClientsResponse ¶
type GroupSetClientsResponse struct {
Clients []*Client `json:"clients"`
}
Request Response
type GroupSetMuteRequest ¶
Request Response
type GroupSetMuteResponse ¶
type GroupSetMuteResponse struct {
Muted bool `json:"muted"`
}
Request Response
type GroupSetNameRequest ¶
Request Response
type GroupSetNameResponse ¶
type GroupSetNameResponse struct {
Name string `json:"name"`
}
Request Response
type GroupSetStreamRequest ¶
Request Response
type GroupSetStreamResponse ¶
type GroupSetStreamResponse struct {
StreamID string `json:"stream_id"`
}
Request Response
type LoopStatus ¶
type LoopStatus string
const ( LoopNone LoopStatus = "none" LoopTrack LoopStatus = "track" LoopPlaylist LoopStatus = "playlist" )
type Metadata ¶
type Metadata struct {
TrackID string `json:"trackId,omitempty"`
Title string `json:"title,omitempty"`
Artist []string `json:"artist,omitempty"`
Album string `json:"album,omitempty"`
AlbumArtist []string `json:"albumArtist,omitempty"`
Genre []string `json:"genre,omitempty"`
Duration float64 `json:"duration,omitempty"`
TrackNumber int `json:"trackNumber,omitempty"`
DiscNumber int `json:"discNumber,omitempty"`
Date string `json:"date,omitempty"`
ArtURL string `json:"artUrl,omitempty"`
URL string `json:"url,omitempty"`
}
type Notification ¶
type Notification struct {
ID *int `json:"id,omitempty"`
JsonRPC string `json:"jsonrpc,omitempty"`
Method *NotificationMethod `json:"method,omitempty"`
Params interface{} `json:"params,omitempty"`
ReceivedAt time.Time `json:"-"`
}
type NotificationMethod ¶
type NotificationMethod string
const ( // Client MethodClientOnConnect NotificationMethod = "Client.OnConnect" MethodClientOnDisconnect NotificationMethod = "Client.OnDisconnect" MethodClientOnVolumeChanged NotificationMethod = "Client.OnVolumeChanged" MethodClientOnLatencyChanged NotificationMethod = "Client.OnLatencyChanged" MethodClientOnNameChanged NotificationMethod = "Client.OnNameChanged" // Group MethodGroupOnMute NotificationMethod = "Group.OnMute" MethodGroupOnStreamChanged NotificationMethod = "Group.OnStreamChanged" MethodGroupOnNameChanged NotificationMethod = "Group.OnNameChanged" // Stream MethodStreamOnProperties NotificationMethod = "Stream.OnProperties" MethodStreamOnUpdate NotificationMethod = "Stream.OnUpdate" // Server MethodServerOnUpdate NotificationMethod = "Server.OnUpdate" )
Notifications
type PlaybackStatus ¶
type PlaybackStatus string
const ( PlaybackPlaying PlaybackStatus = "playing" PlaybackPaused PlaybackStatus = "paused" PlaybackStopped PlaybackStatus = "stopped" )
type Properties ¶
type Properties struct {
PlaybackStatus PlaybackStatus `json:"playbackStatus,omitempty"`
LoopStatus LoopStatus `json:"loopStatus,omitempty"`
Shuffle bool `json:"shuffle,omitempty"`
Volume int `json:"volume,omitempty"`
Mute bool `json:"mute,omitempty"`
Rate float64 `json:"rate,omitempty"`
Position float64 `json:"position,omitempty"`
CanGoNext bool `json:"canGoNext,omitempty"`
CanGoPrevious bool `json:"canGoPrevious,omitempty"`
CanPlay bool `json:"canPlay,omitempty"`
CanPause bool `json:"canPause,omitempty"`
CanSeek bool `json:"canSeek,omitempty"`
CanControl bool `json:"canControl,omitempty"`
Metadata *Metadata `json:"metadata,omitempty"`
}
type Request ¶
type Request struct {
ID *int `json:"id,omitempty"`
JsonRPC string `json:"jsonrpc,omitempty"`
Method *RequestMethod `json:"method,omitempty"`
Params interface{} `json:"params,omitempty"`
}
type RequestMethod ¶
type RequestMethod string
const ( // Client MethodClientGetStatus RequestMethod = "Client.GetStatus" MethodClientSetVolume RequestMethod = "Client.SetVolume" MethodClientSetLatency RequestMethod = "Client.SetLatency" MethodClientSetName RequestMethod = "Client.SetName" // Group MethodGroupGetStatus RequestMethod = "Group.GetStatus" MethodGroupSetMute RequestMethod = "Group.SetMute" MethodGroupSetStream RequestMethod = "Group.SetStream" MethodGroupSetClients RequestMethod = "Group.SetClients" MethodGroupSetName RequestMethod = "Group.SetName" // Server MethodServerGetRPCVersion RequestMethod = "Server.GetRPCVersion" MethodServerGetStatus RequestMethod = "Server.GetStatus" MethodServerDeleteClient RequestMethod = "Server.DeleteClient" // Stream MethodStreamAddStream RequestMethod = "Stream.AddStream" MethodStreamRemoveStream RequestMethod = "Stream.RemoveStream" MethodStreamControl RequestMethod = "Stream.Control" MethodStreamSetProperty RequestMethod = "Stream.SetProperty" )
Requests
type ServerDeleteClientResponse ¶
type ServerDeleteClientResponse struct {
Server Server `json:"server"`
}
Request Response
type ServerGetRPCVersionResponse ¶
type ServerGetRPCVersionResponse struct {
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
}
Request Response
type ServerGetStatusResponse ¶
type ServerGetStatusResponse struct {
Server Server `json:"server"`
}
Request Response
type Snapserver ¶
type Stream ¶
type Stream struct {
ID string `json:"id"`
Status StreamStatus `json:"status"`
URI struct {
Fragment string `json:"fragment"`
Host string `json:"host"`
Path string `json:"path"`
Query map[string]string `json:"query"`
Raw string `json:"raw"`
Scheme string `json:"scheme"`
} `json:"uri"`
Properties *Properties `json:"properties,omitempty"`
}
type StreamAddStream ¶
type StreamAddStream struct {
StreamUri string `json:"streamUri"`
}
Request Response
type StreamAddStreamResponse ¶
type StreamAddStreamResponse struct {
StreamId string `json:"stream_id"`
}
Request Response
type StreamCommand ¶
type StreamCommand string
const ( StreamCommandNext StreamCommand = "next" StreamCommandPrevious StreamCommand = "previous" StreamCommandPlay StreamCommand = "play" StreamCommandPause StreamCommand = "pause" StreamCommandPlayPause StreamCommand = "playPause" StreamCommandStop StreamCommand = "stop" StreamCommandSeek StreamCommand = "seek" StreamCommandSetPosition StreamCommand = "setPosition" )
type StreamControl ¶
type StreamControl struct {
ID string `json:"id"`
Command StreamCommand `json:"command"`
Params interface{} `json:"params,omitempty"`
}
Request Response
type StreamOnProperties ¶
type StreamOnProperties struct {
ID string `json:"id"`
Properties Properties `json:"properties"`
}
Notifications
type StreamOnUpdate ¶
Notifications
type StreamRemoveStreamResponse ¶
type StreamRemoveStreamResponse struct {
StreamId string `json:"stream_id"`
}
Request Response
type StreamSetProperty ¶
type StreamSetProperty struct {
ID string `json:"id"`
Property string `json:"property"`
Value interface{} `json:"value"`
}
Request Response
type StreamStatus ¶
type StreamStatus string
const ( StreamIdle StreamStatus = "idle" StreamPlaying StreamStatus = "playing" )
func (StreamStatus) IsIdle ¶
func (s StreamStatus) IsIdle() bool
func (StreamStatus) IsPlaying ¶
func (s StreamStatus) IsPlaying() bool
Click to show internal directories.
Click to hide internal directories.