-- 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 -- https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md @package swagger @version 0.3.0 -- | The Authorisation Object part of the swagger specification. For -- construction please consider using -- Data.Swagger.Build.Authorisation. module Data.Swagger.Model.Authorisation -- | Cf. Authorization Object 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. Scope Object data Scope Scope :: Text -> Maybe Text -> Scope [scope] :: Scope -> Text [description] :: Scope -> Maybe Text -- | Cf. Grant Types Object data GrantTypes GrantTypes :: Maybe ImplicitGrant -> Maybe AuthCode -> GrantTypes [implicit] :: GrantTypes -> Maybe ImplicitGrant [authCode] :: GrantTypes -> Maybe AuthCode -- | Cf. Implicit Object data ImplicitGrant ImplicitGrant :: LoginEndpoint -> Maybe Text -> ImplicitGrant [loginEndpoint] :: ImplicitGrant -> LoginEndpoint [tokenName] :: ImplicitGrant -> Maybe Text newtype LoginEndpoint LoginEndpoint :: Text -> LoginEndpoint [loginUrl] :: LoginEndpoint -> Text -- | Cf. Authorization Code Object data AuthCode AuthCode :: TokenRequestEndpoint -> TokenEndpoint -> AuthCode [tokenRequestEndpoint] :: AuthCode -> TokenRequestEndpoint [tokenEndpoint] :: AuthCode -> TokenEndpoint -- | Cf. Token Request Endpoint Object data TokenRequestEndpoint TokenRequestEndpoint :: Text -> Maybe Text -> Maybe Text -> TokenRequestEndpoint [tokenRequestUrl] :: TokenRequestEndpoint -> Text [clientIdName] :: TokenRequestEndpoint -> Maybe Text [clientSecretName] :: TokenRequestEndpoint -> Maybe Text -- | Cf. Token Endpoint Object 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.PassMethod instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.Scope instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.GrantTypes instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.ImplicitGrant instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.AuthCode instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.LoginEndpoint instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.TokenRequestEndpoint instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Authorisation.TokenEndpoint -- | The Resource Listing part of the swagger specification. For -- construction please consider using Data.Swagger.Build.Resource. module Data.Swagger.Model.Resource -- | Cf. Resource Listing Object 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. Resource Object data Resource Resource :: Text -> Maybe Text -> Resource [path] :: Resource -> Text [description] :: Resource -> Maybe Text -- | Cf. Info Object 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.Resource instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Resource.Info -- | The API Declaration part of the swagger specification. For -- construction please consider using Data.Swagger.Build.Api. module Data.Swagger.Model.Api -- | Cf. API Declaration 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. API Object data API API :: Text -> [Operation] -> Maybe Text -> API [path] :: API -> Text [operations] :: API -> [Operation] [apiDescription] :: API -> Maybe Text -- | Cf. Operation Object 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. Parameter Object 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. Response Message Object data Response Response :: Int -> Text -> Maybe ModelId -> Response [code] :: Response -> Int [message] :: Response -> Text [responseModel] :: Response -> Maybe ModelId -- | Cf. Model Object 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. Property Object 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. Primitive Types 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.ParamType instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Response instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Model instance Data.Aeson.Types.ToJSON.ToJSON Data.Swagger.Model.Api.Property 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 -- end can be used, e.g. defineModel "Foo" end 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 -- end can be used, e.g. defineModel "Foo" end 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 Data.Swagger.Model.Api values. For example: -- --
--   declare "http://petstore.swagger.wordnik.com/api" "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
--   
module Data.Swagger.Build.Api -- | Cf. API Declaration data ApiDecl -- | Cf. API Object data API -- | Cf. Operation Object data Operation -- | Cf. Parameter Object data Parameter data ParamType Path :: ParamType Query :: ParamType Body :: ParamType Header :: ParamType Form :: ParamType -- | Cf. Response Message Object data Response -- | Cf. Model Object data Model -- | Cf. Property Object data Property data DataType -- | Cf. Primitive Types 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 -- ParamType, the parameter name and the actual data-type plus -- some other parameter values. parameter :: ParamType -> Text -> DataType -> ParameterBuilder -> OperationBuilder -- | Like parameter but specific for file uploads. file :: Text -> ParameterBuilder -> OperationBuilder -- | Like parameter but specific for request body parameters. Sets -- ParamType to Body 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 -- end can be used, e.g. defineModel "Foo" end end :: Monad m => m ()