Gowl is a simple implementation of the prowl API in Go because implementing the Prowl API is a pretty good way to get started with learning a lanuage.
Gowl's goal is to make sending prowl notifications as easy as possible. This is all the code you need to start sending notifications to your iOS devices:
package main
import (
"github.com/stevenleeg/gowl"
"fmt"
)
func main() {
fmt.Println("Sending test notification")
notification := &gowl.Notification{
Url: "http://example.com",
Application: "Gowl",
Event: "Test",
Description: "Hello world",
}
g := gowl.New("[Your API key goes here]")
g.Add(notification)
}
Since this is my first venture into writing a Go library, I wanted to make a simple API that accomplishes its task elegantly. If you think anything here breaks this philosophy, go ahead and open an issue and tell me what sucks.
Creates a new instance of a gowl.Gowl
type and returns a pointer to the struct
Manages interactions with an API based on an API key.
type Gowl struct {
ApiKey string
}
Sends the provided notification
struct to the API. Returns an error object if anything has gone wrong, nil if the notification was sent successfully.
Represents a notification that will be sent to the API using Gowl.Add(...)
type Notification struct {
Priority int,
Url, Application, Event, Description string
}
Gowl is released under the MIT License. Do whatever you want with the code as long as you have fun with it!