-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
doc.go
38 lines (30 loc) · 1015 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
Package gocorona is a Golang client library for accessing global coronavirus (COVID-19, SARS-CoV-2) outbreak data.
It consumes data from Coronavirus Tracker API.
You can read the API server documentation at https://github.com/ExpDev07/coronavirus-tracker-api.
Usage:
create a new instance of Client, then use the various methods on the client to access different parts of the API.
For demonstration:
package main
import (
"context"
"fmt"
"log"
"github.com/itsksaurabh/go-corona"
)
func main() {
// client for accessing different endpoints of the API
client := gocorona.Client{}
ctx := context.Background()
// GetLatestData returns total amonut confirmed cases, deaths, and recoveries.
data, err := client.GetLatestData(ctx)
if err != nil {
log.Fatal("request failed:", err)
}
fmt.Println(data)
}
Notes:
* Using the [https://godoc.org/context](https://godoc.org/context) package for passing context.
* Look at tests(*_test.go) files for more sample usage.
*/
package gocorona