apixu

package module
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 10 Imported by: 3

README

Apixu Go

Go package for Apixu Weather API

GoDoc

Install

go get github.com/andreiavrammsd/apixu-go

Usage

See the examples and run them with: APIXUKEY=yourapikey go run examples/filename.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 file.

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) (*response.Forecast, error)
	Search(q string) (response.Search, error)
	History(q string, since time.Time) (*response.History, error)
}

Apixu defines methods implemented by Apixu Weather API

func New

func New(c Config) (Apixu, error)

New creates an Apixu package instance

type Config

type Config struct {
	Version string
	Format  string
	APIKey  string
}

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

Version: API version
Format: API response format (JSON or XML)
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
Package formatter provides methods to convert JSON/XML strings to provided types
Package formatter provides methods to convert JSON/XML strings to provided types

Jump to

Keyboard shortcuts

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