Skip to content

Commit

Permalink
Rename subregion items to one word, bumps
Browse files Browse the repository at this point in the history
  • Loading branch information
FinleyMcIlwaine committed Dec 16, 2023
1 parent 865aedf commit 846f9b0
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 53 deletions.
4 changes: 4 additions & 0 deletions ebird-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for ebird-api

## 0.2.0.0 -- 2023-12-16

* Rename subregion items so subregion is one word.

## 0.1.0.0 -- 2023-07-30

* First version. Released on an unsuspecting world.
2 changes: 1 addition & 1 deletion ebird-api/ebird-api.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ebird-api
version: 0.1.0.0
version: 0.2.0.0
synopsis:
A Haskell description of the eBird API
description:
Expand Down
6 changes: 3 additions & 3 deletions ebird-api/src/Data/EBird/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module Data.EBird.API
-- section](https://documenter.getpostman.com/view/664302/S1ENwy59#c9947c5c-2dce-4c6d-9911-7d702235506c)
-- of the eBird API documentation.
, RegionInfoAPI
, SubRegionListAPI
, SubregionListAPI
, AdjacentRegionsAPI

-- * eBird checklists
Expand Down Expand Up @@ -194,7 +194,7 @@ type EBirdAPI =

-- Region APIs
:<|> RegionInfoAPI
:<|> SubRegionListAPI
:<|> SubregionListAPI
:<|> AdjacentRegionsAPI

-- | Convenient synonym for requiring an @x-ebirdapitoken@ on a route
Expand Down Expand Up @@ -572,7 +572,7 @@ type RegionInfoAPI =
--
-- See the [eBird API documentation for this
-- route](https://documenter.getpostman.com/view/664302/S1ENwy59#382da1c8-8bff-4926-936a-a1f8b065e7d5).
type SubRegionListAPI =
type SubregionListAPI =
"v2" :> "ref" :> "region"
:> "list"
:> WithAPIKey
Expand Down
2 changes: 1 addition & 1 deletion ebird-api/src/Data/EBird/API/Regions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ data RegionBounds =
}
deriving (Show, Read, Eq)

-- | The data structure returned by the eBird 'Data.EBird.API.SubRegionListAPI' and
-- | The data structure returned by the eBird 'Data.EBird.API.SubregionListAPI' and
-- 'Data.EBird.API.AdjacentRegionsAPI'.
data RegionListEntry =
RegionListEntry
Expand Down
5 changes: 5 additions & 0 deletions ebird-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Revision history for ebird-cli

## 0.3.0.0 -- 2023-12-16

* Rename subregion items so subregion is one word.
* Bump `ebird-api` and `ebird-client` constraints.

## 0.2.0.0 -- 2023-09-27

* Renamed `ebird` executable to `ebird-cli`.
Expand Down
6 changes: 3 additions & 3 deletions ebird-cli/ebird-cli.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ebird-cli
version: 0.2.0.0
version: 0.3.0.0
synopsis:
A command-line utility for interacting with the
eBird API.
Expand Down Expand Up @@ -47,8 +47,8 @@ library
exposed-modules:
Data.EBird.CLI
build-depends:
ebird-api >= 0.1.0.0 && < 0.2
, ebird-client >= 0.1.0.0 && < 0.2
ebird-api >= 0.2.0.0 && < 0.3
, ebird-client >= 0.2.0.0 && < 0.3

, aeson >= 1.5.6.0 && < 2.2
, aeson-pretty >= 0.8.8 && < 0.9
Expand Down
60 changes: 30 additions & 30 deletions ebird-cli/src/Data/EBird/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ eBirdCli = do
opts =
info
(eBirdCommand <**> helper)
( header "ebird - Go birding on your command line!"
( header "ebird-cli - Go birding on your command line!"
<> progDesc "Query the official eBird API"
)

Expand Down Expand Up @@ -98,7 +98,7 @@ runEBirdCommand getAPIKey = \case
recentObservationsHotspots
recentObservationsProvisionals
recentObservationsMaxResults
recentObservationsSubRegions
recentObservationsSubregions
recentObservationsSPPLocale
handleResponse res

Expand All @@ -111,7 +111,7 @@ runEBirdCommand getAPIKey = \case
recentNotableObservationsDetail
recentNotableObservationsHotspots
recentNotableObservationsMaxResults
recentNotableObservationsSubRegions
recentNotableObservationsSubregions
recentNotableObservationsSPPLocale
handleResponse res

Expand All @@ -125,7 +125,7 @@ runEBirdCommand getAPIKey = \case
recentSpeciesObservationsHotspots
recentSpeciesObservationsProvisionals
recentSpeciesObservationsMaxResults
recentSpeciesObservationsSubRegions
recentSpeciesObservationsSubregions
recentSpeciesObservationsSPPLocale
handleResponse res

Expand Down Expand Up @@ -204,7 +204,7 @@ runEBirdCommand getAPIKey = \case
historicalObservationsProvisionals
historicalObservationsMaxResults
historicalObservationsRank
historicalObservationsSubRegions
historicalObservationsSubregions
historicalObservationsSPPLocale
handleResponse res

Expand Down Expand Up @@ -322,12 +322,12 @@ runEBirdCommand getAPIKey = \case
regionInfoRegionNameFormat
handleResponse res

SubRegionListCommand SubRegionListOptions{..} -> do
SubregionListCommand SubregionListOptions{..} -> do
apiKey <- getAPIKey
res <- askEBird $
subRegionList apiKey
subRegionListRegionType
subRegionListParentRegionCode
subregionList apiKey
subregionListRegionType
subregionListParentRegionCode
handleResponse res

AdjacentRegionsCommand AdjacentRegionsOptions{..} -> do
Expand Down Expand Up @@ -389,7 +389,7 @@ data EBirdCommand
| TaxonomyVersionsCommand
| TaxonomicGroupsCommand TaxonomicGroupsOptions
| RegionInfoCommand RegionInfoOptions
| SubRegionListCommand SubRegionListOptions
| SubregionListCommand SubregionListOptions
| AdjacentRegionsCommand AdjacentRegionsOptions
deriving (Show, Eq)

Expand All @@ -402,7 +402,7 @@ data RecentObservationsOptions =
, recentObservationsHotspots :: Maybe Bool
, recentObservationsProvisionals :: Maybe Bool
, recentObservationsMaxResults :: Maybe Integer
, recentObservationsSubRegions :: Maybe RegionCode
, recentObservationsSubregions :: Maybe RegionCode
, recentObservationsSPPLocale :: Maybe SPPLocale
}
deriving (Show, Read, Eq)
Expand All @@ -415,7 +415,7 @@ data RecentNotableObservationsOptions =
, recentNotableObservationsDetail :: Maybe DetailLevel
, recentNotableObservationsHotspots :: Maybe Bool
, recentNotableObservationsMaxResults :: Maybe Integer
, recentNotableObservationsSubRegions :: Maybe RegionCode
, recentNotableObservationsSubregions :: Maybe RegionCode
, recentNotableObservationsSPPLocale :: Maybe SPPLocale
}
deriving (Show, Read, Eq)
Expand All @@ -429,7 +429,7 @@ data RecentSpeciesObservationsOptions =
, recentSpeciesObservationsHotspots :: Maybe Bool
, recentSpeciesObservationsProvisionals :: Maybe Bool
, recentSpeciesObservationsMaxResults :: Maybe Integer
, recentSpeciesObservationsSubRegions :: Maybe RegionCode
, recentSpeciesObservationsSubregions :: Maybe RegionCode
, recentSpeciesObservationsSPPLocale :: Maybe SPPLocale
}
deriving (Show, Read, Eq)
Expand Down Expand Up @@ -507,7 +507,7 @@ data HistoricalObservationsOptions =
, historicalObservationsProvisionals :: Maybe Bool
, historicalObservationsMaxResults :: Maybe Integer
, historicalObservationsRank :: Maybe SelectObservation
, historicalObservationsSubRegions :: Maybe RegionCode
, historicalObservationsSubregions :: Maybe RegionCode
, historicalObservationsSPPLocale :: Maybe SPPLocale
}
deriving (Show, Read, Eq)
Expand Down Expand Up @@ -630,15 +630,15 @@ data RegionInfoOptions =
}
deriving (Show, Read, Eq)

-- | Options for the @sub-regions@ command.
data SubRegionListOptions =
SubRegionListOptions
{ subRegionListParentRegionCode :: RegionCode
, subRegionListRegionType :: RegionType
-- | Options for the @subregions@ command.
data SubregionListOptions =
SubregionListOptions
{ subregionListParentRegionCode :: RegionCode
, subregionListRegionType :: RegionType
}
deriving (Show, Read, Eq)

-- | Options for the @sub-regions@ command.
-- | Options for the @subregions@ command.
newtype AdjacentRegionsOptions =
AdjacentRegionsOptions
{ adjacentRegionsRegion :: Region
Expand Down Expand Up @@ -699,7 +699,7 @@ eBirdCommand =
(
commandGroup "Region commands:"
<> command "region-info" regionInfoInfo
<> command "sub-regions" subRegionsInfo
<> command "subregions" subregionsInfo
<> command "adjacent-regions" adjacentRegionsInfo
<> hidden
)
Expand Down Expand Up @@ -854,11 +854,11 @@ eBirdCommand =
(RegionInfoCommand <$> regionInfoOptions)
(progDesc "Get information about a region")

subRegionsInfo :: ParserInfo EBirdCommand
subRegionsInfo =
subregionsInfo :: ParserInfo EBirdCommand
subregionsInfo =
info
(SubRegionListCommand <$> subRegionListOptions)
(progDesc "Get the list of sub-regions within a region")
(SubregionListCommand <$> subregionListOptions)
(progDesc "Get the list of subregions within a region")

adjacentRegionsInfo :: ParserInfo EBirdCommand
adjacentRegionsInfo =
Expand Down Expand Up @@ -1438,15 +1438,15 @@ regionInfoOptions =
<*> optional regionNameFormat
<**> helper

-- | Parse the options for the @sub-regions@ command.
subRegionListOptions :: Parser SubRegionListOptions
subRegionListOptions =
SubRegionListOptions
-- | Parse the options for the @subregions@ command.
subregionListOptions :: Parser SubregionListOptions
subregionListOptions =
SubregionListOptions
<$> regionCode
<*> regionType
<**> helper

-- | Parse the options for the @sub-regions@ command.
-- | Parse the options for the @subregions@ command.
adjacentRegionsOptions :: Parser AdjacentRegionsOptions
adjacentRegionsOptions =
AdjacentRegionsOptions
Expand Down
5 changes: 5 additions & 0 deletions ebird-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Revision history for ebird-client

## 0.2.0.0 -- 2023-12-16

* Rename subregion items so that subregion is one word.
* Bump `ebird-api` constraint.

## 0.1.0.0 -- 2023-07-30

* First version. Released on an unsuspecting world.
4 changes: 2 additions & 2 deletions ebird-client/ebird-client.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ebird-client
version: 0.1.0.0
version: 0.2.0.0
synopsis:
Client functions for querying the eBird API.
description:
Expand Down Expand Up @@ -57,7 +57,7 @@ library
Data.EBird.Client.Regions
Data.EBird.Client.Taxonomy
build-depends:
, ebird-api >= 0.1.0.0 && < 0.2
, ebird-api >= 0.2.0.0 && < 0.3

, data-default >= 0.7.1.1 && < 0.8
, http-client-tls >= 0.3.5.3 && < 0.4
Expand Down
2 changes: 1 addition & 1 deletion ebird-client/src/Data/EBird/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Data.EBird.Client (

-- ** Region queries
, regionInfo
, subRegionList
, subregionList
, adjacentRegions

-- * Less convenient, generated queries
Expand Down
10 changes: 5 additions & 5 deletions ebird-client/src/Data/EBird/Client/Generated.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas -ddump-verbose-inlinings #-}
{-# HLINT ignore "Eta reduce" #-}

-- |
Expand Down Expand Up @@ -56,7 +56,7 @@ module Data.EBird.Client.Generated

-- ** Region queries
, regionInfo_
, subRegionList_
, subregionList_
, adjacentRegions_
) where

Expand Down Expand Up @@ -709,13 +709,13 @@ regionInfo_
-- /default: 'Full'/
-> ClientM RegionInfo

-- | Get a list of sub-regions of a given region type within a given region.
-- | Get a list of subregions of a given region type within a given region.
-- Keep in mind that many combinations of sub region and parent region are
-- invalid, e.g. 'CountryType' regions within "US-WY".
--
-- See the [eBird API documentation for the corresponding
-- endpoint](https://documenter.getpostman.com/view/664302/S1ENwy59#382da1c8-8bff-4926-936a-a1f8b065e7d5).
subRegionList_
subregionList_
:: Text
-- ^ eBird API key
-> RegionType
Expand Down Expand Up @@ -760,5 +760,5 @@ recentObservations_
:<|> taxonomyVersions_
:<|> taxonomicGroups_
:<|> regionInfo_
:<|> subRegionList_
:<|> subregionList_
:<|> adjacentRegions_ = client (Proxy @EBirdAPI)
14 changes: 7 additions & 7 deletions ebird-client/src/Data/EBird/Client/Regions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,30 @@ makeFieldLabels ''RegionInfoParams
-- * Sub region list
-------------------------------------------------------------------------------

-- | Get a list of sub-regions of a given region type within a given region.
-- Keep in mind that many combinations of sub-region and parent region are
-- | 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"
-- askEBird $ subregionList key Subnational2Type "US-WY"
-- @
--
-- Note that the endpoint for this query is simple enough that 'subRegionList'
-- is equivalent to the generated 'subRegionList_'.
-- 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](https://documenter.getpostman.com/view/664302/S1ENwy59#382da1c8-8bff-4926-936a-a1f8b065e7d5).
subRegionList
subregionList
:: Text
-- ^ eBird API key
-> RegionType
-- ^ Type of subregions to fetch
-> RegionCode
-- ^ Parent 'RegionCode'
-> ClientM [RegionListEntry]
subRegionList = subRegionList_
subregionList = subregionList_

-------------------------------------------------------------------------------
-- * Adjacent regions
Expand Down

0 comments on commit 846f9b0

Please sign in to comment.