Documentation
¶
Overview ¶
Package notifysource defines the interface and types for external notification sources (Gmail, Discord, etc.) that can be polled for new items.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ID string `json:"id"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
IntervalMinutes int `json:"intervalMinutes"`
Query string `json:"query,omitempty"`
Options map[string]string `json:"options,omitempty"`
}
Config holds the configuration for a notification source instance.
type Factory ¶
type Factory func(cfg Config, tokens TokenAccessor) (Source, error)
Factory creates a Source from configuration and a token accessor.
type Notification ¶
type Notification struct {
Title string `json:"title"`
Body string `json:"body"`
ReceivedAt time.Time `json:"receivedAt"`
Meta map[string]string `json:"meta,omitempty"`
}
Notification represents a single notification item from an external source.
type PollResult ¶
type PollResult struct {
Items []Notification
Cursor string // opaque cursor for next poll (e.g., Gmail historyId)
}
PollResult contains the result of a polling operation.
type Source ¶
type Source interface {
// Type returns the source type identifier (e.g., "gmail", "discord").
Type() string
// Poll checks for new items since the given cursor.
// An empty cursor means first poll (source should return recent items).
Poll(ctx context.Context, cursor string) (*PollResult, error)
// Validate checks if credentials and configuration are valid.
Validate(ctx context.Context) error
}
Source is the interface that notification source implementations must satisfy.
Click to show internal directories.
Click to hide internal directories.