json

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess          int16 = 4000
	StatusError            int16 = 4001
	StatusActionError      int16 = 4002
	StatusPayloadError     int16 = 4003
	StatusErrorInvalidJSON int16 = 4004
)

Variables

Functions

func ServeMessageSchemaJSON

func ServeMessageSchemaJSON(w http.ResponseWriter, r *http.Request)

func ServeResponseSchemaJSON

func ServeResponseSchemaJSON(w http.ResponseWriter, r *http.Request)

func ServeStatusRestJSON

func ServeStatusRestJSON(w http.ResponseWriter, r *http.Request)

func ServeStatusSchemaJSON

func ServeStatusSchemaJSON(w http.ResponseWriter, r *http.Request)

Types

type Action

type Action string
const (
	// Get composed informations about all sinks, sources, inputs and build
	ActionGetStatus Action = "GetStatus"

	// Metadata about build
	ActionGetBuildInfo Action = "GetBuildInfo"

	// SINKS, e.g. Speakers
	ActionSetSinkVolume Action = "SetSinkVolume"
	ActionSetSinkMuted  Action = "SetSinkMuted"

	// Apps playing audio
	ActionSetSinkInputVolume Action = "SetSinkInputVolume"
	ActionSetSinkInputMuted  Action = "SetSinkInputMuted"
	// Move App to different SINK
	ActionMoveSinkInput Action = "MoveSinkInput"

	// SOURCES, e.g. Microphones
	ActionSetSourceVolume Action = "SetSourceVolume"
	ActionSetSourceMuted  Action = "SetSourceMuted"

	// Apps active access to microphones
	ActionSetSourceInputVolume Action = "SetSourceInputVolume"
	ActionSetSourceInputMuted  Action = "SetSourceInputMuted"
	// Move App to different SOURCE
	ActionMoveSourceOutput Action = "MoveSourceOutput"
)

type Message

type Message struct {
	// Actions listed in availableCommands slice
	Action Action `` /* 271-byte string literal not displayed */
	// Paylod send with Set* actions if necessary
	Payload interface{} `json:"payload,omitempty" doc:"Paylod send with Set* actions if necessary"`
}

Message is an request from the client

type Response

type Response struct {
	// Action performed by API
	Action string `json:"action" doc:"Action performed by API"`
	// Status code
	Status int16 `json:"status" doc:"Status code"`
	// Response payload
	Payload interface{} `json:"payload" doc:"Response payload"`
	// Error description if any
	Error string `json:"error,omitempty" doc:"Error description if any"`
}

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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