Documentation ¶
Overview ¶
Package client provides a method to query an API endpoint to extract data about the latest covid numbers and report these to the cmd line via stdout or save them as a csv or markdown file
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorBadDateFormat = errors.New("Incorrect Date Format") //Bad date format from the command line
)
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
APIClient the client and the request url for the api server
type APIResponse ¶
type APIResponse struct { Country string `json:"country"` Province []string `json:"province"` RawData RawData `json:"timeline"` TimeSeries TimeSeries }
APIResponse the main response from the server
func (*APIResponse) FormatResponse ¶
func (r *APIResponse) FormatResponse(from, to time.Time, latest bool) error
FormatResponse format the timeseries map to something with more structure (i.e. []Day)
type RawData ¶
type RawData struct { Cases map[string]int `json:"cases"` Deaths map[string]int `json:"deaths"` Recovered map[string]int `json:"recovered"` }
RawData the raw response timeseries
type TimeSeries ¶
type TimeSeries struct {
Data []Day // A slice of daily data
}
TimeSeries holds a slice of days
Click to show internal directories.
Click to hide internal directories.