@@ -1,14 +1,17 @@
11{-# LANGUAGE AllowAmbiguousTypes #-}
22{-# LANGUAGE CPP #-}
33{-# LANGUAGE DataKinds #-}
4+{-# LANGUAGE DefaultSignatures #-}
5+{-# LANGUAGE ExtendedDefaultRules #-}
46{-# LANGUAGE FlexibleContexts #-}
57{-# LANGUAGE FlexibleInstances #-}
8+{-# LANGUAGE FunctionalDependencies #-}
69{-# LANGUAGE GeneralizedNewtypeDeriving #-}
710{-# LANGUAGE InstanceSigs #-}
811{-# LANGUAGE MultiParamTypeClasses #-}
912{-# LANGUAGE OverloadedStrings #-}
1013{-# LANGUAGE PolyKinds #-}
11−{-# LANGUAGE Rank2Types #-}
14+{-# LANGUAGE RecordWildCards #-}
1215{-# LANGUAGE ScopedTypeVariables #-}
1316{-# LANGUAGE TupleSections #-}
1417{-# LANGUAGE TypeFamilies #-}
@@ -26,9 +29,7 @@
2629module Servant.Reflex
2730 ( client
2831 , clientWithOpts
29− , clientWithOptsAndResultHandler
3032 , clientWithRoute
31− , clientWithRouteAndResultHandler
3233 , BuildHeaderKeysTo(..)
3334 , toHeaders
3435 , HasClient
@@ -39,56 +40,56 @@ module Servant.Reflex
3940
4041------------------------------------------------------------------------------
4142import Control.Applicative
42−import qualified Data.CaseInsensitive as CI
43+import qualified Data.ByteString as BS
44+import qualified Data.ByteString.Lazy as BL
45+import Data.CaseInsensitive (mk)
4346import Data.Functor.Identity
44−import qualified Data.Map as Map
45−import Data.Monoid ((<>))
46−import Data.Proxy (Proxy (..))
47−import qualified Data.Set as Set
48−import Data.Text (Text)
49−import qualified Data.Text as T
50−import qualified Data.Text.Encoding as E
51−import GHC.Exts (Constraint)
52−import GHC.TypeLits (KnownSymbol, symbolVal)
53−import Servant.API ((:<|>) (..), (:>), BasicAuth,
54− BasicAuthData, BuildHeadersTo (..),
55− Capture, Header, Headers (..),
56− HttpVersion, IsSecure,
57− MimeRender (..), MimeUnrender,
58− NoContent, QueryFlag, QueryParam,
59− QueryParams, Raw, ReflectMethod (..),
60− RemoteHost, ReqBody,
61− ToHttpApiData (..), Vault, Verb,
62− contentType)
63−import Servant.API.Description (Summary)
64−import qualified Servant.Auth as Auth
65−
66−import Reflex.Dom.Core (Dynamic, Event, Reflex,
67− XhrRequest (..), XhrResponse (..),
68− XhrResponseHeaders (..),
69− attachPromptlyDynWith, constDyn, ffor,
70− fmapMaybe, leftmost,
71− performRequestsAsync)
47+import Data.Kind (Type)
48+import qualified Data.Map as Map
49+import Data.Monoid ((<>))
50+import Data.Proxy (Proxy (..))
51+import qualified Data.Set as Set
52+import Data.Text (Text)
53+import qualified Data.Text as T
54+import qualified Data.Text.Encoding as E
55+import qualified Data.Text.Lazy as TL
56+import GHC.Exts (Constraint)
57+import GHC.TypeLits (KnownSymbol, symbolVal)
58+import GHCJS.DOM.Types (Blob, Document, FormData)
59+import Servant.API ((:<|>) (..), (:>), Accept (..),
60+ BasicAuth, BasicAuthData,
61+ BuildHeadersTo (..), Capture,
62+ FormUrlEncoded, Header, Headers (..),
63+ HttpVersion, IsSecure, JSON,
64+ MimeRender (..), NoContent,
65+ OctetStream, PlainText, QueryFlag,
66+ QueryParam, QueryParams, Raw,
67+ ReflectMethod (..), RemoteHost,
68+ ReqBody, ToHttpApiData (..), Vault,
69+ Verb, contentType)
70+import qualified Servant.Auth as Auth
71+
72+import Reflex.Dom.Core (Dynamic, Event, IsXhrPayload, Reflex,
73+ XhrRequest (..), XhrResponse (..),
74+ XhrResponseHeaders (..),
75+ attachPromptlyDynWith, constDyn, ffor,
76+ fmapMaybe, leftmost,
77+ performRequestsAsync)
7278------------------------------------------------------------------------------
73−import Servant.Common.BaseUrl (BaseUrl(..), Scheme(..), baseUrlWidget,
74− showBaseUrl,
75− SupportsServantReflex)
76−import Servant.Common.Req (ClientOptions(..),
77− defaultClientOptions,
78− Req, ReqResult(..), QParam(..),
79− QueryPart(..), addHeader, authData,
80− defReq, evalResponse, prependToPathParts,
81− -- performRequestCT,
82− performRequestsCT,
83− -- performRequestNoBody,
84− performRequestsNoBody,
85− performSomeRequestsAsync,
86− qParamToQueryPart, reqBody,
87− reqSuccess, reqFailure,
88− reqMethod, respHeaders,
89− response,
90− reqTag,
91− qParams, withCredentials)
79+import Servant.Common.BaseUrl (BaseUrl (..), Scheme (..),
80+ SupportsServantReflex, baseUrlWidget,
81+ showBaseUrl)
82+import Servant.Common.Req (ClientOptions (..), MimeUnrender (..),
83+ QParam (..), QueryPart (..), Req (..),
84+ ReqResult (..), addHeader, authData,
85+ defReq, defaultClientOptions,
86+ evalResponse, performRequestsCT,
87+ performRequestsNoBody,
88+ performSomeRequestsAsync,
89+ prependToPathParts, qParamToQueryPart,
90+ qParams, reqBody, reqFailure,
91+ reqMethod, reqSuccess, reqTag,
92+ respHeaders, response, withCredentials)
9293
9394
9495-- * Accessing APIs as a Client
@@ -103,7 +104,7 @@ import Servant.Common.Req (ClientOptions(..),
103104-- >
104105-- > getAllBooks :: Event t l -> m (Event t (l, ReqResult [Book]))
105106-- > postNewBook :: Dynamic t (Maybe Book) -> Event t l
106−-- > -> m (Event t (l, ReqResult Book)))
107+-- -> m (Event t (l, ReqResult Book)))
107108-- > (getAllBooks :<|> postNewBook) = client myApi host
108109-- > where host = constDyn $ BaseUrl Http "localhost" 8080
109110client
@@ -125,53 +126,21 @@ clientWithOpts
125126 -> Client t m layout tag
126127clientWithOpts p q t baseurl = clientWithRoute p q t defReq baseurl
127128
128−-- | Like 'clientWithOpts' but allows passing a function which will process the
129−-- result event in some way. This can be used to handle errors in a uniform way
130−-- across call sites.
131−clientWithOptsAndResultHandler
132− :: (HasClient t m layout tag)
133− => Proxy layout
134− -> Proxy m
135− -> Proxy tag
136− -> Dynamic t BaseUrl
137− -> ClientOptions
138− -> (forall a. Event t (ReqResult tag a) -> m (Event t (ReqResult tag a)))
139− -> Client t m layout tag
140−clientWithOptsAndResultHandler p q t = clientWithRouteAndResultHandler p q t defReq
141−
142129
143130-- | This class lets us define how each API combinator
144131-- influences the creation of an HTTP request. It's mostly
145132-- an internal class, you can just use 'client'.
146−class Monad m => HasClient t m layout (tag :: *) where
147− type Client t m layout tag :: *
148− clientWithRoute
149− :: Proxy layout
150− -> Proxy m
151− -> Proxy tag
152− -> Req t
153− -> Dynamic t BaseUrl
154− -> ClientOptions
155− -> Client t m layout tag
156− clientWithRoute l m t r b o = clientWithRouteAndResultHandler l m t r b o return
157−
158− clientWithRouteAndResultHandler
159− :: Proxy layout
160− -> Proxy m
161− -> Proxy tag
162− -> Req t
163− -> Dynamic t BaseUrl
164− -> ClientOptions
165− -> (forall a. Event t (ReqResult tag a) -> m (Event t (ReqResult tag a)))
166− -> Client t m layout tag
133+class HasClient t m layout (tag :: Type) where
134+ type Client t m layout tag :: Type
135+ clientWithRoute :: Proxy layout -> Proxy m -> Proxy tag -> Req t -> Dynamic t BaseUrl -> ClientOptions -> Client t m layout tag
167136
168137
169138instance (HasClient t m a tag, HasClient t m b tag) => HasClient t m (a :<|> b) tag where
170139 type Client t m (a :<|> b) tag = Client t m a tag :<|> Client t m b tag
171140
172− clientWithRouteAndResultHandler Proxy q pTag req baseurl opts wrap =
173− clientWithRouteAndResultHandler (Proxy :: Proxy a) q pTag req baseurl opts wrap :<|>
174− clientWithRouteAndResultHandler (Proxy :: Proxy b) q pTag req baseurl opts wrap
141+ clientWithRoute Proxy q pTag req baseurl opts =
142+ clientWithRoute (Proxy :: Proxy a) q pTag req baseurl opts :<|>
143+ clientWithRoute (Proxy :: Proxy b) q pTag req baseurl opts
175144
176145
177146-- Capture. Example:
@@ -192,9 +161,11 @@ instance (SupportsServantReflex t m, ToHttpApiData a, HasClient t m sublayout ta
192161 type Client t m (Capture capture a :> sublayout) tag =
193162 Dynamic t (Either Text a) -> Client t m sublayout tag
194163
195− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap val =
196− clientWithRouteAndResultHandler
197− (Proxy :: Proxy sublayout) q t (prependToPathParts p req) baseurl opts wrap
164+ clientWithRoute Proxy q t req baseurl opts val =
165+ clientWithRoute (Proxy :: Proxy sublayout)
166+ q t
167+ (prependToPathParts p req)
168+ baseurl opts
198169 where p = (fmap . fmap) (toUrlPiece) val
199170
200171
@@ -207,8 +178,8 @@ instance {-# OVERLAPPABLE #-}
207178 Event t tag -> m (Event t (ReqResult tag a))
208179 -- TODO how to access input types here?
209180 -- ExceptT ServantError IO a
210− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs =
211− wrap =<< fmap runIdentity <$> performRequestsCT (Proxy :: Proxy ct) method (constDyn $ Identity $ req') baseurl opts trigs
181+ clientWithRoute Proxy _ _ req baseurl opts trigs =
182+ fmap runIdentity <$> performRequestsCT (Proxy :: Proxy ct) method (constDyn $ Identity $ req') baseurl opts trigs
212183 where method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
213184 req' = req { reqMethod = method }
214185
@@ -221,33 +192,29 @@ instance {-# OVERLAPPING #-}
221192 Event t tag -> m (Event t (ReqResult tag NoContent))
222193 -- TODO: how to access input types here?
223194 -- ExceptT ServantError IO NoContent
224− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs =
225− wrap =<< fmap runIdentity <$> performRequestsNoBody method (constDyn $ Identity req) baseurl opts trigs
195+ clientWithRoute Proxy _ _ req baseurl opts =
196+ (fmap . fmap) runIdentity . performRequestsNoBody method (constDyn $ Identity req) baseurl opts
226197 where method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
227198
228199
229200toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
230201toHeaders r =
231− let hdrs = maybe []
232− (\xhr -> fmap (\(h,v) -> (CI.map E.encodeUtf8 h, E.encodeUtf8 v))
202+ let toBS = E.encodeUtf8
203+ hdrs = maybe []
204+ (\xhr -> fmap (\(h,v) -> (mk (toBS h), toBS v))
233205 (Map.toList $ _xhrResponse_headers xhr))
234206 (response r)
235207 in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
236208
237−
238209class BuildHeaderKeysTo hs where
239− buildHeaderKeysTo :: Proxy hs -> [CI.CI T.Text]
210+ buildHeaderKeysTo :: Proxy hs -> [T.Text]
240211
241212instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
242213 where buildHeaderKeysTo _ = []
243214
244215instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
245216 => BuildHeaderKeysTo ((Header h v) ': xs) where
246− buildHeaderKeysTo _ =
247− let
248− thisKey = CI.mk $ T.pack (symbolVal (Proxy :: Proxy h))
249− in thisKey : buildHeaderKeysTo (Proxy :: Proxy xs)
250−
217+ buildHeaderKeysTo _ = T.pack (symbolVal (Proxy :: Proxy h)) : buildHeaderKeysTo (Proxy :: Proxy xs)
251218
252219-- HEADERS Verb (Content) --
253220-- Headers combinator not treated in fully general case,
@@ -262,10 +229,10 @@ instance {-# OVERLAPPABLE #-}
262229 ) => HasClient t m (Verb method status cts' (Headers ls a)) tag where
263230 type Client t m (Verb method status cts' (Headers ls a)) tag =
264231 Event t tag -> m (Event t (ReqResult tag (Headers ls a)))
265− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs = do
232+ clientWithRoute Proxy _ _ req baseurl opts trigs = do
266233 let method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
267234 resp <- fmap runIdentity <$> performRequestsCT (Proxy :: Proxy ct) method (constDyn $ Identity req') baseurl opts trigs
268− wrap $ toHeaders <$> resp
235+ return $ toHeaders <$> resp
269236 where req' = req { respHeaders =
270237 OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))
271238 }
@@ -278,10 +245,10 @@ instance {-# OVERLAPPABLE #-}
278245 ) => HasClient t m (Verb method status cts (Headers ls NoContent)) tag where
279246 type Client t m (Verb method status cts (Headers ls NoContent)) tag
280247 = Event t tag -> m (Event t (ReqResult tag (Headers ls NoContent)))
281− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs = do
248+ clientWithRoute Proxy _ _ req baseurl opts trigs = do
282249 let method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
283250 resp <- fmap runIdentity <$> performRequestsNoBody method (constDyn $ Identity req') baseurl opts trigs
284− wrap $ toHeaders <$> resp
251+ return $ toHeaders <$> resp
285252 where req' = req {respHeaders =
286253 OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))
287254 }
@@ -308,11 +275,11 @@ instance (KnownSymbol sym, ToHttpApiData a,
308275 type Client t m (Header sym a :> sublayout) tag =
309276 Dynamic t (Either Text a) -> Client t m sublayout tag
310277
311− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap eVal =
312− clientWithRouteAndResultHandler
313− (Proxy :: Proxy sublayout) q t
314− (Servant.Common.Req.addHeader hname eVal req)
315− baseurl opts wrap
278+ clientWithRoute Proxy q t req baseurl opts eVal =
279+ clientWithRoute (Proxy :: Proxy sublayout)
280+ q t
281+ (Servant.Common.Req.addHeader hname eVal req)
282+ baseurl opts
316283 where hname = T.pack $ symbolVal (Proxy :: Proxy sym)
317284
318285
@@ -326,21 +293,8 @@ instance HasClient t m sublayout tag
326293 type Client t m (HttpVersion :> sublayout) tag =
327294 Client t m sublayout tag
328295
329− clientWithRouteAndResultHandler Proxy =
330− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout)
331−
332−-- | Using a 'Summary' combinator in your API doesn't affect the client
333−-- functions.
334−instance (HasClient t m sublayout tag, KnownSymbol sym)
335− => HasClient t m (Summary sym :> sublayout) tag where
336−
337− type Client t m (Summary sym :> sublayout) tag =
338− Client t m sublayout tag
339−
340− clientWithRouteAndResultHandler Proxy =
341− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout)
342−
343−
296+ clientWithRoute Proxy q t =
297+ clientWithRoute (Proxy :: Proxy sublayout) q t
344298
345299
346300-- | If you use a 'QueryParam' in one of your endpoints in your API,
@@ -376,9 +330,9 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient t m sublayout tag, Reflex
376330 Dynamic t (QParam a) -> Client t m sublayout tag
377331
378332 -- if mparam = Nothing, we don't add it to the query string
379− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap mparam =
380− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t
381− (req {qParams = paramPair : qParams req}) baseurl opts wrap
333+ clientWithRoute Proxy q t req baseurl opts mparam =
334+ clientWithRoute (Proxy :: Proxy sublayout) q t
335+ (req {qParams = paramPair : qParams req}) baseurl opts
382336
383337 where pname = symbolVal (Proxy :: Proxy sym)
384338 --p prm = QueryPartParam $ (fmap . fmap) (toQueryParam) prm
@@ -422,8 +376,8 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient t m sublayout tag, Reflex
422376 type Client t m (QueryParams sym a :> sublayout) tag =
423377 Dynamic t [a] -> Client t m sublayout tag
424378
425− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap paramlist =
426− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t req' baseurl opts wrap
379+ clientWithRoute Proxy q t req baseurl opts paramlist =
380+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
427381
428382 where req' = req { qParams = (T.pack pname, params') : qParams req }
429383 pname = symbolVal (Proxy :: Proxy sym)
@@ -462,8 +416,8 @@ instance (KnownSymbol sym, HasClient t m sublayout tag, Reflex t)
462416 type Client t m (QueryFlag sym :> sublayout) tag =
463417 Dynamic t Bool -> Client t m sublayout tag
464418
465− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap flag =
466− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t req' baseurl opts wrap
419+ clientWithRoute Proxy q t req baseurl opts flag =
420+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
467421
468422 where req' = req { qParams = thisPair : qParams req }
469423 thisPair = (T.pack pName, QueryPartFlag flag) :: (Text, QueryPart t)
@@ -477,7 +431,7 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
477431 -> Event t tag
478432 -> m (Event t (ReqResult tag ()))
479433
480− clientWithRouteAndResultHandler _ _ _ _ baseurl _ wrap xhrs triggers = do
434+ clientWithRoute _ _ _ _ baseurl _ xhrs triggers = do
481435
482436 let xhrs' = liftA2 (\x path -> case x of
483437 Left e -> Left e
@@ -488,7 +442,7 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
488442 okReq = fmapMaybe (\(t,x) -> either (const Nothing) (Just . (t,)) x) xhrs'' :: Event t (tag, XhrRequest ())
489443
490444 resps <- performRequestsAsync okReq
491− wrap $ leftmost [ uncurry RequestFailure <$> badReq
445+ return $ leftmost [ uncurry RequestFailure <$> badReq
492446 , evalResponse (const $ Right ()) <$> resps
493447 ]
494448
@@ -513,30 +467,73 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
513467-- > where host = BaseUrl Http "localhost" 8080
514468-- > -- then you can just use "addBook" to query that endpoint
515469
516−instance (MimeRender ct a, HasClient t m sublayout tag, Reflex t)
517− => HasClient t m (ReqBody (ct ': cts) a :> sublayout) tag where
470+instance (GHCJS'MimeRender ct a, IsXhrPayload (ToSend ct a), Show (ToSend ct a),
471+ HasClient t m sublayout tag, Reflex t)
472+ => HasClient t m (ReqBody (ct ': cts) (a :: Type) :> sublayout) tag where
518473
519474 type Client t m (ReqBody (ct ': cts) a :> sublayout) tag =
520− Dynamic t (Either Text a) -> Client t m sublayout tag
475+ Dynamic t (Either Text (ToConvert ct a)) -> Client t m sublayout tag
521476
522− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap body =
523− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t req' baseurl opts wrap
524− where req' = req { reqBody = bodyBytesCT }
477+ clientWithRoute Proxy q t Req{..} baseurl opts body =
478+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
479+ where req' = Req { reqBody = Just $ (fmap . fmap)
480+ (\b -> (ghcjsMimeRender ctProxy atProxy b, ctString)) body
481+ , ..}
525482 ctProxy = Proxy :: Proxy ct
483+ atProxy = Proxy :: Proxy a
526484 ctString = T.pack $ show $ contentType ctProxy
527− bodyBytesCT = Just $ (fmap . fmap)
528− (\b -> (mimeRender ctProxy b, ctString))
529− body
530485
486+class Accept ctype => GHCJS'MimeRender (ctype :: Type) (a :: Type) where
487+ type ToConvert ctype a :: Type
488+ type ToConvert ctype a = a
489+
490+ type ToSend ctype a :: Type
491+ type ToSend ctype a = BS.ByteString
531492
493+ ghcjsMimeRender
494+ :: IsXhrPayload (ToSend ctype a)
495+ => Proxy ctype -> Proxy a -> ToConvert ctype a -> ToSend ctype a
496+ default ghcjsMimeRender
497+ :: (IsXhrPayload (ToSend ctype a), MimeRender ctype a,
498+ MimeRender ctype (ToConvert ctype a), ToSend ctype a ~ BS.ByteString)
499+ => Proxy ctype -> Proxy a -> ToConvert ctype a -> ToSend ctype a
500+ ghcjsMimeRender ctype _ = BL.toStrict . mimeRender ctype
501+
502+instance MimeRender JSON x => GHCJS'MimeRender JSON x
503+
504+instance MimeRender FormUrlEncoded x => GHCJS'MimeRender FormUrlEncoded x
505+
506+instance GHCJS'MimeRender OctetStream BL.ByteString where
507+ type ToConvert OctetStream BL.ByteString = Blob
508+ type ToSend OctetStream BL.ByteString = Blob
509+ ghcjsMimeRender _ _ = id
510+
511+instance GHCJS'MimeRender PlainText String where
512+ type ToSend PlainText String = Text
513+ ghcjsMimeRender _ _ = T.pack
514+
515+instance GHCJS'MimeRender PlainText Text where
516+ type ToSend PlainText Text = Text
517+ ghcjsMimeRender _ _ = id
518+
519+instance GHCJS'MimeRender PlainText TL.Text where
520+ type ToSend PlainText TL.Text = Text
521+ ghcjsMimeRender _ _ = TL.toStrict
522+
523+instance GHCJS'MimeRender PlainText BL.ByteString where
524+ type ToSend PlainText BL.ByteString = BS.ByteString
525+ ghcjsMimeRender _ _ = BL.toStrict
526+
527+instance GHCJS'MimeRender PlainText BS.ByteString where
528+ ghcjsMimeRender _ _ = id
532529
533530-- | Make the querying function append @path@ to the request path.
534531instance (KnownSymbol path, HasClient t m sublayout tag, Reflex t) => HasClient t m (path :> sublayout) tag where
535532 type Client t m (path :> sublayout) tag = Client t m sublayout tag
536533
537− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap =
538− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t
539− (prependToPathParts (pure (Right $ T.pack p)) req) baseurl opts wrap
534+ clientWithRoute Proxy q t req baseurl opts =
535+ clientWithRoute (Proxy :: Proxy sublayout) q t
536+ (prependToPathParts (pure (Right $ T.pack p)) req) baseurl opts
540537
541538 where p = symbolVal (Proxy :: Proxy path)
542539
@@ -544,23 +541,23 @@ instance (KnownSymbol path, HasClient t m sublayout tag, Reflex t) => HasClient
544541instance HasClient t m api tag => HasClient t m (Vault :> api) tag where
545542 type Client t m (Vault :> api) tag = Client t m api tag
546543
547− clientWithRouteAndResultHandler Proxy =
548− clientWithRouteAndResultHandler (Proxy :: Proxy api)
544+ clientWithRoute Proxy q t req baseurl =
545+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
549546
550547
551548instance HasClient t m api tag => HasClient t m (RemoteHost :> api) tag where
552549 type Client t m (RemoteHost :> api) tag = Client t m api tag
553550
554− clientWithRouteAndResultHandler Proxy =
555− clientWithRouteAndResultHandler (Proxy :: Proxy api)
551+ clientWithRoute Proxy q t req baseurl =
552+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
556553
557554
558555
559556instance HasClient t m api tag => HasClient t m (IsSecure :> api) tag where
560557 type Client t m (IsSecure :> api) tag = Client t m api tag
561558
562− clientWithRouteAndResultHandler Proxy =
563− clientWithRouteAndResultHandler (Proxy :: Proxy api)
559+ clientWithRoute Proxy q t req baseurl =
560+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
564561
565562
566563instance (HasClient t m api tag, Reflex t)
@@ -569,8 +566,8 @@ instance (HasClient t m api tag, Reflex t)
569566 type Client t m (BasicAuth realm usr :> api) tag = Dynamic t (Maybe BasicAuthData)
570567 -> Client t m api tag
571568
572− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap authdata =
573− clientWithRouteAndResultHandler (Proxy :: Proxy api) q t req' baseurl opts wrap
569+ clientWithRoute Proxy q t req baseurl opts authdata =
570+ clientWithRoute (Proxy :: Proxy api) q t req' baseurl opts
574571 where
575572 req' = req { authData = Just authdata }
576573
@@ -613,7 +610,7 @@ for empty and one for non-empty lists).
613610instance (HasCookieAuth auths, HasClient t m api tag) => HasClient t m (Auth.Auth auths a :> api) tag where
614611
615612 type Client t m (Auth.Auth auths a :> api) tag = Client t m api tag
616− clientWithRouteAndResultHandler Proxy = clientWithRouteAndResultHandler (Proxy :: Proxy api)
613+ clientWithRoute Proxy = clientWithRoute (Proxy :: Proxy api)
617614
618615
619616type family HasCookieAuth xs :: Constraint where
@@ -622,4 +619,3 @@ type family HasCookieAuth xs :: Constraint where
622619 HasCookieAuth '[] = CookieAuthNotEnabled
623620
624621class CookieAuthNotEnabled
625−