Skip to content

StatusCakeDev/statuscake-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

statuscake-go test

The Go implementation of the StatusCake API client. Documentation for this library can be found here.

Prerequisites

You will need the following things properly installed on your computer.

Installation

With Go module support (Go 1.11+), add the following import

import "github.com/StatusCakeDev/statuscake-go"

to your code, and then go [build|run|test] will automatically fetch the necessary dependencies.

Otherwise, to install the statuscake-go package, run the following command:

$ go get -u github.com/StatusCakeDev/statuscake-go

Usage

Within any Go file instantiate an API client and execute a request:

package main

import (
	"context"
	"fmt"

	"github.com/StatusCakeDev/statuscake-go"
	"github.com/StatusCakeDev/statuscake-go/credentials"
)

func main() {
	bearer := credentials.NewBearerWithStaticToken(apiToken)
	client := statuscake.NewClient(statuscake.WithRequestCredentials(bearer))

	tests, err := client.ListUptimeTests(context.Background()).Execute()
	if err != nil {
		panic(err)
	}

	fmt.Printg("%+v\n", tests.Data)

License

This project is licensed under the MIT License.