ebird-client-0.2.0.1: Client functions for querying the eBird API.
Copyright(c) 2023 Finley McIlwaine
LicenseMIT (see LICENSE)
MaintainerFinley McIlwaine <finleymcilwaine@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.EBird.Client.Regions

Description

Types and functions for region-related eBird API queries.

Synopsis

Region info

regionInfo Source #

Arguments

:: Text

eBird API key

-> Region

Region to get information for

-> RegionInfoParams

Optional parameters

default: defaultRegionInfoParams

-> ClientM RegionInfo 

Get a RegionInfo for an eBird region.

For example, get information about the Park County, Wyoming region (using -XOverloadedLabels and -XOverloadedStrings):

askEBird $ regionInfo key "US-WY-029" def

See the eBird API documentation for the corresponding endpoint.

newtype RegionInfoParams Source #

Optional parameters accepted by the RegionInfoAPI.

Note that defaultRegionInfoParams (or the Default instance's def value) may be used to accept the defaults of the eBird API.

Additionally, note that there are optics available for manipulating this type. For example, if you would like to just set the _regionInfoParamsFormat field to NameOnlyNameFormat (using -XOverloadedString):

def & regionInfoParamsFormat ?~ "nameonly"

Or, using -XOverloadedLabels:

def & #format ?~ "nameonly"

Constructors

RegionInfoParams 

Fields

defaultRegionInfoParams :: RegionInfoParams Source #

Note that this value does not actually use the eBird API default values. It simply sets every option to Nothing, which means we just don't send any of these parameters to the eBird API and they will use their own defaults.

Optics for RegionInfoParams

Sub region list

subregionList Source #

Arguments

:: Text

eBird API key

-> RegionType

Type of subregions to fetch

-> RegionCode

Parent RegionCode

-> ClientM [RegionListEntry] 

Get a list of subregions of a given region type within a given region. Keep in mind that many combinations of subregion and parent region are invalid, e.g. CountryType regions within "US-WY".

For example, get county sub regions of Wyoming (using -XOverloadedStrings):

askEBird $ subregionList key Subnational2Type "US-WY"

Note that the endpoint for this query is simple enough that subregionList is equivalent to the generated subregionList_.

See the eBird API documentation for the corresponding endpoint.

Adjacent regions

adjacentRegions Source #

Arguments

:: Text

eBird API key

-> Region

Region to fetch the adjacent regions of

-> ClientM [RegionListEntry] 

Get a list of regions adjacent to a given region. Subnational2 region codes are only currently supported in the United States, New Zealand, or Mexico.

For example, get regions adjacent to Wyoming (using -XOverloadedStrings):

askEBird $ adjacentRegions key "US-WY"

Note that the endpoint for this query is simple enough that adjacentRegions is equivalent to the generated adjacentRegions_.

See the eBird API documentation for the corresponding endpoint.