Skip to content

l3x/gopush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

gopush

a Go client library for Pushover notifications

gopush provides an interface to Superblock's Pushover.

To use it, use the import "github.com/l3x/gopush/pushover".

Example usage:

package main

import (
	"fmt"
	"bitbucket.org/kisom/gopush/pushover"
	"os"
	"path/filepath"
)

func main() {
	if len(os.Args) < 3 {
		fmt.Printf("usage: %s api_key user_key\n", filepath.Base(os.Args[0]))
		os.Exit(1)
	}

	identity := pushover.Authenticate(
		os.Args[1],
		os.Args[2],
	)

	sent := pushover.Notify(identity,"testing gopush")
	if !sent {
		fmt.Println("[!] notification failed.")
		os.Exit(1)
	}
}

Notification functions:

Authenticate

Authenticate returns an Identity struct. To create one, call the Authentication function with the API token and user key:

identity := pushover.Authenticate(token, user_key)

Notify

Notify is the most basic notification function. Its signature is:

Notify(Identity, string) bool

Notify returns true if the message was sent successfully, and false otherwise.

Notify_titled

Notify_titled is used to send a notification with a custom title. Its signature is:

Notify_titled(Identity, string, string) bool

The first string is the message, the second string is the title. It returns the same as Notify.

Notify_device

Notify_device is used to send a notification to a specific device. Its signature is:

Notify_titled(Identity, string, string) bool

The first string is the message, the second string is the device name. It returns the same as Notify.

Details

Shamelessly take from bitbucket.org/kisom/gopush/pushover.

This version does not have mercurial as a dependency.

About

Golang client library for Pushover notifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages