Skip to content

Latest commit

 

History

History
79 lines (58 loc) · 2.69 KB

README.md

File metadata and controls

79 lines (58 loc) · 2.69 KB

go-whatsup-client

Code Quality & TestsMaintainability Test Coverage

This client allows you to retrieve the status page data for various services. It currently supports the following status page formats:

Usage

Retrieving statuspage.io style status pages

The URL for a Status page using the statuspage.io format typically follows the pattern https://<domain>/api/v2/status.json. You provide a service name and a URL for the status page to whatsup.StatuspageIoService(). Using GitHub as an example, we use github for the service name and the URL https://www.githubstatus.com/api/v2/status.json.

package main

import (
	"fmt"
	"os"

	"github.com/sprak3000/go-whatsup-client/whatsup"
)

func main() {
	c := whatsup.NewStatusPageClient()
	v, err := c.StatuspageIoService("github", "https://www.githubstatus.com/api/v2/status.json")
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Printf("%#v\n", v)
}

If an error occurs, the error message contains the github service name as part of the message. The return value is a statuspageio.Response structure.

Retrieving Slack's status page

As there is only one Slack status page, you simply call whatsup.Slack().

package main

import (
	"fmt"
	"os"

	"github.com/sprak3000/go-whatsup-client/whatsup"
)

func main() {
	c := whatsup.NewStatusPageClient()
	v, err := c.Slack()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Printf("%#v\n", v)
}

If an error occurs, the error message contains slack as the service name as part of the message. The return value is a slack.Response structure.

Contributing

You want to contribute to the project? Welcome!

Since this is an open source project, we would love to have your feedback! If you are interested, we would also love to have your help! Whether helpful examples to add to the docs, or FAQ entries, everything helps. Read our guide on contributing, then set up the tooling necessary.