Skip to content

spectrogram/go-statuspage-api

 
 

Repository files navigation

go-statuspage-api

Go library for StatusPage.io API

Usage

Base

package main

import "github.com/yfronto/go-statuspage-api"

const (
  apiKey = "....."
  pageID = "....."
)

func main() {
  c, err := statuspage.NewClient(apiKey, pageID)
  if err != nil {
    // ...
   }
   // Do stuff
}

Components

// Pretty print all components on a StatusPage
resp, _ := c.GetAllComponents()
for _, component := range resp {
  fmt.Printf("%v", &component)
}

Component groups

// Pretty print all component groups on a StatusPage
resp, _ := c.GetAllComponentGroups()
for _, componentGroup := range resp {
  fmt.Printf("%v", &componentGroup)
}
// Update a component group
newName := "foobar"
newComponents := []string{"gibberish", "gobbledegook"}

group, _ := c.GetComponentGroupByID("baz")
group.Components = newComponents
group.Name = newName
resp, _ := c.UpdateComponentGroup(group)
// Delete a component group
func DeleteComponentGroup() {
  group, _ := c.GetComponentGroupByID("deadbeef")
  err = c.DeleteComponentGroup(group)
}

Integration testing

Create a file named .client-testing.json containing your StatusPage API key and page ID. It should look something like this:

{
  "apiKey": "foobar",
  "pageID": "blahblah"
}

Things are still in progress.

About

Go library for StatusPage.io API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.7%
  • Makefile 1.3%