Documentation
¶
Index ¶
- Constants
- Variables
- type ActiveMedia
- type AddMappingParams
- type AllMappingsResponse
- type ClientResponse
- type DeleteClientParams
- type DeleteInboxParams
- type DeleteMappingParams
- type ErrorObject
- type HealthCheckResponse
- type HistoryResponse
- type HistoryResponseEntry
- type InboxMessage
- type InboxResponse
- type IndexingStatusResponse
- type LogDownloadResponse
- type MappingResponse
- type MediaIndexParams
- type MediaResponse
- type MediaStartedParams
- type NewClientParams
- type Notification
- type PaginationInfo
- type PlaytimeLimitReachedParams
- type PlaytimeLimitWarningParams
- type PlaytimeLimitsResponse
- type PlaytimeStatusResponse
- type RPCID
- func (id *RPCID) Equal(other RPCID) bool
- func (id *RPCID) IsAbsent() bool
- func (id *RPCID) IsAbsentOrNull() bool
- func (id *RPCID) IsNull() bool
- func (id *RPCID) Key() string
- func (id RPCID) MarshalJSON() ([]byte, error)
- func (id *RPCID) String() string
- func (id *RPCID) UnmarshalJSON(data []byte) error
- type ReaderInfo
- type ReaderResponse
- type ReaderWriteParams
- type ReadersResponse
- type RequestObject
- type ResponseErrorObject
- type ResponseObject
- type RunParams
- type RunScriptParams
- type SearchParams
- type SearchResultMedia
- type SearchResults
- type SettingsResponse
- type System
- type SystemsResponse
- type TagsResponse
- type TokenResponse
- type TokensResponse
- type UpdateActiveMediaParams
- type UpdateMappingParams
- type UpdatePlaytimeLimitsParams
- type UpdateSettingsParams
- type VersionResponse
Constants ¶
const ( NotificationReadersConnected = "readers.added" NotificationReadersDisconnected = "readers.removed" NotificationRunning = "running" NotificationTokensAdded = "tokens.added" NotificationTokensRemoved = "tokens.removed" NotificationStopped = "media.stopped" NotificationStarted = "media.started" NotificationMediaIndexing = "media.indexing" // TODO: rename to generating NotificationPlaytimeLimitReached = "playtime.limit.reached" NotificationPlaytimeLimitWarning = "playtime.limit.warning" NotificationInboxAdded = "inbox.added" )
const ( PlaytimeLimitReasonSession = "session" PlaytimeLimitReasonDaily = "daily" )
const ( MethodLaunch = "launch" // DEPRECATED MethodRun = "run" MethodRunScript = "run.script" MethodStop = "stop" MethodTokens = "tokens" MethodMedia = "media" MethodMediaGenerate = "media.generate" MethodMediaGenerateCancel = "media.generate.cancel" MethodMediaIndex = "media.index" // DEPRECATED MethodMediaSearch = "media.search" MethodMediaTags = "media.tags" MethodMediaActive = "media.active" MethodMediaActiveUpdate = "media.active.update" MethodSettings = "settings" MethodSettingsUpdate = "settings.update" MethodSettingsReload = "settings.reload" MethodSettingsLogsDownload = "settings.logs.download" MethodPlaytimeLimits = "settings.playtime.limits" MethodPlaytimeLimitsUpdate = "settings.playtime.limits.update" MethodPlaytime = "playtime" MethodClients = "clients" MethodClientsNew = "clients.new" MethodClientsDelete = "clients.delete" MethodSystems = "systems" MethodLaunchersRefresh = "launchers.refresh" MethodHistory = "tokens.history" MethodMappings = "mappings" MethodMappingsNew = "mappings.new" MethodMappingsDelete = "mappings.delete" MethodMappingsUpdate = "mappings.update" MethodMappingsReload = "mappings.reload" MethodReaders = "readers" MethodReadersWrite = "readers.write" MethodReadersWriteCancel = "readers.write.cancel" MethodVersion = "version" MethodHealthCheck = "health" MethodInbox = "inbox" MethodInboxDelete = "inbox.delete" MethodInboxClear = "inbox.clear" )
Variables ¶
var ErrInvalidRPCID = errors.New("JSON-RPC ID cannot be an object or array")
ErrInvalidRPCID is returned when an ID is an object or array.
var NullRPCID = RPCID{RawMessage: []byte("null")}
NullRPCID represents a null JSON-RPC ID.
Functions ¶
This section is empty.
Types ¶
type ActiveMedia ¶
type ActiveMedia struct {
Started time.Time `json:"started"`
LauncherID string `json:"launcherId"`
SystemID string `json:"systemId"`
SystemName string `json:"systemName"`
Path string `json:"mediaPath"`
Name string `json:"mediaName"`
}
func NewActiveMedia ¶ added in v2.7.0
func NewActiveMedia(systemID, systemName, path, name, launcherID string) *ActiveMedia
NewActiveMedia creates a new ActiveMedia with the current timestamp.
func (*ActiveMedia) Equal ¶
func (a *ActiveMedia) Equal(with *ActiveMedia) bool
type AddMappingParams ¶
type AddMappingParams struct {
Label string `json:"label" validate:"max=255"`
Type string `json:"type" validate:"required,oneof=id value data uid text"`
Match string `json:"match" validate:"required,oneof=exact partial regex"`
Pattern string `json:"pattern" validate:"required"`
Override string `json:"override"`
Enabled bool `json:"enabled"`
}
type AllMappingsResponse ¶
type AllMappingsResponse struct {
Mappings []MappingResponse `json:"mappings"`
}
type ClientResponse ¶
type DeleteClientParams ¶
type DeleteClientParams struct {
ID string `json:"id" validate:"required,min=1"`
}
type DeleteInboxParams ¶ added in v2.8.0
type DeleteInboxParams struct {
ID int64 `json:"id" validate:"gt=0"`
}
type DeleteMappingParams ¶
type DeleteMappingParams struct {
ID int `json:"id" validate:"gt=0"`
}
type ErrorObject ¶
type HealthCheckResponse ¶ added in v2.7.1
type HealthCheckResponse struct {
Status string `json:"status"`
}
type HistoryResponse ¶
type HistoryResponse struct {
Entries []HistoryResponseEntry `json:"entries"`
}
type HistoryResponseEntry ¶
type InboxMessage ¶ added in v2.8.0
type InboxResponse ¶ added in v2.8.0
type InboxResponse struct {
Messages []InboxMessage `json:"messages"`
}
type IndexingStatusResponse ¶
type IndexingStatusResponse struct {
TotalSteps *int `json:"totalSteps,omitempty"`
CurrentStep *int `json:"currentStep,omitempty"`
CurrentStepDisplay *string `json:"currentStepDisplay,omitempty"`
TotalFiles *int `json:"totalFiles,omitempty"`
TotalMedia *int `json:"totalMedia,omitempty"`
Exists bool `json:"exists"`
Indexing bool `json:"indexing"`
Optimizing bool `json:"optimizing"`
}
type LogDownloadResponse ¶
type MappingResponse ¶
type MediaIndexParams ¶
type MediaIndexParams struct {
Systems *[]string `json:"systems" validate:"omitempty,dive,system"`
}
type MediaResponse ¶
type MediaResponse struct {
Database IndexingStatusResponse `json:"database"`
Active []ActiveMedia `json:"active"`
}
type MediaStartedParams ¶
type NewClientParams ¶
type NewClientParams struct {
Name string `json:"name" validate:"required,min=1,max=255"`
}
type Notification ¶
type Notification struct {
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
type PaginationInfo ¶ added in v2.7.0
type PlaytimeLimitReachedParams ¶ added in v2.7.0
type PlaytimeLimitReachedParams struct {
Reason string `json:"reason"`
}
type PlaytimeLimitWarningParams ¶ added in v2.7.0
type PlaytimeLimitsResponse ¶ added in v2.7.0
type PlaytimeStatusResponse ¶ added in v2.7.0
type PlaytimeStatusResponse struct {
SessionStarted *string `json:"sessionStarted,omitempty"`
SessionDuration *string `json:"sessionDuration,omitempty"`
SessionCumulativeTime *string `json:"sessionCumulativeTime,omitempty"`
SessionRemaining *string `json:"sessionRemaining,omitempty"`
CooldownRemaining *string `json:"cooldownRemaining,omitempty"`
DailyUsageToday *string `json:"dailyUsageToday,omitempty"`
DailyRemaining *string `json:"dailyRemaining,omitempty"`
State string `json:"state"`
SessionActive bool `json:"sessionActive"`
LimitsEnabled bool `json:"limitsEnabled"`
}
type RPCID ¶ added in v2.8.0
type RPCID struct {
json.RawMessage
}
RPCID represents a JSON-RPC 2.0 request/response ID. Per spec, ID can be a String, Number, or Null value. We use json.RawMessage to preserve the exact JSON representation, ensuring IDs are echoed back exactly as received.
func NewNumberID ¶ added in v2.8.0
NewNumberID creates an RPCID from an integer value.
func NewStringID ¶ added in v2.8.0
NewStringID creates an RPCID from a string value.
func (*RPCID) IsAbsent ¶ added in v2.8.0
IsAbsent returns true if the ID field was not present in the JSON. This indicates a notification in JSON-RPC 2.0.
func (*RPCID) IsAbsentOrNull ¶ added in v2.8.0
IsAbsentOrNull returns true if the ID is either absent or explicitly null. For JSON-RPC 2.0, absent means notification (no response), while null means request with null ID (must respond). Use IsAbsent() to distinguish.
func (*RPCID) IsNull ¶ added in v2.8.0
IsNull returns true if the ID is explicitly JSON null. Note: This returns false for absent IDs - use IsAbsent() for that.
func (*RPCID) Key ¶ added in v2.8.0
Key returns a string suitable for use as a map key. This is the raw JSON representation of the ID.
func (RPCID) MarshalJSON ¶ added in v2.8.0
MarshalJSON returns the raw JSON bytes of the ID.
func (*RPCID) String ¶ added in v2.8.0
String returns the string representation for logging/debugging. Note: If the ID is a JSON string "foo", this returns "foo" (with quotes).
func (*RPCID) UnmarshalJSON ¶ added in v2.8.0
UnmarshalJSON enforces JSON-RPC 2.0 spec compliance by rejecting objects and arrays as ID values at parse time.
type ReaderInfo ¶
type ReaderResponse ¶
type ReaderWriteParams ¶
type ReaderWriteParams struct {
Text string `json:"text" validate:"required"`
}
type ReadersResponse ¶
type ReadersResponse struct {
Readers []ReaderInfo `json:"readers"`
}
type RequestObject ¶
type RequestObject struct {
JSONRPC string `json:"jsonrpc"`
ID RPCID `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
type ResponseErrorObject ¶
type ResponseErrorObject struct {
Error *ErrorObject `json:"error"`
JSONRPC string `json:"jsonrpc"`
ID RPCID `json:"id"`
}
ResponseErrorObject exists for sending errors, so we can omit result from the response, but so nil responses are still returned when using the main ResponseObject.
type ResponseObject ¶
type ResponseObject struct {
Result any `json:"result"`
Error *ErrorObject `json:"error,omitempty"`
JSONRPC string `json:"jsonrpc"`
ID RPCID `json:"id"`
}
type RunScriptParams ¶
type RunScriptParams struct {
Name *string `json:"name"`
Cmds []models.ZapScriptCmd `json:"cmds"`
ZapScript int `json:"zapscript"`
Unsafe bool `json:"unsafe"`
}
type SearchParams ¶
type SearchParams struct {
Systems *[]string `json:"systems" validate:"omitempty,dive,system"`
MaxResults *int `json:"maxResults" validate:"omitempty,gt=0,max=1000"`
Cursor *string `json:"cursor,omitempty"`
Tags *[]string `json:"tags,omitempty" validate:"omitempty,dive,min=1"`
Letter *string `json:"letter,omitempty" validate:"omitempty,letter"`
Query *string `json:"query"`
}
type SearchResultMedia ¶
type SearchResults ¶
type SearchResults struct {
Pagination *PaginationInfo `json:"pagination,omitempty"`
Results []SearchResultMedia `json:"results"`
Total int `json:"total"`
}
type SettingsResponse ¶
type SettingsResponse struct {
ReadersScanMode string `json:"readersScanMode"`
ReadersScanIgnoreSystem []string `json:"readersScanIgnoreSystems"`
ReadersScanExitDelay float32 `json:"readersScanExitDelay"`
RunZapScript bool `json:"runZapScript"`
DebugLogging bool `json:"debugLogging"`
AudioScanFeedback bool `json:"audioScanFeedback"`
ReadersAutoDetect bool `json:"readersAutoDetect"`
}
type SystemsResponse ¶
type SystemsResponse struct {
Systems []System `json:"systems"`
}
type TagsResponse ¶ added in v2.7.0
type TokenResponse ¶
type TokensResponse ¶
type TokensResponse struct {
Last *TokenResponse `json:"last,omitempty"`
Active []TokenResponse `json:"active"`
}
type UpdateActiveMediaParams ¶
type UpdateMappingParams ¶
type UpdateMappingParams struct {
Label *string `json:"label" validate:"omitempty,max=255"`
Enabled *bool `json:"enabled"`
Type *string `json:"type" validate:"omitempty,oneof=id value data uid text"`
Match *string `json:"match" validate:"omitempty,oneof=exact partial regex"`
Pattern *string `json:"pattern" validate:"omitempty,min=1"`
Override *string `json:"override"`
ID int `json:"id" validate:"gt=0"`
}
type UpdatePlaytimeLimitsParams ¶ added in v2.7.0
type UpdatePlaytimeLimitsParams struct {
Enabled *bool `json:"enabled"`
Daily *string `json:"daily" validate:"omitempty,duration"`
Session *string `json:"session" validate:"omitempty,duration"`
SessionReset *string `json:"sessionReset" validate:"omitempty,duration"`
Warnings *[]string `json:"warnings" validate:"omitempty,dive,duration"`
Retention *int `json:"retention" validate:"omitempty,gte=0"`
}
type UpdateSettingsParams ¶
type UpdateSettingsParams struct {
RunZapScript *bool `json:"runZapScript"`
DebugLogging *bool `json:"debugLogging"`
AudioScanFeedback *bool `json:"audioScanFeedback"`
ReadersAutoDetect *bool `json:"readersAutoDetect"`
ReadersScanMode *string `json:"readersScanMode" validate:"omitempty,oneof=tap hold"`
ReadersScanExitDelay *float32 `json:"readersScanExitDelay" validate:"omitempty,gte=0"`
ReadersScanIgnoreSystem *[]string `json:"readersScanIgnoreSystems" validate:"omitempty,dive,system"`
}