Documentation ¶
Overview ¶
Package coronavirus contains utilities for obtaining UK coronavirus statistics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStatus = errors.New("unexpected status code")
ErrStatus is the error given when an HTTP call to api.coronavirus.data.gov.uk returns an error status code.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Response string `json:"response"` StatusCode int `json:"status_code"` Status string `json:"status"` }
APIError represents the response format from the government coronavirus API when it returns an error.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The Client type is used to communicate with the government coronavirus API.
func (*Client) GetSummary ¶
GetSummary returns a summary of coronavirus statistics for the provided date.
type GetDataResponse ¶
type GetDataResponse struct { Length int `json:"length"` MaxPageLimit int `json:"maxPageLimit"` Data []struct { Date string `json:"date"` NewCases int `json:"newCases"` NewDeaths *int `json:"newDeaths"` // This can be null, so we use a pointer. } `json:"data"` Pagination struct { Current string `json:"current"` Next interface{} `json:"next"` Previous interface{} `json:"previous"` First string `json:"first"` Last string `json:"last"` } `json:"pagination"` }
GetDataResponse represents the response format from the government coronavirus API.
Click to show internal directories.
Click to hide internal directories.