Categorygithub.com/andyhaskell/climacell-go
modulepackage
0.0.0-20200603023707-a475c6fb1109
Repository: https://github.com/andyhaskell/climacell-go.git
Documentation: pkg.go.dev

# README

ClimaCell API Go client

This is the beginning of a Go client for the ClimaCell API. It is currently in very early development stage. Docs coming soon!

šŸ“¢ CONTRIBUTORS AND MAINTAINERS WANTED!

I would love your contributions to this ClimaCell Go client, including:

šŸ’» Pull requests šŸ”­ Opening new issues and feature requests šŸ“ Documentation and tutorials

Disclaimer: This is not an official ClimaCell project; original author of this project is not affiliated with ClimaCell.

Installing

Use go get to retrieve the library and add it to the your GOPATH workspace, or project's Go module dependencies.

go get github.com/andyhaskell/climacell-go

Usage example

package main

import (
	"github.com/andyhaskell/climacell-go"
	"log"
	"os"
	"time"
)

func main() {
	var c *climacell.Client
	c = climacell.New(os.Getenv("CLIMACELL_API_KEY"))

	weatherSamples, err := c.HourlyForecast(climacell.ForecastArgs{
		Location:     &climacell.LatLon{Lat: 42.3826, Lon: -71.146},
		UnitSystem: "us",
		Fields:     []string{"temp"},
		Start:  time.Now(),
		End:    time.Now().Add(24*time.Hour),
	})

	if err != nil {
		log.Fatalf("error getting forecast data: %v", err)
	}

	for _, w := range weatherSamples {
		log.Printf("The temperature at %s is %f degrees %s\n",
			w.ObservationTime.Value, *w.Temp.Value, w.Temp.Units)
	}
}

# Packages

No description provided by the author

# Functions

New takes in a ClimaCell API key and returns a client for the ClimaCell API.
NewWithClient takes in a ClimaCell API key and a net/http Client and returns a client for the ClimaCell API.

# Structs

No description provided by the author
No description provided by the author
Client is the client for sending HTTP requests to ClimaCell's HTTP endpoints.
DateValue is a timestsamp value that can be either in RFC3339 layout, or in YYYY-MM-DD layout.
ErrorResponse returns errors for 400, 401, 403, and 500 errors.
No description provided by the author
FloatAtTimeValue is a field on a ForecastDay returned from the ClimaCell API, in which the data are composed of a timestamp and a FloatValue representing a minimum or maximum on a forecast for a kind of information on the weather, like temperature or precipitation intensity.
FloatValue is a field on a Weather returned from the ClimaCell API that is a floating-point number.
ForecastArgs is converted to query parameters for forecast endpoints.
ForecastDay contains the predicted value for a single day in a location's daily weather forecast (6AM-6AM timeframe), and is returned from the ClimaCell API's /weather/forecast/daily endpoint.
ForecastJSONMinMax is the miniumum or maximum value for a day in a daily forecast.
No description provided by the author
No description provided by the author
No description provided by the author
IntValue is a field on a Weather returned from the ClimaCell API that is an integer.
LatLon produces location query params from a pair of latitude and longitude coordinates.
No description provided by the author
No description provided by the author
No description provided by the author
StringValue is a field on a Weather returned from the ClimaCell API that is of type string.
TimeValue is a field on a Weather returned from the ClimaCell API that is a timestamp.
Weather contains the data for a single weather sample in a location, and is returned from the ClimaCell API's /weather/* endpoints.

# Interfaces

Location produces the query parameters needed for indicating which location to request weather data for.

# Type aliases

ForecastMinAndMax contains the minimum and maximum values for a type of weather data on a daily forecast, which can be accessed with its Min or Max fields.
LocationID produces location query params from a location ID.