Documentation ¶
Overview ¶
Package pushover provides methods for sending messages using the http://pushover.net API.
Index ¶
Examples ¶
Constants ¶
View Source
const ( // PushoverURL is the API endpoint that will be used for sending all messages. PushoverURL = "https://api.pushover.net/1/messages.json" // StatusSuccess is the expected status code when a message has been succesfully sent. StatusSuccess = 1 )
Variables ¶
View Source
var ( // ErrHTTPStatus is returned when pushover.net response with a non HTTP 200 response code. ErrHTTPStatus = errors.New("Recieved a non HTTP 200 (OK) response from the pushover.net API") // ErrUnknown is used to indicate that an error has occurred but its underlying cause could not be determined. ErrUnknown = errors.New("Recieved a status code indicating an error but did not receive an error message from pushover.net") )
Functions ¶
This section is empty.
Types ¶
type Message ¶
Message contains all the required settings for sending messages via the pushover.net API
func NewMessage ¶
NewMessage returns a new Message with API token values and a recipient device configured.
func (*Message) Push ¶
Push sends a message via the pushover.net API and returns the json response
Example ¶
// You'll need to configure these by logging in to https://pushover.net. token := "KzGDORePKggMaC0QOYAMyEEuZJnyUi" user := "e9e1495ec75826de5983cd1abc8031" // Send a new message using the Push method. m := pushover.NewMessage(token, user) m.Push("Test message contents")
Output:
Click to show internal directories.
Click to hide internal directories.