apixu

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 11 Imported by: 0

README

Apixu Go

Go package for Apixu Weather API

GoDoc

Install

Add to your go.mod file

require github.com/apixu/apixu-go/v2 v2.0.0

or run

go get github.com/apixu/apixu-go/v2

Usage

See the examples and run them with:

APIXUKEY=yourapikey go run examples/<dirname>/main.go

Error handling

For more details of an API method error, assert it to the apixu.Error type.

Full documentation of Apixu API

https://www.apixu.com/doc/

Extending the package

See the extend example.

Testing and QA tools for development

See Makefile.

Documentation

Overview

Package apixu provides interaction with Apixu Weather service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apixu

type Apixu interface {
	Conditions() (response.Conditions, error)
	Current(q string) (*response.CurrentWeather, error)
	Forecast(q string, days int, hour *int) (*response.Forecast, error)
	Search(q string) (response.Search, error)
	History(q string, since time.Time, until *time.Time) (*response.History, error)
}

Apixu Weather API methods

func New

func New(c Config) (Apixu, error)

New creates an Apixu package instance

type Config

type Config struct {
	APIKey string
}

Config is used to set up the Apixu service instance with the following:

ApiKey: API key generated on Apixu website

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error adds error details based on the API error response

func (*Error) Error

func (ar *Error) Error() string

func (*Error) Response

func (ar *Error) Response() response.ErrorResponse

Response provides extra error info

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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