-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Implementation of swagger data model
--   
--   Implementation of Swagger specification version 1.2 as defined in
--   <a>https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md</a>
@package swagger
@version 0.3.0


-- | The <a>Authorisation Object</a> part of the swagger specification. For
--   construction please consider using
--   <a>Data.Swagger.Build.Authorisation</a>.
module Data.Swagger.Model.Authorisation

-- | Cf. <a>Authorization Object</a>
data Authorisation
BasicAuth :: Authorisation
ApiKey :: PassMethod -> Text -> Authorisation
[passAs] :: Authorisation -> PassMethod
[keyname] :: Authorisation -> Text
OAuth2 :: Maybe [Scope] -> GrantTypes -> Authorisation
[scopes] :: Authorisation -> Maybe [Scope]
[grantTypes] :: Authorisation -> GrantTypes
data PassMethod
PassAsHeader :: PassMethod
PassAsQuery :: PassMethod

-- | Cf. <a>Scope Object</a>
data Scope
Scope :: Text -> Maybe Text -> Scope
[scope] :: Scope -> Text
[description] :: Scope -> Maybe Text

-- | Cf. <a>Grant Types Object</a>
data GrantTypes
GrantTypes :: Maybe ImplicitGrant -> Maybe AuthCode -> GrantTypes
[implicit] :: GrantTypes -> Maybe ImplicitGrant
[authCode] :: GrantTypes -> Maybe AuthCode

-- | Cf. <a>Implicit Object</a>
data ImplicitGrant
ImplicitGrant :: LoginEndpoint -> Maybe Text -> ImplicitGrant
[loginEndpoint] :: ImplicitGrant -> LoginEndpoint
[tokenName] :: ImplicitGrant -> Maybe Text
newtype LoginEndpoint
LoginEndpoint :: Text -> LoginEndpoint
[loginUrl] :: LoginEndpoint -> Text

-- | Cf. <a>Authorization Code Object</a>
data AuthCode
AuthCode :: TokenRequestEndpoint -> TokenEndpoint -> AuthCode
[tokenRequestEndpoint] :: AuthCode -> TokenRequestEndpoint
[tokenEndpoint] :: AuthCode -> TokenEndpoint

-- | Cf. <a>Token Request Endpoint Object</a>
data TokenRequestEndpoint
TokenRequestEndpoint :: Text -> Maybe Text -> Maybe Text -> TokenRequestEndpoint
[tokenRequestUrl] :: TokenRequestEndpoint -> Text
[clientIdName] :: TokenRequestEndpoint -> Maybe Text
[clientSecretName] :: TokenRequestEndpoint -> Maybe Text

-- | Cf. <a>Token Endpoint Object</a>
data TokenEndpoint
TokenEndpoint :: Text -> Maybe Text -> TokenEndpoint
[tokenEndpointUrl] :: TokenEndpoint -> Text
[tokenEndpointTokenName] :: TokenEndpoint -> Maybe Text
instance GHC.Show.Show Data.Swagger.Model.Authorisation.Authorisation
instance GHC.Show.Show Data.Swagger.Model.Authorisation.GrantTypes
instance GHC.Show.Show Data.Swagger.Model.Authorisation.AuthCode
instance GHC.Show.Show Data.Swagger.Model.Authorisation.TokenEndpoint
instance GHC.Show.Show Data.Swagger.Model.Authorisation.TokenRequestEndpoint
instance GHC.Show.Show Data.Swagger.Model.Authorisation.ImplicitGrant
instance GHC.Show.Show Data.Swagger.Model.Authorisation.LoginEndpoint
instance GHC.Show.Show Data.Swagger.Model.Authorisation.Scope
instance GHC.Show.Show Data.Swagger.Model.Authorisation.PassMethod
instance GHC.Classes.Eq Data.Swagger.Model.Authorisation.PassMethod
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.Authorisation
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.GrantTypes
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.AuthCode
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.TokenEndpoint
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.TokenRequestEndpoint
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.ImplicitGrant
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.LoginEndpoint
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.Scope
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.PassMethod


-- | The <a>Resource Listing</a> part of the swagger specification. For
--   construction please consider using <a>Data.Swagger.Build.Resource</a>.
module Data.Swagger.Model.Resource

-- | Cf. <a>Resource Listing Object</a>
data Resources
Resources :: Text -> [Resource] -> Maybe Text -> Maybe Info -> Maybe [(Text, Authorisation)] -> Resources
[swaggerVersion] :: Resources -> Text
[apis] :: Resources -> [Resource]
[apiVersion] :: Resources -> Maybe Text
[info] :: Resources -> Maybe Info
[authorisations] :: Resources -> Maybe [(Text, Authorisation)]

-- | Cf. <a>Resource Object</a>
data Resource
Resource :: Text -> Maybe Text -> Resource
[path] :: Resource -> Text
[description] :: Resource -> Maybe Text

-- | Cf. <a>Info Object</a>
data Info
Info :: Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Info
[title] :: Info -> Text
[infoDescription] :: Info -> Maybe Text
[termsOfServiceUrl] :: Info -> Maybe Text
[contact] :: Info -> Maybe Text
[license] :: Info -> Maybe Text
[licenseUrl] :: Info -> Maybe Text
instance GHC.Show.Show Data.Swagger.Model.Resource.Resources
instance GHC.Show.Show Data.Swagger.Model.Resource.Info
instance GHC.Show.Show Data.Swagger.Model.Resource.Resource
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Resource.Resources
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Resource.Info
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Resource.Resource


-- | The <a>API Declaration</a> part of the swagger specification. For
--   construction please consider using <a>Data.Swagger.Build.Api</a>.
module Data.Swagger.Model.Api

-- | Cf. <a>API Declaration</a>
data ApiDecl
ApiDecl :: Text -> Text -> [API] -> Maybe Text -> Maybe Text -> Maybe [(Text, Model)] -> Maybe [Text] -> Maybe [Text] -> Maybe [(Text, [Scope])] -> ApiDecl
[swaggerVersion] :: ApiDecl -> Text
[basePath] :: ApiDecl -> Text
[apis] :: ApiDecl -> [API]
[apiVersion] :: ApiDecl -> Maybe Text
[resourcePath] :: ApiDecl -> Maybe Text
[models] :: ApiDecl -> Maybe [(Text, Model)]
[apiProduces] :: ApiDecl -> Maybe [Text]
[apiConsumes] :: ApiDecl -> Maybe [Text]
[apiAuthorisations] :: ApiDecl -> Maybe [(Text, [Scope])]

-- | Cf. <a>API Object</a>
data API
API :: Text -> [Operation] -> Maybe Text -> API
[path] :: API -> Text
[operations] :: API -> [Operation]
[apiDescription] :: API -> Maybe Text

-- | Cf. <a>Operation Object</a>
data Operation
Operation :: Text -> Text -> Either () DataType -> [Parameter] -> Maybe Text -> Maybe Text -> Maybe [(Text, [Scope])] -> Maybe [Response] -> Maybe [Text] -> Maybe [Text] -> Maybe Bool -> Operation
[method] :: Operation -> Text
[nickname] :: Operation -> Text
[returnType] :: Operation -> Either () DataType
[parameters] :: Operation -> [Parameter]
[summary] :: Operation -> Maybe Text
[notes] :: Operation -> Maybe Text
[authorisations] :: Operation -> Maybe [(Text, [Scope])]
[responses] :: Operation -> Maybe [Response]
[produces] :: Operation -> Maybe [Text]
[consumes] :: Operation -> Maybe [Text]
[deprecated] :: Operation -> Maybe Bool

-- | Cf. <a>Parameter Object</a>
data Parameter
Parameter :: ParamType -> Either File DataType -> Text -> Maybe Text -> Maybe Bool -> Maybe Bool -> Parameter
[paramType] :: Parameter -> ParamType
[inputType] :: Parameter -> Either File DataType
[paramName] :: Parameter -> Text
[description] :: Parameter -> Maybe Text
[required] :: Parameter -> Maybe Bool
[allowMultiple] :: Parameter -> Maybe Bool
data ParamType
Path :: ParamType
Query :: ParamType
Body :: ParamType
Header :: ParamType
Form :: ParamType

-- | Cf. <a>Response Message Object</a>
data Response
Response :: Int -> Text -> Maybe ModelId -> Response
[code] :: Response -> Int
[message] :: Response -> Text
[responseModel] :: Response -> Maybe ModelId

-- | Cf. <a>Model Object</a>
data Model
Model :: ModelId -> [(PropertyName, Property)] -> Maybe Text -> Maybe [PropertyName] -> Maybe [Model] -> Maybe PropertyName -> Model
[modelId] :: Model -> ModelId
[properties] :: Model -> [(PropertyName, Property)]
[modelDescription] :: Model -> Maybe Text
[requiredProps] :: Model -> Maybe [PropertyName]
[subTypes] :: Model -> Maybe [Model]
[discriminator] :: Model -> Maybe PropertyName

-- | Cf. <a>Property Object</a>
data Property
Property :: DataType -> Maybe Text -> Property
[propertyType] :: Property -> DataType
[propDescription] :: Property -> Maybe Text
data DataType
[Prim] :: (Show a, ToJSON a) => Primitive a -> DataType
[Array] :: (Show a, ToJSON a) => Items a -> Maybe Bool -> DataType
[Ref] :: ModelId -> DataType

-- | Cf. <a>Primitive Types</a>
data Primitive a
Primitive :: PrimType -> Maybe a -> Maybe [a] -> Maybe a -> Maybe a -> Primitive a
[primType] :: Primitive a -> PrimType
[defaultValue] :: Primitive a -> Maybe a
[enum] :: Primitive a -> Maybe [a]
[minVal] :: Primitive a -> Maybe a
[maxVal] :: Primitive a -> Maybe a
data Items a
PrimItems :: Primitive a -> Items a
ModelItems :: ModelId -> Items a
data PrimType
PrimInt32 :: PrimType
PrimInt64 :: PrimType
PrimFloat :: PrimType
PrimDouble :: PrimType
PrimString :: PrimType
PrimByte :: PrimType
PrimBool :: PrimType
PrimDate :: PrimType
PrimDateTime :: PrimType
data File
File :: File
type ModelId = Text
type PropertyName = Text
instance GHC.Show.Show Data.Swagger.Model.Api.ApiDecl
instance GHC.Show.Show Data.Swagger.Model.Api.API
instance GHC.Show.Show Data.Swagger.Model.Api.Operation
instance GHC.Show.Show Data.Swagger.Model.Api.Parameter
instance GHC.Show.Show Data.Swagger.Model.Api.File
instance GHC.Show.Show Data.Swagger.Model.Api.Model
instance GHC.Show.Show Data.Swagger.Model.Api.Property
instance GHC.Show.Show a => GHC.Show.Show (Data.Swagger.Model.Api.Items a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Swagger.Model.Api.Primitive a)
instance GHC.Show.Show Data.Swagger.Model.Api.PrimType
instance GHC.Show.Show Data.Swagger.Model.Api.Response
instance GHC.Show.Show Data.Swagger.Model.Api.ParamType
instance GHC.Classes.Eq Data.Swagger.Model.Api.ParamType
instance GHC.Show.Show Data.Swagger.Model.Api.DataType
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.ApiDecl
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.API
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Operation
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Parameter
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Model
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Property
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Response
instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.ParamType

module Data.Swagger.Build.Resource

-- | Construct a resource listing object given a swagger version and some
--   resource objects.
resources :: Text -> ResourcesBuilder -> Resources

-- | Add one resource object to a resource listing given a path and some
--   resource specific values.
api :: Text -> ResourceBuilder -> ResourcesBuilder
apiVersion :: Text -> ResourcesBuilder

-- | Set the info object of a resource listing object given a title and
--   other infor object specific values.
info :: Text -> InfoBuilder -> ResourcesBuilder
termsOfServiceUrl :: Text -> InfoBuilder
contact :: Text -> InfoBuilder
license :: Text -> InfoBuilder
licenseUrl :: Text -> InfoBuilder

-- | Add a authorisation object to a resource listing with the given name.
authorisation :: Text -> Authorisation -> ResourcesBuilder

-- | If cases where no build steps are provided but a builder is required
--   <a>end</a> can be used, e.g. <tt>defineModel "Foo" end</tt>
end :: Monad m => m ()
type ResourcesBuilder = State Resources ()
type InfoBuilder = State InfoSt ()

module Data.Swagger.Build.Authorisation
basic :: Authorisation
apiKey :: PassMethod -> Text -> Authorisation
data PassMethod
PassAsHeader :: PassMethod
PassAsQuery :: PassMethod
oauth2 :: GrantTypes -> OAuth2Builder -> Authorisation

-- | Add one scope with the given name to an OAuth2 object.
scope :: Text -> ScopeBuilder -> OAuth2Builder

-- | Construct an implicit grant type with the given login endpoint and
--   some optional token name.
implicit :: Text -> ImplicitBuilder -> GrantTypes

-- | Construct an authentorisation code based grant type object.
authCode :: TokenRequestEndpoint -> TokenEndpoint -> GrantTypes
tokenEndpoint :: Text -> TokenEndpointBuilder -> TokenEndpoint
tokenRequestEndpoint :: Text -> TokenReqEndpointBuilder -> TokenRequestEndpoint
clientIdName :: Text -> TokenReqEndpointBuilder
clientSecretName :: Text -> TokenReqEndpointBuilder
token :: Text -> State (TokenName a) ()

-- | If cases where no build steps are provided but a builder is required
--   <a>end</a> can be used, e.g. <tt>defineModel "Foo" end</tt>
end :: Monad m => m ()
type OAuth2Builder = State [Scope] ()
type ScopeSt = Common '["description"] Scope
type ScopeBuilder = State ScopeSt ()
type ImplicitBuilder = State (TokenName ImplicitGrant) ()
type TokenEndpointBuilder = State (TokenName TokenEndpoint) ()
type TokenReqEndpointBuilder = State TokenRequestEndpoint ()


-- | Construction of <a>Data.Swagger.Model.Api</a> values. For example:
--   
--   <pre>
--   declare "<a>http://petstore.swagger.wordnik.com/api"</a> "1.2" $ do
--      apiVersion "1.0.0"
--      resourcePath "/store"
--      model foo
--      model bar
--      produces "application/json"
--      produces "text/html"
--      produces "text/plain"
--      api "/store/order/{orderId}" $ do
--          operation "GET" "foo" $ do
--              summary "give me some foo"
--              notes   "but only the good one"
--              returns (ref foo)
--              parameter Header "type" (string $ enum ["bar", "baz"]) $ do
--                  description "specifies the type of foo"
--                  optional
--              parameter Query "format" (string $ enum ["plain", "html"]) $
--                  description "output format"
--              parameter Query "size" (int32 $ min 1 . max 100 . def 10) $
--                  description "amount of foo"
--              produces "application/json"
--              produces "text/html"
--              response 200 "OK" (model foo)
--              response 400 "Bad Request" end
--          operation "POST" "foo" $ do
--              summary "something else"
--              deprecated
--   </pre>
module Data.Swagger.Build.Api

-- | Cf. <a>API Declaration</a>
data ApiDecl

-- | Cf. <a>API Object</a>
data API

-- | Cf. <a>Operation Object</a>
data Operation

-- | Cf. <a>Parameter Object</a>
data Parameter
data ParamType
Path :: ParamType
Query :: ParamType
Body :: ParamType
Header :: ParamType
Form :: ParamType

-- | Cf. <a>Response Message Object</a>
data Response

-- | Cf. <a>Model Object</a>
data Model

-- | Cf. <a>Property Object</a>
data Property
data DataType

-- | Cf. <a>Primitive Types</a>
data Primitive a
data Items a
int32 :: (Primitive Int32 -> Primitive Int32) -> DataType
int32' :: DataType
int64 :: (Primitive Int64 -> Primitive Int64) -> DataType
int64' :: DataType
float :: (Primitive Float -> Primitive Float) -> DataType
float' :: DataType
bool :: (Primitive Bool -> Primitive Bool) -> DataType
bool' :: DataType
double :: (Primitive Double -> Primitive Double) -> DataType
double' :: DataType
string :: (Primitive String -> Primitive String) -> DataType
string' :: DataType
bytes :: (Primitive String -> Primitive String) -> DataType
bytes' :: DataType
date :: (Primitive UTCTime -> Primitive UTCTime) -> DataType
date' :: DataType
dateTime :: (Primitive UTCTime -> Primitive UTCTime) -> DataType
dateTime' :: DataType

-- | Default value of some primitive type.
def :: a -> Primitive a -> Primitive a

-- | Enumerate valid values of some primitive type.
enum :: [a] -> Primitive a -> Primitive a

-- | Minimum value of some primitive type.
min :: a -> Primitive a -> Primitive a

-- | Maximum value of some primitive type.
max :: a -> Primitive a -> Primitive a
ref :: Model -> DataType
array :: DataType -> DataType

-- | Specify that array elements are unique.
unique :: DataType -> DataType
type ApiDeclSt = Common '["produces", "consumes", "models", "authorisations"] ApiDecl
type ApiDeclBuilder = State ApiDeclSt ()
type ApiSt = Common '["description"] API
type ApiBuilder = State ApiSt ()
type OperationSt = Common '["produces", "consumes", "authorisations"] Operation
type OperationBuilder = State OperationSt ()
type ParameterSt = Common '["description", "required"] Parameter
type ParameterBuilder = State ParameterSt ()
type ResponseSt = Common '["models"] Response
type ResponseBuilder = State ResponseSt ()
type ModelSt = Common '["description"] Model
type ModelBuilder = State ModelSt ()
type PropertySt = Common '["description", "required"] Property
type PropertyBuilder = State PropertySt ()

-- | Create an API declaration given a base URL, a swagger version, and
--   other API declaration values.
declare :: Text -> Text -> ApiDeclBuilder -> ApiDecl
apiVersion :: Text -> ApiDeclBuilder
resourcePath :: Text -> ApiDeclBuilder

-- | Add one API object to an API declaration given some path and other API
--   object values.
api :: Text -> ApiBuilder -> ApiDeclBuilder
model :: Elem "models" f => Model -> State (Common f a) ()

-- | Add one operation object to an API object given an HTTP method, a
--   nickname and other operation specific values.
operation :: Text -> Text -> OperationBuilder -> ApiBuilder
returns :: DataType -> OperationBuilder

-- | Add one parameter object to an operation object given the
--   <a>ParamType</a>, the parameter name and the actual data-type plus
--   some other parameter values.
parameter :: ParamType -> Text -> DataType -> ParameterBuilder -> OperationBuilder

-- | Like <a>parameter</a> but specific for file uploads.
file :: Text -> ParameterBuilder -> OperationBuilder

-- | Like <a>parameter</a> but specific for request body parameters. Sets
--   <a>ParamType</a> to <a>Body</a> and uses as name "body" which is the
--   only valid name for request bodies.
body :: DataType -> ParameterBuilder -> OperationBuilder
summary :: Text -> OperationBuilder
notes :: Text -> OperationBuilder

-- | Add one response message object to an operation given a status code
--   and some message plus response message specific values.
response :: Int -> Text -> ResponseBuilder -> OperationBuilder
produces :: Elem "produces" f => Text -> State (Common f a) ()
authorisation :: Elem "authorisations" f => Auth -> State (Common f a) ()
data Auth
Basic :: Auth
ApiKey :: Auth
OAuth2 :: Scope -> Auth
None :: Auth
multiple :: ParameterBuilder

-- | Construct a complex data-type (aka "Model") given some identifier and
--   model-specific values.
defineModel :: ModelId -> ModelBuilder -> Model

-- | Add a property to a model given a name, type and other propertu
--   values.
property :: PropertyName -> DataType -> PropertyBuilder -> ModelBuilder

-- | Specify a sub-typing relationship for a model by given a
--   "discriminator" property name and all sub-types.
children :: PropertyName -> [Model] -> ModelBuilder
description :: Elem "description" f => Text -> State (Common f a) ()
optional :: Elem "required" f => State (Common f a) ()
consumes :: Elem "consumes" f => Text -> State (Common f a) ()
deprecated :: OperationBuilder

-- | If cases where no build steps are provided but a builder is required
--   <a>end</a> can be used, e.g. <tt>defineModel "Foo" end</tt>
end :: Monad m => m ()
