Documentation
¶
Index ¶
- Constants
- Variables
- func OpenAPI() []byte
- type Config
- type Consumer
- type Cursor
- type Event
- type Notification
- type Page
- type Preferences
- type RecipientResult
- type Repository
- type Resolver
- type Result
- type Service
- func (s *Service) Cleanup(ctx context.Context) (int64, error)
- func (s *Service) Consume(ctx context.Context, d Event) (Result, error)
- func (s *Service) List(ctx context.Context, owner, after string, limit int) (Page, error)
- func (s *Service) MarkAllRead(ctx context.Context, owner string) error
- func (s *Service) MarkRead(ctx context.Context, owner, id string) error
- func (s *Service) Preferences(ctx context.Context, owner string, enabled *bool) (Preferences, error)
- func (s *Service) Unread(ctx context.Context, owner string) (int64, error)
- type Target
Constants ¶
View Source
const ( SuppressionInteractionDisabled = "interaction_disabled" SuppressionStaleRevision = "stale_revision" )
Variables ¶
Functions ¶
Types ¶
type Event ¶
type Event struct {
Source string
ID string
EventType string
Subject string
Revision int64
Recipients []string
Type string
Target Target
TitleKey string
TitleParams map[string]string
}
Event is a trusted, complete notification mapping of one source event. Source, ID, EventType, Subject and Revision retain the producer's identity. The relay validates the CloudEvents envelope and maps only supported results.
type Notification ¶
type Notification struct {
ID string `json:"id"`
Type string `json:"type"`
SourceModule string `json:"source_module"`
Target Target `json:"target"`
TitleKey string `json:"title_key"`
TitleParams map[string]string `json:"title_params"`
CreatedAt time.Time `json:"created_at"`
ReadAt *time.Time `json:"read_at"`
TargetStatus string `json:"target_status"`
Count int64 `json:"count"`
}
type Page ¶
type Page struct {
Items []Notification `json:"items"`
NextCursor string `json:"next_cursor"`
}
type Preferences ¶
type Preferences struct {
InteractionEnabled bool `json:"interaction_enabled"`
}
type RecipientResult ¶
type Repository ¶
type Repository interface {
Consume(context.Context, Event, string, time.Time, time.Duration) (Result, error)
List(context.Context, string, Cursor, int) ([]Notification, error)
Unread(context.Context, string) (int64, error)
MarkRead(context.Context, string, string, time.Time) error
MarkAllRead(context.Context, string, time.Time) error
Preferences(context.Context, string, *bool) (Preferences, error)
Cleanup(context.Context, time.Time, int) (int64, error)
}
type Resolver ¶
Resolver enforces current target authorization for the recipient. Unknown targets must return inaccessible; dependency failures return an error.
type Result ¶
type Result struct {
Recipients []RecipientResult `json:"recipients"`
Ignored bool `json:"ignored"`
}
Click to show internal directories.
Click to hide internal directories.