Skip to content

fasttrack-solutions/go-deadmanssnitch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-deadmanssnitch GoDoc Go Report Card License

go-deadmanssnitch is a Go client library for the Dead Man's Snitch API.

Installation

Make sure you have a working Go environment. To install, simply run:

go get github.com/PremiereGlobal/go-deadmanssnitch

Usage

package main

import (
  "github.com/PremiereGlobal/go-deadmanssnitch"
)

var apiKey = "" // Set your api key here

func main() {

  client := deadmanssnitch.NewClient(apiKey)
  ...
}

For more information, read the godoc package documentation.

Examples

Check-In

  var	snitchToken = "" // Set your snitch token here
  err := client.CheckIn(snitchToken)
  if err != nil {
    panic(err)
  }

List All Snitches

  snitches, err := client.ListSnitches([]string{})
  if err != nil {
    panic(err)
  }

Create Snitch

  snitch := deadmanssnitch.Snitch {
    Name:      "testSnitch",
    Interval:  "hourly",
    AlertType: "basic",
    Tags:      []string{"test"},
    Notes:     "This is an example snitch",
  }

  createdSnitch, err := client.CreateSnitch(&snitch)
  if err != nil {
    panic(err)
  }

Testing the Client Library

Tests will validate API calls by creating a test snitch, checking in and updating the snitch using all of the methods. It will then delete the snitch after waiting wait seconds (to allow for manual verification).

go test -v --args -apikey=<apiKey> -wait 30

About

A Go client library for the Dead Man's Snitch API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%