Documentation
¶
Overview ¶
Package capability provides the capability invocation framework.
Index ¶
- Constants
- Variables
- func BoolParam(params map[string]any, key string) (bool, bool)
- func EncodeCursor(secret []byte, payload CursorPayload) (string, error)
- func GetEventPool() *ants.PoolWithFunc
- func InitEventPool(size int, expiryDuration string, mc *metrics.CapabilityCollector) error
- func Int64Param(params map[string]any, key string) (int64, bool)
- func IntParam(params map[string]any, key string) (int, bool)
- func IsMutation(op string) bool
- func Op(capType hub.CapabilityType, key string) string
- func Register(s Spec) error
- func RegisterInvoker(capability hub.CapabilityType, operation string, invoker Invoker) error
- func RegisterOperations(capType hub.CapabilityType, ops map[string]string)
- func RequiredInt(params map[string]any, key string) (int, error)
- func RequiredInt64(params map[string]any, key string) (int64, error)
- func RequiredString(params map[string]any, key string) (string, error)
- func SetBulkheadCallbacks()
- func SetEventEmitter(emitter EventEmitter)
- func SetEventSourceManager(m *EventSourceManager)
- func SetMetricsCollector(mc *metrics.CapabilityCollector)
- func ShutdownEventPool()
- func StringParam(params map[string]any, key string) (string, bool)
- func UnregisterInvoker(capability hub.CapabilityType, operation string)
- type ArchiveItem
- type Bookmark
- type BookmarkListQuery
- type BookmarkSearchQuery
- type CursorPayload
- type DevopsDashboard
- type DevopsDatasource
- type DevopsDozzleInfo
- type DevopsGrafanaHealth
- type DevopsGrafanaQueryField
- type DevopsGrafanaQueryFrame
- type DevopsGrafanaQueryResult
- type DevopsMetricFamily
- type DevopsNetalertxDevice
- type DevopsNetalertxTotals
- type DevopsRouter
- type DevopsService
- type DevopsStatus
- type DevopsSystem
- type DevopsTraefikOverview
- type DevopsWakapiProject
- type DevopsWakapiSummary
- type Entry
- type EventEmitter
- type EventRef
- type EventSourceEmitter
- type EventSourceManager
- func (m *EventSourceManager) RegisterPolling(r PollingResource)
- func (m *EventSourceManager) RegisterWebhook(c WebhookConverter)
- func (m *EventSourceManager) SetPool(pool *ants.PoolWithFunc)
- func (m *EventSourceManager) Start(ctx context.Context) error
- func (m *EventSourceManager) Stop(ctx context.Context) error
- func (m *EventSourceManager) WebhookHandler() fiber.Handler
- type EventStore
- type ExampleListQuery
- type Feed
- type FinanceAbout
- type FinanceUser
- type ForgeCommitDiff
- type ForgeIssue
- type ForgeListIssuesQuery
- type ForgeRepo
- type ForgeUser
- type GithubListIssuesQuery
- type GithubPageQuery
- type Host
- type InvokeResult
- type Invoker
- type KanbanCreateTaskRequest
- type KanbanMoveTaskRequest
- type KanbanSearchQuery
- type KanbanTaskQuery
- type KanbanUpdateTaskRequest
- type ListResult
- type Memo
- type MemoListQuery
- type NocoBase
- type NocoColumn
- type NocoRecord
- type NocoTable
- type Note
- type NoteListQuery
- type Notification
- type OpDef
- type PageInfo
- type PageRequest
- type Persistence
- type PollResult
- type PollingEntry
- type PollingResource
- type PollingState
- func (s *PollingState) Flush(ctx context.Context) error
- func (*PollingState) FlushInterval() time.Duration
- func (s *PollingState) Get(name string) PollingEntry
- func (s *PollingState) Load(ctx context.Context) error
- func (s *PollingState) MarkDirty(name string)
- func (s *PollingState) Update(name string, entry PollingEntry)
- type ReaderEntryQuery
- type ReaderFeedQuery
- type Registry
- func (r *Registry) Invoke(ctx context.Context, capability hub.CapabilityType, operation string, ...) (*InvokeResult, error)
- func (r *Registry) Register(capability hub.CapabilityType, operation string, invoker Invoker) error
- func (r *Registry) Unregister(capability hub.CapabilityType, operation string)
- type Release
- type ResourceMeta
- type Spec
- type Task
- type Torrent
- type Transaction
- type WebhookConverter
Constants ¶
const ( OpExampleList = "list" OpExampleGet = "get" OpExampleCreate = "create" OpExampleUpdate = "update" OpExampleDelete = "delete" OpExampleHealth = "health" OpBookmarkList = "list" OpBookmarkGet = "get" OpBookmarkCreate = "create" OpBookmarkDelete = "delete" OpBookmarkArchive = "archive" OpBookmarkSearch = "search" OpBookmarkAttachTags = "attach_tags" OpBookmarkDetachTags = "detach_tags" OpBookmarkCheckURL = "check_url" OpArchiveAdd = "add" OpArchiveSearch = "search" OpArchiveGet = "get" OpReaderListFeeds = "list_feeds" OpReaderCreateFeed = "create_feed" OpReaderListEntries = "list_entries" OpReaderMarkEntryRead = "mark_entry_read" OpReaderMarkEntryUnread = "mark_entry_unread" OpReaderStarEntry = "star_entry" OpReaderUnstarEntry = "unstar_entry" OpKanbanListTasks = "list_tasks" OpKanbanGetTask = "get_task" OpKanbanCreateTask = "create_task" OpKanbanUpdateTask = "update_task" OpKanbanDeleteTask = "delete_task" OpKanbanMoveTask = "move_task" OpKanbanCompleteTask = "complete_task" OpKanbanGetColumns = "get_columns" OpKanbanSearchTasks = "search_tasks" OpFinanceCreateTransaction = "create_transaction" OpFinanceAbout = "about" OpFinanceCurrentUser = "current_user" OpFinanceHealth = "health" OpTorrentAdd = "add" OpTorrentList = "list" OpTorrentStop = "stop" OpTorrentRemove = "remove" OpTorrentHealth = "health" OpNocoListBases = "list_bases" OpNocoListTables = "list_tables" OpNocoGetTable = "get_table" OpNocoListRecords = "list_records" OpNocoGetRecord = "get_record" OpNocoCreateRecord = "create_record" OpNocoUpdateRecord = "update_record" OpNocoDeleteRecord = "delete_record" OpNocoHealth = "health" OpGithubGetUser = "get_user" OpGithubGetUserByLogin = "get_user_by_login" OpGithubGetRepo = "get_repo" OpGithubListIssues = "list_issues" OpGithubGetIssue = "get_issue" OpGithubGetCommitDiff = "get_commit_diff" OpGithubGetFileContent = "get_file_content" OpGithubListNotifications = "list_notifications" OpGithubListReleases = "list_releases" OpForgeGetUser = "get_user" OpForgeGetRepo = "get_repo" OpForgeListIssues = "list_issues" OpForgeGetIssue = "get_issue" OpForgeGetCommitDiff = "get_commit_diff" OpForgeGetFileContent = "get_file_content" OpNotifySend = "send" OpNotifyDigest = "digest" OpNoteList = "list" OpNoteGet = "get" OpNoteCreate = "create" OpNoteUpdate = "update" OpNoteDelete = "delete" OpNoteGetContent = "get_content" OpNoteSetContent = "set_content" OpNoteSearch = "search" OpNoteGetAppInfo = "get_app_info" OpMemoList = "list" OpMemoGet = "get" OpMemoCreate = "create" OpMemoUpdate = "update" OpMemoDelete = "delete" OpMemoHealth = "health" OpAgentRun = "run" )
Legacy operation name constants kept for call-site compatibility during the 1:1 provider migration. Prefer package-local constants such as karakeep.OpList.
Variables ¶
var DefaultRegistry = NewRegistry()
var ( // Operations maps capability type to operation name set (populated by Register). Operations = map[hub.CapabilityType]map[string]string{} )
Functions ¶
func EncodeCursor ¶
func EncodeCursor(secret []byte, payload CursorPayload) (string, error)
func GetEventPool ¶
func GetEventPool() *ants.PoolWithFunc
GetEventPool returns the global event pool, or nil if not initialized.
func InitEventPool ¶
func InitEventPool(size int, expiryDuration string, mc *metrics.CapabilityCollector) error
InitEventPool creates the global event pool. Must be called once during startup. Call ShutdownEventPool during server shutdown.
func IsMutation ¶
IsMutation reports whether the operation name indicates a write that modifies state.
func Op ¶
func Op(capType hub.CapabilityType, key string) string
Op looks up a registered operation name by capability and key.
func Register ¶
Register registers hub metadata and invokers from Spec. It skips registration and logs a warning when Instance is nil.
func RegisterInvoker ¶
func RegisterInvoker(capability hub.CapabilityType, operation string, invoker Invoker) error
func RegisterOperations ¶
func RegisterOperations(capType hub.CapabilityType, ops map[string]string)
RegisterOperations records operation names for a capability (used by UI/audit).
func SetBulkheadCallbacks ¶
func SetBulkheadCallbacks()
SetBulkheadCallbacks wires the bulkhead manager with metrics reporting callbacks.
func SetEventEmitter ¶
func SetEventEmitter(emitter EventEmitter)
func SetEventSourceManager ¶
func SetEventSourceManager(m *EventSourceManager)
SetEventSourceManager stores the EventSourceManager for cross-package access. Must be called during server startup before modules Bootstrap.
func SetMetricsCollector ¶
func SetMetricsCollector(mc *metrics.CapabilityCollector)
SetMetricsCollector sets the CapabilityCollector on the DefaultRegistry.
func ShutdownEventPool ¶
func ShutdownEventPool()
ShutdownEventPool releases the pool, waiting up to 30s for in-flight tasks.
func UnregisterInvoker ¶
func UnregisterInvoker(capability hub.CapabilityType, operation string)
UnregisterInvoker removes an invoker for a capability and operation.
Types ¶
type ArchiveItem ¶
type ArchiveItem struct {
ID string `json:"id"`
URL string `json:"url"`
Title string `json:"title,omitzero"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
}
ArchiveItem represents a saved web page or document in an archive store.
type Bookmark ¶
type Bookmark struct {
ID string `json:"id"`
URL string `json:"url"`
Title string `json:"title,omitzero"`
Summary string `json:"summary,omitzero"`
Tags []string `json:"tags,omitzero"`
Archived bool `json:"archived"`
Favourited bool `json:"favourited"`
CreatedAt time.Time `json:"created_at"`
}
Bookmark represents a saved web bookmark with metadata and organisation flags.
type BookmarkListQuery ¶
type BookmarkListQuery struct {
Page PageRequest
Archived *bool
Favourited *bool
Tags []string
}
BookmarkListQuery wraps pagination and filters for listing bookmarks.
type BookmarkSearchQuery ¶
type BookmarkSearchQuery struct {
Page PageRequest
Q string
}
BookmarkSearchQuery wraps pagination for searching bookmarks.
type CursorPayload ¶
type CursorPayload struct {
Capability string `json:"capability,omitempty"`
// Backend is retained only for decoding cursors issued before CapType==provider ID.
// New encoders must leave it empty; do not write this field.
Backend string `json:"backend,omitempty"`
Strategy string `json:"strategy,omitempty"`
ProviderCursor string `json:"provider_cursor,omitempty"`
Page int `json:"page,omitempty"`
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
SortBy string `json:"sort_by,omitempty"`
SortOrder string `json:"sort_order,omitempty"`
FilterHash string `json:"filter_hash,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
}
func DecodeCursor ¶
type DevopsDashboard ¶
type DevopsDashboard struct {
UID string `json:"uid"`
Title string `json:"title"`
URL string `json:"url,omitzero"`
}
DevopsDashboard is a Grafana dashboard search hit.
type DevopsDatasource ¶
type DevopsDatasource struct {
ID int64 `json:"id"`
UID string `json:"uid,omitzero"`
Name string `json:"name"`
Type string `json:"type,omitzero"`
}
DevopsDatasource is a Grafana data source.
type DevopsDozzleInfo ¶
type DevopsDozzleInfo struct {
Healthy bool `json:"healthy"`
Version string `json:"version,omitzero"`
}
DevopsDozzleInfo is Dozzle health/version info.
type DevopsGrafanaHealth ¶
type DevopsGrafanaHealth struct {
Database string `json:"database,omitzero"`
Version string `json:"version,omitzero"`
}
DevopsGrafanaHealth is Grafana instance health.
type DevopsGrafanaQueryField ¶
type DevopsGrafanaQueryField struct {
Name string `json:"name"`
Type string `json:"type,omitzero"`
Values any `json:"values,omitzero"`
}
DevopsGrafanaQueryField summarizes a frame field.
type DevopsGrafanaQueryFrame ¶
type DevopsGrafanaQueryFrame struct {
Name string `json:"name,omitzero"`
RefID string `json:"ref_id,omitzero"`
Fields []DevopsGrafanaQueryField `json:"fields,omitzero"`
}
DevopsGrafanaQueryFrame summarizes one data frame from a Grafana query.
type DevopsGrafanaQueryResult ¶
type DevopsGrafanaQueryResult struct {
Backend string `json:"backend"`
DatasourceUID string `json:"datasource_uid"`
DatasourceType string `json:"datasource_type"`
Frames []DevopsGrafanaQueryFrame `json:"frames,omitzero"`
}
DevopsGrafanaQueryResult is a Grafana datasource query response summary.
type DevopsMetricFamily ¶
type DevopsMetricFamily struct {
Name string `json:"name"`
Help string `json:"help,omitzero"`
Count int `json:"sample_count"`
}
DevopsMetricFamily summarizes one Prometheus metric family from Uptime Kuma.
type DevopsNetalertxDevice ¶
type DevopsNetalertxDevice struct {
Name string `json:"name"`
MAC string `json:"mac,omitzero"`
IP string `json:"ip,omitzero"`
Type string `json:"type,omitzero"`
Status string `json:"status,omitzero"`
Vendor string `json:"vendor,omitzero"`
}
DevopsNetalertxDevice is a NetAlertX network device.
type DevopsNetalertxTotals ¶
type DevopsNetalertxTotals struct {
All int `json:"all"`
Connected int `json:"connected"`
Favorites int `json:"favorites"`
New int `json:"new"`
Down int `json:"down"`
Archived int `json:"archived"`
}
DevopsNetalertxTotals holds NetAlertX device category counts.
type DevopsRouter ¶
type DevopsRouter struct {
Name string `json:"name"`
Rule string `json:"rule,omitzero"`
Service string `json:"service,omitzero"`
Status string `json:"status,omitzero"`
}
DevopsRouter is a Traefik HTTP router.
type DevopsService ¶
type DevopsService struct {
Name string `json:"name"`
Type string `json:"type,omitzero"`
Status string `json:"status,omitzero"`
}
DevopsService is a Traefik HTTP service.
type DevopsStatus ¶
DevopsStatus reports which devops backends are configured.
type DevopsSystem ¶
type DevopsSystem struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status,omitzero"`
Host string `json:"host,omitzero"`
}
DevopsSystem is a Beszel monitored host.
type DevopsTraefikOverview ¶
type DevopsTraefikOverview struct {
HTTPRouters int `json:"http_routers"`
HTTPServices int `json:"http_services"`
}
DevopsTraefikOverview is Traefik overview counts.
type DevopsWakapiProject ¶
DevopsWakapiProject is a Wakapi tracked project.
type DevopsWakapiSummary ¶
type DevopsWakapiSummary struct {
TotalSeconds int64 `json:"total_seconds"`
}
DevopsWakapiSummary is a coding-stats summary.
type Entry ¶
type Entry struct {
ID int64 `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
Content string `json:"content,omitzero"`
Status string `json:"status"`
Starred bool `json:"starred"`
PublishedAt time.Time `json:"published_at"`
FeedTitle string `json:"feed_title,omitzero"`
}
Entry represents a single article or post within an RSS/Atom feed.
type EventEmitter ¶
type EventEmitter func(ctx context.Context, result *InvokeResult)
type EventSourceEmitter ¶
EventSourceEmitter is the function signature for emitting DataEvents produced by webhook converters and polling resources.
type EventSourceManager ¶
type EventSourceManager struct {
// contains filtered or unexported fields
}
EventSourceManager orchestrates webhook converters and polling resources, dispatching their output through the EventEmitter chain.
func GetEventSourceManager ¶
func GetEventSourceManager() *EventSourceManager
GetEventSourceManager returns the global EventSourceManager, or nil if not set.
func NewEventSourceManager ¶
func NewEventSourceManager( emitter EventSourceEmitter, stateStore *PollingState, mc *metrics.EventSourceCollector, ) *EventSourceManager
NewEventSourceManager creates an EventSourceManager backed by the given emitter, state store, and metrics collector.
func (*EventSourceManager) RegisterPolling ¶
func (m *EventSourceManager) RegisterPolling(r PollingResource)
RegisterPolling registers a polling resource. The poll interval is derived from the resource's DefaultInterval method. Nil resources are silently skipped.
func (*EventSourceManager) RegisterWebhook ¶
func (m *EventSourceManager) RegisterWebhook(c WebhookConverter)
RegisterWebhook registers a webhook converter.
func (*EventSourceManager) SetPool ¶
func (m *EventSourceManager) SetPool(pool *ants.PoolWithFunc)
SetPool assigns the event pool for non-blocking webhook event submission.
func (*EventSourceManager) Start ¶
func (m *EventSourceManager) Start(ctx context.Context) error
Start begins the cron scheduler, loads persisted state, and starts periodic flush.
func (*EventSourceManager) Stop ¶
func (m *EventSourceManager) Stop(ctx context.Context) error
Stop shuts down the cron scheduler, flushes state, and releases the event pool.
func (*EventSourceManager) WebhookHandler ¶
func (m *EventSourceManager) WebhookHandler() fiber.Handler
WebhookHandler returns a Fiber handler that dispatches incoming webhook requests to the registered WebhookConverter for the given path.
type EventStore ¶
type EventStore interface {
AppendDataEvent(ctx context.Context, event types.DataEvent) error
AppendEventOutbox(ctx context.Context, event types.DataEvent) error
}
EventStore abstracts the persistence of DataEvent records.
type ExampleListQuery ¶
type ExampleListQuery struct {
Page PageRequest
}
ExampleListQuery wraps pagination for listing example items.
type Feed ¶
type Feed struct {
ID int64 `json:"id"`
Title string `json:"title"`
FeedURL string `json:"feed_url"`
SiteURL string `json:"site_url,omitzero"`
Category string `json:"category,omitzero"`
}
Feed represents an RSS/Atom feed subscription in a reader service.
type FinanceAbout ¶
type FinanceAbout struct {
Version string `json:"version"`
APIVersion string `json:"api_version,omitzero"`
PHPVersion string `json:"php_version,omitzero"`
OS string `json:"os,omitzero"`
Driver string `json:"driver,omitzero"`
}
FinanceAbout holds Firefly III instance metadata.
type FinanceUser ¶
type FinanceUser struct {
ID string `json:"id"`
Email string `json:"email,omitzero"`
Role string `json:"role,omitzero"`
}
FinanceUser holds the authenticated Firefly III user.
type ForgeCommitDiff ¶
type ForgeCommitDiff struct {
CommitID string `json:"commit_id"`
CommitMessage string `json:"commit_message"`
Files []string `json:"files"`
DiffContent string `json:"diff_content"`
}
ForgeCommitDiff represents a commit diff on a software forge.
type ForgeIssue ¶
type ForgeIssue struct {
ID int64 `json:"id"`
Index int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body,omitzero"`
State string `json:"state"`
HTMLURL string `json:"html_url"`
Author string `json:"author,omitzero"`
}
ForgeIssue represents an issue on a software forge.
type ForgeListIssuesQuery ¶
type ForgeListIssuesQuery struct {
Page PageRequest
State string
}
ForgeListIssuesQuery wraps pagination and filtering for listing forge issues.
type ForgeRepo ¶
type ForgeRepo struct {
ID int64 `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description,omitzero"`
Private bool `json:"private"`
HTMLURL string `json:"html_url"`
CloneURL string `json:"clone_url,omitzero"`
Owner string `json:"owner"`
}
ForgeRepo represents a repository on a software forge.
type ForgeUser ¶
type ForgeUser struct {
ID int64 `json:"id"`
UserName string `json:"username"`
Email string `json:"email,omitzero"`
AvatarURL string `json:"avatar_url,omitzero"`
}
ForgeUser represents a forge user account.
type GithubListIssuesQuery ¶
type GithubListIssuesQuery struct {
Page PageRequest
State string
}
GithubListIssuesQuery wraps pagination and filtering for listing GitHub issues.
type GithubPageQuery ¶
type GithubPageQuery struct {
Page PageRequest
}
GithubPageQuery wraps pagination for GitHub list operations.
type Host ¶
type Host struct {
ID string `json:"id"`
Name string `json:"name"`
Address string `json:"address,omitzero"`
Status string `json:"status"`
}
Host represents a discovered homelab service instance.
type InvokeResult ¶
type InvokeResult struct {
Capability hub.CapabilityType `json:"capability"`
Operation string `json:"operation"`
Data any `json:"data,omitzero"`
Page *PageInfo `json:"page,omitzero"`
Text string `json:"text,omitzero"`
Meta map[string]any `json:"meta,omitzero"`
Events []EventRef `json:"events,omitzero"`
Resource *ResourceMeta `json:"_resource,omitempty"`
}
type KanbanCreateTaskRequest ¶
type KanbanCreateTaskRequest struct {
Title string
Description string
ProjectID int
ColumnID int
Tags []string
Reference string
}
KanbanCreateTaskRequest holds fields for creating a task.
type KanbanMoveTaskRequest ¶
KanbanMoveTaskRequest holds fields for moving a task.
type KanbanSearchQuery ¶
type KanbanSearchQuery struct {
Page PageRequest
ProjectID int
Q string
}
KanbanSearchQuery wraps pagination for searching tasks.
type KanbanTaskQuery ¶
type KanbanTaskQuery struct {
Page PageRequest
ProjectID int
ColumnID int
Status string
}
KanbanTaskQuery wraps pagination and filters for listing tasks.
type KanbanUpdateTaskRequest ¶
KanbanUpdateTaskRequest holds fields for updating a task.
type ListResult ¶
type Memo ¶
type Memo struct {
Name string `json:"name"`
State string `json:"state,omitzero"`
Content string `json:"content,omitzero"`
Visibility string `json:"visibility,omitzero"`
Tags []string `json:"tags,omitzero"`
Pinned bool `json:"pinned"`
Creator string `json:"creator,omitzero"`
Snippet string `json:"snippet,omitzero"`
CreateTime time.Time `json:"create_time,omitzero"`
UpdateTime time.Time `json:"update_time,omitzero"`
}
Memo represents a memo from a note-taking system such as Memos.
type MemoListQuery ¶
type MemoListQuery struct {
Page PageRequest
}
MemoListQuery wraps pagination for listing memos.
type NocoColumn ¶
type NocoColumn struct {
ID string `json:"id"`
Title string `json:"title,omitzero"`
Type string `json:"type,omitzero"`
}
NocoColumn represents a NocoDB table column.
type NocoRecord ¶
NocoRecord represents a NocoDB table row.
type NocoTable ¶
type NocoTable struct {
ID string `json:"id"`
Title string `json:"title,omitzero"`
BaseID string `json:"base_id,omitzero"`
Columns []NocoColumn `json:"columns,omitzero"`
}
NocoTable represents a NocoDB table with optional columns.
type Note ¶
type Note struct {
ID string `json:"id"`
Title string `json:"title"`
Type string `json:"type,omitzero"`
Content string `json:"content,omitzero"`
ParentNoteIDs []string `json:"parent_note_ids,omitzero"`
ChildNoteIDs []string `json:"child_note_ids,omitzero"`
IsProtected bool `json:"is_protected"`
DateCreated string `json:"date_created,omitzero"`
DateModified string `json:"date_modified,omitzero"`
UtcDateCreated string `json:"utc_date_created,omitzero"`
UtcDateModified string `json:"utc_date_modified,omitzero"`
}
Note represents a note from a note-taking system such as Trilium.
type NoteListQuery ¶
type NoteListQuery struct {
Page PageRequest
Query string
}
NoteListQuery wraps pagination for listing notes.
type Notification ¶
type Notification struct {
ID string `json:"id"`
Reason string `json:"reason,omitzero"`
Unread bool `json:"unread"`
Subject string `json:"subject,omitzero"`
RepoName string `json:"repo_name,omitzero"`
UpdatedAt time.Time `json:"updated_at"`
LastReadAt time.Time `json:"last_read_at,omitzero"`
}
Notification represents a GitHub notification.
type OpDef ¶
type OpDef struct {
Name string
Description string
Scopes []string
Mutation bool
Input []hub.ParamDef
Handler Invoker
}
OpDef declares a single capability operation for registration.
type PageRequest ¶
type PageRequest struct {
Limit int `json:"limit,omitzero"`
Cursor string `json:"cursor,omitzero"`
SortBy string `json:"sort_by,omitzero"`
SortOrder string `json:"sort_order,omitzero"`
}
func PageRequestFromParams ¶
func PageRequestFromParams(params map[string]any) PageRequest
type Persistence ¶
type Persistence interface {
LoadAll(ctx context.Context) (map[string]PollingEntry, error)
Save(ctx context.Context, resourceName, cursor string, knownHashes map[string]string) error
}
Persistence defines the backend storage interface for polling state.
type PollResult ¶
PollResult carries a batch of items returned by a polling List call.
type PollingEntry ¶
PollingEntry holds cursor position and known content hashes for one polling resource.
type PollingResource ¶
type PollingResource interface {
// ResourceName returns a unique name for the polled resource type.
ResourceName() string
// DefaultInterval returns the recommended polling interval for this resource.
DefaultInterval() time.Duration
// DiffKey returns a unique key from an item used to detect changes between polls.
DiffKey(item any) string
// ContentHash returns a hash of the item content for change detection.
ContentHash(item any) string
// CursorField returns the field name used for cursor-based pagination.
CursorField() string
// List fetches a batch of items from the provider starting after cursor.
List(ctx context.Context, cursor string) (PollResult, error)
}
PollingResource represents a single pollable resource type from a provider. Each (provider, resource) pair registers one PollingResource.
type PollingState ¶
type PollingState struct {
// contains filtered or unexported fields
}
PollingState manages in-memory polling state with periodic persistence. Each pollEntry has its own lock to avoid global contention.
func NewPollingState ¶
func NewPollingState(backend Persistence) *PollingState
NewPollingState creates a PollingState backed by the given Persistence.
func (*PollingState) Flush ¶
func (s *PollingState) Flush(ctx context.Context) error
Flush persists all dirty entries to the backend. It attempts to save every dirty entry and collects errors so that a single failure does not abandon remaining entries.
func (*PollingState) FlushInterval ¶
func (*PollingState) FlushInterval() time.Duration
FlushInterval returns the recommended interval between periodic flushes.
func (*PollingState) Get ¶
func (s *PollingState) Get(name string) PollingEntry
Get returns a copy of the polling entry for the named resource. Returns an empty entry if the resource is unknown.
func (*PollingState) Load ¶
func (s *PollingState) Load(ctx context.Context) error
Load restores state from the persistence backend. It overwrites any in-memory entries with the persisted data — this is intended to be called once during startup before any polls run, so persisted state takes precedence over in-memory defaults.
func (*PollingState) MarkDirty ¶
func (s *PollingState) MarkDirty(name string)
MarkDirty marks a resource as needing persistence.
func (*PollingState) Update ¶
func (s *PollingState) Update(name string, entry PollingEntry)
Update sets the polling entry for the named resource.
type ReaderEntryQuery ¶
type ReaderEntryQuery struct {
Page PageRequest
Status string
FeedID int64
}
ReaderEntryQuery wraps pagination and filters for listing entries.
type ReaderFeedQuery ¶
type ReaderFeedQuery struct {
Page PageRequest
}
ReaderFeedQuery wraps pagination for listing feeds.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Invoke ¶
func (r *Registry) Invoke(ctx context.Context, capability hub.CapabilityType, operation string, params map[string]any) (*InvokeResult, error)
func (*Registry) Unregister ¶
func (r *Registry) Unregister(capability hub.CapabilityType, operation string)
Unregister removes an invoker for a capability and operation.
type Release ¶
type Release struct {
ID int64 `json:"id"`
TagName string `json:"tag_name"`
Name string `json:"name,omitzero"`
Body string `json:"body,omitzero"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
HTMLURL string `json:"html_url,omitzero"`
PublishedAt time.Time `json:"published_at,omitzero"`
}
Release represents a GitHub repository release.
type ResourceMeta ¶
type ResourceMeta struct {
EventID string `json:"event_id"`
EntityID string `json:"entity_id"`
App string `json:"app"`
}
ResourceMeta identifies a resource created by a capability mutation operation.
type Spec ¶
type Spec struct {
Type hub.CapabilityType
App string
Description string
Events []hub.EventDef
Instance any
Ops []OpDef
}
Spec describes a capability for hub + invoker registration.
type Task ¶
type Task struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitzero"`
ProjectID int `json:"project_id"`
ColumnID int `json:"column_id"`
Tags []string `json:"tags,omitzero"`
Reference string `json:"reference,omitzero"`
}
Task represents a work item on a kanban board.
type Torrent ¶
type Torrent struct {
ID int64 `json:"id"`
Name string `json:"name,omitzero"`
Status string `json:"status,omitzero"`
PercentDone float64 `json:"percent_done,omitzero"`
RateDownload int64 `json:"rate_download,omitzero"`
RateUpload int64 `json:"rate_upload,omitzero"`
DownloadDir string `json:"download_dir,omitzero"`
HashString string `json:"hash_string,omitzero"`
ErrorString string `json:"error_string,omitzero"`
}
Torrent represents a BitTorrent download managed by Transmission.
type Transaction ¶
type Transaction struct {
ID string `json:"id"`
Type string `json:"type,omitzero"`
Amount string `json:"amount,omitzero"`
Description string `json:"description,omitzero"`
Date string `json:"date,omitzero"`
CurrencyCode string `json:"currency_code,omitzero"`
SourceName string `json:"source_name,omitzero"`
DestinationName string `json:"destination_name,omitzero"`
CategoryName string `json:"category_name,omitzero"`
Notes string `json:"notes,omitzero"`
}
Transaction represents a finance transaction from Firefly III.
type WebhookConverter ¶
type WebhookConverter interface {
// WebhookPath returns the URL path that the webhook endpoint listens on.
WebhookPath() string
// VerifySignature validates the incoming webhook payload against the provider's signing scheme.
VerifySignature(headers map[string]string, body []byte) error
// Convert transforms a raw webhook payload into one or more DataEvent records.
Convert(body []byte, headers map[string]string) ([]types.DataEvent, error)
}
WebhookConverter converts a provider-specific webhook payload into DataEvent records. Each implementation encapsulates its own signature verification scheme.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent provides the agent capability for pipeline steps to run chat agent prompts.
|
Package agent provides the agent capability for pipeline steps to run chat agent prompts. |
|
Package clip provides the clip capability for creating shareable markdown clips.
|
Package clip provides the clip capability for creating shareable markdown clips. |
|
Package conformance provides a standard test suite for ability adapters.
|
Package conformance provides a standard test suite for ability adapters. |
|
Package devops implements the multi-provider devops capability aggregator.
|
Package devops implements the multi-provider devops capability aggregator. |
|
Package example implements the example provider adapter for the example capability.
|
Package example implements the example provider adapter for the example capability. |
|
Package fireflyiii implements the Firefly III adapter for the finance capability.
|
Package fireflyiii implements the Firefly III adapter for the finance capability. |
|
Package gitea implements the Gitea adapter for the forge capability.
|
Package gitea implements the Gitea adapter for the forge capability. |
|
Package github implements the GitHub adapter for the github capability.
|
Package github implements the GitHub adapter for the github capability. |
|
Package kanboard implements the Kanboard adapter for the kanban capability.
|
Package kanboard implements the Kanboard adapter for the kanban capability. |
|
Package karakeep implements the Karakeep adapter for the bookmark capability.
|
Package karakeep implements the Karakeep adapter for the bookmark capability. |
|
Package memos implements the Memos adapter for the memo capability.
|
Package memos implements the Memos adapter for the memo capability. |
|
Package miniflux implements the Miniflux adapter for the reader capability.
|
Package miniflux implements the Miniflux adapter for the reader capability. |
|
Package nocodb implements the NocoDB adapter for the database capability.
|
Package nocodb implements the NocoDB adapter for the database capability. |
|
Package notify provides the notification capability for the capability framework.
|
Package notify provides the notification capability for the capability framework. |
|
Package transmission implements the Transmission adapter for the download capability.
|
Package transmission implements the Transmission adapter for the download capability. |
|
Package trilium implements the Trilium adapter for the note capability.
|
Package trilium implements the Trilium adapter for the note capability. |