bom

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatRestyResponse

func FormatRestyResponse(resp *resty.Response, err error) (*resty.Response, error)

Types

type Client

type Client struct {
	Rest *resty.Client
}

func New

func New(cli *Client) *Client

func (*Client) ObservationByTown

func (inst *Client) ObservationByTown(town, state string) (*Observations, error)

func (*Client) ObservationByZip added in v0.0.2

func (inst *Client) ObservationByZip(town string) (*Observations, error)

func (*Client) Observations

func (inst *Client) Observations(geo string) (*Observations, error)

func (*Client) SearchByTown

func (inst *Client) SearchByTown(town, state string) (*Search, string, error)

func (*Client) SearchByZip

func (inst *Client) SearchByZip(postCode string) (*Search, string, error)

type Error

type Error struct {
	Code    int    `json:"error_code,omitempty"`
	Message string `json:"error_message,omitempty"`
}

An Error maps to Form3 API error responses

type FoundMessage

type FoundMessage struct {
	Found bool `json:"found"`
}

type Message

type Message struct {
	Message string `json:"message"`
}

type Observations

type Observations struct {
	Metadata struct {
		ResponseTimestamp time.Time `json:"response_timestamp"`
		IssueTime         time.Time `json:"issue_time"`
		ObservationTime   time.Time `json:"observation_time"`
	} `json:"metadata"`
	Data struct {
		Temp          float64 `json:"temp"`
		TempFeelsLike float64 `json:"temp_feels_like"`
		Wind          struct {
			SpeedKilometre int    `json:"speed_kilometre"`
			SpeedKnot      int    `json:"speed_knot"`
			Direction      string `json:"direction"`
		} `json:"wind"`
		Gust struct {
			SpeedKilometre int `json:"speed_kilometre"`
			SpeedKnot      int `json:"speed_knot"`
		} `json:"gust"`
		MaxGust struct {
			SpeedKilometre int       `json:"speed_kilometre"`
			SpeedKnot      int       `json:"speed_knot"`
			Time           time.Time `json:"time"`
		} `json:"max_gust"`
		MaxTemp struct {
			Time  time.Time `json:"time"`
			Value float64   `json:"value"`
		} `json:"max_temp"`
		MinTemp struct {
			Time  time.Time `json:"time"`
			Value float64   `json:"value"`
		} `json:"min_temp"`
		RainSince9Am int `json:"rain_since_9am"`
		Humidity     int `json:"humidity"`
		Station      struct {
			BomId    string `json:"bom_id"`
			Name     string `json:"name"`
			Distance int    `json:"distance"`
		} `json:"station"`
	} `json:"data"`
}
type Search struct {
	Metadata struct {
		ResponseTimestamp time.Time `json:"response_timestamp"`
	} `json:"metadata"`
	Data []struct {
		Geohash  string `json:"geohash"`
		Id       string `json:"id"`
		Name     string `json:"name"`
		Postcode string `json:"postcode"`
		State    string `json:"state"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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