Copyright | (c) 2023 Finley McIlwaine |
---|---|
License | MIT (see LICENSE) |
Maintainer | Finley McIlwaine <finleymcilwaine@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Types and functions for region-related eBird API queries.
Synopsis
- regionInfo :: Text -> Region -> RegionInfoParams -> ClientM RegionInfo
- newtype RegionInfoParams = RegionInfoParams {
- _regionInfoParamsFormat :: Maybe RegionNameFormat
- defaultRegionInfoParams :: RegionInfoParams
- regionInfoParamsFormat :: Iso' RegionInfoParams (Maybe RegionNameFormat)
- subregionList :: Text -> RegionType -> RegionCode -> ClientM [RegionListEntry]
- adjacentRegions :: Text -> Region -> ClientM [RegionListEntry]
Region info
:: Text | eBird API key |
-> Region | Region to get information for |
-> RegionInfoParams | Optional parameters default: |
-> 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"
RegionInfoParams | |
|
Instances
Read RegionInfoParams Source # | |
Defined in Data.EBird.Client.Regions | |
Show RegionInfoParams Source # | |
Defined in Data.EBird.Client.Regions showsPrec :: Int -> RegionInfoParams -> ShowS # show :: RegionInfoParams -> String # showList :: [RegionInfoParams] -> ShowS # | |
Default RegionInfoParams Source # | |
Defined in Data.EBird.Client.Regions def :: RegionInfoParams # | |
Eq RegionInfoParams Source # | |
Defined in Data.EBird.Client.Regions (==) :: RegionInfoParams -> RegionInfoParams -> Bool # (/=) :: RegionInfoParams -> RegionInfoParams -> Bool # | |
(k ~ An_Iso, a ~ Maybe RegionNameFormat, b ~ Maybe RegionNameFormat) => LabelOptic "format" k RegionInfoParams RegionInfoParams a b Source # | |
Defined in Data.EBird.Client.Regions labelOptic :: Optic k NoIx RegionInfoParams RegionInfoParams a b # |
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
regionInfoParamsFormat :: Iso' RegionInfoParams (Maybe RegionNameFormat) Source #
Sub region list
:: Text | eBird API key |
-> RegionType | Type of subregions to fetch |
-> RegionCode | Parent |
-> 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
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.