notification

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReceivedPayload EventType = 1
	JobCompleted    EventType = 2
	Failure         Status    = 0
	Success         Status    = 1
)

Constants defined for notification delivery.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType int

EventType is the type of the notification.

type Message added in v1.0.0

type Message struct {
	EventType    EventType `json:"event_type"`
	Recorded     time.Time `json:"recorded" swaggertype:"primitive,string"`
	DocumentType string    `json:"document_type"`
	Status       string    `json:"status"`
	Message      string    `json:"message"`
	DocumentID   string    `json:"document_id"`
	AccountID    string    `json:"account_id"` // account_id is the account associated to webhook
	FromID       string    `json:"from_id"`    // from_id if provided, original trigger of the event
	ToID         string    `json:"to_id"`      // to_id if provided, final destination of the event
}

Message is the payload used to send the notifications.

type Sender

type Sender interface {
	Send(ctx context.Context, notification Message) (Status, error)
}

Sender defines methods that can handle a notification.

func NewWebhookSender

func NewWebhookSender() Sender

NewWebhookSender returns an implementation of a Sender that sends notifications through webhooks.

type Status

type Status int

Status defines the status of the notification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL