goma

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 14 Imported by: 0

README

goma

Control SESAME SmartLock by SESAME v2 API

Installation

As a library

go get github.com/ouest/goma

or if you want to use it as a bin command

go >= 1.17

go install github.com/ouest/goma/cmd/goma@latest

go < 1.17

go get github.com/ouest/goma/cmd/goma

Usage

Add your application configuration to your .env file in the root of your project:

SESAME_UUID=YOUR_SESAME_UUID
SESAME_API_KEY=YOUR_SESAME_API_KEY
SESAME_SECRET_KEY=YOUR_SERSAME_SECRET_KEY

Then in your Go app you can do something like

package main

import (
    "github.com/ouest/goma"
)

func main() {
    // get goma state
    state := goma.State()
    // get goma history
    history := goma.History(0, 10)
    // lock goma
    goma.Lock("account_name")
    // toggle goma
    goma.Toggle("account_name")
    // unlock goma
    goma.Unlock("account_name")
}
Command Mode

Assuming you've installed the command as above and you've got $GOPATH/bin in your $PATH

goma state
goma history -p 0 -n 10
goma lock account_name
goma toggle account_name
goma unlock account_name

License

See LICENSE © ouest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func History

func History(page uint, number uint) string

func Lock

func Lock(account string) string

func State

func State() string

func Toggle

func Toggle(account string) string

func Unlock

func Unlock(account string) string

Types

type Options

type Options struct {
	Account       string
	HistoryPage   uint
	HistoryNumber uint
}

type RequestBody

type RequestBody struct {
	Cmd     uint   `json:"cmd"`
	History string `json:"history"`
	Sign    string `json:"sign"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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