@@ -1,17 +1,18 @@
1−module Servant.JQuery.Angular where
1+module Servant.JS.Angular where
3−import Servant.JQuery.Internal
3+import Servant.JS.Internal
4import Control.Lens
4import Control.Lens
5import Data.List
5import Data.List
6import Data.Monoid
6import Data.Monoid
8data AngularOptions = AngularOptions
8data AngularOptions = AngularOptions
9 { serviceName :: String -- ^ When generating code with wrapInService,
9 { serviceName :: String -- ^ When generating code with wrapInService,
10− -- ^ name of the service to generate
10+ -- name of the service to generate
11 , prologue :: String -> String -> String -- ^ beginning of the service definition
11 , prologue :: String -> String -> String -- ^ beginning of the service definition
12 , epilogue :: String -- ^ end of the service definition
12 , epilogue :: String -- ^ end of the service definition
15+-- | Default options for the Angular codegen. Used by 'wrapInService'.
15defAngularOptions :: AngularOptions
16defAngularOptions :: AngularOptions
16defAngularOptions = AngularOptions
17defAngularOptions = AngularOptions
17 { serviceName = ""
18 { serviceName = ""
@@ -21,8 +22,8 @@ defAngularOptions = AngularOptions
23-- | Instead of simply generating top level functions, generates a service instance
24-- | Instead of simply generating top level functions, generates a service instance
24−-- on which your controllers can depend to access your API
25+-- on which your controllers can depend to access your API.
25−-- This variant uses default AngularOptions
26+-- This variant uses default 'AngularOptions'.
26wrapInService :: AngularOptions -> [AjaxReq] -> String
27wrapInService :: AngularOptions -> [AjaxReq] -> String
27wrapInService ngOpts reqs = wrapInServiceWith ngOpts defCommonGeneratorOptions reqs
28wrapInService ngOpts reqs = wrapInServiceWith ngOpts defCommonGeneratorOptions reqs