vaccines

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeBatches = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBatchResponse added in v1.8.4

type APIBatchResponse struct {
	Date         Timestamp `json:"date"`
	Manufacturer string    `json:"manufacturer"`
	Amount       int       `json:"amount"`
}

APIBatchResponse represents one batch of vaccines

func (APIBatchResponse) GetAttributeNames added in v1.8.4

func (b APIBatchResponse) GetAttributeNames() []string

GetAttributeNames returns the names of the types of vaccinations

func (APIBatchResponse) GetAttributeValues added in v1.8.4

func (b APIBatchResponse) GetAttributeValues() (values []float64)

GetAttributeValues gets the value for each supported type of vaccination

func (APIBatchResponse) GetGroupFieldValue added in v1.8.4

func (b APIBatchResponse) GetGroupFieldValue(groupField apiclient.GroupField) (value string)

GetGroupFieldValue returns the value of a groupable field. Not used for APIBatchResponse.

func (APIBatchResponse) GetTimestamp added in v1.8.4

func (b APIBatchResponse) GetTimestamp() time.Time

GetTimestamp returns the batch's timestamp

func (APIBatchResponse) GetTotalValue added in v1.8.4

func (b APIBatchResponse) GetTotalValue() float64

GetTotalValue returns the entry's total number of vaccines

type Client

type Client struct {
	httpclient.Caller
	URL string
}

Client calls the different Vaccines APIs

func (Client) DataTypes added in v1.10.0

func (c Client) DataTypes() map[int]string

func (Client) Fetch added in v1.10.0

func (c Client) Fetch(ctx context.Context, dataType int) ([]apiclient.APIResponse, error)

func (Client) GetLastUpdated added in v1.12.1

func (c Client) GetLastUpdated(ctx context.Context, dataType int) (time.Time, error)

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp representation for APIBatchResponse. Needed to unmarshal the date as received from the API

func (Timestamp) MarshalJSON added in v1.10.0

func (date Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON marshals a Timestamp in a APIBatchResponse

func (*Timestamp) UnmarshalJSON

func (date *Timestamp) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshals the Timestamp in a APIBatchResponse

Jump to

Keyboard shortcuts

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