api-builder-0.12.0.0: Library for easily building REST API wrappers in Haskell

Safe HaskellSafe
LanguageHaskell2010

Network.API.Builder.Routes

Synopsis

Documentation

data Route Source #

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.

Constructors

Route 

type URLPiece = Text Source #

Alias for Text to store the URL fragments for each Route.

type URLParam = [(Text, Text)] Source #

Alias to (Text, Maybe Text) used to store each query that gets tacked onto the request.

(=.) :: ToQuery a => Text -> a -> [(Text, Text)] Source #

Convenience function for building URLParams. Right-hand argument must have a ToQuery instance so it can be converted to the appropriate representation in a query string. Query values do not need to be escaped.

>>> "api_type" =. ("json" :: Text)
("api_type", Just "json")

routeURL Source #

Arguments

:: Text

base URL for the Route (you can usually get this from the Builder)

-> Route

the Route to process

-> Text

the finalized URL as a Text

Converts a Route to a URL. Drops any Nothing values from the query, separates the fragments with "/" and tacks them onto the end of the base URL.