Documentation
¶
Overview ¶
Package notify defines broker approval notification interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalMessage ¶
type ApprovalMessage struct {
GrantID string
DecisionToken string
Text string
Client string
Operation string
Target string
Reason string
RequestedMinutes int
MaxUses usebudget.Limit
Fields []Field
}
ApprovalMessage is the generic notification payload for an approval request.
type Decision ¶
type Decision struct {
Action Action
GrantID string
DecisionToken string
Approver string
ChatID int64
CallbackID string
MessageID int
MessageText string
OperatorID int64
OperatorTag string
}
Decision is a parsed operator decision.
type DecisionResult ¶
type DecisionResult struct {
// Answer is the short callback answer shown by the approval channel.
Answer string
// Retry leaves the callback unanswered and its update offset uncommitted.
// Brokers use it when a durable decision transaction could not be saved.
Retry bool
}
DecisionResult is the callback answer returned after an operator decision.
type Memory ¶
type Memory struct {
Messages []ApprovalMessage
Statuses []string
}
Memory is an in-memory notifier for tests and local dry runs.
func (*Memory) SendApproval ¶
func (m *Memory) SendApproval(_ context.Context, msg ApprovalMessage) (MessageRef, error)
SendApproval records msg and returns a fake message reference.
func (*Memory) UpdateStatus ¶
UpdateStatus records a status update.
type MessageRef ¶
type MessageRef struct {
Kind string `json:"kind"`
ChatID int64 `json:"chat_id"`
MessageID int `json:"message_id"`
Text string `json:"text"`
}
MessageRef identifies an editable notification.
type Notifier ¶
type Notifier interface {
SendApproval(context.Context, ApprovalMessage) (MessageRef, error)
UpdateStatus(context.Context, MessageRef, string) error
}
Notifier sends approval requests and status updates.
Click to show internal directories.
Click to hide internal directories.