Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant client API for They Work For You
Different calls are being implemented as needed for now so if you require any of the API calls that are not yet implemented please either submit a pull request via github or let me know you want it and I will add it myself.
TODO: getPerson, getMPInfo, getMPsInfo, getLord, getLords, getMLA, getMLAs, getMSP, getMSPs, getGeometry, getBoundary, getCommittee, getDebates, getWrans, getWMS, getHansard, getComments
- type TwfyAPI = ("getConstituency" :> (QueryParam "key" ApiKey :> (QueryParam "name" Text :> (QueryParam "postcode" Text :> Get '[JsonIso8859] Constituency)))) :<|> (("getConstituencies" :> (QueryParam "key" ApiKey :> Get '[JsonIso8859] [Constituency])) :<|> (("getMP" :> (QueryParam "key" ApiKey :> (QueryParam "id" Int :> (QueryParam "constituency" Text :> (QueryParam "postcode" Text :> (QueryParam "always_return" Bool :> Get '[JsonIso8859] MP)))))) :<|> ("getMPs" :> (QueryParam "key" ApiKey :> (QueryParam "search" Text :> (QueryParam "party" Text :> (QueryParam "date" Text :> Get '[JsonIso8859] [MP])))))))
- type ApiKey = Text
- getConstituency :: Maybe ApiKey -> Maybe Text -> Maybe Text -> ClientM Constituency
- getConstituencies :: Maybe ApiKey -> ClientM [Constituency]
- getMP :: Maybe ApiKey -> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Bool -> ClientM MP
- getMPs :: Maybe ApiKey -> Maybe Text -> Maybe Text -> Maybe Text -> ClientM [MP]
Documentation
type TwfyAPI = ("getConstituency" :> (QueryParam "key" ApiKey :> (QueryParam "name" Text :> (QueryParam "postcode" Text :> Get '[JsonIso8859] Constituency)))) :<|> (("getConstituencies" :> (QueryParam "key" ApiKey :> Get '[JsonIso8859] [Constituency])) :<|> (("getMP" :> (QueryParam "key" ApiKey :> (QueryParam "id" Int :> (QueryParam "constituency" Text :> (QueryParam "postcode" Text :> (QueryParam "always_return" Bool :> Get '[JsonIso8859] MP)))))) :<|> ("getMPs" :> (QueryParam "key" ApiKey :> (QueryParam "search" Text :> (QueryParam "party" Text :> (QueryParam "date" Text :> Get '[JsonIso8859] [MP]))))))) Source #
Servant API definition
The getConstituency
function retreives a constituency based on name or post code
:: Maybe ApiKey | API key |
-> ClientM [Constituency] |
The getConstituencies
function retreives all constituencies