Documentation ¶
Overview ¶
Package pushover provides client for Pushover API (http://pushover.net/).
Index ¶
Constants ¶
const ( LowestPriority = -2 // lowest priority, no notification LowPriority = -1 // low priority, no sound and vibration NormalPriority = 0 // normal priority, default HighPriority = 1 // high priority, always with sound and vibration EmergencyPriority = 2 // emergency priority, requires acknowledge )
Message priority.
const ( PushoverSound = "pushover" BikeSound = "bike" BugleSound = "bugle" CashregisterSound = "cashregister" ClassicalSound = "classical" CosmicSound = "cosmic" FallingSound = "falling" GamelanSound = "gamelan" IncomingSound = "incoming" IntermissionSound = "intermission" MagicSound = "magic" MechanicalSound = "mechanical" PianobarSound = "pianobar" SirenSound = "siren" SpacealarmSound = "spacealarm" TugboatSound = "tugboat" AlienSound = "alien" ClimbSound = "climb" PersistentSound = "persistent" EchoSound = "echo" UpdownSound = "updown" NoneSound = "none" )
Message sound.
Variables ¶
This section is empty.
Functions ¶
func Send ¶
Send sends message. It does not retries failed sends. Returns either nil, TemporaryError or FatalError.
func SendMessage ¶
SendMessage sends message to specified user. It does not retries failed sends. Returns either nil, TemporaryError or FatalError.
func SendMessageWithRetries ¶
SendMessageWithRetries sends message to specified user. It does retries failed sends for temporary errors up to maxRetries times with 5 second delay. Specify maxRetries <= 0 for unlimited retries. Returns either nil, TemporaryError (if gave up) or FatalError.
func SendWithRetries ¶
SendWithRetries sends message. It does retries failed sends for temporary errors up to maxRetries times with 5 second delay. Specify maxRetries <= 0 for unlimited retries. Returns either nil, TemporaryError (if gave up) or FatalError.
Types ¶
type Client ¶
type Client struct { ApplicationToken string // application API token HTTPClient *http.Client // if nil, http.DefaultClient is used }
Client sends messages.
var DefaultClient Client
DefaultClient is a default client for this package.
func (*Client) Send ¶
Send sends message. It does not retries failed sends. Returns either nil, TemporaryError or FatalError.
func (*Client) SendMessage ¶
SendMessage sends message to specified user. It does not retries failed sends. Returns either nil, TemporaryError or FatalError.
func (*Client) SendMessageWithRetries ¶
SendMessageWithRetries sends message to specified user. It does retries failed sends for temporary errors up to maxRetries times with 5 second delay. Specify maxRetries <= 0 for unlimited retries. Returns either nil, TemporaryError (if gave up) or FatalError.
func (*Client) SendWithRetries ¶
SendWithRetries sends message. It does retries failed sends for temporary errors up to maxRetries times with 5 second delay. Specify maxRetries <= 0 for unlimited retries. Returns either nil, TemporaryError (if gave up) or FatalError.
type FatalError ¶
FatalError implementes net.Error and represents fatal error. Request should not be retried.
func (*FatalError) Error ¶
func (c *FatalError) Error() string
func (*FatalError) Temporary ¶
func (c *FatalError) Temporary() bool
func (*FatalError) Timeout ¶
func (c *FatalError) Timeout() bool
type Message ¶
type Message struct { // mandatory parameters User string // user/group key Message string // message to send // optional parameters Device string // device name to send the message directly to that device, rather than all of the user's devices Title string // message title URL string // supplementary URL URLTitle string // title for supplementary URL Priority int // priority, defaults to NormalPriority Timestamp time.Time // message time Sound string // message sound // for emergency priority only Retry int Expire int Callback string }
Message to send.
type TemporaryError ¶
TemporaryError implementes net.Error and represents temporary error. Request may be retried later after 5 second delay.
func (*TemporaryError) Error ¶
func (c *TemporaryError) Error() string
func (*TemporaryError) Temporary ¶
func (c *TemporaryError) Temporary() bool
func (*TemporaryError) Timeout ¶
func (c *TemporaryError) Timeout() bool