Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data OpenAPIPetstoreConfig = OpenAPIPetstoreConfig {}
- newConfig :: IO OpenAPIPetstoreConfig
- addAuthMethod :: AuthMethod auth => OpenAPIPetstoreConfig -> auth -> OpenAPIPetstoreConfig
- withStdoutLogging :: OpenAPIPetstoreConfig -> IO OpenAPIPetstoreConfig
- withStderrLogging :: OpenAPIPetstoreConfig -> IO OpenAPIPetstoreConfig
- withNoLogging :: OpenAPIPetstoreConfig -> OpenAPIPetstoreConfig
- data OpenAPIPetstoreRequest req contentType res accept = OpenAPIPetstoreRequest {
- rMethod :: Method
- rUrlPath :: [ByteString]
- rParams :: Params
- rAuthTypes :: [TypeRep]
- rMethodL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) Method
- rUrlPathL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) [ByteString]
- rParamsL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) Params
- rAuthTypesL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) [TypeRep]
- class HasBodyParam req param where
- setBodyParam :: forall contentType res accept. (Consumes req contentType, MimeRender contentType param) => OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept
- class HasOptionalParam req param where
- applyOptionalParam :: OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept
- (-&-) :: OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept
- data Params = Params {}
- paramsQueryL :: Lens_' Params Query
- paramsHeadersL :: Lens_' Params RequestHeaders
- paramsBodyL :: Lens_' Params ParamBody
- data ParamBody
- _mkRequest :: Method -> [ByteString] -> OpenAPIPetstoreRequest req contentType res accept
- _mkParams :: Params
- setHeader :: OpenAPIPetstoreRequest req contentType res accept -> [Header] -> OpenAPIPetstoreRequest req contentType res accept
- removeHeader :: OpenAPIPetstoreRequest req contentType res accept -> [HeaderName] -> OpenAPIPetstoreRequest req contentType res accept
- _setContentTypeHeader :: forall req contentType res accept. MimeType contentType => OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreRequest req contentType res accept
- _setAcceptHeader :: forall req contentType res accept. MimeType accept => OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreRequest req contentType res accept
- setQuery :: OpenAPIPetstoreRequest req contentType res accept -> [QueryItem] -> OpenAPIPetstoreRequest req contentType res accept
- addForm :: OpenAPIPetstoreRequest req contentType res accept -> Form -> OpenAPIPetstoreRequest req contentType res accept
- _addMultiFormPart :: OpenAPIPetstoreRequest req contentType res accept -> Part -> OpenAPIPetstoreRequest req contentType res accept
- _setBodyBS :: OpenAPIPetstoreRequest req contentType res accept -> ByteString -> OpenAPIPetstoreRequest req contentType res accept
- _setBodyLBS :: OpenAPIPetstoreRequest req contentType res accept -> ByteString -> OpenAPIPetstoreRequest req contentType res accept
- _hasAuthType :: AuthMethod authMethod => OpenAPIPetstoreRequest req contentType res accept -> Proxy authMethod -> OpenAPIPetstoreRequest req contentType res accept
- toPath :: ToHttpApiData a => a -> ByteString
- toHeader :: ToHttpApiData a => (HeaderName, a) -> [Header]
- toForm :: ToHttpApiData v => (ByteString, v) -> Form
- toQuery :: ToHttpApiData a => (ByteString, Maybe a) -> [QueryItem]
- data CollectionFormat
- toHeaderColl :: ToHttpApiData a => CollectionFormat -> (HeaderName, [a]) -> [Header]
- toFormColl :: ToHttpApiData v => CollectionFormat -> (ByteString, [v]) -> Form
- toQueryColl :: ToHttpApiData a => CollectionFormat -> (ByteString, Maybe [a]) -> Query
- _toColl :: Traversable f => CollectionFormat -> (f a -> [(b, ByteString)]) -> f [a] -> [(b, ByteString)]
- _toCollA :: (Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t ByteString)]) -> f (t [a]) -> [(b, t ByteString)]
- _toCollA' :: (Monoid c, Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)]
- class Typeable a => AuthMethod a where
- applyAuthMethod :: OpenAPIPetstoreConfig -> a -> OpenAPIPetstoreRequest req contentType res accept -> IO (OpenAPIPetstoreRequest req contentType res accept)
- data AnyAuthMethod = AuthMethod a => AnyAuthMethod a
- data AuthMethodException = AuthMethodException String
- _applyAuthMethods :: OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreConfig -> IO (OpenAPIPetstoreRequest req contentType res accept)
- _omitNulls :: [(Text, Value)] -> Value
- _toFormItem :: (ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text])
- _emptyToNothing :: Maybe String -> Maybe String
- _memptyToNothing :: (Monoid a, Eq a) => Maybe a -> Maybe a
- newtype DateTime = DateTime {}
- _readDateTime :: (ParseTime t, Monad m, Alternative m) => String -> m t
- _showDateTime :: (t ~ UTCTime, FormatTime t) => t -> String
- _parseISO8601 :: (ParseTime t, Monad m, Alternative m) => String -> m t
- newtype Date = Date {}
- _readDate :: (ParseTime t, Monad m) => String -> m t
- _showDate :: FormatTime t => t -> String
- newtype ByteArray = ByteArray {}
- _readByteArray :: Monad m => Text -> m ByteArray
- _showByteArray :: ByteArray -> Text
- newtype Binary = Binary {}
- _readBinaryBase64 :: Monad m => Text -> m Binary
- _showBinaryBase64 :: Binary -> Text
- type Lens_' s a = Lens_ s s a a
- type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t
OpenAPIPetstoreConfig
data OpenAPIPetstoreConfig Source #
OpenAPIPetstoreConfig | |
|
Instances
Show OpenAPIPetstoreConfig Source # | display the config |
Defined in OpenAPIPetstore.Core showsPrec :: Int -> OpenAPIPetstoreConfig -> ShowS # show :: OpenAPIPetstoreConfig -> String # showList :: [OpenAPIPetstoreConfig] -> ShowS # |
newConfig :: IO OpenAPIPetstoreConfig Source #
constructs a default OpenAPIPetstoreConfig
configHost:
http://petstore.swagger.io:80/v2
configUserAgent:
"openapi-petstore/0.1.0.0"
addAuthMethod :: AuthMethod auth => OpenAPIPetstoreConfig -> auth -> OpenAPIPetstoreConfig Source #
updates config use AuthMethod on matching requests
withStdoutLogging :: OpenAPIPetstoreConfig -> IO OpenAPIPetstoreConfig Source #
updates the config to use stdout logging
withStderrLogging :: OpenAPIPetstoreConfig -> IO OpenAPIPetstoreConfig Source #
updates the config to use stderr logging
withNoLogging :: OpenAPIPetstoreConfig -> OpenAPIPetstoreConfig Source #
updates the config to disable logging
OpenAPIPetstoreRequest
data OpenAPIPetstoreRequest req contentType res accept Source #
Represents a request.
Type Variables:
OpenAPIPetstoreRequest | |
|
Instances
Show (OpenAPIPetstoreRequest req contentType res accept) Source # | |
Defined in OpenAPIPetstore.Core showsPrec :: Int -> OpenAPIPetstoreRequest req contentType res accept -> ShowS # show :: OpenAPIPetstoreRequest req contentType res accept -> String # showList :: [OpenAPIPetstoreRequest req contentType res accept] -> ShowS # |
rUrlPathL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) [ByteString] Source #
rUrlPath
Lens
rAuthTypesL :: Lens_' (OpenAPIPetstoreRequest req contentType res accept) [TypeRep] Source #
rParams
Lens
HasBodyParam
class HasBodyParam req param where Source #
Designates the body parameter of a request
Nothing
setBodyParam :: forall contentType res accept. (Consumes req contentType, MimeRender contentType param) => OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept Source #
Instances
HasOptionalParam
class HasOptionalParam req param where Source #
Designates the optional parameters of a request
applyOptionalParam :: OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept Source #
Apply an optional parameter to a request
(-&-) :: OpenAPIPetstoreRequest req contentType res accept -> param -> OpenAPIPetstoreRequest req contentType res accept infixl 2 Source #
infix operator / alias for addOptionalParam
Instances
Request Params
paramsQueryL :: Lens_' Params Query Source #
paramsQuery
Lens
paramsBodyL :: Lens_' Params ParamBody Source #
paramsBody
Lens
Request Body
OpenAPIPetstoreRequest Utils
:: Method | Method |
-> [ByteString] | Endpoint |
-> OpenAPIPetstoreRequest req contentType res accept | req: Request Type, res: Response Type |
setHeader :: OpenAPIPetstoreRequest req contentType res accept -> [Header] -> OpenAPIPetstoreRequest req contentType res accept Source #
removeHeader :: OpenAPIPetstoreRequest req contentType res accept -> [HeaderName] -> OpenAPIPetstoreRequest req contentType res accept Source #
_setContentTypeHeader :: forall req contentType res accept. MimeType contentType => OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreRequest req contentType res accept Source #
_setAcceptHeader :: forall req contentType res accept. MimeType accept => OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreRequest req contentType res accept Source #
setQuery :: OpenAPIPetstoreRequest req contentType res accept -> [QueryItem] -> OpenAPIPetstoreRequest req contentType res accept Source #
addForm :: OpenAPIPetstoreRequest req contentType res accept -> Form -> OpenAPIPetstoreRequest req contentType res accept Source #
_addMultiFormPart :: OpenAPIPetstoreRequest req contentType res accept -> Part -> OpenAPIPetstoreRequest req contentType res accept Source #
_setBodyBS :: OpenAPIPetstoreRequest req contentType res accept -> ByteString -> OpenAPIPetstoreRequest req contentType res accept Source #
_setBodyLBS :: OpenAPIPetstoreRequest req contentType res accept -> ByteString -> OpenAPIPetstoreRequest req contentType res accept Source #
_hasAuthType :: AuthMethod authMethod => OpenAPIPetstoreRequest req contentType res accept -> Proxy authMethod -> OpenAPIPetstoreRequest req contentType res accept Source #
Params Utils
toPath :: ToHttpApiData a => a -> ByteString Source #
toHeader :: ToHttpApiData a => (HeaderName, a) -> [Header] Source #
toForm :: ToHttpApiData v => (ByteString, v) -> Form Source #
toQuery :: ToHttpApiData a => (ByteString, Maybe a) -> [QueryItem] Source #
OpenAPI CollectionFormat
Utils
data CollectionFormat Source #
Determines the format of the array if type array is used.
CommaSeparated | CSV format for multiple parameters. |
SpaceSeparated | Also called SSV |
TabSeparated | Also called TSV |
PipeSeparated | `value1|value2|value2` |
MultiParamArray | Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" ( |
toHeaderColl :: ToHttpApiData a => CollectionFormat -> (HeaderName, [a]) -> [Header] Source #
toFormColl :: ToHttpApiData v => CollectionFormat -> (ByteString, [v]) -> Form Source #
toQueryColl :: ToHttpApiData a => CollectionFormat -> (ByteString, Maybe [a]) -> Query Source #
_toColl :: Traversable f => CollectionFormat -> (f a -> [(b, ByteString)]) -> f [a] -> [(b, ByteString)] Source #
_toCollA :: (Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t ByteString)]) -> f (t [a]) -> [(b, t ByteString)] Source #
_toCollA' :: (Monoid c, Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)] Source #
AuthMethods
class Typeable a => AuthMethod a where Source #
Provides a method to apply auth methods to requests
applyAuthMethod :: OpenAPIPetstoreConfig -> a -> OpenAPIPetstoreRequest req contentType res accept -> IO (OpenAPIPetstoreRequest req contentType res accept) Source #
Instances
data AnyAuthMethod Source #
An existential wrapper for any AuthMethod
AuthMethod a => AnyAuthMethod a |
Instances
AuthMethod AnyAuthMethod Source # | |
Defined in OpenAPIPetstore.Core applyAuthMethod :: OpenAPIPetstoreConfig -> AnyAuthMethod -> OpenAPIPetstoreRequest req contentType res accept -> IO (OpenAPIPetstoreRequest req contentType res accept) Source # |
data AuthMethodException Source #
indicates exceptions related to AuthMethods
Instances
Show AuthMethodException Source # | |
Defined in OpenAPIPetstore.Core showsPrec :: Int -> AuthMethodException -> ShowS # show :: AuthMethodException -> String # showList :: [AuthMethodException] -> ShowS # | |
Exception AuthMethodException Source # | |
Defined in OpenAPIPetstore.Core |
_applyAuthMethods :: OpenAPIPetstoreRequest req contentType res accept -> OpenAPIPetstoreConfig -> IO (OpenAPIPetstoreRequest req contentType res accept) Source #
apply all matching AuthMethods in config to request
Utils
_omitNulls :: [(Text, Value)] -> Value Source #
Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
_toFormItem :: (ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text]) Source #
Encodes fields using WH.toQueryParam
_memptyToNothing :: (Monoid a, Eq a) => Maybe a -> Maybe a Source #
Collapse (Just mempty) to Nothing
DateTime Formatting
Instances
_readDateTime :: (ParseTime t, Monad m, Alternative m) => String -> m t Source #
_parseISO8601
_showDateTime :: (t ~ UTCTime, FormatTime t) => t -> String Source #
TI.formatISO8601Millis
_parseISO8601 :: (ParseTime t, Monad m, Alternative m) => String -> m t Source #
parse an ISO8601 date-time string
Date Formatting
Instances
_readDate :: (ParseTime t, Monad m) => String -> m t Source #
TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"
_showDate :: FormatTime t => t -> String Source #
TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"
Byte/Binary Formatting
base64 encoded characters
Instances
_showByteArray :: ByteArray -> Text Source #
show base64 encoded characters
any sequence of octets
Instances
_showBinaryBase64 :: Binary -> Text Source #