utils

package
v0.0.0-...-efa4506 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: GPL-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// FCMTopic is a string of the FCM message topic the notification is pushed to
	FCMTopic = "/topics/prt-updates"
)

Variables

This section is empty.

Functions

func GetCurrentStatus

func GetCurrentStatus(c context.Context) (*prt.Status, error)

func NotifyFCM

func NotifyFCM(c context.Context, status *prt.Status, weather *Weather) (fcm.Response, error)

func NotifyPushbullet

func NotifyPushbullet(c context.Context, status *prt.Status) error

func StoreNewStatus

func StoreNewStatus(c context.Context, status *prt.Status) error

func WriteJSON

func WriteJSON(w http.ResponseWriter, data interface{}) error

Types

type Weather

type Weather struct {
	// Temperature is the temperature in Fahrenheit
	Temperature float32 `json:"temperature"`
	// Humidity is the relative humidity percentage
	Humidity float32 `json:"humidity"`
	// Weather contains the simple weather conditions and current icon name
	Weather string `json:"weather"`
	// Conditions contains a description of the weather conditions
	Conditions string `json:"conditions"`
	// FeelsLike is the "feels like" temperature in Fahrenheit
	FeelsLike float32 `json:"feelsLike"`
	// Precip1hr is the inches of precipitation from the past hour
	Precip1hr float32 `json:"precip1hr"`
	// PrecipToday is the inches of precipitation today
	PrecipToday float32 `json:"precipToday"`
	// Visibility is the relative kilometers of visibility
	Visibility float32 `json:"visibility"`
	// WindDir is the direction of the wind
	WindDir string `json:"windDir"`
	// WindSpeed is the speed of the wind in miles per hour (MPH)
	WindSpeed float32 `json:"windSpeed"`
}

Weather contains data from Weather Underground response

func GetCurrentWeather

func GetCurrentWeather(c context.Context) (*Weather, error)

func RetrieveWeather

func RetrieveWeather(c context.Context) (*Weather, error)

func (*Weather) Save

func (w *Weather) Save(c context.Context, timestamp int64) error

Jump to

Keyboard shortcuts

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