go-whatsup-client

module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2024 License: MIT

README

go-whatsup-client

Maintainability 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.

Directories

Path Synopsis
Package slack handles communicating with status pages following the Slack format
Package slack handles communicating with status pages following the Slack format
Package status is an abstraction for handling and displaying status details from various services
Package status is an abstraction for handling and displaying status details from various services
Package statuspageio handles communicating with status pages following the statuspage.io format
Package statuspageio handles communicating with status pages following the statuspage.io format
Package whatsup is the client interface for getting status pages
Package whatsup is the client interface for getting status pages
clientmock
Package clientmock is a generated GoMock package.
Package clientmock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL