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


-- | Automatically derive Elm functions to query servant webservices.
--   
--   Please see README.md
@package servant-elm
@version 0.4.0.1

module Servant.Elm.Internal.Foreign
data LangElm
getEndpoints :: (HasForeign LangElm ElmDatatype api, GenerateList ElmDatatype (Foreign ElmDatatype api)) => Proxy api -> [Req ElmDatatype]
instance Elm.Type.ElmType a => Servant.Foreign.Internal.HasForeignType Servant.Elm.Internal.Foreign.LangElm Elm.Type.ElmDatatype a

module Servant.Elm.Internal.Orphans
instance Elm.Type.ElmType Elm.Type.ElmDatatype
instance Elm.Type.ElmType Servant.API.ContentTypes.NoContent

module Servant.Elm.Internal.Generate

-- | Options to configure how code is generated.
data ElmOptions
ElmOptions :: UrlPrefix -> Options -> [ElmDatatype] -> [ElmDatatype] -> ElmOptions

-- | The protocol, host and any path prefix to be used as the base for all
--   requests.
--   
--   Example: <tt>Static "<a>https://mydomain.com/api/v1"</a></tt>
--   
--   When <tt>Dynamic</tt>, the generated Elm functions take the base URL
--   as the first argument.
[urlPrefix] :: ElmOptions -> UrlPrefix

-- | Options to pass to elm-export
[elmExportOptions] :: ElmOptions -> Options

-- | Types that represent an empty Http response.
[emptyResponseElmTypes] :: ElmOptions -> [ElmDatatype]

-- | Types that represent a String.
[stringElmTypes] :: ElmOptions -> [ElmDatatype]
data UrlPrefix
Static :: Text -> UrlPrefix
Dynamic :: UrlPrefix

-- | Default options for generating Elm code.
--   
--   The default options are:
--   
--   <pre>
--   { urlPrefix =
--       Static ""
--   , elmExportOptions =
--       Elm.defaultOptions
--   , emptyResponseElmTypes =
--       [ toElmType NoContent ]
--   , stringElmTypes =
--       [ toElmType "" ]
--   }
--   </pre>
defElmOptions :: ElmOptions

-- | Default imports required by generated Elm code.
--   
--   You probably want to include this at the top of your generated Elm
--   module.
--   
--   The default required imports are:
--   
--   <pre>
--   import Json.Decode exposing (..)
--   import Json.Decode.Pipeline exposing (..)
--   import Json.Encode
--   import Http
--   import String
--   </pre>
defElmImports :: Text

-- | Generate Elm code for the API with default options.
--   
--   Returns a list of Elm functions to query your Servant API from Elm.
--   
--   You could spit these out to a file and call them from your Elm code,
--   but you would be better off creating a <tt>Spec</tt> with the result
--   and using <tt>specsToDir</tt>, which handles the module name for you.
generateElmForAPI :: (HasForeign LangElm ElmDatatype api, GenerateList ElmDatatype (Foreign ElmDatatype api)) => Proxy api -> [Text]

-- | Generate Elm code for the API with custom options.
generateElmForAPIWith :: (HasForeign LangElm ElmDatatype api, GenerateList ElmDatatype (Foreign ElmDatatype api)) => ElmOptions -> Proxy api -> [Text]
i :: Int

-- | Generate an Elm function for one endpoint.
generateElmForRequest :: ElmOptions -> Req ElmDatatype -> Doc
mkTypeSignature :: ElmOptions -> Req ElmDatatype -> Doc
elmHeaderArg :: HeaderArg ElmDatatype -> Doc
elmCaptureArg :: Segment ElmDatatype -> Doc
elmQueryArg :: QueryArg ElmDatatype -> Doc
elmBodyArg :: Doc
mkArgs :: ElmOptions -> Req ElmDatatype -> Doc
mkLetParams :: ElmOptions -> Req ElmDatatype -> Maybe Doc
mkRequest :: ElmOptions -> Req ElmDatatype -> Doc
mkUrl :: ElmOptions -> [Segment ElmDatatype] -> Doc
mkQueryParams :: Req ElmDatatype -> Doc

-- | Determines whether we construct an Elm function that expects an empty
--   response body.
isEmptyType :: ElmOptions -> ElmDatatype -> Bool

-- | Determines whether we call <tt>toString</tt> on URL captures and query
--   params of this type in Elm.
isElmStringType :: ElmOptions -> ElmDatatype -> Bool
docToText :: Doc -> Text
stext :: Text -> Doc
elmRecord :: [Doc] -> Doc
elmList :: [Doc] -> Doc


-- | Basic usage:
--   
--   <pre>
--   import MyLib (MyServantApiType)
--   import Servant.Elm
--   
--   spec :: Spec
--   spec = Spec ["Generated", "MyApi"]
--               (defElmImports : generateElmForAPI (Proxy :: Proxy MyServantApiType))
--   
--   main :: IO ()
--   main = specsToDir [spec] "my-elm-dir"
--   </pre>
module Servant.Elm

-- | Generate Elm code for the API with default options.
--   
--   Returns a list of Elm functions to query your Servant API from Elm.
--   
--   You could spit these out to a file and call them from your Elm code,
--   but you would be better off creating a <tt>Spec</tt> with the result
--   and using <tt>specsToDir</tt>, which handles the module name for you.
generateElmForAPI :: (HasForeign LangElm ElmDatatype api, GenerateList ElmDatatype (Foreign ElmDatatype api)) => Proxy api -> [Text]

-- | Generate Elm code for the API with custom options.
generateElmForAPIWith :: (HasForeign LangElm ElmDatatype api, GenerateList ElmDatatype (Foreign ElmDatatype api)) => ElmOptions -> Proxy api -> [Text]

-- | Options to configure how code is generated.
data ElmOptions
ElmOptions :: UrlPrefix -> Options -> [ElmDatatype] -> [ElmDatatype] -> ElmOptions

-- | The protocol, host and any path prefix to be used as the base for all
--   requests.
--   
--   Example: <tt>Static "<a>https://mydomain.com/api/v1"</a></tt>
--   
--   When <tt>Dynamic</tt>, the generated Elm functions take the base URL
--   as the first argument.
[urlPrefix] :: ElmOptions -> UrlPrefix

-- | Options to pass to elm-export
[elmExportOptions] :: ElmOptions -> Options

-- | Types that represent an empty Http response.
[emptyResponseElmTypes] :: ElmOptions -> [ElmDatatype]

-- | Types that represent a String.
[stringElmTypes] :: ElmOptions -> [ElmDatatype]
data UrlPrefix
Static :: Text -> UrlPrefix
Dynamic :: UrlPrefix

-- | Default options for generating Elm code.
--   
--   The default options are:
--   
--   <pre>
--   { urlPrefix =
--       Static ""
--   , elmExportOptions =
--       Elm.defaultOptions
--   , emptyResponseElmTypes =
--       [ toElmType NoContent ]
--   , stringElmTypes =
--       [ toElmType "" ]
--   }
--   </pre>
defElmOptions :: ElmOptions

-- | Default imports required by generated Elm code.
--   
--   You probably want to include this at the top of your generated Elm
--   module.
--   
--   The default required imports are:
--   
--   <pre>
--   import Json.Decode exposing (..)
--   import Json.Decode.Pipeline exposing (..)
--   import Json.Encode
--   import Http
--   import String
--   </pre>
defElmImports :: Text
data Spec :: *
Spec :: [Text] -> [Text] -> Spec
class ElmType a
specsToDir :: [Spec] -> FilePath -> IO ()

-- | A concrete, poly-kinded proxy type
data Proxy k (t :: k) :: forall k. () => k -> *
Proxy :: Proxy k
