Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.49 KB

File metadata and controls

37 lines (25 loc) · 1.49 KB

Go Visual Crossing API for Stryd

A #golang package to consume Visual Crossing Timeline Weather API calls.

Getting Started with the Visual Crossing API

All usage requires a Visual Crossing API key, which you can obtain from your Visual Crossing account page.

To use the Go libary client, instantiate a visualcrossing.Client with your API key:

lat := "47.202"
lng := "-123.4167"

client := visualcrossing.NewClient("APIKEY")
client.SetTimeout(10 * time.Second)
now := time.Now()
f, err := client.GetTimeLineForecast(lat, lng, &now, visualcrossing.Defaults)
if err != nil {
  // Handle error
}

See the Forecast to get a picture of the shape of the returned data.

You may also want to explore the Visual Crossing Data Format documentation, which explains when each property is expected to be populated.

API Arguments

The API accepts a few modification parameters. Set these via a visualcrossing.Arguments. If you want the default behavior, use visualcrossing.Defaults. If you're looking only for the Currently data object, then you should use visualcrossing.CurrentOnly instead. Examples:

If you'd like to set other arguments, you'll need to construct a visualcrossing.Arguments directly. The type is a simple map[string]string: