pavlok

package module
v0.0.0-...-1f4d14c Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 5 Imported by: 1

README

Pavlok CLI and API wrapper written in Go

This package provides a simple CLI and Go API wrapper for the Pavlok smartwatch's API.

CLI Installation

Install Go and run the following:

go install github.com/carreter/pavlok-go/cmd/pavlok-cli@latest

Also ensure that $GOPATH/bin is in your PATH.

Now you're all set to start zapping away!

Usage:

Get an API key by signing in to the Pavlok API docs with the same email as the Pavlok account your device is registered to.

To send a stimulus, run pavlok-cli [flags] <stimulus type>.

Allowable stimulus types:

  • zap: Zaps the user.
  • beep: Emits a beep.
  • vibe: Vibrates the device.

Flags:

  • --apikey (string, required): The API key.
  • --reason (string): The reason for the stimulus.
  • --value (int): The value (strength) of the stimulus.

Documentation

Overview

Package pavlok provides a wrapper for the Pavlok API.

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.pavlok.com/api/v5"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client is a client to the Pavlok API.

func NewClient

func NewClient(apiKey string, options ...OptionsFunc) *Client

NewClient creates a new client to the Pavlok API.

func (*Client) Beep

func (c *Client) Beep(value int) error

Beep sends a beep stimulus.

func (*Client) SendStimulus

func (c *Client) SendStimulus(stimulus Stimulus) error

SendStimulus sends a stimulus.

func (*Client) Vibe

func (c *Client) Vibe(value int) error

Vibe sends a vibe stimulus.

func (*Client) Zap

func (c *Client) Zap(value int) error

Zap sends a zap stimulus.

type OptionsFunc

type OptionsFunc func(client *Client) *Client

func WithBaseURL

func WithBaseURL(baseURL string) OptionsFunc

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) OptionsFunc

type Stimulus

type Stimulus struct {
	Type   StimulusType `json:"stimulusType"`
	Value  int          `json:"stimulusValue"` // 1-100, inclusive
	Reason string       `json:"reason,omitempty"`
}

type StimulusType

type StimulusType string
const (
	Zap  StimulusType = "zap"
	Beep StimulusType = "beep"
	Vibe StimulusType = "vibe"
)

Directories

Path Synopsis
cmd
pavlok-cli command

Jump to

Keyboard shortcuts

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