bloomskyStructure

package module
v0.0.0-...-955716e Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

README

BloomSky API in Go

Language] Build Status Repo Size Go Report Card Coverage Status GoDoc License codebeat badge CII Best Practices GolangCI

Package BloomskyStructure

The BloomskyStructure package provides APIs for bloomsky device.

Install

Execute :

go get github.com/patrickalin/bloomsky-api-go

Usage Example : How to use API

Example in /example

cd example
go build .
./example

Usage Bloomsky Client

If you want, I have a runtime client which uses this API.

Folders / Files

  • command/ : command to help me (build, test, ...)
  • command/bench.sh : performance tests
  • command/assembly.sh : add test and mock file in binnary
  • command/build.sh : build source
  • command/err.sh : check if all errors catch
  • command/pprof.sh : performance tests
  • command/pprofRaw.sh : performance tests
  • command/tag.sh : tag in Git
  • command/test.sh : test code
  • command/torch.sh : Flame Graph, test performance
  • mock/ : mock to simulate one bloomsky device
  • scripts/ : use in Makefile
  • testCase/ : test files use by tests
  • .gitignore : ignore to commit
  • .travis.yml : Continuous Integration
  • LICENSE : text with license
  • Makefile : command to help me (build, test, ...)
  • README.md : this file
  • bloomskyStructure.go : the main code
  • bloomskyStructure_test.go : the test of the main code
  • example_test.go : litte example to understand how to use the API
  • utils.go : some reusable functions (error, log, ...). Not specific of this project.
  • utils_test.go : file to test utils.go

How to test code

make test

or

command/test.sh

or

go test .

License

The code is licensed under the permissive Apache v2.0 licence. This means you can do what you like with the software, as long as you include the required notices. Read this for a summary.

Documentation

Overview

Package bloomskyStructure calls rest API Bloomsky, puts it in the structure and gives somes functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloomsky

type Bloomsky interface {
	GetDeviceID() string
	GetHumidity() float64
	GetCity() string
	GetNumOfFollowers() int
	GetPressureHPa() float64
	GetWindDirection() string
	GetWindDirectionDeg() int
	GetTimeStamp() time.Time
	GetIndexUV() string
	GetTemperatureFahrenheit() float64
	GetTemperatureCelsius() float64
	GetPressureInHg() float64
	GetWindGustMph() float64
	GetWindGustMs() float64
	GetSustainedWindSpeedMs() float64
	GetSustainedWindSpeedMph() float64
	GetRainDailyIn() float64
	GetRainRateIn() float64
	GetRainIn() float64
	GetRainDailyMm() float64
	GetRainRateMm() float64
	GetWindGustkmh() float64
	GetSustainedWindSpeedkmh() float64
	GetRainMm() float64
	GetBloomskyStruct() BloomskyStructure
	GetLastCall() string
	GetTS() float64
	IsRain() bool
	IsNight() bool
	Refresh()
	RefreshFromBody(body []byte)
}

Bloomsky is the interface BloomskyStructure

func New

func New(bloomskyURL, bloomskyToken string, mock bool, l *logrus.Logger) Bloomsky

New calls bloomsky and get structurebloomsky

type BloomskyDataStructure

type BloomskyDataStructure struct {
	Luminance    float64 `json:"Luminance"`
	TemperatureF float64 `json:"Temperature"`
	TemperatureC float64
	ImageURL     string  `json:"ImageURL"`
	TS           float64 `json:"TS"`
	Rain         bool    `json:"Rain"`
	Humidity     float64 `json:"Humidity"`
	Pressure     float64 `json:"Pressure"`
	Pressurehpa  float64
	DeviceType   string  `json:"DeviceType"`
	Voltage      float64 `json:"Voltage"`
	Night        bool    `json:"Night"`
	UVIndex      float64 `json:"UVIndex"`
	ImageTS      float64 `json:"ImageTS"`
}

BloomskyDataStructure represents the structure SKY of the JSON return by the API

type BloomskyStormStructure

type BloomskyStormStructure struct {
	UVIndex               string      `json:"UVIndex"`
	WindDirection         interface{} `json:"WindDirection,int"`
	WindGust              float64     `json:"WindGust"`
	WindGustms            float64
	WindGustkmh           float64
	SustainedWindSpeed    float64 `json:"SustainedWindSpeed"`
	SustainedWindSpeedms  float64
	SustainedWindSpeedkmh float64
	Rain                  float64
	RainDaily             float64 `json:"RainDaily"`
	RainDailymm           float64
	RainRate              float64 `json:"RainRate"`
	RainRatemm            float64
	Rainin                float64 `json:"24hRain"`
	Rainmm                float64
}

BloomskyStormStructure represents the structure STORM of the JSON return by the API

type BloomskyStructure

type BloomskyStructure struct {
	UTC              float64                `json:"UTC"`
	CityName         string                 `json:"CityName"`
	Storm            BloomskyStormStructure `json:"Storm"`
	Searchable       bool                   `json:"Searchable"`
	DeviceName       string                 `json:"DeviceName"`
	RegisterTime     float64                `json:"RegisterTime"`
	DST              float64                `json:"DST"`
	BoundedPoint     string                 `json:"BoundedPoint"`
	LON              float64                `json:"LON"`
	Point            interface{}            `json:"Point"`
	VideoList        []string               `json:"VideoList"`
	VideoListC       []string               `json:"VideoList_C"`
	DeviceID         string                 `json:"DeviceID"`
	NumOfFollowers   float64                `json:"NumOfFollowers"`
	LAT              float64                `json:"LAT"`
	ALT              float64                `json:"ALT"`
	Data             BloomskyDataStructure  `json:"Data"`
	FullAddress      string                 `json:"FullAddress"`
	StreetName       string                 `json:"StreetName"`
	PreviewImageList []string               `json:"PreviewImageList"`
	LastCall         string
}

BloomskyStructure represents the structure of the JSON return by the API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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