json-spec-elm-servant-0.4.0.1: Generated elm code for servant APIs.
Safe HaskellNone
LanguageHaskell2010

Data.JsonSpec.Elm.Servant

Synopsis

Generating Elm Clients

servantDefs :: forall {k} (api :: k). Elmable api => Proxy api -> Set Definition Source #

This function will traverse the api type, generating elm definitions for: * Http requests for each endpoint, including encoders and decoders for anonymous elm types. * Named Elm types (i.e. Any Specification that is bound to a name using JsonLet * Decoders and Encoders for named elm types.

Extensions

The symbols in this section are mainly exposed in case you are using some extensions to the standard servant types and need to build some companion extensions to generate proper Elm types for them. For most normal usage you will probably just use servantDefs.

class Elmable (e :: k) where Source #

Class of servant APIs for which Elm client code can be generated.

Methods

endpoints :: [Param] -> Definitions () Source #

Collect all the Elm definitions needed to implement a client for the API. This is called recursively on our walk down the API tree, and the [Param] argument contains all the request parameters (like Capture, ReqBody', etc) that have been encountered so far on whatever particular branch . It will start out empty at the API root.

Instances

Instances details
Elmable (ToServantApi api) => Elmable (NamedRoutes api :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

(Elmable a, Elmable b) => Elmable (a :<|> b :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

ReflectMethod method => Elmable (NoContentVerb method :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

(IsParam a, Elmable b) => Elmable (a :> b :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

Elmable (NoContentVerb m) => Elmable (Verb m c t NoContent :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

Elmable (Verb m c t r) => Elmable (Verb m c t (Headers h r) :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

(HasType (EncodingSpec response), ReflectMethod method) => Elmable (Verb method code types response :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

endpoints :: [Param] -> Definitions () Source #

class IsParam (a :: k) where Source #

Obtain a value-level request parameter type from the type-level servant parameter type.

Instances

Instances details
KnownSymbol segment => IsParam (segment :: Symbol) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

KnownSymbol name => IsParam (Capture name tpy :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

KnownSymbol name => IsParam (Header' (Optional ': mods) name a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

KnownSymbol name => IsParam (Header' (Required ': mods) name a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

IsParam (Header' mods name a) => IsParam (Header' (other ': mods) name a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

KnownSymbol name => IsParam (QueryParam' (Optional ': more) name typ :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

KnownSymbol name => IsParam (QueryParam' (Required ': more) name typ :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

IsParam (QueryParam' more name typ) => IsParam (QueryParam' (other ': more) name typ :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

HasType (DecodingSpec a) => IsParam (ReqBody' (Required ': mods) (JSON ': accept) a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

IsParam (ReqBody' mods '[JSON] a) => IsParam (ReqBody' (other ': mods) (JSON ': accept) a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

IsParam (ReqBody' mods accept a) => IsParam (ReqBody' mods (other ': accept) a :: Type) Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

data Param Source #

Instances

Instances details
Eq Param Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

(==) :: Param -> Param -> Bool #

(/=) :: Param -> Param -> Bool #

data PathParam Source #

Constructors

Static Text 
Capture Text 

Instances

Instances details
Eq PathParam Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

data HeaderParam Source #

Instances

Instances details
Eq HeaderParam Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

data QP Source #

Instances

Instances details
Eq QP Source # 
Instance details

Defined in Data.JsonSpec.Elm.Servant

Methods

(==) :: QP -> QP -> Bool #

(/=) :: QP -> QP -> Bool #