apixu-go: github.com/andreiavrammsd/apixu-go Index | Files | Directories

package apixu

import "github.com/andreiavrammsd/apixu-go"

Package apixu provides interaction with Apixu Weather service

Index

Package Files

apixu.go config.go error.go http_client.go

type Apixu Uses

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 Uses

func New(c Config) (Apixu, error)

New creates an Apixu package instance

type Config Uses

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 Uses

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

Error adds error details based on the API error response

func (*Error) Error Uses

func (ar *Error) Error() string

func (*Error) Response Uses

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

Response provides extra error info

Directories

PathSynopsis
examples
formatterPackage formatter provides methods to convert JSON/XML strings to provided types
response
types

Package apixu imports 10 packages (graph) and is imported by 3 packages. Updated 2018-09-21. Refresh now. Tools for package owners.