git.iko.soy/typeable/http-api-data
on master help sign in
Add comments
commitce7887ebfea0961994805ab9eef522825702c980 authorCatherine Galkina <catherine@getshoptv.com> dateWed 8 Jun 2016, 17:34 (10 years ago) parentcf58f99
1 file changed+15
Web/HttpApiData/Internal.hs+15
Web/HttpApiData/Internal.hs+15
@@ -284,16 +284,31 @@ parseBoundedTextData = parseMaybeTextData (flip lookup values . T.toLower)
284284 where
285285 values = map (showTextData &&& id) [minBound..maxBound]
286286
287+-- | /Case insensitive/.
288+--
289+-- Parse values case insensitively based on @'ToHttpApiData'@ instance.
290+-- Uses @'toUrlPiece'@ to get possible values.
291+--
287292parseBoundedUrlPiece :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a
288293parseBoundedUrlPiece = parseMaybeTextData (flip lookup values . T.toLower)
289294 where
290295 values = map (toUrlPiece &&& id) [minBound..maxBound]
291296
297+-- | /Case insensitive/.
298+--
299+-- Parse values case insensitively based on @'ToHttpApiData'@ instance.
300+-- Uses @'toQueryParam'@ to get possible values.
301+--
292302parseBoundedQueryParam :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a
293303parseBoundedQueryParam = parseMaybeTextData (flip lookup values . T.toLower)
294304 where
295305 values = map (toQueryParam &&& id) [minBound..maxBound]
296306
307+-- | /Case insensitive/.
308+--
309+-- Parse values case insensitively based on @'ToHttpApiData'@ instance.
310+-- Uses @'toHeader'@ to get possible values.
311+--
297312parseBoundedHeader :: (ToHttpApiData a, Bounded a, Enum a) => Text -> Either Text a
298313parseBoundedHeader = parseMaybeTextData (flip lookup values . T.toLower)
299314 where