particle

package module
v0.0.0-...-91835f7 Latest Latest
Warning

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

Go to latest
Published: May 15, 2017 License: MIT Imports: 8 Imported by: 1

README

particle

-- import "github.com/mckee/particle"

Usage

const URL string = "https://api.particle.io/v1/devices/events/"
func Subscribe
func Subscribe(eventPrefix string, token string) <-chan Event

subscribes to a particle.io event stream and returns a channel to receive them

type Event
type Event struct {
	Name string
	Data struct {
		Data      string `json:"data"`
		TTL       string `json:"ttl"`
		Timestamp string `json:"published_at"`
		CoreID    string `json:"coreid"`
	}
}

Documentation

Index

Constants

View Source
const DEVICE_URL string = "https://api.particle.io/v1/devices/"
View Source
const URL string = "https://api.particle.io/v1/devices/events/"

Variables

This section is empty.

Functions

func Subscribe

func Subscribe(eventPrefix string, token string) <-chan Event

subscribes to a particle.io event stream and returns a channel to receive them

Types

type Device

type Device struct {
	Id        string            `json:"id"`
	Name      string            `json:"name"`
	LastApp   string            `json:"last_app"`
	Connected bool              `json:"connected"`
	LastHeard time.Time         `json:"last_heard"`
	ProductId int               `json:"product_id"`
	Variables map[string]string `json:"variables"`
	Functions []string          `json:"functions"`
}

func GetDevice

func GetDevice(Id string, token string) Device

type Event

type Event struct {
	Name string
	Data struct {
		Data      string    `json:"data"`
		TTL       uint32    `json:"ttl"`
		Timestamp time.Time `json:"published_at"`
		CoreID    string    `json:"coreid"`
	}
}

Jump to

Keyboard shortcuts

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