Skip to content

heartbeat-sh/heartbeat.go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heartbeat.sh Go Client

This is a Go client library for heartbeat.sh.

Usage

Install with go get github.com/heartbeat-sh/heartbeat.go

package main

import (
    "fmt"
    "github.com/heartbeat-sh/heartbeat.go/heartbeatsh"
    "time"
)

func main() {
    client := heartbeatsh.NewClient("example")
    minute := time.Minute
    hour := time.Hour

    // Send a beat
    err := client.SendBeat("go", &minute, &hour)
    if err != nil {
        fmt.Printf("Unexpected error %v", err)
    }

    // Send beat with a time frame, beats will only be checked between 09:00 and 17:00
    err = client.SendBeatWithTimes("go", &minute, &hour, "09:00", "17:00")
    if err != nil {
        fmt.Printf("Unexpected error %v", err)
    }

    // Delete a beat
    err = client.DeleteBeat("go")
    if err != nil {
        fmt.Printf("Unexpected error %v", err)
    }
}

About

A Go client for heartbeat.sh

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages