models

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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"
	NotificationProfilesActive       = "profiles.active"
	NotificationProfilesData         = "profiles.data"
	NotificationUIChanged            = "ui.changed"
	NotificationAuthLinkStatus       = "auth.link.status"
	NotificationBackupState          = "backup.state"
)
View Source
const (
	ProfilesDataApplied     = "applied"
	ProfilesDataDeferred    = "deferred"
	ProfilesDataFailed      = "failed"
	ProfilesDataUnavailable = "unavailable"
)

Profile data swap statuses reported by the profiles.data notification.

View Source
const (
	PlaytimeLimitReasonSession = "session"
	PlaytimeLimitReasonDaily   = "daily"
)
View Source
const (
	MethodLaunch                      = "launch" // DEPRECATED
	MethodRun                         = "run"
	MethodConfirm                     = "confirm"
	MethodUI                          = "ui"
	MethodUIRespond                   = "ui.respond"
	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"
	MethodSettingsBackup              = "settings.backup"
	MethodSettingsBackupList          = "settings.backup.list"
	MethodSettingsBackupInspect       = "settings.backup.inspect"
	MethodSettingsBackupDelete        = "settings.backup.delete"
	MethodSettingsBackupRestore       = "settings.backup.restore"
	MethodSettingsBackupStatus        = "settings.backup.status"
	MethodSettingsBackupRemoteRun     = "settings.backup.remote.run"
	MethodSettingsBackupRemoteList    = "settings.backup.remote.list"
	MethodSettingsBackupRemoteRestore = "settings.backup.remote.restore"
	MethodPlaytimeLimits              = "settings.playtime.limits"
	MethodPlaytimeLimitsUpdate        = "settings.playtime.limits.update"
	MethodPlaytime                    = "playtime"
	MethodClients                     = "clients"
	MethodClientsCurrent              = "clients.current"
	MethodClientsDelete               = "clients.delete"
	MethodClientsPairStart            = "clients.pair.start"
	MethodClientsPairCancel           = "clients.pair.cancel"
	MethodProfiles                    = "profiles"
	MethodProfilesNew                 = "profiles.new"
	MethodProfilesUpdate              = "profiles.update"
	MethodProfilesDelete              = "profiles.delete"
	MethodProfilesActive              = "profiles.active"
	MethodProfilesSwitch              = "profiles.switch"
	MethodProfilesVerify              = "profiles.verify"
	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"
	MethodSettingsAuthStatus          = "settings.auth.status"
	MethodSettingsAuthUnlink          = "settings.auth.unlink"
	MethodSettingsAuthLink            = "settings.auth.link"
	MethodSettingsAuthLinkStatus      = "settings.auth.link.status"
	MethodSettingsAuthLinkCancel      = "settings.auth.link.cancel"
	MethodUpdateCheck                 = "update.check"
	MethodUpdateApply                 = "update.apply"
	MethodInputKeyboard               = "input.keyboard"
	MethodInputGamepad                = "input.gamepad"
	MethodScreenshot                  = "screenshot"
	MethodMediaTitleParse             = "media.title.parse"
)
View Source
const (
	AuthLinkStatusNone      = "none"
	AuthLinkStatusPending   = "pending"
	AuthLinkStatusApproved  = "approved"
	AuthLinkStatusFailed    = "failed"
	AuthLinkStatusCancelled = "cancelled"
)

Auth link session statuses (settings.auth.link).

Variables

View Source
var ErrInvalidRPCID = errors.New("JSON-RPC ID cannot be an object or array")

ErrInvalidRPCID is returned when an ID is an object or array.

View Source
var NullRPCID = RPCID{RawMessage: []byte("null")}

NullRPCID represents a null JSON-RPC ID.

Functions

func ClientErr added in v2.11.0

func ClientErr(err error) error

ClientErr wraps an error as a ClientError.

func ClientErrf added in v2.11.0

func ClientErrf(format string, a ...any) error

ClientErrf creates a new formatted ClientError.

func MethodHasUnboundedRuntime added in v2.16.0

func MethodHasUnboundedRuntime(method string) bool

MethodHasUnboundedRuntime reports whether a method may run without a fixed whole-operation deadline. Full-device backup and restore work is bounded by caller cancellation, shutdown, and per-transfer timeouts instead; both the server request context and the local client wait consult this list so the two cannot disagree.

func QuietClientErr added in v2.14.0

func QuietClientErr(err error) error

QuietClientErr wraps an error as a QuietClientError.

func QuietClientErrf added in v2.14.0

func QuietClientErrf(format string, a ...any) error

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 ActiveProfile added in v2.16.0

type ActiveProfile struct {
	LimitsEnabled *bool   `json:"limitsEnabled,omitempty"`
	DailyLimit    *string `json:"dailyLimit,omitempty"`
	SessionLimit  *string `json:"sessionLimit,omitempty"`
	ProfileID     string  `json:"profileId"`
	Name          string  `json:"name"`
	Role          string  `json:"role"`
	HasPIN        bool    `json:"hasPin"`
}

ActiveProfile is a snapshot of the device's active profile, held in service state and broadcast on the profiles.active notification. It carries the resolved limit overrides so the playtime hot path never touches the database. Nil limit fields mean "inherit global config".

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 AuthLinkStatusResponse added in v2.16.0

type AuthLinkStatusResponse struct {
	ExpiresAt               *time.Time `json:"expiresAt,omitempty"`
	Status                  string     `json:"status"`
	UserCode                string     `json:"userCode,omitempty"`
	VerificationURL         string     `json:"verificationUrl,omitempty"`
	VerificationURLComplete string     `json:"verificationUrlComplete,omitempty"`
	Error                   string     `json:"error,omitempty"`
}

AuthLinkStatusResponse is the state of the reverse (QR / user code) device link flow. It is returned by settings.auth.link and settings.auth.link.status, and pushed as the auth.link.status notification on every transition. Notifications omit user codes and verification URLs.

type BackupCategoryStatus added in v2.16.0

type BackupCategoryStatus struct {
	Files   int64 `json:"files"`
	Bytes   int64 `json:"bytes"`
	Enabled bool  `json:"enabled"`
}

type BackupNameParams added in v2.16.0

type BackupNameParams struct {
	Name string `json:"name" validate:"required"`
}

type BackupRemoteRestoreParams added in v2.16.0

type BackupRemoteRestoreParams struct {
	ID string `json:"id" validate:"required"`
}

type BackupStateNotification added in v2.16.0

type BackupStateNotification struct {
	Operation string `json:"operation,omitempty"`
	Paused    bool   `json:"paused"`
	Throttled bool   `json:"throttled"`
	Finished  bool   `json:"finished,omitempty"`
}

BackupStateNotification is the payload for the backup.state notification, sent while a backup operation is running whenever its pause/throttle state changes in response to a game starting or stopping, and once with Finished set when the operation ends (whatever its outcome). Operation is the active operation kind from settings.backup.status (e.g. "remote-upload").

type BackupStatusEntry added in v2.16.0

type BackupStatusEntry struct {
	LastRunAt             *string                         `json:"lastRunAt,omitempty"`
	LastSuccessAt         *string                         `json:"lastSuccessAt,omitempty"`
	LastSnapshotCreatedAt *string                         `json:"lastSnapshotCreatedAt,omitempty"`
	AvailabilityCheckedAt *string                         `json:"availabilityCheckedAt,omitempty"`
	DeviceName            *string                         `json:"deviceName,omitempty"`
	LinkedAt              *string                         `json:"linkedAt,omitempty"`
	Categories            map[string]BackupCategoryStatus `json:"categories,omitempty"`
	Schedule              string                          `json:"schedule,omitempty"`
	LastError             string                          `json:"lastError,omitempty"`
	Availability          string                          `json:"availability,omitempty"`
	LastStatus            string                          `json:"lastStatus"`
	Warnings              []BackupWarning                 `json:"warnings,omitempty"`
	LastBackupSize        int64                           `json:"lastBackupSize"`
	SkippedFiles          int                             `json:"skippedFiles,omitempty"`
	Linked                bool                            `json:"linked,omitempty"`
	Enabled               bool                            `json:"enabled"`
	// LastRunNoChanges marks the most recent successful run as verified-
	// unchanged: the server already held an identical snapshot, so nothing
	// new was stored. LastSuccessAt still advances on such runs;
	// LastSnapshotCreatedAt is when the stored content last changed.
	LastRunNoChanges bool `json:"lastRunNoChanges,omitempty"`
}

type BackupStatusResponse added in v2.16.0

type BackupStatusResponse struct {
	ActiveSince     *string           `json:"activeSince,omitempty"`
	ActiveOperation string            `json:"activeOperation,omitempty"`
	Local           BackupStatusEntry `json:"local"`
	Remote          BackupStatusEntry `json:"remote"`
}

type BackupWarning added in v2.16.0

type BackupWarning struct {
	Category string `json:"category"`
	Path     string `json:"path"`
	Reason   string `json:"reason"`
}

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"`
	TotalDirs  int             `json:"totalDirs"`
}

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 ClientResponse struct {
	Name    string    `json:"name"`
	Address string    `json:"address"`
	Secret  string    `json:"secret"` //nolint:gosec // G117: pairing secret, not a credential
	ID      uuid.UUID `json:"id"`
}

type ClientsCurrentResponse added in v2.16.0

type ClientsCurrentResponse struct {
	Role         *string  `json:"role"`
	Capabilities []string `json:"capabilities"`
	Paired       bool     `json:"paired"`
}

ClientsCurrentResponse describes the current connection's paired identity and effective role capabilities. Role is null when the connection has no paired identity; capabilities remain populated from its legacy grant.

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 ClientsPairStartParams added in v2.16.0

type ClientsPairStartParams struct {
	Role string `json:"role" validate:"omitempty,oneof=admin member"`
}

ClientsPairStartParams configures a new pairing flow. Role is the permission role the paired client will receive ("admin" or "member"); empty defaults to member.

type ClientsPairStartResponse added in v2.11.0

type ClientsPairStartResponse struct {
	PIN       string `json:"pin"`
	ExpiresAt int64  `json:"expiresAt"`
}

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 DeleteProfileParams added in v2.16.0

type DeleteProfileParams struct {
	ProfileID string `json:"profileId" validate:"required,min=1"`
}

type ErrorObject

type ErrorObject struct {
	// Data is optional structured detail about the error. Per JSON-RPC 2.0
	// §5.1 it MUST be a member of the error object, not a sibling.
	Data    any    `json:"data,omitempty"`
	Message string `json:"message"`
	Code    int    `json:"code"`
}

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 HistoryResponseEntry struct {
	Time    time.Time `json:"time"`
	Type    string    `json:"type"`
	UID     string    `json:"uid"`
	Text    string    `json:"text"`
	Data    string    `json:"data"`
	Success bool      `json:"success"`
}

type InboxMessage added in v2.8.0

type InboxMessage struct {
	CreatedAt time.Time `json:"createdAt"`
	Title     string    `json:"title"`
	Body      string    `json:"body,omitempty"`
	Category  string    `json:"category,omitempty"`
	ID        int64     `json:"id"`
	Severity  int       `json:"severity"`
	ProfileID int64     `json:"profileId,omitempty"`
}

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"`
	// MissingMedia is the count of indexed media flagged missing on disk —
	// what media.clean.orphans would remove.
	MissingMedia *int `json:"missingMedia,omitempty"`
	// SystemsCompleted/SystemsTotal report per-system indexing coverage so
	// clients can serve partial results while a scan is still running.
	SystemsCompleted *int `json:"systemsCompleted,omitempty"`
	SystemsTotal     *int `json:"systemsTotal,omitempty"`
	Exists           bool `json:"exists"`
	Indexing         bool `json:"indexing"`
	Optimizing       bool `json:"optimizing"`
	Paused           bool `json:"paused"`
	// Throttled reports that indexing is running at reduced speed while
	// media plays.
	Throttled bool `json:"throttled,omitempty"`
}

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 Launcher added in v2.12.0

type Launcher struct {
	ID                 string   `json:"id"`
	SystemID           string   `json:"systemId,omitempty"`
	SystemName         string   `json:"systemName,omitempty"`
	AvailabilityReason string   `json:"availabilityReason,omitempty"`
	Groups             []string `json:"groups,omitempty"`
	Available          bool     `json:"available"`
}

type LaunchersResponse added in v2.12.0

type LaunchersResponse struct {
	Launchers []Launcher `json:"launchers"`
}

type LogDownloadResponse

type LogDownloadResponse struct {
	Filename string `json:"filename"`
	Content  string `json:"content"`
	Size     int    `json:"size"`
}

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 MediaControlParams struct {
	Args   map[string]string `json:"args,omitempty"`
	Action string            `json:"action" validate:"required,min=1"`
	Slot   string            `json:"slot,omitempty"`
}

type MediaHistoryLatestEntry added in v2.14.0

type MediaHistoryLatestEntry struct {
	SystemID   string `json:"systemId"`
	SystemName string `json:"systemName"`
	MediaName  string `json:"mediaName"`
	MediaPath  string `json:"mediaPath"`
	LauncherID string `json:"launcherId"`
	StartedAt  string `json:"startedAt"`
}

type MediaHistoryLatestResponse added in v2.14.0

type MediaHistoryLatestResponse struct {
	Entry *MediaHistoryLatestEntry `json:"entry"`
}

type MediaHistoryParams added in v2.10.0

type MediaHistoryParams struct {
	Systems     *[]string `json:"systems,omitempty" validate:"omitempty,dive,min=1"`
	FuzzySystem *bool     `json:"fuzzySystem,omitempty"`
	Limit       *int      `json:"limit,omitempty" validate:"omitempty,gt=0,max=100"`
	Cursor      *string   `json:"cursor,omitempty"`
}

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 MediaHistoryTopParams struct {
	Systems     *[]string `json:"systems,omitempty" validate:"omitempty,dive,min=1"`
	FuzzySystem *bool     `json:"fuzzySystem,omitempty"`
	Since       *string   `json:"since,omitempty"`
	Limit       *int      `json:"limit,omitempty" validate:"omitempty,gt=0,max=100"`
}

type MediaHistoryTopResponse added in v2.10.0

type MediaHistoryTopResponse struct {
	Entries []MediaHistoryTopEntry `json:"entries"`
}

type MediaImageParams added in v2.12.0

type MediaImageParams struct {
	MediaID *int64 `json:"mediaId,omitempty"`
	// MaxSize is a hint for the longest edge (in pixels) of the returned image.
	// The server resizes down to fit a MaxSize×MaxSize box and caches the result;
	// omit it to receive the full-size image. Requests are snapped to a small set
	// of standard sizes server-side, so the returned image may be larger than
	// requested — clients should downscale to their final display size.
	MaxSize    *int32   `json:"maxSize,omitempty" validate:"omitempty,gt=0,max=8192"`
	System     string   `json:"system"            validate:"omitempty,min=1"`
	Path       string   `json:"path"              validate:"omitempty,min=1"`
	ImageTypes []string `json:"imageTypes"        validate:"omitempty,dive,min=1"`
}

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 MediaIndexParams struct {
	Systems     *[]string `json:"systems" validate:"omitempty,dive,min=1"`
	FuzzySystem *bool     `json:"fuzzySystem,omitempty"`
	// Rebuild discards the media database entirely and indexes from scratch.
	// Scraped metadata is lost and must be re-scraped; user data (favourites,
	// launcher overrides) lives in UserDB and is re-applied after indexing.
	// Incompatible with a systems filter: a fresh database indexed selectively
	// would silently drop every other system's media.
	Rebuild *bool `json:"rebuild,omitempty"`
}

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 MediaLookupParams struct {
	FuzzySystem *bool  `json:"fuzzySystem,omitempty"`
	Name        string `json:"name" validate:"required,min=1"`
	System      string `json:"system" validate:"required,min=1"`
}

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 MediaMetaParams struct {
	MediaID *int64 `json:"mediaId,omitempty"`
	System  string `json:"system" validate:"omitempty,min=1"`
	Path    string `json:"path"   validate:"omitempty,min=1"`
}

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

type MediaMetaSystemResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

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 MediaScrapeParams struct {
	ScraperID string   `json:"scraperId" validate:"required,min=1"`
	Systems   []string `json:"systems"   validate:"omitempty,dive,min=1"`
	Force     bool     `json:"force"`
}

type MediaStartedParams

type MediaStartedParams struct {
	SystemID   string `json:"systemId" validate:"required"`
	SystemName string `json:"systemName" validate:"required"`
	MediaPath  string `json:"mediaPath" validate:"required"`
	MediaName  string `json:"mediaName" validate:"required"`
	Slot       string `json:"slot,omitempty"`
}

type MediaStoppedParams added in v2.10.0

type MediaStoppedParams struct {
	SystemID   string `json:"systemId"`
	SystemName string `json:"systemName"`
	MediaName  string `json:"mediaName"`
	MediaPath  string `json:"mediaPath"`
	LauncherID string `json:"launcherId"`
	Slot       string `json:"slot,omitempty"`
	Elapsed    int    `json:"elapsed"`
}

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 MediaTitleParseParams struct {
	SystemID string `json:"systemId" validate:"required,min=1"`
	Path     string `json:"path" validate:"required,min=1"`
}

type MediaTitleParseResponse added in v2.13.0

type MediaTitleParseResponse struct {
	SecondarySlug *string `json:"secondarySlug,omitempty"`
	Slug          string  `json:"slug"`
	Name          string  `json:"name"`
	SlugLength    int     `json:"slugLength"`
	SlugWordCount int     `json:"slugWordCount"`
}

type NewClientParams

type NewClientParams struct {
	Name string `json:"name" validate:"required,min=1,max=255"`
}

type NewProfileParams added in v2.16.0

type NewProfileParams struct {
	PIN           *string `json:"pin" validate:"omitempty,numeric,min=4,max=8"`
	LimitsEnabled *bool   `json:"limitsEnabled"`
	DailyLimit    *string `json:"dailyLimit" validate:"omitempty,duration"`
	SessionLimit  *string `json:"sessionLimit" validate:"omitempty,duration"`
	Name          string  `json:"name" validate:"required,min=1,max=255"`
	Role          string  `json:"role" validate:"omitempty,oneof=admin member"`
}

NewProfileParams creates a profile. Nil limit fields inherit the global config; a "0" duration means explicitly unlimited.

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 PaginationInfo struct {
	NextCursor  *string `json:"nextCursor,omitempty"`
	HasNextPage bool    `json:"hasNextPage"`
	PageSize    int     `json:"pageSize"`
}

type PairedClient added in v2.11.0

type PairedClient struct {
	ClientID   string `json:"clientId"`
	ClientName string `json:"clientName"`
	Role       string `json:"role"`
	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

type PlaylistItemInfo struct {
	Name      string `json:"name"`
	ZapScript string `json:"zapScript"`
}

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 PlaytimeLimitWarningParams struct {
	Interval  string `json:"interval"`
	Remaining string `json:"remaining"`
}

type PlaytimeLimitsResponse added in v2.7.0

type PlaytimeLimitsResponse struct {
	Daily        *string  `json:"daily,omitempty"`
	Session      *string  `json:"session,omitempty"`
	SessionReset *string  `json:"sessionReset,omitempty"`
	Retention    *int     `json:"retention,omitempty"`
	Warnings     []string `json:"warnings,omitempty"`
	Enabled      bool     `json:"enabled"`
}

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 ProfileResponse added in v2.16.0

type ProfileResponse struct {
	LimitsEnabled *bool   `json:"limitsEnabled,omitempty"`
	DailyLimit    *string `json:"dailyLimit,omitempty"`
	SessionLimit  *string `json:"sessionLimit,omitempty"`
	LastUsedAt    *int64  `json:"lastUsedAt,omitempty"`
	ProfileID     string  `json:"profileId"`
	Name          string  `json:"name"`
	Role          string  `json:"role"`
	SwitchID      string  `json:"switchId,omitempty"`
	CreatedAt     int64   `json:"createdAt"`
	LastUpdatedAt int64   `json:"lastUpdatedAt"`
	HasPIN        bool    `json:"hasPin"`
}

ProfileResponse represents a device profile in API responses. The PIN hash is never exposed — only whether a PIN is set. SwitchID is a bearer credential (presenting it authorizes a PIN-free switch on every path), so it is only included for privileged clients that need it for card-writing UX; for other clients it is omitted.

type ProfileVerifyResponse added in v2.16.0

type ProfileVerifyResponse struct {
	ProfileID string `json:"profileId"`
	Name      string `json:"name"`
	Role      string `json:"role"`
	HasPIN    bool   `json:"hasPin"`
}

ProfileVerifyResponse is the response for the profiles.verify RPC method: the identity of the profile whose credential was verified. Verification grants nothing server-side — the client owns whatever it unlocks with it.

type ProfilesActiveNotification added in v2.16.0

type ProfilesActiveNotification struct {
	Profile *ActiveProfile `json:"profile"`
}

ProfilesActiveNotification is the payload for the profiles.active notification. Profile is null when the device has no active profile.

type ProfilesDataNotification added in v2.16.0

type ProfilesDataNotification struct {
	ProfileID string `json:"profileId"`
	Status    string `json:"status"`
	Reason    string `json:"reason,omitempty"`
}

ProfilesDataNotification is the payload for the profiles.data notification, reporting the state of profile data swapping (save files etc.) after a profile change. ProfileID is empty for the shared profile. Status is one of the ProfilesData* constants; Reason is a human-readable explanation for failed/unavailable statuses.

type ProfilesResponse added in v2.16.0

type ProfilesResponse struct {
	Profiles []ProfileResponse `json:"profiles"`
}

ProfilesResponse is the response for the profiles RPC method.

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

func NewNumberID(n int64) RPCID

NewNumberID creates an RPCID from an integer value.

func NewStringID added in v2.8.0

func NewStringID(s string) RPCID

NewStringID creates an RPCID from a string value.

func (*RPCID) Equal added in v2.8.0

func (id *RPCID) Equal(other RPCID) bool

Equal compares two RPCIDs for byte-level equality.

func (*RPCID) IsAbsent added in v2.8.0

func (id *RPCID) IsAbsent() bool

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

func (id *RPCID) IsAbsentOrNull() bool

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

func (id *RPCID) IsNull() bool

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

func (id *RPCID) Key() string

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

func (id RPCID) MarshalJSON() ([]byte, error)

MarshalJSON returns the raw JSON bytes of the ID.

func (*RPCID) String added in v2.8.0

func (id *RPCID) String() string

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

func (id *RPCID) UnmarshalJSON(data []byte) error

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 ReaderInfo struct {
	ID           string   `json:"id"`
	ReaderID     string   `json:"readerId"`
	Driver       string   `json:"driver"`
	Info         string   `json:"info"`
	Capabilities []string `json:"capabilities"`
	Connected    bool     `json:"connected"`
}

type ReaderResponse

type ReaderResponse struct {
	Driver    string `json:"driver"`
	Path      string `json:"path"`
	Connected bool   `json:"connected"`
}

type ReaderWriteCancelParams added in v2.9.0

type ReaderWriteCancelParams struct {
	ReaderID *string `json:"readerId,omitempty"`
}

type ReaderWriteParams

type ReaderWriteParams struct {
	ReaderID *string `json:"readerId,omitempty"`
	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 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 RunParams

type RunParams struct {
	Type   *string `json:"type"`
	UID    *string `json:"uid"`
	Text   *string `json:"text"`
	Data   *string `json:"data" validate:"omitempty,hexdata"`
	Unsafe bool    `json:"unsafe"`
}

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 ScrapeSystemProgressResponse struct {
	SystemID   string `json:"systemId"`
	SystemName string `json:"systemName,omitempty"`
	Processed  int    `json:"processed"`
	Total      int    `json:"total"`
	Matched    int    `json:"matched"`
	Skipped    int    `json:"skipped"`
}

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"`
	// Throttled reports that scraping is running at reduced speed while
	// media plays.
	Throttled bool `json:"throttled,omitempty"`
	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 ScreenshotResponse struct {
	Path string `json:"path"`
	Data string `json:"data"` // base64 encoded
	Size int    `json:"size"` // original byte count
}

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 SettingsAuthClaimParams struct {
	ClaimURL string `json:"claimUrl" validate:"required,url"`
	Token    string `json:"token" validate:"required"`
}

type SettingsAuthClaimResponse added in v2.10.0

type SettingsAuthClaimResponse struct {
	Domains []string `json:"domains"`
}

type SettingsAuthLinkParams added in v2.16.0

type SettingsAuthLinkParams struct {
	// URL overrides the auth server base URL; defaults to the official
	// Zaparoo API.
	URL string `json:"url,omitempty" validate:"omitempty,url"`
}

type SettingsAuthStatusParams added in v2.16.0

type SettingsAuthStatusParams struct {
	URL string `json:"url,omitempty" validate:"omitempty,url"`
}

type SettingsAuthStatusResponse added in v2.16.0

type SettingsAuthStatusResponse struct {
	Linked bool `json:"linked"`
}

type SettingsAuthUnlinkResponse added in v2.16.0

type SettingsAuthUnlinkResponse struct {
	Domains []string `json:"domains"`
}

SettingsAuthUnlinkResponse lists the domains whose credentials were removed by settings.auth.unlink.

type SettingsResponse

type SettingsResponse struct {
	BackupRemoteEnabled       *bool              `json:"backupRemoteEnabled,omitempty"`
	PlaytimeSyncEnabled       *bool              `json:"playtimeSyncEnabled,omitempty"`
	BackupRemoteSchedule      *string            `json:"backupRemoteSchedule,omitempty"`
	BackupRemoteBaseURL       *string            `json:"backupRemoteBaseUrl,omitempty"`
	UpdateChannel             string             `json:"updateChannel"`
	ReadersScanMode           string             `json:"readersScanMode"`
	ReadersScanIgnoreSystem   []string           `json:"readersScanIgnoreSystems"`
	ReadersConnect            []ReaderConnection `json:"readersConnect"`
	SystemDefaults            []SystemDefault    `json:"systemDefaults"`
	AudioVolume               int                `json:"audioVolume"`
	LaunchGuardTimeout        float32            `json:"launchGuardTimeout"`
	LaunchGuardDelay          float32            `json:"launchGuardDelay"`
	ReadersScanExitDelay      float32            `json:"readersScanExitDelay"`
	RunZapScript              bool               `json:"runZapScript"`
	DebugLogging              bool               `json:"debugLogging"`
	AudioScanFeedback         bool               `json:"audioScanFeedback"`
	ReadersAutoDetect         bool               `json:"readersAutoDetect"`
	ErrorReporting            bool               `json:"errorReporting"`
	Encryption                bool               `json:"encryption"`
	LaunchGuardEnabled        bool               `json:"launchGuardEnabled"`
	LaunchGuardRequireConfirm bool               `json:"launchGuardRequireConfirm"`
	ProfilesRequireForLaunch  bool               `json:"profilesRequireForLaunch"`
	ProfilesSwapData          bool               `json:"profilesSwapData"`
}

type SwitchProfileParams added in v2.16.0

type SwitchProfileParams struct {
	ProfileID *string `json:"profileId"`
	SwitchID  *string `json:"switchId"`
	PIN       *string `json:"pin"`
}

SwitchProfileParams switches the device's active profile. Exactly one of ProfileID or SwitchID selects the target; both omitted (or null) means deactivate. PIN is required when the target profile has one set.

type System

type System struct {
	ReleaseDate  *string `json:"releaseDate,omitempty"`
	Manufacturer *string `json:"manufacturer,omitempty"`
	ID           string  `json:"id,omitempty"`
	Name         string  `json:"name,omitempty"`
	Category     string  `json:"category,omitempty"`
	ZapScript    string  `json:"zapScript,omitempty"`
}

type SystemDefault added in v2.12.0

type SystemDefault struct {
	System     string `json:"system" validate:"required,system"`
	Launcher   string `json:"launcher,omitempty"`
	BeforeExit string `json:"beforeExit,omitempty"`
}

type SystemsParams added in v2.16.0

type SystemsParams struct {
	All bool `json:"all,omitempty"`
}

type SystemsResponse

type SystemsResponse struct {
	Systems []System `json:"systems"`
}

type TagsResponse added in v2.7.0

type TagsResponse struct {
	Tags []database.TagInfo `json:"tags"`
}

type TokenResponse

type TokenResponse struct {
	ScanTime time.Time `json:"scanTime"`
	Type     string    `json:"type"`
	UID      string    `json:"uid"`
	Text     string    `json:"text"`
	Data     string    `json:"data"`
	ReaderID string    `json:"readerId,omitempty"`
}

type TokensResponse

type TokensResponse struct {
	Last   *TokenResponse  `json:"last,omitempty"`
	Active []TokenResponse `json:"active"`
}

type UIChoice added in v2.16.0

type UIChoice struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

type UIEvent added in v2.16.0

type UIEvent struct {
	CreatedAt        time.Time   `json:"createdAt"`
	ExpiresAt        *time.Time  `json:"expiresAt,omitempty"`
	ID               string      `json:"id"`
	Kind             UIEventKind `json:"kind"`
	Title            string      `json:"title,omitempty"`
	Message          string      `json:"message,omitempty"`
	SelectedChoiceID string      `json:"selectedChoiceId,omitempty"`
	Choices          []UIChoice  `json:"choices,omitempty"`
	Dismissible      bool        `json:"dismissible"`
}

type UIEventKind added in v2.16.0

type UIEventKind string
const (
	UIEventKindNotice  UIEventKind = "notice"
	UIEventKindLoader  UIEventKind = "loader"
	UIEventKindPicker  UIEventKind = "picker"
	UIEventKindConfirm UIEventKind = "confirm"
)

type UIOutcome added in v2.16.0

type UIOutcome string
const (
	UIOutcomeConfirmed  UIOutcome = "confirmed"
	UIOutcomeSelected   UIOutcome = "selected"
	UIOutcomeDismissed  UIOutcome = "dismissed"
	UIOutcomeTimedOut   UIOutcome = "timed_out"
	UIOutcomeCompleted  UIOutcome = "completed"
	UIOutcomeSuperseded UIOutcome = "superseded"
	UIOutcomeCancelled  UIOutcome = "cancelled"
)

type UIResolution added in v2.16.0

type UIResolution struct {
	ID       string    `json:"id"`
	Outcome  UIOutcome `json:"outcome"`
	ChoiceID string    `json:"choiceId,omitempty"`
}

type UIRespondParams added in v2.16.0

type UIRespondParams struct {
	ID       string           `json:"id" validate:"required"`
	Action   UIResponseAction `json:"action" validate:"required,oneof=dismiss select confirm"`
	ChoiceID string           `json:"choiceId,omitempty"`
}

type UIResponseAction added in v2.16.0

type UIResponseAction string
const (
	UIResponseActionDismiss UIResponseAction = "dismiss"
	UIResponseActionSelect  UIResponseAction = "select"
	UIResponseActionConfirm UIResponseAction = "confirm"
)

type UIStateResponse added in v2.16.0

type UIStateResponse struct {
	Events   []UIEvent      `json:"events"`
	Resolved []UIResolution `json:"resolved"`
	Revision uint64         `json:"revision"`
}

type UpdateActiveMediaParams

type UpdateActiveMediaParams struct {
	SystemID  string `json:"systemId" validate:"required"`
	MediaPath string `json:"mediaPath" validate:"required"`
	MediaName string `json:"mediaName" validate:"required"`
}

type UpdateApplyResponse added in v2.10.0

type UpdateApplyResponse struct {
	PreviousVersion string `json:"previousVersion"`
	NewVersion      string `json:"newVersion"`
}

type UpdateCheckResponse added in v2.10.0

type UpdateCheckResponse struct {
	CurrentVersion  string `json:"currentVersion"`
	LatestVersion   string `json:"latestVersion,omitempty"`
	ReleaseNotes    string `json:"releaseNotes,omitempty"`
	UpdateAvailable bool   `json:"updateAvailable"`
}

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 UpdateProfileParams added in v2.16.0

type UpdateProfileParams struct {
	Name               *string `json:"name" validate:"omitempty,min=1,max=255"`
	PIN                *string `json:"pin" validate:"omitempty,numeric,min=4,max=8"`
	LimitsEnabled      *bool   `json:"limitsEnabled"`
	DailyLimit         *string `json:"dailyLimit" validate:"omitempty,duration"`
	SessionLimit       *string `json:"sessionLimit" validate:"omitempty,duration"`
	Role               *string `json:"role" validate:"omitempty,oneof=admin member"`
	ProfileID          string  `json:"profileId" validate:"required,min=1"`
	ClearPIN           bool    `json:"clearPin"`
	ClearLimits        bool    `json:"clearLimits"`
	RegenerateSwitchID bool    `json:"regenerateSwitchId"`
}

UpdateProfileParams updates a profile. Omitted fields are unchanged. ClearPIN removes the PIN; ClearLimits resets all limit overrides back to inheriting global config before any limit fields in the same request are applied (clear-then-set); RegenerateSwitchID issues a new switch ID (lost-card replacement).

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"`
	Encryption                *bool               `json:"encryption"`
	BackupRemoteEnabled       *bool               `json:"backupRemoteEnabled"`
	PlaytimeSyncEnabled       *bool               `json:"playtimeSyncEnabled"`
	UpdateChannel             *string             `json:"updateChannel" validate:"omitempty,oneof=stable beta"`
	BackupRemoteSchedule      *string             `json:"backupRemoteSchedule" validate:"omitempty,oneof=daily weekly manual"`
	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"`
	ProfilesRequireForLaunch  *bool               `json:"profilesRequireForLaunch"`
	ProfilesSwapData          *bool               `json:"profilesSwapData"`
}

type VerifyProfileParams added in v2.16.0

type VerifyProfileParams struct {
	ProfileID *string `json:"profileId"`
	SwitchID  *string `json:"switchId"`
	PIN       *string `json:"pin"`
}

VerifyProfileParams verifies a profile credential without switching. Exactly one of ProfileID (with PIN when the profile has one) or SwitchID (a bearer credential) must be given.

type VersionResponse

type VersionResponse struct {
	Version  string `json:"version"`
	Platform string `json:"platform"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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