events

package
v0.0.0-...-cbce884 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// QueueHooks is the redis queue for web hooks
	QueueHooks = "hook_queue"
	// QueueHookResults is the redis queue for web hook result messages
	QueueHookResults = "hook_result_queue"
	// QueueEmailNotifications process email send
	QueueEmailNotifications = "email_notifications_queue"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Project   *models.ProjectDetail `json:"project"`
	Entity    string                `json:"entity"` // resource, json
	EntityKey string                `json:"entity_key"`
	EntityID  string                `json:"entity_id"`
	Action    string                `json:"action"` // create, edit, delete
	Keys      []string              `json:"keys"`
	Payload   []byte                `json:"payload"`
}

Event defines the event(s) to be processed

type HookEvent

type HookEvent struct {
	Hook      *models.WebHook `json:"hook"`
	EntityKey string          `json:"entity_key"`
	Payload   interface{}     `json:"payload"`
}

HookEvent describes a single web hook event

type Notification

type Notification struct {
	Template         string            `json:"template"`
	Subject          string            `json:"subject"`
	ReceiverName     string            `json:"receiver_name"`
	ReceiverEmail    string            `json:"receiver_email"`
	PlainTextContent string            `json:"plain_text_content"` // plain text in the case email html can't render
	Data             map[string]string `json:"data"`               // data for template
	Meta             map[string]string `json:"meta"`               // meta data for logging
}

Notification contains the information in the queue for an email notification

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor process and emits events for web hooks and websockets

func NewProcessor

NewProcessor creates and returns a new instance of `Processor` with the given redis client

func (*Processor) ProcessResults

func (p *Processor) ProcessResults() error

ProcessResults listens for web hook results on the redis queue. This function should be run as a goroutine.

func (*Processor) PushEvent

func (p *Processor) PushEvent(e *Event) error

PushEvent processes and emits an event

Jump to

Keyboard shortcuts

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