hipchat

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColourYellow Colour = "yellow"
	ColourRed           = "red"
	ColourGreen         = "green"
	ColourPurple        = "purple"
	ColourGrey          = "gray"
	ColourRandom        = "random"
)

Variables

View Source
var ValidFormats = map[Format]bool{
	FormatHtml: true,
	FormatText: true,
}

Functions

func Notify

func Notify(msg *Message) error

Notify wraps DefaultNotifier.Notify

Types

type Colour

type Colour string

func (Colour) Valid

func (c Colour) Valid() bool

Valid tests if this colour is valid

type Format

type Format string
const (
	FormatHtml Format = "html"
	FormatText        = "text"
)

func (Format) Valid

func (f Format) Valid() bool

Valid tests if this format is valid

type HttpNotifier

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

HttpNotifier is a notifier that talks to the Hipchat API via HTTP

func NewHttpNotifier

func NewHttpNotifier() *HttpNotifier

NewHttpNotifier mints an HTTP notifier, configuring it from the config service

func (*HttpNotifier) Notify

func (n *HttpNotifier) Notify(msg *Message) error

Notify sends a message

type Message

type Message struct {
	Room   string // Room name or ID
	From   string // From is who we are sending the message from
	Body   string // Body is the message content
	Format Format // Format that the body is supplied in; text or html
	Notify bool   // Notify indicates we want to make the Hipchat icon bounce around like mad and annoy people
	Colour Colour // Colour is the background colour of the announcement
}

Message represents some message we send

func (*Message) Valid

func (msg *Message) Valid() error

Valid tests if the message is valid for sending

type Notifier

type Notifier interface {
	Notify(msg *Message) error
}

Notifier represents something that can send notifications

Jump to

Keyboard shortcuts

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