Documentation
¶
Overview ¶
Package notify defines notices and actionable inbox items shared by host applications. Authentication, rendering, delivery channels and the action that remedies a problem belong to the application. Reading never resolves an item. Existing domain records can be projected as Items without copying their authoritative state into another queue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalid = errors.New("notify: invalid input") ErrNotFound = errors.New("notify: item not found") ErrConflict = errors.New("notify: item changed") ErrRecipientErased = errors.New("notify: recipient erased") )
Errors are stable outcomes of validation, scoped lookup and concurrent edits.
Functions ¶
func ValidateRecipient ¶
ValidateRecipient checks the scope-local identity; it grants no authority.
Types ¶
type Audience ¶
type Audience string
Audience selects an authorization boundary, not a delivery channel.
type Input ¶
type Input struct {
Recipient Recipient `json:"recipient"`
Origin Origin `json:"origin"`
Kind string `json:"kind"`
Data json.RawMessage `json:"data"`
CreatedAt time.Time `json:"created_at"`
Status Status `json:"status,omitempty"`
// ActionRequested records the item's category at creation. With empty Status
// it is historical information, not a claim that the issue is still open.
ActionRequested bool `json:"action_requested,omitempty"`
Severity string `json:"severity,omitempty"`
}
Input is trusted application-authored content. Kind is extensible. Data must contain only fields the recipient may see. CreatedAt is the source time. Publish accepts StatusNotice or StatusOpen; workflow transitions are separate.
type Item ¶
type Item struct {
ID string `json:"id"`
Input
ReadAt *time.Time `json:"read_at"`
// DismissedAt archives this recipient's receipt without resolving work.
DismissedAt *time.Time `json:"dismissed_at"`
ResolvedAt *time.Time `json:"resolved_at"`
UpdatedAt time.Time `json:"updated_at"`
Revision int64 `json:"revision"`
}
Item is an inbox record or a projection of an existing domain record. ReadAt and ResolvedAt describe different operations; neither implies the other. Revision is positive in the durable store and zero for unversioned projections.
type ListOptions ¶
type ListOptions struct {
Limit int
Cursor string
UnreadOnly bool
Status *Status
// Dismissed selects archived receipts instead of the active inbox.
Dismissed bool
}
ListOptions selects a bounded, newest-first page. Status nil includes notices and work items; a pointer to StatusNotice selects only general notices.
type Origin ¶
type Origin struct {
System string `json:"system"`
Scope string `json:"scope"`
ID string `json:"id"`
// Subject is the source recipient, when the destination maps it to a
// different local identity. It grants no authority by itself.
Subject string `json:"subject,omitempty"`
}
Origin preserves a producer's deployment, namespace and stable item ID. Scope can identify a merchant, project or account issuer. Each recipient receives at most one item for the same System, Scope and ID in one local store scope; Subject is optional provenance, not part of that identity.
type Publisher ¶
Publisher is implemented by durable stores and application adapters. A retry with the same recipient and origin preserves the original content/read state.
type Recipient ¶
Recipient names a user or an operator queue within the store's scope. Hosts authorize this pair; an email address is never an identity join.