Documentation ¶
Index ¶
- type APICasesResponse
- type APITestResultsResponse
- type APIVaccinationsResponse
- type Cache
- type Client
- func (client *Client) GetCases(ctx context.Context) (results []*APICasesResponse, err error)
- func (client *Client) GetTestResults(ctx context.Context) (results []*APITestResultsResponse, err error)
- func (client *Client) GetVaccinations(ctx context.Context) (results []*APIVaccinationsResponse, err error)
- type Getter
- type TimeStamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICasesResponse ¶ added in v1.6.0
type APICasesResponse struct { TimeStamp TimeStamp `json:"DATE"` Province string `json:"PROVINCE"` Region string `json:"REGION"` AgeGroup string `json:"AGEGROUP"` Cases int `json:"CASES"` }
APICasesResponse is the response of the Sciensano cases API
type APITestResultsResponse ¶
type APITestResultsResponse struct { TimeStamp TimeStamp `json:"DATE"` Province string `json:"PROVINCE"` Region string `json:"REGION"` Total int `json:"TESTS_ALL"` Positive int `json:"TESTS_ALL_POS"` }
APITestResultsResponse is the response of the Sciensano test results API
type APIVaccinationsResponse ¶
type APIVaccinationsResponse struct { TimeStamp TimeStamp `json:"DATE"` Region string `json:"REGION"` AgeGroup string `json:"AGEGROUP"` Gender string `json:"SEX"` Dose string `json:"DOSE"` Count int `json:"Count"` }
APIVaccinationsResponse is the response of the Sciensano vaccinations API
type Cache ¶
Cache implements a cache for the Sciensano API. It's meant to be API-compatible with Getter, so clients can replace their Getter with a Cache instead:
client := &Client{ Getter: &apiclient.Client{HTTPClient: &http.Client{}}, }
becomes:
client := &Client{ Getter: &apiclient.Cache{ Getter: &apiclient.Client{HTTPClient: &http.Client{}}, Retention: 15 * time.Minute, }, }
func (*Cache) GetCases ¶ added in v1.6.0
func (cache *Cache) GetCases(ctx context.Context) (results []*APICasesResponse, err error)
GetCases retrieves all COVID-19 cases. If a valid cached result exists, that is returned instead.
func (*Cache) GetTestResults ¶
func (cache *Cache) GetTestResults(ctx context.Context) (results []*APITestResultsResponse, err error)
GetTestResults retrieves all COVID-19 test results. If a valid cached result exists, that is returned instead.
func (*Cache) GetVaccinations ¶
func (cache *Cache) GetVaccinations(ctx context.Context) (results []*APIVaccinationsResponse, err error)
GetVaccinations retrieves all COVID-19 vaccinations. If a valid cached result exists, that is returned instead.
type Client ¶
Client calls the different sciensano APIs
func (*Client) GetCases ¶ added in v1.6.0
func (client *Client) GetCases(ctx context.Context) (results []*APICasesResponse, err error)
GetCases retrieves all recorded COVID-19 cases
func (*Client) GetTestResults ¶
func (client *Client) GetTestResults(ctx context.Context) (results []*APITestResultsResponse, err error)
GetTestResults retrieves all COVID-19 test results.
func (*Client) GetVaccinations ¶
func (client *Client) GetVaccinations(ctx context.Context) (results []*APIVaccinationsResponse, err error)
GetVaccinations retrieves all COVID-19 vaccinations.
type Getter ¶ added in v1.6.0
type Getter interface { GetTestResults(ctx context.Context) (results []*APITestResultsResponse, err error) GetVaccinations(ctx context.Context) (results []*APIVaccinationsResponse, err error) GetCases(ctx context.Context) (results []*APICasesResponse, err error) }
Getter interface exposes the different supported Sciensano APIs