@@ -110,7 +110,7 @@ module Servant.JS
110 , -- * Misc.
110 , -- * Misc.
111 listFromAPI
111 listFromAPI
112 , javascript
112 , javascript
113− , LangJS
113+ , NoTypes
114 , GenerateList(..)
114 , GenerateList(..)
@@ -123,37 +123,30 @@ import Servant.JS.Axios
123import Servant.JS.Internal
123import Servant.JS.Internal
124import Servant.JS.JQuery
124import Servant.JS.JQuery
125import Servant.JS.Vanilla
125import Servant.JS.Vanilla
126−import Servant.Foreign (GenerateList(..), listFromAPI)
126+import Servant.Foreign (GenerateList(..), listFromAPI, NoTypes)
128−-- Dummy type specifying target language
131-- | Generate the data necessary to generate javascript code
128-- | Generate the data necessary to generate javascript code
132-- for all the endpoints of an API, as ':<|>'-separated values
129-- for all the endpoints of an API, as ':<|>'-separated values
133-- of type 'AjaxReq'.
130-- of type 'AjaxReq'.
134−javascript :: HasForeign LangJS layout => Proxy layout -> Foreign layout
131+javascript :: HasForeign NoTypes layout => Proxy layout -> Foreign layout
135−javascript p = foreignFor (Proxy :: Proxy LangJS) p defReq
132+javascript p = foreignFor (Proxy :: Proxy NoTypes) p defReq
137-- | Directly generate all the javascript functions for your API
134-- | Directly generate all the javascript functions for your API
138-- from a 'Proxy' for your API type. You can then write it to
135-- from a 'Proxy' for your API type. You can then write it to
139-- a file or integrate it in a page, for example.
136-- a file or integrate it in a page, for example.
140−jsForAPI :: (HasForeign LangJS api, GenerateList (Foreign api))
137+jsForAPI :: (HasForeign NoTypes api, GenerateList (Foreign api))
141 => Proxy api -- ^ proxy for your API type
138 => Proxy api -- ^ proxy for your API type
142 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
139 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
143 -> Text -- ^ a text that you can embed in your pages or write to a file
140 -> Text -- ^ a text that you can embed in your pages or write to a file
144−jsForAPI p gen = gen (listFromAPI (Proxy :: Proxy LangJS) p)
141+jsForAPI p gen = gen (listFromAPI (Proxy :: Proxy NoTypes) p)
146-- | Directly generate all the javascript functions for your API
143-- | Directly generate all the javascript functions for your API
147-- from a 'Proxy' for your API type using the given generator
144-- from a 'Proxy' for your API type using the given generator
148-- and write the resulting code to a file at the given path.
145-- and write the resulting code to a file at the given path.
149−writeJSForAPI :: (HasForeign LangJS api, GenerateList (Foreign api))
146+writeJSForAPI :: (HasForeign NoTypes api, GenerateList (Foreign api))
150 => Proxy api -- ^ proxy for your API type
147 => Proxy api -- ^ proxy for your API type
151 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
148 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
152 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
149 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
154writeJSForAPI p gen fp = writeFile fp (jsForAPI p gen)
151writeJSForAPI p gen fp = writeFile fp (jsForAPI p gen)
156−-- A catch all instance since JavaScript has no types.
157−instance HasForeignType LangJS a where