awair_api

package module
v0.0.0-...-4ef0130 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 6 Imported by: 2

README

awair_api

Build Status codecov

Golang client for getawair.com

Documentation

Index

Constants

View Source
const (
	AwairV1 = "https://developer-apis.awair.is/v1"
)
View Source
const (
	Version = "0.1.1"
)

Variables

This section is empty.

Functions

func SetHTTPClient

func SetHTTPClient(httpClient *http.Client) func(*Client)

Types

type APIQuota

type APIQuota struct {
	Quota int    `json:"quota"`
	Scope string `json:"scope"`
}

type APIUsage

type APIUsage struct {
	Scope string `json:"scope"`
	Usage int    `json:"usage"`
}

type Client

type Client struct {
	AccessToken  string
	UseFarenheit bool
	UserAgent    string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(accessToken string, options ...Option) *Client

func (*Client) DeviceAPIUsage

func (c *Client) DeviceAPIUsage(deviceType string, deviceId int) (*DeviceUsage, error)

func (*Client) Devices

func (c *Client) Devices() (*DeviceList, error)

func (*Client) UserInfo

func (c *Client) UserInfo() (*User, error)

func (*Client) UserLatestAirData

func (c *Client) UserLatestAirData(deviceType string, deviceId int) (*DeviceDataList, error)

type Device

type Device struct {
	DeviceId     int     `json:"deviceId"`
	DeviceType   string  `json:"deviceType"`
	DeviceUUID   string  `json:"deviceUUID"`
	Latitude     float64 `json:"latitude"`
	LocationName string  `json:"locationName"`
	Longitude    float64 `json:"longitude"`
	Name         string  `json:"name"`
	Preference   string  `json:"preference"`
	RoomType     string  `json:"roomType"`
	SpaceType    string  `json:"spaceType"`
	Timezone     string  `json:"timezone"`
}

type DeviceData

type DeviceData struct {
	Indices   []DeviceIndexData     `json:"indices"`
	Score     float64               `json:"score"`
	Sensors   []DeviceSensorReading `json:"sensors"`
	Timestamp time.Time             `json:"timestamp"`
}

type DeviceDataList

type DeviceDataList struct {
	Data []DeviceData `json:"data"`
}

type DeviceIndexData

type DeviceIndexData struct {
	Comp  string  `json:"comp"`
	Value float64 `json:"value"`
}

type DeviceList

type DeviceList struct {
	Devices []Device `json:"devices"`
}

type DeviceSensorReading

type DeviceSensorReading struct {
	Comp  string  `json:"comp"`
	Value float64 `json:"value"`
}

type DeviceUsage

type DeviceUsage struct {
	Usages []APIUsage `json:"usages"`
}

type Option

type Option func(*Client)

type User

type User struct {
	DOBYear     int        `json:"dobYear"`
	Email       string     `json:"email"`
	FirstName   string     `json:"firstName"`
	Id          string     `json:"id"`
	LastName    string     `json:"lastName"`
	Permissions []APIQuota `json:"permissions"`
	Sex         string     `json:"sex"`
	Tier        string     `json:"tier"`
	Usages      []APIUsage `json:"usages"`
}

Jump to

Keyboard shortcuts

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