client

package
v0.0.0-...-28812bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCardIDConflict = errors.New("badge ID already in use")

Functions

This section is empty.

Types

type Card

type Card struct {
	ID     int    // assigned when adding
	Number int    // encoded on the fob
	Name   string // 32 char opaque(?) string
}

type CardSwipe

type CardSwipe struct {
	ID     int    // increments for each log entry
	Name   string // name associated with the CardID
	CardID int
	DoorID string
	Time   time.Time
}

type Client

type Client struct {
	Addr    string
	Timeout time.Duration
	// contains filtered or unexported fields
}

func (*Client) AddCard

func (c *Client) AddCard(ctx context.Context, num int, name string) error

func (*Client) ListCards

func (c *Client) ListCards(ctx context.Context) ([]*Card, error)

func (*Client) ListSwipes

func (c *Client) ListSwipes(ctx context.Context, earliestID int, fn func(*CardSwipe) error) error

ListSwipes lists all card swipes going back to a particular swipe ID. To travel all the way back to the beginning of the log, set earliestID to -1.

func (*Client) RemoveCard

func (c *Client) RemoveCard(ctx context.Context, id int) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL