@@ -34,12 +34,15 @@ import Language.Haskell.Exts.SrcLoc
34import Language.Haskell.Exts.Syntax hiding (Alt, Int, Lit)
34import Language.Haskell.Exts.Syntax hiding (Alt, Int, Lit)
36urlSig :: Name -> Decl
36urlSig :: Name -> Decl
37−urlSig n = TypeSig noLoc [n] (TyCon "BaseUrl")
37+urlSig n = TypeSig noLoc [n] (TyCon "RequestBuilder")
39−urlDecl :: Name -> String -> Text -> Integer -> Decl
39+urlDecl :: Service a -> Name -> Decl
40−urlDecl n s u p = sfun noLoc n [] (UnGuardedRhs rhs) noBinds
40+urlDecl s n = sfun noLoc n [] (UnGuardedRhs rhs) noBinds
42− rhs = appFun (var "BaseUrl") [var (name s), str u, intE p]
42+ rhs = appFun (var "defaultRequest")
43+ [ str (s ^. dRootUrl)
44+ , str (s ^. dServicePath)
44 -- type API = :<|> ...
47 -- type API = :<|> ...
45apiAlias :: Name -> [Name] -> Decl
48apiAlias :: Name -> [Name] -> Decl
@@ -183,23 +186,21 @@ googleRequestDecl g n assoc alt p api url fields m pat prec =
183 InstDecl noLoc Nothing [] [] (unqual "GoogleRequest") [n]
186 InstDecl noLoc Nothing [] [] (unqual "GoogleRequest") [n]
185 , request
188 , request
186− , requestWithRoute
189+ , requestWith
189− request = funD "request" $
192+ request = funD "request" $ app (var "requestWith") (var url)
190− appFun (var "requestWithRoute") [var "defReq", var url]
192− requestWithRoute = InsDecl (FunBind [match])
194+ requestWith = InsDecl (FunBind [match])
194− match = Match noLoc (name "requestWithRoute") pats Nothing rhs decls
196+ match = Match noLoc (name "requestWith") pats Nothing rhs decls
196 decls = BDecls
198 decls = BDecls
197 [ patBind noLoc pat $
199 [ patBind noLoc pat $
198− appFun (var "clientWithRoute") $
200+ appFun (var "clientBuild") $
199 [ ExpTypeSig noLoc (var "Proxy") $
201 [ ExpTypeSig noLoc (var "Proxy") $
200 TyApp (TyCon "Proxy") (TyCon (UnQual api))
202 TyApp (TyCon "Proxy") (TyCon (UnQual api))
201− , var "r"
203+ , var "rq"
@@ -237,7 +238,7 @@ googleRequestDecl g n assoc alt p api url fields m pat prec =
238 $ map fst (rights (extractPath (_mPath m))) ++ _mParameterOrder m
239 $ map fst (rights (extractPath (_mPath m))) ++ _mParameterOrder m
240− pats = [pvar "r", pvar "u", prec]
241+ pats = [pvar "rq", prec]
242authDecl :: Global -> Prefix -> [Local] -> Decl
243authDecl :: Global -> Prefix -> [Local] -> Decl
243authDecl g p fs = InstDecl noLoc Nothing [] [] (unqual "GoogleAuth") [tycon g]
244authDecl g p fs = InstDecl noLoc Nothing [] [] (unqual "GoogleAuth") [tycon g]