go-weatherkit

Go Reference Go Report Card Build status

A WeatherKit API client in Go. WeatherKit is powered by the Apple Weather service.

Notice: The WeatherKit REST API is currently in beta and is subject to change. This client was created from documentation available here: https://developer.apple.com/documentation/weatherkitrestapi

go-weatherkit is an open source project not affiliated with Apple Inc.

Installing

This assumes you already have a working Go environment, if not please see this page first.

go get github.com/shawntoffel/go-weatherkit

Usage

Import the package into your project:

import "github.com/shawntoffel/go-weatherkit"

Create a new weatherkit client:

client := weatherkit.Client{}

Build a request:

request := weatherkit.WeatherRequest{
		Latitude:  38.960,
		Longitude: -104.506,
		Language:  language.English,
		DataSets: weatherkit.DataSets{
			weatherkit.DataSetCurrentWeather,
		},
	}

Get a response:

ctx := context.Background()

response, err := client.Weather(ctx, token, request)

The token parameter is a JWT developer token used for authentication. See the documentation here for details on JWT creation.

Documentation

Attribution

See Apple’s documentation for Apple Weather and third-party attribution requirements.

Examples

Troubleshooting

Please use the GitHub Discussions tab for questions regarding this client library. The Apple Developer forums are available for questions regarding the underlying API: https://developer.apple.com/forums/tags/weatherkit

GitHub

View Github