40 lines
811 B
Go
40 lines
811 B
Go
package webhook
|
|
|
|
import "time"
|
|
|
|
type EventType string
|
|
|
|
const (
|
|
EventUserPaid EventType = "user.paid"
|
|
EventUserAdded EventType = "user.added"
|
|
EventUserExtended EventType = "user.extended"
|
|
EventUserRemoved EventType = "user.removed"
|
|
)
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusPending Status = "pending"
|
|
StatusDelivered Status = "delivered"
|
|
StatusDead Status = "dead"
|
|
)
|
|
|
|
type Payload struct {
|
|
Event EventType `json:"event"`
|
|
Timestamp string `json:"timestamp"`
|
|
Domain string `json:"domain"`
|
|
Data map[string]any `json:"data"`
|
|
}
|
|
|
|
type OutboxItem struct {
|
|
ID int64
|
|
EventType EventType
|
|
Payload string
|
|
Attempts int
|
|
LastAttemptAt *time.Time
|
|
NextAttemptAt time.Time
|
|
Status Status
|
|
LastError string
|
|
CreatedAt time.Time
|
|
}
|