Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Session
- defaultManagerSettings :: ConnectionContext -> ManagerSettings
- withRecordFunction :: (forall a. Recorder -> String -> IO a -> IO a) -> Session -> Session
- withWreq :: (Session -> IO a) -> Environment -> IO a
- withWreqNoCookies :: (Session -> IO a) -> Environment -> IO a
- withWreqSettings :: Recorder -> Maybe CookieJar -> ManagerSettings -> (Session -> IO a) -> IO a
- get :: Session -> String -> IO (Response ByteString)
- post :: Postable a => Session -> String -> a -> IO (Response ByteString)
- head_ :: Session -> String -> IO (Response ())
- options :: Session -> String -> IO (Response ())
- put :: Putable a => Session -> String -> a -> IO (Response ByteString)
- delete :: Session -> String -> IO (Response ByteString)
- getWith :: Options -> Session -> String -> IO (Response ByteString)
- postWith :: Postable a => Options -> Session -> String -> a -> IO (Response ByteString)
- headWith :: Options -> Session -> String -> IO (Response ())
- optionsWith :: Options -> Session -> String -> IO (Response ())
- putWith :: Putable a => Options -> Session -> String -> a -> IO (Response ByteString)
- deleteWith :: Options -> Session -> String -> IO (Response ByteString)
- getJSON :: FromJSON a => Session -> String -> IO (Response a)
- getJSONWith :: FromJSON a => Options -> Session -> String -> IO (Response a)
- postJSON :: (Postable a, FromJSON b) => Session -> String -> a -> IO (Response b)
- postJSONWith :: (Postable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b)
- putJSON :: (Putable a, FromJSON b) => Session -> String -> a -> IO (Response b)
- putJSONWith :: (Putable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b)
- deleteJSON :: FromJSON a => Session -> String -> IO (Response a)
- deleteJSONWith :: FromJSON a => Options -> Session -> String -> IO (Response a)
Documentation
An opaque type created by withWreq
, withWreqNoCookies
,
or withWreqSettings
. All HTTP calls require a Session
.
defaultManagerSettings :: ConnectionContext -> ManagerSettings Source #
Create ManagerSettings
with no timeout using a shared TLS
ConnectionContext
withRecordFunction :: (forall a. Recorder -> String -> IO a -> IO a) -> Session -> Session Source #
Replaces the record function of the Session with the provided one.
This is useful for custom recorder actions, or if you need to catch any exceptions thrown by the IO action and don't wish them to bubble up to the statistics.
Session Creation
withWreq :: (Session -> IO a) -> Environment -> IO a Source #
Create a Session
using the wrecker
Environment
, passing it to the
given function. The Session
will no longer be valid after that
function returns.
This session manages cookies and uses default session manager configuration.
withWreqNoCookies :: (Session -> IO a) -> Environment -> IO a Source #
Create a session.
This uses the default session manager settings, but does not manage cookies. It is intended for use with REST-like HTTP-based APIs, which typically do not use cookies.
:: Recorder | |
-> Maybe CookieJar | If |
-> ManagerSettings | |
-> (Session -> IO a) | |
-> IO a |
Create a session, using the given cookie jar and manager settings.
HTTP Methods
HTTP Methods with Options
optionsWith :: Options -> Session -> String -> IO (Response ()) Source #
Session
-specific version of optionsWith
.
deleteWith :: Options -> Session -> String -> IO (Response ByteString) Source #
Session
-specific version of deleteWith
.
HTTP Methods to get JSON responses
postJSONWith :: (Postable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b) Source #
putJSONWith :: (Putable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b) Source #