Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface {
GetUserID() int64
GetTraceID() string
GetAction() storage.Action
GetEntityType() storage.EntityType
GetEntityID() string
// contains filtered or unexported methods
}
func ParseEvent ¶
ParseEvent parses a raw webhook payload into a typed event. Returns ErrUnknownEventType for unknown entity types or actions.
type ProcessRequest ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor(clientSecret string, notificationStore storage.NotificationStore) *Processor
func (*Processor) ProcessWebhook ¶
func (p *Processor) ProcessWebhook(ctx context.Context, req ProcessRequest) error
type RecoveryEvent ¶
type RecoveryEvent struct {
SleepID string `json:"id"`
// contains filtered or unexported fields
}
func (RecoveryEvent) GetAction ¶
func (e RecoveryEvent) GetAction() storage.Action
func (RecoveryEvent) GetEntityID ¶
func (e RecoveryEvent) GetEntityID() string
func (RecoveryEvent) GetEntityType ¶
func (e RecoveryEvent) GetEntityType() storage.EntityType
func (RecoveryEvent) GetTraceID ¶
func (e RecoveryEvent) GetTraceID() string
type Service ¶
type Service interface {
// ProcessWebhook verifies the webhook signature, parses the event,
// and stores/publishes the resulting notification.
// Returns ErrMissingSignature if signature headers are empty.
// Returns ErrInvalidSignature if the signature doesn't match.
// Returns ErrTimestampExpired if the timestamp is too old.
// Returns ErrUnknownEventType for unknown event types (caller may treat as success).
ProcessWebhook(ctx context.Context, req ProcessRequest) error
}
type SleepEvent ¶
type SleepEvent struct {
SleepID string `json:"id"`
// contains filtered or unexported fields
}
func (SleepEvent) GetAction ¶
func (e SleepEvent) GetAction() storage.Action
func (SleepEvent) GetEntityID ¶
func (e SleepEvent) GetEntityID() string
func (SleepEvent) GetEntityType ¶
func (e SleepEvent) GetEntityType() storage.EntityType
func (SleepEvent) GetTraceID ¶
func (e SleepEvent) GetTraceID() string
type WorkoutEvent ¶
type WorkoutEvent struct {
WorkoutID string `json:"id"`
// contains filtered or unexported fields
}
func (WorkoutEvent) GetAction ¶
func (e WorkoutEvent) GetAction() storage.Action
func (WorkoutEvent) GetEntityID ¶
func (e WorkoutEvent) GetEntityID() string
func (WorkoutEvent) GetEntityType ¶
func (e WorkoutEvent) GetEntityType() storage.EntityType
func (WorkoutEvent) GetTraceID ¶
func (e WorkoutEvent) GetTraceID() string
Click to show internal directories.
Click to hide internal directories.