Documentation
¶
Overview ¶
Package console is the v1 notification adapter (R-230, R-231).
Console-only: a notification is recorded and shown to the recipient the next time they look at Pando. Nothing is sent anywhere, and that is the whole of R-231 rather than a placeholder for it.
The honest consequence, which the product has to state rather than imply: a console-only notification reaches nobody who is not already looking. That is why R-266 says sharing an app sends no message — the tile appearing in the recipient's launcher is the notification, and it is strictly better than a console message, because it is waiting there for someone who has never signed in. An adapter that can reach a person elsewhere is R-232, and LATER.
This adapter exists now so the category is exercised: the interface has an implementation, main registers it, and R-232's SMTP adapter is a new file rather than a new seam.
Package console implements the v1 notification adapter (R-231).
The interface exists so SMTP and hosted senders drop in later without touching core.
Index ¶
- Constants
- func Info() api.KindInfo
- type Adapter
- func (a *Adapter) Capabilities() api.NotifyCapabilities
- func (a *Adapter) Category() api.Category
- func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error
- func (a *Adapter) HealthCheck(context.Context) error
- func (a *Adapter) Kind() string
- func (a *Adapter) Notify(ctx context.Context, n api.Notification) error
- type Config
- type Sink
Constants ¶
const Kind = "console"
Kind is the adapter's kind string.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter records notifications for display in the console.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() api.NotifyCapabilities
Capabilities: the console reaches the people a notification names.
func (*Adapter) HealthCheck ¶
HealthCheck succeeds when there is somewhere to record to.
func (*Adapter) Notify ¶
Notify records the message.
Recipients with no user ID are dropped rather than guessed at. This adapter reaches people inside Pando, and a recipient Pando has no account for is someone it cannot reach — saying so by dropping them is better than recording a notification addressed to nobody, which would look delivered.
type Config ¶
type Config struct {
// Retain is how long a delivered notification is kept. A console
// notification that is never read is not a failure worth keeping forever.
RetainDays int `json:"retain_days,omitempty"`
}
Config is the adapter's configuration.
type Sink ¶
Sink is where a notification is recorded.
An interface so this adapter stores nothing itself: R-027 forbids an adapter touching state, and this is that boundary — main supplies a writer that core owns.
The signature uses only api types on purpose. A struct declared here would have to be imported by whatever implements this, which would make core depend on one specific adapter — the dependency running backwards, past the boundary the lint is guarding, in a direction the lint does not check.