Documentation
¶
Index ¶
- Constants
- Variables
- func ClientErr(err error) error
- func ClientErrf(format string, a ...any) error
- func QuietClientErr(err error) error
- func QuietClientErrf(format string, a ...any) error
- type ActiveMedia
- type ActiveMediaQueryParams
- type ActiveMediaResponse
- type AddMappingParams
- type AllMappingsParams
- type AllMappingsResponse
- type BrowseEntry
- type BrowseIndexGroup
- type BrowseIndexResults
- type BrowseParams
- type BrowseResults
- type ClientError
- type ClientResponse
- type ClientsDeleteParams
- type ClientsPairStartResponse
- type ClientsPairedNotification
- type ClientsResponse
- type DeleteClientParams
- type DeleteInboxParams
- type DeleteMappingParams
- type ErrorObject
- type HealthCheckResponse
- type HistoryResponse
- type HistoryResponseEntry
- type InboxMessage
- type InboxResponse
- type IndexingStatusResponse
- type InputGamepadParams
- type InputKeyboardParams
- type Launcher
- type LaunchersResponse
- type LogDownloadResponse
- type MappingResponse
- type MediaCleanOrphansResponse
- type MediaControlParams
- type MediaHistoryLatestEntry
- type MediaHistoryLatestResponse
- type MediaHistoryParams
- type MediaHistoryResponse
- type MediaHistoryResponseEntry
- type MediaHistoryTopEntry
- type MediaHistoryTopParams
- type MediaHistoryTopResponse
- type MediaImageParams
- type MediaImageResponse
- type MediaIndexParams
- type MediaLookupMatch
- type MediaLookupParams
- type MediaLookupResponse
- type MediaMetaBatchItemResponse
- type MediaMetaBatchResponse
- type MediaMetaMediaResponse
- type MediaMetaParams
- type MediaMetaPropertyItem
- type MediaMetaResponse
- type MediaMetaSystemResponse
- type MediaMetaTitleResponse
- type MediaMetaUpdateParams
- type MediaResponse
- type MediaScrapeParams
- type MediaStartedParams
- type MediaStoppedParams
- type MediaTagsUpdateParams
- type MediaTitleParseParams
- type MediaTitleParseResponse
- type NewClientParams
- type Notification
- type NotificationObject
- type PaginationInfo
- type PairedClient
- type PlaylistItemInfo
- type PlaylistState
- type PlaytimeLimitReachedParams
- type PlaytimeLimitWarningParams
- type PlaytimeLimitsResponse
- type PlaytimeStatusResponse
- type QuietClientError
- 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 ReaderConnection
- type ReaderInfo
- type ReaderResponse
- type ReaderWriteCancelParams
- type ReaderWriteParams
- type ReadersResponse
- type RequestObject
- type ResponseErrorObject
- type ResponseObject
- type ResponseWithCallback
- type RunParams
- type RunScriptParams
- type ScrapeSystemProgressResponse
- type ScraperInfo
- type ScrapersResponse
- type ScrapingStatusResponse
- type ScreenshotResponse
- type SearchParams
- type SearchResultMedia
- type SearchResults
- type SettingsAuthClaimParams
- type SettingsAuthClaimResponse
- type SettingsResponse
- type System
- type SystemDefault
- type SystemsResponse
- type TagsResponse
- type TokenResponse
- type TokensResponse
- type UpdateActiveMediaParams
- type UpdateApplyResponse
- type UpdateCheckResponse
- 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 NotificationMediaScraping = "media.scraping" NotificationTokensStaged = "tokens.staged" NotificationTokensStagedReady = "tokens.staged.ready" //nolint:gosec // not a credential NotificationPlaytimeLimitReached = "playtime.limit.reached" NotificationPlaytimeLimitWarning = "playtime.limit.warning" NotificationInboxAdded = "inbox.added" NotificationClientsPaired = "clients.paired" )
const ( PlaytimeLimitReasonSession = "session" PlaytimeLimitReasonDaily = "daily" )
const ( MethodLaunch = "launch" // DEPRECATED MethodRun = "run" MethodConfirm = "confirm" MethodRunScript = "run.script" MethodStop = "stop" MethodTokens = "tokens" MethodMedia = "media" MethodMediaGenerate = "media.generate" MethodMediaGenerateCancel = "media.generate.cancel" MethodMediaGenerateResume = "media.generate.resume" MethodMediaIndex = "media.index" // DEPRECATED MethodMediaSearch = "media.search" MethodMediaTags = "media.tags" MethodMediaTagsUpdate = "media.tags.update" MethodMediaMetaUpdate = "media.meta.update" MethodMediaActive = "media.active" MethodMediaHistory = "media.history" MethodMediaHistoryLatest = "media.history.latest" MethodMediaHistoryTop = "media.history.top" MethodMediaLookup = "media.lookup" MethodMediaMeta = "media.meta" MethodMediaImage = "media.image" MethodScrapers = "scrapers" MethodMediaScrape = "media.scrape" MethodMediaScrapeStatus = "media.scrape.status" MethodMediaScrapeCancel = "media.scrape.cancel" MethodMediaScrapeResume = "media.scrape.resume" MethodMediaBrowse = "media.browse" MethodMediaBrowseIndex = "media.browse.index" MethodMediaControl = "media.control" MethodMediaActiveUpdate = "media.active.update" MethodMediaCleanOrphans = "media.clean.orphans" 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" MethodClientsDelete = "clients.delete" MethodClientsPairStart = "clients.pair.start" MethodClientsPairCancel = "clients.pair.cancel" MethodSystems = "systems" MethodLaunchers = "launchers" 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" MethodSettingsAuthClaim = "settings.auth.claim" MethodUpdateCheck = "update.check" MethodUpdateApply = "update.apply" MethodInputKeyboard = "input.keyboard" MethodInputGamepad = "input.gamepad" MethodScreenshot = "screenshot" MethodMediaTitleParse = "media.title.parse" )
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 ¶
func ClientErrf ¶ added in v2.11.0
ClientErrf creates a new formatted ClientError.
func QuietClientErr ¶ added in v2.14.0
QuietClientErr wraps an error as a QuietClientError.
func QuietClientErrf ¶ added in v2.14.0
QuietClientErrf creates a formatted QuietClientError that the API server logs at debug level instead of warning level.
Types ¶
type ActiveMedia ¶
type ActiveMedia struct {
Started time.Time `json:"started"`
RelPath *string `json:"relativePath,omitempty"`
PositionMs *int64 `json:"positionMs,omitempty"`
DurationMs *int64 `json:"durationMs,omitempty"`
LauncherID string `json:"launcherId"`
SystemID string `json:"systemId"`
SystemName string `json:"systemName"`
Path string `json:"mediaPath"`
Name string `json:"mediaName"`
Slot string `json:"slot,omitempty"`
LauncherControls []string `json:"launcherControls,omitempty"`
MediaID int64 `json:"mediaId,omitempty"`
}
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 ActiveMediaQueryParams ¶ added in v2.15.0
type ActiveMediaQueryParams struct {
Slot string `json:"slot,omitempty"`
}
ActiveMediaQueryParams holds the optional filter parameters for the media.active method. Slot selects which slot to read; defaults to primary when empty.
type ActiveMediaResponse ¶ added in v2.9.0
type ActiveMediaResponse struct {
ZapScript string `json:"zapScript"`
ActiveMedia
}
ActiveMediaResponse is the API response type for active media, including ZapScript.
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 AllMappingsParams ¶ added in v2.15.0
type AllMappingsParams struct {
// IncludeReadOnly also returns read-only mappings loaded from the mappings
// folder. Defaults to false so older clients keep receiving DB mappings only.
IncludeReadOnly bool `json:"includeReadOnly,omitempty"`
}
type AllMappingsResponse ¶
type AllMappingsResponse struct {
Mappings []MappingResponse `json:"mappings"`
}
type BrowseEntry ¶ added in v2.10.0
type BrowseEntry struct {
SystemID *string `json:"systemId,omitempty"`
RelPath *string `json:"relativePath,omitempty"`
ZapScript *string `json:"zapScript,omitempty"`
FileCount *int `json:"fileCount,omitempty"`
Group *string `json:"group,omitempty"`
Path string `json:"path"`
Type string `json:"type"`
Name string `json:"name"`
SystemIDs []string `json:"systemIds,omitempty"`
Tags []database.TagInfo `json:"tags,omitempty"`
DisambiguatingTags []database.TagInfo `json:"disambiguatingTags,omitempty"`
MediaID int64 `json:"mediaId,omitempty"`
HasCover bool `json:"hasCover"`
}
type BrowseIndexGroup ¶ added in v2.15.0
type BrowseIndexGroup struct {
Key string `json:"key"`
Label string `json:"label"`
Cursor string `json:"cursor"`
Count int `json:"count"`
Offset int `json:"offset"`
}
BrowseIndexGroup is one first-character section of a browse list. Key is the stable bucket identifier and Label is what to display (equal for the Latin scheme; separated so a future locale scheme can show a glyph differing from the key). Cursor is an opaque media.browse cursor positioned just before the bucket's first row: passing it to media.browse with the same scope returns a continuous page that begins at the bucket. Clients must treat Key and Cursor as opaque. Offset is the 0-based position of the bucket's first item among the scope's media files (excluding any leading directories), for clients that jump to a position in the full list rather than reload from the cursor.
type BrowseIndexResults ¶ added in v2.15.0
type BrowseIndexResults struct {
Scheme string `json:"scheme"`
Groups []BrowseIndexGroup `json:"groups"`
TotalFiles int `json:"totalFiles"`
}
BrowseIndexResults is the response for media.browse.index. Scheme reports the collation used to derive buckets ("latin"), or "none" when no letter rail applies to the scope (non-alphabetical sort, or a root listing); Groups is then empty. Groups is authoritative and already ordered for the active sort; clients render it as-is without assuming any alphabet.
type BrowseParams ¶ added in v2.10.0
type BrowseParams struct {
Systems *[]string `json:"systems" validate:"omitempty,dive,min=1"`
FuzzySystem *bool `json:"fuzzySystem,omitempty"`
Path *string `json:"path,omitempty"`
MaxResults *int `json:"maxResults,omitempty" validate:"omitempty,gt=0,max=1000"`
Cursor *string `json:"cursor,omitempty"`
Letter *string `json:"letter,omitempty" validate:"omitempty,letter"`
Sort *string `json:"sort,omitempty" validate:"omitempty,oneof=name-asc name-desc filename-asc filename-desc"`
}
type BrowseResults ¶ added in v2.10.0
type BrowseResults struct {
Pagination *PaginationInfo `json:"pagination,omitempty"`
Path string `json:"path"`
Entries []BrowseEntry `json:"entries"`
TotalFiles int `json:"totalFiles"`
}
type ClientError ¶ added in v2.11.0
type ClientError struct {
Err error
}
ClientError wraps an error to indicate it is an expected client-facing error (bad input, validation failure, expected operational state) rather than an internal server error. The API server uses this to log at Warn level instead of Error, keeping expected failures out of Sentry.
func (*ClientError) Error ¶ added in v2.11.0
func (e *ClientError) Error() string
func (*ClientError) Unwrap ¶ added in v2.11.0
func (e *ClientError) Unwrap() error
type ClientResponse ¶
type ClientsDeleteParams ¶ added in v2.11.0
type ClientsDeleteParams struct {
ClientID string `json:"clientId"`
}
ClientsDeleteParams is the parameters object for the clients.delete RPC method.
type ClientsPairStartResponse ¶ added in v2.11.0
ClientsPairStartResponse is the response for the clients.pair.start RPC method.
type ClientsPairedNotification ¶ added in v2.11.0
type ClientsPairedNotification struct {
ClientID string `json:"clientId"`
ClientName string `json:"clientName"`
}
ClientsPairedNotification is the payload for the clients.paired notification, broadcast when a client successfully completes the PAKE pairing flow.
type ClientsResponse ¶ added in v2.11.0
type ClientsResponse struct {
Clients []PairedClient `json:"clients"`
}
ClientsResponse is the response for the clients RPC method.
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"`
Paused bool `json:"paused"`
}
type InputGamepadParams ¶ added in v2.10.0
type InputGamepadParams struct {
Buttons string `json:"buttons" validate:"required,min=1"`
}
type InputKeyboardParams ¶ added in v2.10.0
type InputKeyboardParams struct {
Keys string `json:"keys" validate:"required,min=1"`
}
type LaunchersResponse ¶ added in v2.12.0
type LaunchersResponse struct {
Launchers []Launcher `json:"launchers"`
}
type LogDownloadResponse ¶
type MappingResponse ¶
type MappingResponse struct {
ID string `json:"id"`
Added string `json:"added"`
Label string `json:"label"`
Type string `json:"type"`
Match string `json:"match"`
Pattern string `json:"pattern"`
Override string `json:"override"`
// Source identifies where the mapping came from: "database" or "file".
Source string `json:"source"`
// ReadOnly is true for mappings that can't be edited via the API (file mappings).
ReadOnly bool `json:"readOnly"`
Enabled bool `json:"enabled"`
}
type MediaCleanOrphansResponse ¶ added in v2.12.0
type MediaCleanOrphansResponse struct {
Deleted int64 `json:"deleted"`
}
type MediaControlParams ¶ added in v2.10.0
type MediaHistoryLatestEntry ¶ added in v2.14.0
type MediaHistoryLatestResponse ¶ added in v2.14.0
type MediaHistoryLatestResponse struct {
Entry *MediaHistoryLatestEntry `json:"entry"`
}
type MediaHistoryParams ¶ added in v2.10.0
type MediaHistoryResponse ¶ added in v2.10.0
type MediaHistoryResponse struct {
Pagination *PaginationInfo `json:"pagination,omitempty"`
Entries []MediaHistoryResponseEntry `json:"entries"`
}
type MediaHistoryResponseEntry ¶ added in v2.10.0
type MediaHistoryResponseEntry struct {
RelPath *string `json:"relativePath,omitempty"`
EndedAt *string `json:"endedAt,omitempty"`
SystemID string `json:"systemId"`
SystemName string `json:"systemName"`
MediaName string `json:"mediaName"`
MediaPath string `json:"mediaPath"`
LauncherID string `json:"launcherId"`
StartedAt string `json:"startedAt"`
PlayTime int `json:"playTime"`
MediaID int64 `json:"mediaId,omitempty"`
}
type MediaHistoryTopEntry ¶ added in v2.10.0
type MediaHistoryTopEntry struct {
RelPath *string `json:"relativePath,omitempty"`
SystemID string `json:"systemId"`
SystemName string `json:"systemName"`
MediaName string `json:"mediaName"`
MediaPath string `json:"mediaPath"`
LastPlayedAt string `json:"lastPlayedAt"`
TotalPlayTime int `json:"totalPlayTime"`
SessionCount int `json:"sessionCount"`
MediaID int64 `json:"mediaId,omitempty"`
}
type MediaHistoryTopParams ¶ added in v2.10.0
type MediaHistoryTopResponse ¶ added in v2.10.0
type MediaHistoryTopResponse struct {
Entries []MediaHistoryTopEntry `json:"entries"`
}
type MediaImageParams ¶ added in v2.12.0
type MediaImageResponse ¶ added in v2.12.0
type MediaImageResponse struct {
Extension *string `json:"extension,omitempty"`
ContentType string `json:"contentType"`
Data string `json:"data"` // base64-encoded blob
TypeTag string `json:"typeTag"` // e.g. "property:image-boxart"
}
MediaImageResponse is the response for the media.image method. It contains the best-match image for a media record, base64-encoded.
type MediaIndexParams ¶
type MediaLookupMatch ¶ added in v2.10.0
type MediaLookupMatch struct {
RelPath *string `json:"relativePath,omitempty"`
System System `json:"system"`
Name string `json:"name"`
Path string `json:"path"`
ZapScript string `json:"zapScript"`
Tags []database.TagInfo `json:"tags"`
DisambiguatingTags []database.TagInfo `json:"disambiguatingTags,omitempty"`
MediaID int64 `json:"mediaId,omitempty"`
Confidence float64 `json:"confidence"`
}
type MediaLookupParams ¶ added in v2.10.0
type MediaLookupResponse ¶ added in v2.10.0
type MediaLookupResponse struct {
Match *MediaLookupMatch `json:"match"`
}
type MediaMetaBatchItemResponse ¶ added in v2.12.0
type MediaMetaBatchItemResponse struct {
Media *MediaMetaMediaResponse `json:"media,omitempty"`
Error *string `json:"error,omitempty"`
}
type MediaMetaBatchResponse ¶ added in v2.12.0
type MediaMetaBatchResponse struct {
Items []MediaMetaBatchItemResponse `json:"items"`
}
type MediaMetaMediaResponse ¶ added in v2.12.0
type MediaMetaMediaResponse struct {
Properties map[string]MediaMetaPropertyItem `json:"properties"`
LauncherOverride *string `json:"launcherOverride,omitempty"`
Path string `json:"path"`
ParentDir string `json:"parentDir"`
Tags []database.TagInfo `json:"tags"`
AvailableImageTypes []string `json:"availableImageTypes,omitempty"`
Title MediaMetaTitleResponse `json:"title"`
IsMissing bool `json:"isMissing"`
}
MediaMetaMediaResponse is the top-level Media object in a media.meta response.
type MediaMetaParams ¶ added in v2.12.0
type MediaMetaPropertyItem ¶ added in v2.12.0
type MediaMetaPropertyItem struct {
Extension *string `json:"extension,omitempty"`
Text string `json:"text"`
ContentType string `json:"contentType"`
BlobSize int64 `json:"blobSize,omitempty"`
}
MediaMetaPropertyItem represents a single property value in a media.meta response. Binary payloads are intentionally not included; use media.image to fetch image bytes.
type MediaMetaResponse ¶ added in v2.12.0
type MediaMetaResponse struct {
Media MediaMetaMediaResponse `json:"media"`
}
MediaMetaResponse is the response envelope for the media.meta method.
type MediaMetaSystemResponse ¶ added in v2.12.0
MediaMetaSystemResponse is the System sub-object within a media.meta response. Contains only DB-stored fields (id, name) with no static asset enrichment.
type MediaMetaTitleResponse ¶ added in v2.12.0
type MediaMetaTitleResponse struct {
SecondarySlug *string `json:"secondarySlug,omitempty"`
Properties map[string]MediaMetaPropertyItem `json:"properties"`
System MediaMetaSystemResponse `json:"system"`
Slug string `json:"slug"`
Name string `json:"name"`
Tags []database.TagInfo `json:"tags"`
AvailableImageTypes []string `json:"availableImageTypes,omitempty"`
SlugLength int `json:"slugLength"`
SlugWordCount int `json:"slugWordCount"`
}
MediaMetaTitleResponse is the MediaTitle sub-object within a media.meta response, with its own level-separated tags and properties.
type MediaMetaUpdateParams ¶ added in v2.15.0
type MediaMetaUpdateParams struct {
MediaID *int64 `json:"mediaId,omitempty"`
System string `json:"system" validate:"omitempty,min=1"`
Path string `json:"path" validate:"omitempty,min=1"`
Media json.RawMessage `json:"media,omitempty"`
}
type MediaResponse ¶
type MediaResponse struct {
Database IndexingStatusResponse `json:"database"`
Active []ActiveMediaResponse `json:"active"`
Playlists []PlaylistState `json:"playlists,omitempty"`
}
type MediaScrapeParams ¶ added in v2.12.0
type MediaStartedParams ¶
type MediaStoppedParams ¶ added in v2.10.0
type MediaTagsUpdateParams ¶ added in v2.12.0
type MediaTagsUpdateParams struct {
MediaID *int64 `json:"mediaId,omitempty"`
System string `json:"system" validate:"omitempty,min=1"`
Path string `json:"path" validate:"omitempty,min=1"`
Add []string `json:"add,omitempty" validate:"omitempty,dive,min=1"`
Remove []string `json:"remove,omitempty" validate:"omitempty,dive,min=1"`
}
type MediaTitleParseParams ¶ added in v2.13.0
type MediaTitleParseResponse ¶ added in v2.13.0
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 NotificationObject ¶ added in v2.9.0
type NotificationObject struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
type PaginationInfo ¶ added in v2.7.0
type PairedClient ¶ added in v2.11.0
type PairedClient struct {
ClientID string `json:"clientId"`
ClientName string `json:"clientName"`
CreatedAt int64 `json:"createdAt"`
LastSeenAt int64 `json:"lastSeenAt"`
}
PairedClient represents a client paired via the API encryption flow. PairingKey and AuthToken are intentionally omitted from the public API surface — only the metadata identifying the client is exposed.
type PlaylistItemInfo ¶ added in v2.15.0
PlaylistItemInfo is one entry in a PlaylistState.
type PlaylistState ¶ added in v2.15.0
type PlaylistState struct {
ID string `json:"id"`
Name string `json:"name"`
Slot string `json:"slot"`
Repeat string `json:"repeat"`
Items []PlaylistItemInfo `json:"items"`
Index int `json:"index"`
Total int `json:"total"`
Playing bool `json:"playing"`
}
PlaylistState describes the current state of a playlist slot as exposed by the media response. Repeat is one of "none", "all", or "one".
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 QuietClientError ¶ added in v2.14.0
type QuietClientError struct {
Err error
}
QuietClientError is an expected client-facing error that should not be logged as a warning for every occurrence. Use for high-volume misses where the JSON-RPC error response is still correct, but warning logs would create noise.
func (*QuietClientError) As ¶ added in v2.14.0
func (e *QuietClientError) As(target any) bool
func (*QuietClientError) Error ¶ added in v2.14.0
func (e *QuietClientError) Error() string
func (*QuietClientError) Unwrap ¶ added in v2.14.0
func (e *QuietClientError) Unwrap() error
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 ReaderConnection ¶ added in v2.9.0
type ReaderConnection struct {
Enabled *bool `json:"enabled,omitempty"`
Driver string `json:"driver" validate:"required,min=1"`
Path string `json:"path"`
IDSource string `json:"idSource,omitempty"`
}
func (ReaderConnection) IsEnabled ¶ added in v2.11.0
func (r ReaderConnection) IsEnabled() bool
IsEnabled returns whether this connection is enabled. nil (omitted) and true both mean enabled; only explicit false disables.
type ReaderInfo ¶
type ReaderResponse ¶
type ReaderWriteCancelParams ¶ added in v2.9.0
type ReaderWriteCancelParams struct {
ReaderID *string `json:"readerId,omitempty"`
}
type ReaderWriteParams ¶
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 ResponseWithCallback ¶ added in v2.10.0
type ResponseWithCallback struct {
Result any
AfterWrite func()
}
ResponseWithCallback wraps a method result with a function that should be called after the response has been written to the client. This allows handlers to defer side effects (like triggering a restart) until the client has received the response, without relying on arbitrary sleep timers.
type RunScriptParams ¶
type RunScriptParams struct {
Name *string `json:"name"`
Cmds []zapscript.ZapScriptCmd `json:"cmds"`
ZapScript int `json:"zapscript"`
Unsafe bool `json:"unsafe"`
}
type ScrapeSystemProgressResponse ¶ added in v2.14.0
type ScraperInfo ¶ added in v2.12.0
type ScraperInfo struct {
ID string `json:"id"`
Name string `json:"name"`
SupportedSystems []string `json:"supportedSystems"`
}
ScraperInfo is one entry in the ScrapersResponse list.
type ScrapersResponse ¶ added in v2.12.0
type ScrapersResponse struct {
Scrapers []ScraperInfo `json:"scrapers"`
}
ScrapersResponse is the result returned by the "scrapers" RPC method.
type ScrapingStatusResponse ¶ added in v2.12.0
type ScrapingStatusResponse struct {
CurrentStep *int `json:"currentStep,omitempty"`
CurrentStepDisplay *string `json:"currentStepDisplay,omitempty"`
TotalSteps *int `json:"totalSteps,omitempty"`
CurrentSystem *ScrapeSystemProgressResponse `json:"currentSystem,omitempty"`
ScraperID string `json:"scraperId,omitempty"`
SystemID string `json:"systemId,omitempty"`
State string `json:"state,omitempty"`
Error string `json:"error,omitempty"`
Processed int `json:"processed"`
Total int `json:"total"`
Matched int `json:"matched"`
Skipped int `json:"skipped"`
TotalScraped int `json:"totalScraped"`
Scraping bool `json:"scraping"`
Done bool `json:"done"`
Paused bool `json:"paused"`
Force bool `json:"force"`
}
ScrapingStatusResponse is broadcast as a "media.scraping" notification for each ScrapeUpdate received from the scraper and on completion/cancellation.
type ScreenshotResponse ¶ added in v2.10.0
type SearchParams ¶
type SearchParams struct {
Systems *[]string `json:"systems" validate:"omitempty,dive,min=1"`
FuzzySystem *bool `json:"fuzzySystem,omitempty"`
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 SearchResultMedia struct {
RelPath *string `json:"relativePath,omitempty"`
System System `json:"system"`
Name string `json:"name"`
Path string `json:"path"`
ZapScript string `json:"zapScript"`
Tags []database.TagInfo `json:"tags"`
DisambiguatingTags []database.TagInfo `json:"disambiguatingTags,omitempty"`
MediaID int64 `json:"mediaId,omitempty"`
}
type SearchResults ¶
type SearchResults struct {
Pagination *PaginationInfo `json:"pagination,omitempty"`
Results []SearchResultMedia `json:"results"`
Total int `json:"total"`
}
type SettingsAuthClaimParams ¶ added in v2.10.0
type SettingsAuthClaimResponse ¶ added in v2.10.0
type SettingsAuthClaimResponse struct {
Domains []string `json:"domains"`
}
type SettingsResponse ¶
type SettingsResponse struct {
UpdateChannel string `json:"updateChannel"`
ReadersScanMode string `json:"readersScanMode"`
ReadersScanIgnoreSystem []string `json:"readersScanIgnoreSystems"`
ReadersConnect []ReaderConnection `json:"readersConnect"`
SystemDefaults []SystemDefault `json:"systemDefaults"`
ReadersScanExitDelay float32 `json:"readersScanExitDelay"`
LaunchGuardTimeout float32 `json:"launchGuardTimeout"`
LaunchGuardDelay float32 `json:"launchGuardDelay"`
AudioVolume int `json:"audioVolume"`
RunZapScript bool `json:"runZapScript"`
DebugLogging bool `json:"debugLogging"`
AudioScanFeedback bool `json:"audioScanFeedback"`
ReadersAutoDetect bool `json:"readersAutoDetect"`
ErrorReporting bool `json:"errorReporting"`
LaunchGuardEnabled bool `json:"launchGuardEnabled"`
LaunchGuardRequireConfirm bool `json:"launchGuardRequireConfirm"`
}
type SystemDefault ¶ added in v2.12.0
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 UpdateApplyResponse ¶ added in v2.10.0
type UpdateCheckResponse ¶ added in v2.10.0
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"`
ErrorReporting *bool `json:"errorReporting"`
UpdateChannel *string `json:"updateChannel" validate:"omitempty,oneof=stable beta"`
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"`
ReadersConnect *[]ReaderConnection `json:"readersConnect,omitempty"`
SystemDefaults *[]SystemDefault `json:"systemDefaults,omitempty" validate:"omitempty,dive"`
AudioVolume *int `json:"audioVolume" validate:"omitempty,gte=0,lte=200"`
LaunchGuardEnabled *bool `json:"launchGuardEnabled"`
LaunchGuardTimeout *float32 `json:"launchGuardTimeout" validate:"omitempty,gte=-1"`
LaunchGuardDelay *float32 `json:"launchGuardDelay" validate:"omitempty,gte=0"`
LaunchGuardRequireConfirm *bool `json:"launchGuardRequireConfirm"`
}