Safe Haskell | None |
---|
- data Route = Route {
- fragments :: [URLFragment]
- urlParams :: [URLParam]
- httpMethod :: HTTPMethod
- type URLFragment = Text
- type URLParam = (Text, Maybe Text)
- (=.) :: Text -> Maybe Text -> (Text, Maybe Text)
- data HTTPMethod
- = GET
- | POST
- | CustomMethod Text
- showMethod :: HTTPMethod -> String
- routeURL :: Text -> Route -> Text
Documentation
Main type for routes in the API. Used to represent the URL minus the actual endpoint URL as well as the query string and the HTTP method used to communicate with the server.
Route | |
|
type URLFragment = TextSource
Alias for Text
to store the URL fragments for each Route
.
type URLParam = (Text, Maybe Text)Source
Alias to (Text, Maybe Text)
used to store each query that gets
tacked onto the request.
(=.) :: Text -> Maybe Text -> (Text, Maybe Text)Source
Convenience function for building URLParam
s.
>>>
"api_type" =. Just "json"
("api_type", Just "json")
data HTTPMethod Source
Type for different HTTP request methods. Has the two most common ones (GET and POST) as well as support for custom methods.
showMethod :: HTTPMethod -> StringSource
Get a String
from a HTTPMethod. Used mostly for creating Request
s.
>>>
showMethod GET
"GET">>>
showMethod (CustomMethod "PATCH")
"PATCH"