swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe Haskell | None
Language | Haskell2010

SwaggerPetstore.Client

Contents

- Dispatch
  - Lbs
  - Mime
  - Unsafe
- InitRequest
  - Logging

Description

Synopsis

- dispatchLbs :: (Produces req accept, MimeType contentType) => Manager -> SwaggerPetstoreConfig -> SwaggerPetstoreRequest req contentType res -> accept -> IO (Response ByteString)
- data MimeResult res = MimeResult {
  - mimeResult :: Either MimeError res
  - mimeResultResponse :: Response ByteString
  }
- data MimeError = MimeError {
  - mimeError :: String
  - mimeErrorResponse :: Response ByteString
  }
- dispatchMime :: (Produces req accept, MimeUnrender accept res, MimeType contentType) => Manager -> SwaggerPetstoreConfig -> SwaggerPetstoreRequest req contentType res -> accept -> IO (MimeResult res)
- dispatchMime' :: (Produces req accept, MimeUnrender accept res, MimeType contentType) => Manager -> SwaggerPetstoreConfig -> SwaggerPetstoreRequest req contentType res -> accept -> IO (Either MimeError res)
- dispatchLbsUnsafe :: (MimeType accept, MimeType contentType) => Manager -> SwaggerPetstoreConfig -> SwaggerPetstoreRequest req contentType res -> accept -> IO (Response ByteString)
- dispatchInitUnsafe :: Manager -> SwaggerPetstoreConfig -> InitRequest req contentType res accept -> IO (Response ByteString)
- newtype InitRequest req contentType res accept = InitRequest {
  - unInitRequest :: Request
  }
- _toInitRequest :: (MimeType accept, MimeType contentType) => SwaggerPetstoreConfig -> SwaggerPetstoreRequest req contentType res -> accept -> IO (InitRequest req contentType res accept)
- modifyInitRequest :: InitRequest req contentType res accept -> (Request -> Request) -> InitRequest req contentType res accept
- modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (Request -> m Request) -> m (InitRequest req contentType res accept)
- runConfigLog :: MonadIO m => SwaggerPetstoreConfig -> LogExec m
- runConfigLogWithExceptions :: (MonadCatch m, MonadIO m) => Text -> SwaggerPetstoreConfig -> LogExec m

# Dispatch

## Lbs

dispatchLbs Source #

Arguments

:: (Produces req accept, MimeType contentType) |
=> Manager | http-client Connection manager
-> SwaggerPetstoreConfig | config
-> SwaggerPetstoreRequest req contentType res | request
-> accept | "accept" `MimeType`
-> IO (Response ByteString) | response

send a request returning the raw http response

## Mime

data MimeResult res Source #

pair of decoded http body and http response

Constructors

MimeResult |
Fields mimeResult :: Either MimeError res decoded http body mimeResultResponse :: Response ByteString http response

Instances

Functor MimeResult Source # |
Methods fmap :: (a -> b) -> MimeResult a -> MimeResult b # (<$) :: a -> MimeResult b -> MimeResult a #
Foldable MimeResult Source # |
Methods fold :: Monoid m => MimeResult m -> m # foldMap :: Monoid m => (a -> m) -> MimeResult a -> m # foldr :: (a -> b -> b) -> b -> MimeResult a -> b # foldr' :: (a -> b -> b) -> b -> MimeResult a -> b # foldl :: (b -> a -> b) -> b -> MimeResult a -> b # foldl' :: (b -> a -> b) -> b -> MimeResult a -> b # foldr1 :: (a -> a -> a) -> MimeResult a -> a # foldl1 :: (a -> a -> a) -> MimeResult a -> a # toList :: MimeResult a -> [a] # null :: MimeResult a -> Bool # length :: MimeResult a -> Int # elem :: Eq a => a -> MimeResult a -> Bool # maximum :: Ord a => MimeResult a -> a # minimum :: Ord a => MimeResult a -> a # sum :: Num a => MimeResult a -> a # product :: Num a => MimeResult a -> a #
Traversable MimeResult Source # |
Methods traverse :: Applicative f => (a -> f b) -> MimeResult a -> f (MimeResult b) # sequenceA :: Applicative f => MimeResult (f a) -> f (MimeResult a) # mapM :: Monad m => (a -> m b) -> MimeResult a -> m (MimeResult b) # sequence :: Monad m => MimeResult (m a) -> m (MimeResult a) #
Show res => Show (MimeResult res) Source # |
Methods showsPrec :: Int -> MimeResult res -> ShowS # show :: MimeResult res -> String # showList :: [MimeResult res] -> ShowS #

data MimeError Source #

pair of unrender/parser error and http response

Constructors

MimeError |
Fields mimeError :: String unrender/parser error mimeErrorResponse :: Response ByteString http response

Instances

Eq MimeError Source # |
Methods (==) :: MimeError -> MimeError -> Bool # (/=) :: MimeError -> MimeError -> Bool #
Show MimeError Source # |
Methods showsPrec :: Int -> MimeError -> ShowS # show :: MimeError -> String # showList :: [MimeError] -> ShowS #

dispatchMime Source #

Arguments

:: (Produces req accept, MimeUnrender accept res, MimeType contentType) |
=> Manager | http-client Connection manager
-> SwaggerPetstoreConfig | config
-> SwaggerPetstoreRequest req contentType res | request
-> accept | "accept" `MimeType`
-> IO (MimeResult res) | response

send a request returning the `MimeResult`

dispatchMime' Source #

Arguments

:: (Produces req accept, MimeUnrender accept res, MimeType contentType) |
=> Manager | http-client Connection manager
-> SwaggerPetstoreConfig | config
-> SwaggerPetstoreRequest req contentType res | request
-> accept | "accept" `MimeType`
-> IO (Either MimeError res) | response

like `dispatchMime`, but only returns the decoded http body

## Unsafe

dispatchLbsUnsafe Source #

Arguments

:: (MimeType accept, MimeType contentType) |
=> Manager | http-client Connection manager
-> SwaggerPetstoreConfig | config
-> SwaggerPetstoreRequest req contentType res | request
-> accept | "accept" `MimeType`
-> IO (Response ByteString) | response

like `dispatchReqLbs`, but does not validate the operation is a `Producer` of the "accept" `MimeType`. (Useful if the server's response is undocumented)

dispatchInitUnsafe Source #

Arguments

:: Manager | http-client Connection manager
-> SwaggerPetstoreConfig | config
-> InitRequest req contentType res accept | init request
-> IO (Response ByteString) | response

dispatch an InitRequest

# InitRequest

newtype InitRequest req contentType res accept Source #

wraps an http-client `Request` with request/response type parameters

Constructors

InitRequest |
Fields unInitRequest :: Request

Instances

Show (InitRequest req contentType res accept) Source # |
Methods showsPrec :: Int -> InitRequest req contentType res accept -> ShowS # show :: InitRequest req contentType res accept -> String # showList :: [InitRequest req contentType res accept] -> ShowS #

_toInitRequest Source #

Arguments

:: (MimeType accept, MimeType contentType) |
=> SwaggerPetstoreConfig | config
-> SwaggerPetstoreRequest req contentType res | request
-> accept | "accept" `MimeType`
-> IO (InitRequest req contentType res accept) | initialized request

Build an http-client `Request` record from the supplied config and request

modifyInitRequest :: InitRequest req contentType res accept -> (Request -> Request) -> InitRequest req contentType res accept Source #

modify the underlying Request

modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (Request -> m Request) -> m (InitRequest req contentType res accept) Source #

modify the underlying Request (monadic)

## Logging

runConfigLog :: MonadIO m => SwaggerPetstoreConfig -> LogExec m Source #

Run a block using the configured logger instance

runConfigLogWithExceptions :: (MonadCatch m, MonadIO m) => Text -> SwaggerPetstoreConfig -> LogExec m Source #

Run a block using the configured logger instance (logs exceptions)