go-corona icon indicating copy to clipboard operation
go-corona copied to clipboard

Get data for a given province (and county)

Open dabcoder opened this issue 4 years ago • 0 comments

GET ​/v2​/locations allows to add a province and county to filter data for a given country. Endpoints looking like the below:

  • /v2/locations?source=jhu&country_code=<code>&province=<province>
  • /v2/locations?source=jhu&country_code=<code>&province=<province>&county=<county>

Would it make sense to add another method to get data for a given province within a country and another one for a given county?

E.g (method signatures):

  • func (c Client) GetDataByProvince(ctx context.Context, countryCode string, province string, timelines bool) (data Locations, err error)
  • func (c Client) GetDataByCounty(ctx context.Context, countryCode string, province string, county string, timelines bool) (data Locations, err error)

However, I am not sure this is the best way to go about this (I think it's possible to filter by country and county and omit the province). Another way I could think of would be to change the GetDataByCountryCode method signature to add 2 boolean arguments so that users could add province and/or county as filters, e.g:

func (c Client) GetDataByCountryCode(ctx context.Context, countryCode string, province bool, county bool, timelines bool) (data Locations, err error)

And then create the endpoint accordingly if those are set to true. Either way, it might not be useful to add this, so feedback welcome.

dabcoder avatar Jun 01 '20 20:06 dabcoder