apprise

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	// Title is an optional title to go along with the body.
	Title string `json:"title,omitempty"`

	// Body is the main message content. This is the only required field.
	Body string `json:"body"`

	// Type defines the message type you want to send as.
	// The valid options are info, success, warning, and failure.
	// If no type is specified then info is the default value used.
	Type MsgType `json:"type,omitempty"`

	// Tag is used to notify only those tagged accordingly.
	// Use a comma (,) to OR your tags and a space ( ) to AND them.
	Tag string `json:"tag,omitempty"`

	// Format optionally identifies the text format of the data you're feeding Apprise.
	// The valid options are text, markdown, html.
	// The default value if nothing is specified is text.
	Format MsgFormat `json:"format,omitempty"`
}

Message represents the message to be sent to the Apprise API.

type MsgFormat

type MsgFormat string

MsgFormat defines the message format.

const (
	FormatText     MsgFormat = "text"
	FormatMarkdown MsgFormat = "markdown"
	FormatHTML     MsgFormat = "html"
)

Message Formats.

type MsgType

type MsgType string

MsgType defines the message type.

const (
	TypeInfo    MsgType = "info"
	TypeSuccess MsgType = "success"
	TypeWarning MsgType = "warning"
	TypeFailure MsgType = "failure"
)

Message Types.

type Notifier

type Notifier struct {
	// URL defines the Apprise API endpoint.
	URL string

	// DefaultType defines the default message type.
	DefaultType MsgType

	// DefaultTag defines the default message tag.
	DefaultTag string

	// DefaultFormat defines the default message format.
	DefaultFormat MsgFormat

	// AllowUntagged defines if untagged messages are allowed,
	// which are sent to all configured apprise endpoints.
	AllowUntagged bool
	// contains filtered or unexported fields
}

Notifier sends messsages to an Apprise API.

func (*Notifier) Send

func (n *Notifier) Send(ctx context.Context, m *Message) error

Send sends a message to the Apprise API.

func (*Notifier) SetClient

func (n *Notifier) SetClient(client *http.Client)

SetClient sets a custom http client for accessing the Apprise API.

Jump to

Keyboard shortcuts

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