models

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 9 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
	NotificationPlaytimeLimitReached = "playtime.limit.reached"
	NotificationPlaytimeLimitWarning = "playtime.limit.warning"
	NotificationInboxAdded           = "inbox.added"
)
View Source
const (
	PlaytimeLimitReasonSession = "session"
	PlaytimeLimitReasonDaily   = "daily"
)
View Source
const (
	MethodLaunch               = "launch" // DEPRECATED
	MethodRun                  = "run"
	MethodRunScript            = "run.script"
	MethodStop                 = "stop"
	MethodTokens               = "tokens"
	MethodMedia                = "media"
	MethodMediaGenerate        = "media.generate"
	MethodMediaGenerateCancel  = "media.generate.cancel"
	MethodMediaIndex           = "media.index" // DEPRECATED
	MethodMediaSearch          = "media.search"
	MethodMediaTags            = "media.tags"
	MethodMediaActive          = "media.active"
	MethodMediaActiveUpdate    = "media.active.update"
	MethodSettings             = "settings"
	MethodSettingsUpdate       = "settings.update"
	MethodSettingsReload       = "settings.reload"
	MethodSettingsLogsDownload = "settings.logs.download"
	MethodPlaytimeLimits       = "settings.playtime.limits"
	MethodPlaytimeLimitsUpdate = "settings.playtime.limits.update"
	MethodPlaytime             = "playtime"
	MethodClients              = "clients"
	MethodClientsNew           = "clients.new"
	MethodClientsDelete        = "clients.delete"
	MethodSystems              = "systems"
	MethodLaunchersRefresh     = "launchers.refresh"
	MethodHistory              = "tokens.history"
	MethodMappings             = "mappings"
	MethodMappingsNew          = "mappings.new"
	MethodMappingsDelete       = "mappings.delete"
	MethodMappingsUpdate       = "mappings.update"
	MethodMappingsReload       = "mappings.reload"
	MethodReaders              = "readers"
	MethodReadersWrite         = "readers.write"
	MethodReadersWriteCancel   = "readers.write.cancel"
	MethodVersion              = "version"
	MethodHealthCheck          = "health"
	MethodInbox                = "inbox"
	MethodInboxDelete          = "inbox.delete"
	MethodInboxClear           = "inbox.clear"
)

Variables

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

This section is empty.

Types

type ActiveMedia

type ActiveMedia struct {
	Started    time.Time `json:"started"`
	LauncherID string    `json:"launcherId"`
	SystemID   string    `json:"systemId"`
	SystemName string    `json:"systemName"`
	Path       string    `json:"mediaPath"`
	Name       string    `json:"mediaName"`
}

func NewActiveMedia added in v2.7.0

func NewActiveMedia(systemID, systemName, path, name, launcherID string) *ActiveMedia

NewActiveMedia creates a new ActiveMedia with the current timestamp.

func (*ActiveMedia) Equal

func (a *ActiveMedia) Equal(with *ActiveMedia) bool

type AddMappingParams

type AddMappingParams struct {
	Label    string `json:"label" validate:"max=255"`
	Type     string `json:"type" validate:"required,oneof=id value data uid text"`
	Match    string `json:"match" validate:"required,oneof=exact partial regex"`
	Pattern  string `json:"pattern" validate:"required"`
	Override string `json:"override"`
	Enabled  bool   `json:"enabled"`
}

type AllMappingsResponse

type AllMappingsResponse struct {
	Mappings []MappingResponse `json:"mappings"`
}

type ClientResponse

type ClientResponse struct {
	Name    string    `json:"name"`
	Address string    `json:"address"`
	Secret  string    `json:"secret"`
	ID      uuid.UUID `json:"id"`
}

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 ErrorObject struct {
	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"`
	Exists             bool    `json:"exists"`
	Indexing           bool    `json:"indexing"`
	Optimizing         bool    `json:"optimizing"`
}

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"`
	Enabled  bool   `json:"enabled"`
}

type MediaIndexParams

type MediaIndexParams struct {
	Systems *[]string `json:"systems" validate:"omitempty,dive,system"`
}

type MediaResponse

type MediaResponse struct {
	Database IndexingStatusResponse `json:"database"`
	Active   []ActiveMedia          `json:"active"`
}

type MediaStartedParams

type 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"`
}

type NewClientParams

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

type Notification

type Notification struct {
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

type PaginationInfo added in v2.7.0

type PaginationInfo struct {
	NextCursor  *string `json:"nextCursor,omitempty"`
	HasNextPage bool    `json:"hasNextPage"`
	PageSize    int     `json:"pageSize"`
}

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 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 ReaderInfo

type ReaderInfo struct {
	ID           string   `json:"id"`
	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 ReaderWriteParams

type ReaderWriteParams struct {
	Text string `json:"text" validate:"required"`
}

type ReadersResponse

type ReadersResponse struct {
	Readers []ReaderInfo `json:"readers"`
}

type RequestObject

type RequestObject struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      RPCID           `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type ResponseErrorObject

type ResponseErrorObject struct {
	Error   *ErrorObject `json:"error"`
	JSONRPC string       `json:"jsonrpc"`
	ID      RPCID        `json:"id"`
}

ResponseErrorObject exists for sending errors, so we can omit result from the response, but so nil responses are still returned when using the main ResponseObject.

type ResponseObject

type ResponseObject struct {
	Result  any          `json:"result"`
	Error   *ErrorObject `json:"error,omitempty"`
	JSONRPC string       `json:"jsonrpc"`
	ID      RPCID        `json:"id"`
}

type 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      []models.ZapScriptCmd `json:"cmds"`
	ZapScript int                   `json:"zapscript"`
	Unsafe    bool                  `json:"unsafe"`
}

type SearchParams

type SearchParams struct {
	Systems    *[]string `json:"systems" validate:"omitempty,dive,system"`
	MaxResults *int      `json:"maxResults" validate:"omitempty,gt=0,max=1000"`
	Cursor     *string   `json:"cursor,omitempty"`
	Tags       *[]string `json:"tags,omitempty" validate:"omitempty,dive,min=1"`
	Letter     *string   `json:"letter,omitempty" validate:"omitempty,letter"`
	Query      *string   `json:"query"`
}

type SearchResultMedia

type SearchResultMedia struct {
	System    System             `json:"system"`
	Name      string             `json:"name"`
	Path      string             `json:"path"`
	ZapScript string             `json:"zapScript"`
	Tags      []database.TagInfo `json:"tags"`
}

type SearchResults

type SearchResults struct {
	Pagination *PaginationInfo     `json:"pagination,omitempty"`
	Results    []SearchResultMedia `json:"results"`
	Total      int                 `json:"total"`
}

type SettingsResponse

type SettingsResponse struct {
	ReadersScanMode         string   `json:"readersScanMode"`
	ReadersScanIgnoreSystem []string `json:"readersScanIgnoreSystems"`
	ReadersScanExitDelay    float32  `json:"readersScanExitDelay"`
	RunZapScript            bool     `json:"runZapScript"`
	DebugLogging            bool     `json:"debugLogging"`
	AudioScanFeedback       bool     `json:"audioScanFeedback"`
	ReadersAutoDetect       bool     `json:"readersAutoDetect"`
}

type 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"`
}

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"`
}

type TokensResponse

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

type UpdateActiveMediaParams

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

type UpdateMappingParams

type UpdateMappingParams struct {
	Label    *string `json:"label" validate:"omitempty,max=255"`
	Enabled  *bool   `json:"enabled"`
	Type     *string `json:"type" validate:"omitempty,oneof=id value data uid text"`
	Match    *string `json:"match" validate:"omitempty,oneof=exact partial regex"`
	Pattern  *string `json:"pattern" validate:"omitempty,min=1"`
	Override *string `json:"override"`
	ID       int     `json:"id" validate:"gt=0"`
}

type UpdatePlaytimeLimitsParams added in v2.7.0

type UpdatePlaytimeLimitsParams struct {
	Enabled      *bool     `json:"enabled"`
	Daily        *string   `json:"daily" validate:"omitempty,duration"`
	Session      *string   `json:"session" validate:"omitempty,duration"`
	SessionReset *string   `json:"sessionReset" validate:"omitempty,duration"`
	Warnings     *[]string `json:"warnings" validate:"omitempty,dive,duration"`
	Retention    *int      `json:"retention" validate:"omitempty,gte=0"`
}

type UpdateSettingsParams

type UpdateSettingsParams struct {
	RunZapScript            *bool     `json:"runZapScript"`
	DebugLogging            *bool     `json:"debugLogging"`
	AudioScanFeedback       *bool     `json:"audioScanFeedback"`
	ReadersAutoDetect       *bool     `json:"readersAutoDetect"`
	ReadersScanMode         *string   `json:"readersScanMode" validate:"omitempty,oneof=tap hold"`
	ReadersScanExitDelay    *float32  `json:"readersScanExitDelay" validate:"omitempty,gte=0"`
	ReadersScanIgnoreSystem *[]string `json:"readersScanIgnoreSystems" validate:"omitempty,dive,system"`
}

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