Documentation

Overview

Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(resp *http.Response) error

Validate ensures a HTTP response contains the expected fields.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is a builder for HTTP requests to interface with Switch Counter.

func NewHTTPClient

func NewHTTPClient(webhookURL string) API

NewHTTPClient creates a new instance of API over HTTP.

func (API) Status

func (a API) Status() *http.Request

Status returns a request for which systemmate is currently in front.

func (API) Switch

func (a API) Switch(front string) *http.Request

Switch changes the recorded front to the given systemmate.

type Status

type Status struct {
	Front     string    `json:"member_name"`
	StartedAt time.Time `json:"started_at"`
}

Status is the API response.

Source Files