{"modulePath":"github.com/OpenSIN-Code/SIN-Code-Bundle","version":"v1.9.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package notifications\n\nSPDX-License-Identifier: MIT Purpose: cobra CLI for sin-code notifications: list/read/dismiss/listen/clear/stats/prune.\n\nSPDX-License-Identifier: MIT Purpose: Dispatch notifications to TUI channel, stderr, macOS, and webhooks.\n\nSPDX-License-Identifier: MIT Purpose: helpers (paths, mkdir) for notifications package.\n\nSPDX-License-Identifier: MIT Purpose: small json wrapper used by dispatch to keep import surface minimal.\n\nSPDX-License-Identifier: MIT Purpose: notification model and store for todo events. Backed by bbolt.\n\n## Variables\n\n```go\nvar (\n\tErrNotFound = fmt.Errorf(\"notifications: not found\")\n)\n```\n\n```go\nvar NotificationsCmd = \u0026cobra.Command{\n\tUse:   \"notifications\",\n\tShort: \"Manage sin-code todo notifications\",\n\tLong: `System notifications for sin-code todo events.\n\n  list [--unread]            List recent notifications\n  read \u003cid\u003e                   Mark a notification as read\n  unread \u003cid\u003e                 Mark a notification as unread\n  dismiss \u003cid\u003e                Dismiss a notification\n  listen                      Stream notifications as JSONL (Ctrl-C to stop)\n  clear                       Delete all notifications\n  prune [--older-than 168h]   Remove old/dismissed notifications\n  stats                       Counts by type and read state`,\n\tSilenceUsage: true,\n}\n```\n\n## Functions\n\n```go\nfunc Dispatch(n *Notification) error\n```\nDispatch is a convenience wrapper used by other packages (e.g. todo).\n\n```go\nfunc SendTUI(n *Notification)\n```\nSendTUI is the internal non-blocking send used by Dispatcher.\n\n```go\nfunc TUIBroadcaster() \u003c-chan *Notification\n```\nTUIBroadcaster returns the channel that the TUI subscribes to.\n\n## Types\n\n```go\ntype Dispatcher struct {\n\tStore      *Store\n\tWebhookURL string\n\tStderr     bool\n\tMacOS      bool\n\tHTTPClient *http.Client\n}\n```\nDispatcher delivers a notification through all enabled channels.\n\n```go\nfunc NewDispatcher(store *Store) *Dispatcher\n```\n\n```go\nfunc (d *Dispatcher) Send(n *Notification) error\n```\n\n```go\ntype ListFilter struct {\n\tType         Type\n\tTodoID       string\n\tUnread       bool\n\tNotDismissed bool\n}\n```\n\n```go\ntype Notification struct {\n\tID        string    `json:\"id\"`\n\tType      Type      `json:\"type\"`\n\tTodoID    string    `json:\"todo_id\"`\n\tTitle     string    `json:\"title\"`\n\tMessage   string    `json:\"message\"`\n\tActor     string    `json:\"actor,omitempty\"`\n\tCreated   time.Time `json:\"created\"`\n\tRead      bool      `json:\"read\"`\n\tDismissed bool      `json:\"dismissed\"`\n}\n```\n\n```go\nfunc (n *Notification) GetID() string\n```\n\n```go\nfunc (n *Notification) GetMessage() string\n```\n\n```go\nfunc (n *Notification) GetTitle() string\n```\n\n```go\nfunc (n *Notification) GetType() string\n```\n\n```go\ntype Stats struct {\n\tTotal  int          `json:\"total\"`\n\tUnread int          `json:\"unread\"`\n\tByType map[Type]int `json:\"by_type\"`\n}\n```\n\n```go\ntype Store struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc Open(path string) (*Store, error)\n```\n\n```go\nfunc (s *Store) Add(n *Notification) error\n```\n\n```go\nfunc (s *Store) Clear() error\n```\n\n```go\nfunc (s *Store) Close() error\n```\n\n```go\nfunc (s *Store) ComputeStats() (*Stats, error)\n```\n\n```go\nfunc (s *Store) Count() (int, error)\n```\n\n```go\nfunc (s *Store) CountUnread() (int, error)\n```\n\n```go\nfunc (s *Store) DB() *bolt.DB\n```\n\n```go\nfunc (s *Store) Dismiss(id string) error\n```\n\n```go\nfunc (s *Store) Get(id string) (*Notification, error)\n```\n\n```go\nfunc (s *Store) List(f ListFilter, limit int) ([]*Notification, error)\n```\n\n```go\nfunc (s *Store) MarkRead(id string) error\n```\n\n```go\nfunc (s *Store) MarkUnread(id string) error\n```\n\n```go\nfunc (s *Store) Path() string\n```\n\n```go\nfunc (s *Store) Prune(ttl time.Duration) (int, error)\n```\n\n```go\ntype Type string\n```\n\n```go\nconst (\n\tTypeTodoCreated   Type = \"todo_created\"\n\tTypeTodoAssigned  Type = \"todo_assigned\"\n\tTypeTodoClaimed   Type = \"todo_claimed\"\n\tTypeTodoCompleted Type = \"todo_completed\"\n\tTypeTodoCancelled Type = \"todo_cancelled\"\n\tTypeTodoBlocked   Type = \"todo_blocked\"\n\tTypeTodoUnblocked Type = \"todo_unblocked\"\n\tTypeTodoDeleted   Type = \"todo_deleted\"\n\tTypeTodoDepAdd    Type = \"todo_dep_add\"\n\tTypeTodoStale     Type = \"todo_stale\"\n\tTypeTodoOverdue   Type = \"todo_overdue\"\n)\n```\n\n","path":"github.com/OpenSIN-Code/SIN-Code-Bundle/cmd/sin-code/internal/notifications","name":"notifications","synopsis":"SPDX-License-Identifier: MIT Purpose: cobra CLI for sin-code notifications: list/read/dismiss/listen/clear/stats/prune.","isRedistributable":true}
