Documentation
¶
Overview ¶
Package daemon provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- Variables
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- type ApiAddToQueue
- type ApiEvent
- type ApiEventDataMetadata
- type ApiEventDataNotPlaying
- type ApiEventDataPaused
- type ApiEventDataPlaying
- type ApiEventDataRepeatContext
- type ApiEventDataRepeatTrack
- type ApiEventDataSeek
- type ApiEventDataShuffleContext
- type ApiEventDataStopped
- type ApiEventDataVolume
- type ApiEventDataWillPlay
- type ApiEventType
- type ApiNext
- type ApiOutput
- type ApiPlay
- type ApiRepeatContext
- type ApiRepeatTrack
- type ApiRequest
- type ApiRequestDataWebApi
- type ApiRequestType
- type ApiRoot
- type ApiSeek
- type ApiServer
- type ApiSetDeviceName
- type ApiSetVolume
- type ApiShuffleContext
- type ApiStatus
- type ApiToken
- type ApiTrack
- type ApiVolume
- type App
- type AppPlayer
- type CacheConfig
- type ConcreteApiServer
- func (s *ConcreteApiServer) Close() error
- func (s *ConcreteApiServer) Emit(ev *ApiEvent)
- func (s *ConcreteApiServer) GetEvents(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) GetRoot(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) GetStatus(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) GetToken(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerGetVolume(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerNext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerOutput(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerPause(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerPlay(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerPlayPause(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerPrev(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerResume(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) PlayerSeek(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
- func (s *ConcreteApiServer) PlayerStop(w http.ResponseWriter, _ *http.Request)
- func (s *ConcreteApiServer) Receive() <-chan ApiRequest
- func (s *ConcreteApiServer) SetDeviceName(w http.ResponseWriter, r *http.Request)
- type Config
- type CredentialsConfig
- type InteractiveCredentials
- type InvalidParamFormatError
- type MiddlewareFunc
- type Options
- type PlayerAddToQueueJSONRequestBody
- type PlayerNextJSONRequestBody
- type PlayerOutputJSONRequestBody
- type PlayerPlayJSONRequestBody
- type PlayerRepeatContextJSONRequestBody
- type PlayerRepeatTrackJSONRequestBody
- type PlayerSeekJSONRequestBody
- type PlayerSetVolumeJSONRequestBody
- type PlayerShuffleContextJSONRequestBody
- type ProductInfo
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetRoot(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetToken(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerGetVolume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerNext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerOutput(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPause(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPlay(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPlayPause(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerPrev(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerResume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerSeek(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PlayerStop(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SetDeviceName(w http.ResponseWriter, r *http.Request)
- type SetDeviceNameJSONRequestBody
- type SpotifyTokenCredentials
- type State
- type StdHTTPServerOptions
- type StubApiServer
- type TooManyValuesForParamError
- type TrackCodec
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type ZeroconfCredentials
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSession = errors.New("no session") ErrBadRequest = errors.New("bad request") ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") ErrMethodNotAllowed = errors.New("method not allowed") ErrTooManyRequests = errors.New("the app has exceeded its rate limits") )
Functions ¶
func Handler ¶ added in v0.9.0
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶ added in v0.9.0
func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶ added in v0.9.0
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
func HandlerWithOptions ¶ added in v0.9.0
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ApiAddToQueue ¶ added in v0.9.0
type ApiAddToQueue struct {
// Uri The URI for the track that should be added
Uri string `json:"uri"`
}
ApiAddToQueue An add to queue payload
type ApiEvent ¶
type ApiEvent struct {
Type ApiEventType `json:"type"`
Data any `json:"data"`
}
type ApiEventDataMetadata ¶
type ApiEventDataMetadata ApiTrack
type ApiEventDataNotPlaying ¶
type ApiEventDataPaused ¶
type ApiEventDataPlaying ¶
type ApiEventDataRepeatContext ¶
type ApiEventDataRepeatContext struct {
Value bool `json:"value"`
}
type ApiEventDataRepeatTrack ¶
type ApiEventDataRepeatTrack struct {
Value bool `json:"value"`
}
type ApiEventDataSeek ¶
type ApiEventDataShuffleContext ¶
type ApiEventDataShuffleContext struct {
Value bool `json:"value"`
}
type ApiEventDataStopped ¶
type ApiEventDataStopped struct {
PlayOrigin string `json:"play_origin"`
}
type ApiEventDataVolume ¶
type ApiEventDataVolume ApiVolume
type ApiEventDataWillPlay ¶
type ApiEventType ¶
type ApiEventType string
const ( ApiEventTypePlaying ApiEventType = "playing" ApiEventTypeNotPlaying ApiEventType = "not_playing" ApiEventTypeWillPlay ApiEventType = "will_play" ApiEventTypePaused ApiEventType = "paused" ApiEventTypeActive ApiEventType = "active" ApiEventTypeInactive ApiEventType = "inactive" ApiEventTypeMetadata ApiEventType = "metadata" ApiEventTypeVolume ApiEventType = "volume" ApiEventTypeSeek ApiEventType = "seek" ApiEventTypeStopped ApiEventType = "stopped" ApiEventTypeRepeatTrack ApiEventType = "repeat_track" ApiEventTypeRepeatContext ApiEventType = "repeat_context" ApiEventTypeShuffleContext ApiEventType = "shuffle_context" ApiEventTypePlaybackReady ApiEventType = "playback_ready" )
type ApiNext ¶ added in v0.9.0
type ApiNext struct {
// Uri The track URI to skip to. When omitted the next track in the context is played.
Uri *string `json:"uri,omitempty"`
}
ApiNext A skip to next payload
type ApiOutput ¶ added in v0.9.0
type ApiOutput struct {
// Device The output device name to open (backend-specific, e.g. an ALSA device). Empty selects the configured default.
Device string `json:"device,omitempty"`
}
ApiOutput A reopen audio output payload
type ApiPlay ¶ added in v0.9.0
type ApiPlay struct {
// Paused Start playback as paused
Paused bool `json:"paused,omitempty"`
// Position Position in milliseconds to start playback at within the selected track (0 starts from the beginning)
Position int64 `json:"position,omitempty"`
// SkipToUri Spotify URI to skip to (when playing playlists)
SkipToUri string `json:"skip_to_uri,omitempty"`
// Uri Spotify URI to start playing
Uri string `json:"uri"`
}
ApiPlay An initiate playback payload
type ApiRepeatContext ¶ added in v0.9.0
type ApiRepeatContext struct {
// RepeatContext Whether repeating context should be enabled
RepeatContext bool `json:"repeat_context"`
}
ApiRepeatContext A toggle repeating context payload
type ApiRepeatTrack ¶ added in v0.9.0
type ApiRepeatTrack struct {
// RepeatTrack Whether repeating track should be enabled
RepeatTrack bool `json:"repeat_track"`
}
ApiRepeatTrack A toggle repeating track payload
type ApiRequest ¶
type ApiRequest struct {
Type ApiRequestType
Data any
// contains filtered or unexported fields
}
func NewApiRequest ¶
func NewApiRequest(t ApiRequestType, data any) (req ApiRequest, wait func(context.Context) (any, error))
NewApiRequest builds an ApiRequest pre-wired with a reply channel, plus a wait function that blocks until the daemon calls Reply (or ctx is done).
func (*ApiRequest) Reply ¶
func (r *ApiRequest) Reply(data any, err error)
type ApiRequestDataWebApi ¶
ApiRequestDataWebApi is not in the spec: /web-api/ is a catch-all proxy whose path continues for any number of segments, so it is routed by hand.
type ApiRequestType ¶
type ApiRequestType string
const ( ApiRequestTypeRoot ApiRequestType = "root" ApiRequestTypeWebApi ApiRequestType = "web_api" ApiRequestTypeStatus ApiRequestType = "status" ApiRequestTypeResume ApiRequestType = "resume" ApiRequestTypePause ApiRequestType = "pause" ApiRequestTypePlayPause ApiRequestType = "playpause" ApiRequestTypeSeek ApiRequestType = "seek" ApiRequestTypePrev ApiRequestType = "prev" ApiRequestTypeNext ApiRequestType = "next" ApiRequestTypePlay ApiRequestType = "play" ApiRequestTypeStop ApiRequestType = "stop" ApiRequestTypeGetVolume ApiRequestType = "get_volume" ApiRequestTypeSetVolume ApiRequestType = "set_volume" ApiRequestTypeSetRepeatingContext ApiRequestType = "repeating_context" ApiRequestTypeSetRepeatingTrack ApiRequestType = "repeating_track" ApiRequestTypeSetShufflingContext ApiRequestType = "shuffling_context" ApiRequestTypeAddToQueue ApiRequestType = "add_to_queue" ApiRequestTypeToken ApiRequestType = "token" ApiRequestSetDeviceName ApiRequestType = "set_device_name" ApiRequestTypeReopenOutput ApiRequestType = "reopen_output" )
type ApiRoot ¶ added in v0.9.0
type ApiRoot struct {
// PlaybackReady Whether the daemon is fully bootstrapped and ready to accept /player/play
PlaybackReady bool `json:"playback_ready"`
}
ApiRoot API reachability and playback readiness
type ApiSeek ¶ added in v0.9.0
type ApiSeek struct {
// Position Seek position in milliseconds. Must not be negative unless relative is set.
Position int64 `json:"position"`
// Relative Whether the seek position is relative to the current one
Relative bool `json:"relative,omitempty"`
}
ApiSeek A seek payload
type ApiServer ¶
type ApiServer interface {
Emit(ev *ApiEvent)
Receive() <-chan ApiRequest
Close() error
}
func NewApiServer ¶
type ApiSetDeviceName ¶ added in v0.9.0
type ApiSetDeviceName struct {
// Name The new device name
Name string `json:"name"`
}
ApiSetDeviceName A set device name payload
type ApiSetVolume ¶ added in v0.9.0
type ApiSetVolume struct {
// Relative Whether to change the volume relative to the current volume
Relative bool `json:"relative,omitempty"`
// Volume Volume from 0 to max. Must not be negative unless relative is set.
Volume int32 `json:"volume"`
}
ApiSetVolume A set volume payload
type ApiShuffleContext ¶ added in v0.9.0
type ApiShuffleContext struct {
// ShuffleContext Whether shuffling context should be enabled
ShuffleContext bool `json:"shuffle_context"`
}
ApiShuffleContext A toggle shuffling context payload
type ApiStatus ¶ added in v0.9.0
type ApiStatus struct {
// Buffering Whether the player is buffering
Buffering bool `json:"buffering"`
// DeviceId The player device ID
DeviceId string `json:"device_id"`
// DeviceName The player device name
DeviceName string `json:"device_name"`
// DeviceType The player device type, for example COMPUTER or SPEAKER
DeviceType string `json:"device_type"`
// Paused Whether the player is paused
Paused bool `json:"paused"`
// PlayOrigin Who started the playback, "go-librespot" identifies the API as the play origin, everything else is Spotify own stuff
PlayOrigin string `json:"play_origin"`
// RepeatContext Whether the repeat context feature is enabled
RepeatContext bool `json:"repeat_context"`
// RepeatTrack Whether the repeat track feature is enabled
RepeatTrack bool `json:"repeat_track"`
// ShuffleContext Whether the shuffle context feature is enabled
ShuffleContext bool `json:"shuffle_context"`
// Stopped Whether the player is stopped
Stopped bool `json:"stopped"`
Track *ApiTrack `json:"track"`
// Username Currently active account's username
Username string `json:"username"`
// Volume The player current volume from 0 to max
Volume uint32 `json:"volume"`
// VolumeSteps The player max volume value
VolumeSteps uint32 `json:"volume_steps"`
}
ApiStatus The player status
type ApiToken ¶ added in v0.9.0
type ApiToken struct {
// Token The access token
Token string `json:"token"`
}
ApiToken A Spotify access token for the active session
type ApiTrack ¶ added in v0.9.0
type ApiTrack struct {
// AlbumCoverUrl Album cover URL
AlbumCoverUrl *string `json:"album_cover_url"`
// AlbumName Album name
AlbumName string `json:"album_name"`
// ArtistNames Artists name
ArtistNames []string `json:"artist_names"`
// BitDepth Bits per sample of the source audio, null for lossy formats which have no meaningful source bit depth
BitDepth *int `json:"bit_depth"`
// Bitrate Nominal bitrate in kbps, null for formats without a fixed one such as FLAC
Bitrate *int `json:"bitrate"`
// Codec Codec family of the audio file
Codec TrackCodec `json:"codec"`
// DiscNumber Disc number within the album, zero for episodes
DiscNumber int `json:"disc_number"`
// Duration Duration in milliseconds
Duration int `json:"duration"`
// Format Spotify name of the audio file being decoded, for example OGG_VORBIS_160
Format string `json:"format"`
// Name Name
Name string `json:"name"`
// Position Playback position in milliseconds
Position int64 `json:"position"`
// ReleaseDate Album release date, empty for episodes
ReleaseDate string `json:"release_date"`
// SampleRate Sample rate of the decoded audio in Hz
SampleRate *int `json:"sample_rate"`
// TrackNumber Track number within the disc, zero for episodes
TrackNumber int `json:"track_number"`
// Uri URI
Uri string `json:"uri"`
}
ApiTrack A track or podcast episode
type ApiVolume ¶ added in v0.9.0
type ApiVolume struct {
// Max The max volume value
Max uint32 `json:"max"`
// Value The current volume, ranging from 0 to max
Value uint32 `json:"value"`
}
ApiVolume The player volume settings
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Run ¶
Run starts the daemon. It blocks until ctx is cancelled or an unrecoverable error occurs. The credential type configured in cfg.Credentials.Type determines which login flow is used.
func (*App) SetDeviceName ¶ added in v0.7.3
type AppPlayer ¶
type AppPlayer struct {
// contains filtered or unexported fields
}
func (*AppPlayer) Close ¶
func (p *AppPlayer) Close()
Close stops the player and releases its session. It may be called while Run is still busy serving a command, so it must not assume Run reacts promptly: cancelling the context is what actually unblocks in-flight requests.
func (*AppPlayer) Run ¶
func (p *AppPlayer) Run(apiRecv <-chan ApiRequest, mprisRecv <-chan mpris.MediaPlayer2PlayerCommand)
type CacheConfig ¶ added in v0.8.0
type CacheConfig struct {
// Enabled turns the audio file cache on or off.
Enabled bool
// Dir is the directory the cache is stored in.
Dir string
// SizeLimit is the maximum total size of the cached audio files in bytes.
// A value of zero disables eviction (unbounded cache).
SizeLimit int64
}
CacheConfig configures the on-disk cache for downloaded (encrypted) audio files.
type ConcreteApiServer ¶
type ConcreteApiServer struct {
// contains filtered or unexported fields
}
func (*ConcreteApiServer) Close ¶
func (s *ConcreteApiServer) Close() error
func (*ConcreteApiServer) Emit ¶
func (s *ConcreteApiServer) Emit(ev *ApiEvent)
func (*ConcreteApiServer) GetEvents ¶ added in v0.9.0
func (s *ConcreteApiServer) GetEvents(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) GetRoot ¶ added in v0.9.0
func (s *ConcreteApiServer) GetRoot(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) GetStatus ¶ added in v0.9.0
func (s *ConcreteApiServer) GetStatus(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) GetToken ¶ added in v0.9.0
func (s *ConcreteApiServer) GetToken(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerAddToQueue ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerGetVolume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerGetVolume(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerNext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerNext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerOutput ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerOutput(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerPause ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPause(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerPlay ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPlay(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerPlayPause ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPlayPause(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerPrev ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerPrev(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerRepeatContext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerRepeatTrack ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerResume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerResume(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) PlayerSeek ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerSeek(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerSetVolume ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerShuffleContext ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
func (*ConcreteApiServer) PlayerStop ¶ added in v0.9.0
func (s *ConcreteApiServer) PlayerStop(w http.ResponseWriter, _ *http.Request)
func (*ConcreteApiServer) Receive ¶
func (s *ConcreteApiServer) Receive() <-chan ApiRequest
func (*ConcreteApiServer) SetDeviceName ¶ added in v0.9.0
func (s *ConcreteApiServer) SetDeviceName(w http.ResponseWriter, r *http.Request)
type Config ¶
type Config struct {
DeviceId string
DeviceName string
DeviceType string
ClientToken string
AudioBackend string
AudioBackendRuntimeSocket string
AudioDevice string
MixerDevice string
MixerControlName string
AudioBufferTime int
AudioPeriodCount int
AudioOutputPipe string
AudioOutputPipeFormat string
AudioOutputPipeWaitForReader bool
Bitrate int
VolumeSteps uint32
InitialVolume uint32
IgnoreLastVolume bool
NormalisationDisabled bool
NormalisationUseAlbumGain bool
NormalisationPregain float32
CrossfadeDuration int
ExternalVolume bool
DisableAutoplay bool
ZeroconfEnabled bool
ZeroconfPort int
ZeroconfBackend string
ZeroconfInterfacesToAdvertise []string
FlacEnabled bool
// PreferFirewallFriendlyPorts tries accesspoints on 443 and 80 before the
// default 4070, which some networks block outbound.
PreferFirewallFriendlyPorts bool
// ImageSize selects which cover-art image variant the API server returns:
// "default", "small", "medium", "large", "xlarge".
ImageSize string
Cache CacheConfig
Credentials CredentialsConfig
}
Config carries the runtime configuration for a daemon instance.
type CredentialsConfig ¶
type CredentialsConfig struct {
Type string
Interactive InteractiveCredentials
SpotifyToken SpotifyTokenCredentials
Zeroconf ZeroconfCredentials
}
type InteractiveCredentials ¶
type InteractiveCredentials struct {
CallbackPort int
}
type InvalidParamFormatError ¶ added in v0.9.0
func (*InvalidParamFormatError) Error ¶ added in v0.9.0
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶ added in v0.9.0
func (e *InvalidParamFormatError) Unwrap() error
type Options ¶
type Options struct {
Logger librespot.Logger
Config *Config
StateStore librespot.StateStore
APIServer ApiServer
MediaPlayer mpris.Server
}
Options bundles the dependencies a daemon needs at construction time.
type PlayerAddToQueueJSONRequestBody ¶ added in v0.9.0
type PlayerAddToQueueJSONRequestBody = ApiAddToQueue
PlayerAddToQueueJSONRequestBody defines body for PlayerAddToQueue for application/json ContentType.
type PlayerNextJSONRequestBody ¶ added in v0.9.0
type PlayerNextJSONRequestBody = ApiNext
PlayerNextJSONRequestBody defines body for PlayerNext for application/json ContentType.
type PlayerOutputJSONRequestBody ¶ added in v0.9.0
type PlayerOutputJSONRequestBody = ApiOutput
PlayerOutputJSONRequestBody defines body for PlayerOutput for application/json ContentType.
type PlayerPlayJSONRequestBody ¶ added in v0.9.0
type PlayerPlayJSONRequestBody = ApiPlay
PlayerPlayJSONRequestBody defines body for PlayerPlay for application/json ContentType.
type PlayerRepeatContextJSONRequestBody ¶ added in v0.9.0
type PlayerRepeatContextJSONRequestBody = ApiRepeatContext
PlayerRepeatContextJSONRequestBody defines body for PlayerRepeatContext for application/json ContentType.
type PlayerRepeatTrackJSONRequestBody ¶ added in v0.9.0
type PlayerRepeatTrackJSONRequestBody = ApiRepeatTrack
PlayerRepeatTrackJSONRequestBody defines body for PlayerRepeatTrack for application/json ContentType.
type PlayerSeekJSONRequestBody ¶ added in v0.9.0
type PlayerSeekJSONRequestBody = ApiSeek
PlayerSeekJSONRequestBody defines body for PlayerSeek for application/json ContentType.
type PlayerSetVolumeJSONRequestBody ¶ added in v0.9.0
type PlayerSetVolumeJSONRequestBody = ApiSetVolume
PlayerSetVolumeJSONRequestBody defines body for PlayerSetVolume for application/json ContentType.
type PlayerShuffleContextJSONRequestBody ¶ added in v0.9.0
type PlayerShuffleContextJSONRequestBody = ApiShuffleContext
PlayerShuffleContextJSONRequestBody defines body for PlayerShuffleContext for application/json ContentType.
type ProductInfo ¶
type ProductInfo struct {
XMLName xml.Name `xml:"products"`
Products []struct {
XMLName xml.Name `xml:"product"`
Type string `xml:"type"`
HeadFilesUrl string `xml:"head-files-url"`
ImageUrl string `xml:"image-url"`
} `xml:"product"`
}
func (ProductInfo) ImageUrl ¶
func (pi ProductInfo) ImageUrl(fileId []byte) *string
type RequiredHeaderError ¶ added in v0.9.0
func (*RequiredHeaderError) Error ¶ added in v0.9.0
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶ added in v0.9.0
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶ added in v0.9.0
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶ added in v0.9.0
func (e *RequiredParamError) Error() string
type ServeMux ¶ added in v0.9.0
type ServeMux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
ServeMux is an abstraction of http.ServeMux.
type ServerInterface ¶ added in v0.9.0
type ServerInterface interface {
// (GET /)
GetRoot(w http.ResponseWriter, r *http.Request)
// (GET /events)
GetEvents(w http.ResponseWriter, r *http.Request)
// (POST /player/add_to_queue)
PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
// (POST /player/next)
PlayerNext(w http.ResponseWriter, r *http.Request)
// (POST /player/output)
PlayerOutput(w http.ResponseWriter, r *http.Request)
// (POST /player/pause)
PlayerPause(w http.ResponseWriter, r *http.Request)
// (POST /player/play)
PlayerPlay(w http.ResponseWriter, r *http.Request)
// (POST /player/playpause)
PlayerPlayPause(w http.ResponseWriter, r *http.Request)
// (POST /player/prev)
PlayerPrev(w http.ResponseWriter, r *http.Request)
// (POST /player/repeat_context)
PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
// (POST /player/repeat_track)
PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
// (POST /player/resume)
PlayerResume(w http.ResponseWriter, r *http.Request)
// (POST /player/seek)
PlayerSeek(w http.ResponseWriter, r *http.Request)
// (POST /player/shuffle_context)
PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
// (POST /player/stop)
PlayerStop(w http.ResponseWriter, r *http.Request)
// (GET /player/volume)
PlayerGetVolume(w http.ResponseWriter, r *http.Request)
// (POST /player/volume)
PlayerSetVolume(w http.ResponseWriter, r *http.Request)
// (POST /set_device_name)
SetDeviceName(w http.ResponseWriter, r *http.Request)
// (GET /status)
GetStatus(w http.ResponseWriter, r *http.Request)
// (POST /token)
GetToken(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶ added in v0.9.0
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetEvents ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
GetEvents operation middleware
func (*ServerInterfaceWrapper) GetRoot ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetRoot(w http.ResponseWriter, r *http.Request)
GetRoot operation middleware
func (*ServerInterfaceWrapper) GetStatus ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request)
GetStatus operation middleware
func (*ServerInterfaceWrapper) GetToken ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) GetToken(w http.ResponseWriter, r *http.Request)
GetToken operation middleware
func (*ServerInterfaceWrapper) PlayerAddToQueue ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerAddToQueue(w http.ResponseWriter, r *http.Request)
PlayerAddToQueue operation middleware
func (*ServerInterfaceWrapper) PlayerGetVolume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerGetVolume(w http.ResponseWriter, r *http.Request)
PlayerGetVolume operation middleware
func (*ServerInterfaceWrapper) PlayerNext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerNext(w http.ResponseWriter, r *http.Request)
PlayerNext operation middleware
func (*ServerInterfaceWrapper) PlayerOutput ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerOutput(w http.ResponseWriter, r *http.Request)
PlayerOutput operation middleware
func (*ServerInterfaceWrapper) PlayerPause ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPause(w http.ResponseWriter, r *http.Request)
PlayerPause operation middleware
func (*ServerInterfaceWrapper) PlayerPlay ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPlay(w http.ResponseWriter, r *http.Request)
PlayerPlay operation middleware
func (*ServerInterfaceWrapper) PlayerPlayPause ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPlayPause(w http.ResponseWriter, r *http.Request)
PlayerPlayPause operation middleware
func (*ServerInterfaceWrapper) PlayerPrev ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerPrev(w http.ResponseWriter, r *http.Request)
PlayerPrev operation middleware
func (*ServerInterfaceWrapper) PlayerRepeatContext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerRepeatContext(w http.ResponseWriter, r *http.Request)
PlayerRepeatContext operation middleware
func (*ServerInterfaceWrapper) PlayerRepeatTrack ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerRepeatTrack(w http.ResponseWriter, r *http.Request)
PlayerRepeatTrack operation middleware
func (*ServerInterfaceWrapper) PlayerResume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerResume(w http.ResponseWriter, r *http.Request)
PlayerResume operation middleware
func (*ServerInterfaceWrapper) PlayerSeek ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerSeek(w http.ResponseWriter, r *http.Request)
PlayerSeek operation middleware
func (*ServerInterfaceWrapper) PlayerSetVolume ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerSetVolume(w http.ResponseWriter, r *http.Request)
PlayerSetVolume operation middleware
func (*ServerInterfaceWrapper) PlayerShuffleContext ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerShuffleContext(w http.ResponseWriter, r *http.Request)
PlayerShuffleContext operation middleware
func (*ServerInterfaceWrapper) PlayerStop ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) PlayerStop(w http.ResponseWriter, r *http.Request)
PlayerStop operation middleware
func (*ServerInterfaceWrapper) SetDeviceName ¶ added in v0.9.0
func (siw *ServerInterfaceWrapper) SetDeviceName(w http.ResponseWriter, r *http.Request)
SetDeviceName operation middleware
type SetDeviceNameJSONRequestBody ¶ added in v0.9.0
type SetDeviceNameJSONRequestBody = ApiSetDeviceName
SetDeviceNameJSONRequestBody defines body for SetDeviceName for application/json ContentType.
type SpotifyTokenCredentials ¶
type StdHTTPServerOptions ¶ added in v0.9.0
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type StubApiServer ¶
type StubApiServer struct {
// contains filtered or unexported fields
}
func (*StubApiServer) Close ¶
func (s *StubApiServer) Close() error
func (*StubApiServer) Emit ¶
func (s *StubApiServer) Emit(ev *ApiEvent)
func (*StubApiServer) Receive ¶
func (s *StubApiServer) Receive() <-chan ApiRequest
type TooManyValuesForParamError ¶ added in v0.9.0
func (*TooManyValuesForParamError) Error ¶ added in v0.9.0
func (e *TooManyValuesForParamError) Error() string
type TrackCodec ¶ added in v0.9.0
type TrackCodec string
TrackCodec Codec family of the audio file
const ( TrackCodecAac TrackCodec = "aac" TrackCodecEmpty TrackCodec = "" TrackCodecFlac TrackCodec = "flac" TrackCodecMp3 TrackCodec = "mp3" TrackCodecUnknown TrackCodec = "unknown" TrackCodecVorbis TrackCodec = "vorbis" )
Defines values for TrackCodec.
type UnescapedCookieParamError ¶ added in v0.9.0
func (*UnescapedCookieParamError) Error ¶ added in v0.9.0
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶ added in v0.9.0
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶ added in v0.9.0
func (*UnmarshalingParamError) Error ¶ added in v0.9.0
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶ added in v0.9.0
func (e *UnmarshalingParamError) Unwrap() error
type ZeroconfCredentials ¶
type ZeroconfCredentials struct {
PersistCredentials bool
}