notify

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskStateUpdateKey = "task_state_update"
	TaskStepUpdateKey  = "task_step_update"
	TaskValidationKey  = "task_validation"
)

Variables

This section is empty.

Functions

func ListActions

func ListActions() utask.NotifyActions

ListActions returns a list of available actions to notify

func ListSendersNames

func ListSendersNames() []string

ListSendersNames returns a list of available senders

func RegisterActions

func RegisterActions(na utask.NotifyActions)

RegisterActions set available actions

func RegisterSender

func RegisterSender(name string, s NotificationSender, defaultNotificationStrategy map[string]string, templateNotificationStrategies map[string][]utask.TemplateNotificationStrategy)

RegisterSender adds a NotificationSender to the pool of available senders

func Send

func Send(m *Message, params utask.NotifyActionsParameters)

Send dispatches a Message struct over all registered senders

func WrappedSendError added in v1.1.0

func WrappedSendError(etype string, err string)

WrappedSendError print a formatted string from Send Notify in case of issue

Types

type Message added in v1.1.0

type Message struct {
	MainMessage      string
	NotificationType string
	Fields           map[string]string
}

Message represents a generic message to be sent

func WrapTaskStateUpdate added in v1.1.0

func WrapTaskStateUpdate(tsu *TaskStateUpdate) *Message

WrapTaskStateUpdate returns a Message struct formatted for a task state change

func WrapTaskStepUpdate added in v1.13.0

func WrapTaskStepUpdate(tsu *TaskStepUpdate) *Message

WrapTaskStepUpdate returns a Message struct formatted for a task step update

func WrapTaskValidation added in v1.13.0

func WrapTaskValidation(tv *TaskValidation) *Message

WrapTaskValidation returns a Message struct formatted for a task requiring validation

type NotificationSender

type NotificationSender interface {
	Send(m *Message, name string)
}

NotificationSender is an object capable of sending a Message struct over a notification channel, as determined by its implementation

type TaskStateUpdate

type TaskStateUpdate struct {
	Title              string
	PublicID           string
	ResolutionPublicID string
	State              string
	TemplateName       string
	RequesterUsername  string
	ResolverUsername   *string
	PotentialResolvers []string
	StepsDone          int
	StepsTotal         int
	Tags               map[string]string
}

TaskStateUpdate holds a digest of data representing a task state change

type TaskStepUpdate added in v1.13.0

type TaskStepUpdate struct {
	Title              string
	PublicID           string
	ResolutionPublicID string
	State              string
	TemplateName       string
	RequesterUsername  string
	ResolverUsername   string
	StepsDone          int
	StepsTotal         int
	StepName           string
	StepState          string
	Tags               map[string]string
}

TaskStepUpdate holds a digest of data representing a task step update

type TaskValidation added in v1.13.0

type TaskValidation struct {
	Title              string
	PublicID           string
	State              string
	TemplateName       string
	RequesterUsername  string
	PotentialResolvers []string
	Tags               map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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