/coronavirusapi-go

Retrieve coronavirus current and historical data. 🦠

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

coronavirusapi-go logo

coronavirusapi-go

COVID-19 API SDK for Golang. 🦠

Release Go Report Card Go Reference License


Getting Started

Import Covid-19 API Golang module:

import "github.com/moatsystems/coronavirusapi-go"

Dependence

Testing

Run the following command to test the package:

go test

Implementation

c: = client.New()
token,ok := c.Auth("<username>", "<password>")
...

// Call an endpoint such as US Death
usd := client.UsDeath()
  
// Retrieve all US Death data
j, err := usd.GetAll()

// Get API result (see simplejson)
j.Get("Code").String()
j.Get("Message").String()
j.Get("Document").Array()

// GetById
usd.GetById(1)

Below are all the available endpoints:

- UsDeath  
- UsConfirmed  
- GlobalDeath  
- GlobalConfirmed  
- GlobalRecovered  
- GlobalDailyReport 

All the endpoints listed above have five methods:

- GetAll()
- GetById(id int)
- Create(data map[string]interface{})
- UpdateById(id int, data map[string]interface{})
- DeleteById(id int)  

The COVID-19 API documentation is available here. If you need further assistance, don't hesitate to contact us.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the BSD 3-Clause License - see the file for details.

Copyright

(c) 2020 - 2023 Moat Systems Limited.