@@ -1,14 +1,18 @@
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 #-}
11+{-# LANGUAGE LambdaCase #-}
812{-# LANGUAGE MultiParamTypeClasses #-}
913{-# LANGUAGE OverloadedStrings #-}
1014{-# LANGUAGE PolyKinds #-}
11−{-# LANGUAGE Rank2Types #-}
15+{-# LANGUAGE RecordWildCards #-}
1216{-# LANGUAGE ScopedTypeVariables #-}
1317{-# LANGUAGE TupleSections #-}
1418{-# LANGUAGE TypeFamilies #-}
@@ -26,10 +30,9 @@
2630module Servant.Reflex
2731 ( client
2832 , clientWithOpts
29− , clientWithOptsAndResultHandler
3033 , clientWithRoute
31− , clientWithRouteAndResultHandler
3234 , BuildHeaderKeysTo(..)
35+ , GHCJS'MimeRender(..)
3336 , toHeaders
3437 , HasClient
3538 , Client
@@ -39,56 +42,56 @@ module Servant.Reflex
3942
4043------------------------------------------------------------------------------
4144import Control.Applicative
42−import qualified Data.CaseInsensitive as CI
45+import qualified Data.ByteString as BS
46+import qualified Data.ByteString.Lazy as BL
47+import Data.CaseInsensitive (mk)
4348import 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)
49+import Data.Kind (Type)
50+import qualified Data.Map as Map
51+import Data.Monoid ((<>))
52+import Data.Proxy (Proxy (..))
53+import qualified Data.Set as Set
54+import Data.Text (Text)
55+import qualified Data.Text as T
56+import qualified Data.Text.Encoding as E
57+import qualified Data.Text.Lazy as TL
58+import GHC.Exts (Constraint)
59+import GHC.TypeLits (KnownSymbol, symbolVal)
60+import GHCJS.DOM.Types (Blob)
61+import Servant.API ((:<|>) (..), (:>), Accept (..),
62+ BasicAuth, BasicAuthData,
63+ BuildHeadersTo (..), Capture,
64+ FormUrlEncoded, Header, Headers (..),
65+ HttpVersion, IsSecure, JSON,
66+ MimeRender (..), NoContent,
67+ OctetStream, PlainText, QueryFlag,
68+ QueryParam, QueryParams, Raw,
69+ ReflectMethod (..), RemoteHost,
70+ ReqBody, ToHttpApiData (..), Vault,
71+ Verb, contentType)
72+import qualified Servant.Auth as Auth
73+
74+import Reflex.Dom.Core (Dynamic, Event, IsXhrPayload, Reflex,
75+ XhrRequest (..), XhrResponse (..),
76+ XhrResponseHeaders (..),
77+ attachPromptlyDynWith, constDyn, ffor,
78+ fmapMaybe, leftmost,
79+ performRequestsAsync)
7280------------------------------------------------------------------------------
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)
81+import Servant.Common.BaseUrl (BaseUrl (..), Scheme (..),
82+ SupportsServantReflex, baseUrlWidget,
83+ showBaseUrl)
84+import Servant.Common.Req (ClientOptions (..), MimeUnrender (..),
85+ QParam (..), QueryPart (..), Req (..),
86+ ReqResult (..), addHeader, authData,
87+ defReq, defaultClientOptions,
88+ evalResponse, performRequestsCT,
89+ performRequestsNoBody,
90+ performSomeRequestsAsync,
91+ prependToPathParts, qParamToQueryPart,
92+ qParams, reqBody, reqFailure,
93+ reqMethod, reqSuccess, reqTag,
94+ respHeaders, response, withCredentials)
9295
9396
9497-- * Accessing APIs as a Client
@@ -103,7 +106,7 @@ import Servant.Common.Req (ClientOptions(..),
103106-- >
104107-- > getAllBooks :: Event t l -> m (Event t (l, ReqResult [Book]))
105108-- > postNewBook :: Dynamic t (Maybe Book) -> Event t l
106−-- > -> m (Event t (l, ReqResult Book)))
109+-- -> m (Event t (l, ReqResult Book)))
107110-- > (getAllBooks :<|> postNewBook) = client myApi host
108111-- > where host = constDyn $ BaseUrl Http "localhost" 8080
109112client
@@ -125,53 +128,21 @@ clientWithOpts
125128 -> Client t m layout tag
126129clientWithOpts p q t baseurl = clientWithRoute p q t defReq baseurl
127130
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−
142131
143132-- | This class lets us define how each API combinator
144133-- influences the creation of an HTTP request. It's mostly
145134-- 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
135+class HasClient t m layout (tag :: Type) where
136+ type Client t m layout tag :: Type
137+ clientWithRoute :: Proxy layout -> Proxy m -> Proxy tag -> Req t -> Dynamic t BaseUrl -> ClientOptions -> Client t m layout tag
167138
168139
169140instance (HasClient t m a tag, HasClient t m b tag) => HasClient t m (a :<|> b) tag where
170141 type Client t m (a :<|> b) tag = Client t m a tag :<|> Client t m b tag
171142
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
143+ clientWithRoute Proxy q pTag req baseurl opts =
144+ clientWithRoute (Proxy :: Proxy a) q pTag req baseurl opts :<|>
145+ clientWithRoute (Proxy :: Proxy b) q pTag req baseurl opts
175146
176147
177148-- Capture. Example:
@@ -192,9 +163,11 @@ instance (SupportsServantReflex t m, ToHttpApiData a, HasClient t m sublayout ta
192163 type Client t m (Capture capture a :> sublayout) tag =
193164 Dynamic t (Either Text a) -> Client t m sublayout tag
194165
195− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap val =
196− clientWithRouteAndResultHandler
197− (Proxy :: Proxy sublayout) q t (prependToPathParts p req) baseurl opts wrap
166+ clientWithRoute Proxy q t req baseurl opts val =
167+ clientWithRoute (Proxy :: Proxy sublayout)
168+ q t
169+ (prependToPathParts p req)
170+ baseurl opts
198171 where p = (fmap . fmap) (toUrlPiece) val
199172
200173
@@ -207,8 +180,8 @@ instance {-# OVERLAPPABLE #-}
207180 Event t tag -> m (Event t (ReqResult tag a))
208181 -- TODO how to access input types here?
209182 -- 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
183+ clientWithRoute Proxy _ _ req baseurl opts trigs =
184+ fmap runIdentity <$> performRequestsCT (Proxy :: Proxy ct) method (constDyn $ Identity $ req') baseurl opts trigs
212185 where method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
213186 req' = req { reqMethod = method }
214187
@@ -221,33 +194,29 @@ instance {-# OVERLAPPING #-}
221194 Event t tag -> m (Event t (ReqResult tag NoContent))
222195 -- TODO: how to access input types here?
223196 -- ExceptT ServantError IO NoContent
224− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs =
225− wrap =<< fmap runIdentity <$> performRequestsNoBody method (constDyn $ Identity req) baseurl opts trigs
197+ clientWithRoute Proxy _ _ req baseurl opts =
198+ (fmap . fmap) runIdentity . performRequestsNoBody method (constDyn $ Identity req) baseurl opts
226199 where method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
227200
228201
229202toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
230203toHeaders r =
231− let hdrs = maybe []
232− (\xhr -> fmap (\(h,v) -> (CI.map E.encodeUtf8 h, E.encodeUtf8 v))
204+ let toBS = E.encodeUtf8
205+ hdrs = maybe []
206+ (\xhr -> fmap (\(h,v) -> (mk (toBS h), toBS v))
233207 (Map.toList $ _xhrResponse_headers xhr))
234208 (response r)
235209 in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
236210
237−
238211class BuildHeaderKeysTo hs where
239− buildHeaderKeysTo :: Proxy hs -> [CI.CI T.Text]
212+ buildHeaderKeysTo :: Proxy hs -> [T.Text]
240213
241214instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
242215 where buildHeaderKeysTo _ = []
243216
244217instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
245218 => 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−
219+ buildHeaderKeysTo _ = T.pack (symbolVal (Proxy :: Proxy h)) : buildHeaderKeysTo (Proxy :: Proxy xs)
251220
252221-- HEADERS Verb (Content) --
253222-- Headers combinator not treated in fully general case,
@@ -262,10 +231,10 @@ instance {-# OVERLAPPABLE #-}
262231 ) => HasClient t m (Verb method status cts' (Headers ls a)) tag where
263232 type Client t m (Verb method status cts' (Headers ls a)) tag =
264233 Event t tag -> m (Event t (ReqResult tag (Headers ls a)))
265− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs = do
234+ clientWithRoute Proxy _ _ req baseurl opts trigs = do
266235 let method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
267236 resp <- fmap runIdentity <$> performRequestsCT (Proxy :: Proxy ct) method (constDyn $ Identity req') baseurl opts trigs
268− wrap $ toHeaders <$> resp
237+ return $ toHeaders <$> resp
269238 where req' = req { respHeaders =
270239 OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))
271240 }
@@ -278,10 +247,10 @@ instance {-# OVERLAPPABLE #-}
278247 ) => HasClient t m (Verb method status cts (Headers ls NoContent)) tag where
279248 type Client t m (Verb method status cts (Headers ls NoContent)) tag
280249 = Event t tag -> m (Event t (ReqResult tag (Headers ls NoContent)))
281− clientWithRouteAndResultHandler Proxy _ _ req baseurl opts wrap trigs = do
250+ clientWithRoute Proxy _ _ req baseurl opts trigs = do
282251 let method = E.decodeUtf8 $ reflectMethod (Proxy :: Proxy method)
283252 resp <- fmap runIdentity <$> performRequestsNoBody method (constDyn $ Identity req') baseurl opts trigs
284− wrap $ toHeaders <$> resp
253+ return $ toHeaders <$> resp
285254 where req' = req {respHeaders =
286255 OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))
287256 }
@@ -308,11 +277,11 @@ instance (KnownSymbol sym, ToHttpApiData a,
308277 type Client t m (Header sym a :> sublayout) tag =
309278 Dynamic t (Either Text a) -> Client t m sublayout tag
310279
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
280+ clientWithRoute Proxy q t req baseurl opts eVal =
281+ clientWithRoute (Proxy :: Proxy sublayout)
282+ q t
283+ (Servant.Common.Req.addHeader hname eVal req)
284+ baseurl opts
316285 where hname = T.pack $ symbolVal (Proxy :: Proxy sym)
317286
318287
@@ -326,21 +295,8 @@ instance HasClient t m sublayout tag
326295 type Client t m (HttpVersion :> sublayout) tag =
327296 Client t m sublayout tag
328297
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−
298+ clientWithRoute Proxy q t =
299+ clientWithRoute (Proxy :: Proxy sublayout) q t
344300
345301
346302-- | If you use a 'QueryParam' in one of your endpoints in your API,
@@ -376,9 +332,9 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient t m sublayout tag, Reflex
376332 Dynamic t (QParam a) -> Client t m sublayout tag
377333
378334 -- 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
335+ clientWithRoute Proxy q t req baseurl opts mparam =
336+ clientWithRoute (Proxy :: Proxy sublayout) q t
337+ (req {qParams = paramPair : qParams req}) baseurl opts
382338
383339 where pname = symbolVal (Proxy :: Proxy sym)
384340 --p prm = QueryPartParam $ (fmap . fmap) (toQueryParam) prm
@@ -422,8 +378,8 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient t m sublayout tag, Reflex
422378 type Client t m (QueryParams sym a :> sublayout) tag =
423379 Dynamic t [a] -> Client t m sublayout tag
424380
425− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap paramlist =
426− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t req' baseurl opts wrap
381+ clientWithRoute Proxy q t req baseurl opts paramlist =
382+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
427383
428384 where req' = req { qParams = (T.pack pname, params') : qParams req }
429385 pname = symbolVal (Proxy :: Proxy sym)
@@ -462,8 +418,8 @@ instance (KnownSymbol sym, HasClient t m sublayout tag, Reflex t)
462418 type Client t m (QueryFlag sym :> sublayout) tag =
463419 Dynamic t Bool -> Client t m sublayout tag
464420
465− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap flag =
466− clientWithRouteAndResultHandler (Proxy :: Proxy sublayout) q t req' baseurl opts wrap
421+ clientWithRoute Proxy q t req baseurl opts flag =
422+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
467423
468424 where req' = req { qParams = thisPair : qParams req }
469425 thisPair = (T.pack pName, QueryPartFlag flag) :: (Text, QueryPart t)
@@ -477,7 +433,7 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
477433 -> Event t tag
478434 -> m (Event t (ReqResult tag ()))
479435
480− clientWithRouteAndResultHandler _ _ _ _ baseurl _ wrap xhrs triggers = do
436+ clientWithRoute _ _ _ _ baseurl _ xhrs triggers = do
481437
482438 let xhrs' = liftA2 (\x path -> case x of
483439 Left e -> Left e
@@ -488,7 +444,7 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
488444 okReq = fmapMaybe (\(t,x) -> either (const Nothing) (Just . (t,)) x) xhrs'' :: Event t (tag, XhrRequest ())
489445
490446 resps <- performRequestsAsync okReq
491− wrap $ leftmost [ uncurry RequestFailure <$> badReq
447+ return $ leftmost [ uncurry RequestFailure <$> badReq
492448 , evalResponse (const $ Right ()) <$> resps
493449 ]
494450
@@ -513,30 +469,73 @@ instance SupportsServantReflex t m => HasClient t m Raw tag where
513469-- > where host = BaseUrl Http "localhost" 8080
514470-- > -- then you can just use "addBook" to query that endpoint
515471
516−instance (MimeRender ct a, HasClient t m sublayout tag, Reflex t)
517− => HasClient t m (ReqBody (ct ': cts) a :> sublayout) tag where
472+instance (GHCJS'MimeRender ct a, IsXhrPayload (ToSend ct a), Show (ToSend ct a),
473+ HasClient t m sublayout tag, Reflex t)
474+ => HasClient t m (ReqBody (ct ': cts) (a :: Type) :> sublayout) tag where
518475
519476 type Client t m (ReqBody (ct ': cts) a :> sublayout) tag =
520− Dynamic t (Either Text a) -> Client t m sublayout tag
477+ Dynamic t (Either Text (ToConvert ct a)) -> Client t m sublayout tag
521478
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 }
479+ clientWithRoute Proxy q t Req{..} baseurl opts body =
480+ clientWithRoute (Proxy :: Proxy sublayout) q t req' baseurl opts
481+ where req' = Req { reqBody = Just $ (fmap . fmap)
482+ (\b -> (ghcjsMimeRender ctProxy atProxy b, ctString)) body
483+ , ..}
525484 ctProxy = Proxy :: Proxy ct
485+ atProxy = Proxy :: Proxy a
526486 ctString = T.pack $ show $ contentType ctProxy
527− bodyBytesCT = Just $ (fmap . fmap)
528− (\b -> (mimeRender ctProxy b, ctString))
529− body
530487
488+class Accept ctype => GHCJS'MimeRender (ctype :: Type) (a :: Type) where
489+ type ToConvert ctype a :: Type
490+ type ToConvert ctype a = a
491+
492+ type ToSend ctype a :: Type
493+ type ToSend ctype a = BS.ByteString
531494
495+ ghcjsMimeRender
496+ :: IsXhrPayload (ToSend ctype a)
497+ => Proxy ctype -> Proxy a -> ToConvert ctype a -> ToSend ctype a
498+ default ghcjsMimeRender
499+ :: (MimeRender ctype a,
500+ MimeRender ctype (ToConvert ctype a), ToSend ctype a ~ BS.ByteString)
501+ => Proxy ctype -> Proxy a -> ToConvert ctype a -> ToSend ctype a
502+ ghcjsMimeRender ctype _ = BL.toStrict . mimeRender ctype
503+
504+instance MimeRender JSON x => GHCJS'MimeRender JSON x
505+
506+instance MimeRender FormUrlEncoded x => GHCJS'MimeRender FormUrlEncoded x
507+
508+instance GHCJS'MimeRender OctetStream BL.ByteString where
509+ type ToConvert OctetStream BL.ByteString = Either BL.ByteString Blob
510+ type ToSend OctetStream BL.ByteString = Either BS.ByteString Blob
511+ ghcjsMimeRender _ _ = \case Left bl -> Left $ BL.toStrict bl; Right x -> Right x
512+
513+instance GHCJS'MimeRender PlainText String where
514+ type ToSend PlainText String = Text
515+ ghcjsMimeRender _ _ = T.pack
516+
517+instance GHCJS'MimeRender PlainText Text where
518+ type ToSend PlainText Text = Text
519+ ghcjsMimeRender _ _ = id
520+
521+instance GHCJS'MimeRender PlainText TL.Text where
522+ type ToSend PlainText TL.Text = Text
523+ ghcjsMimeRender _ _ = TL.toStrict
524+
525+instance GHCJS'MimeRender PlainText BL.ByteString where
526+ type ToSend PlainText BL.ByteString = BS.ByteString
527+ ghcjsMimeRender _ _ = BL.toStrict
528+
529+instance GHCJS'MimeRender PlainText BS.ByteString where
530+ ghcjsMimeRender _ _ = id
532531
533532-- | Make the querying function append @path@ to the request path.
534533instance (KnownSymbol path, HasClient t m sublayout tag, Reflex t) => HasClient t m (path :> sublayout) tag where
535534 type Client t m (path :> sublayout) tag = Client t m sublayout tag
536535
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
536+ clientWithRoute Proxy q t req baseurl opts =
537+ clientWithRoute (Proxy :: Proxy sublayout) q t
538+ (prependToPathParts (pure (Right $ T.pack p)) req) baseurl opts
540539
541540 where p = symbolVal (Proxy :: Proxy path)
542541
@@ -544,23 +543,23 @@ instance (KnownSymbol path, HasClient t m sublayout tag, Reflex t) => HasClient
544543instance HasClient t m api tag => HasClient t m (Vault :> api) tag where
545544 type Client t m (Vault :> api) tag = Client t m api tag
546545
547− clientWithRouteAndResultHandler Proxy =
548− clientWithRouteAndResultHandler (Proxy :: Proxy api)
546+ clientWithRoute Proxy q t req baseurl =
547+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
549548
550549
551550instance HasClient t m api tag => HasClient t m (RemoteHost :> api) tag where
552551 type Client t m (RemoteHost :> api) tag = Client t m api tag
553552
554− clientWithRouteAndResultHandler Proxy =
555− clientWithRouteAndResultHandler (Proxy :: Proxy api)
553+ clientWithRoute Proxy q t req baseurl =
554+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
556555
557556
558557
559558instance HasClient t m api tag => HasClient t m (IsSecure :> api) tag where
560559 type Client t m (IsSecure :> api) tag = Client t m api tag
561560
562− clientWithRouteAndResultHandler Proxy =
563− clientWithRouteAndResultHandler (Proxy :: Proxy api)
561+ clientWithRoute Proxy q t req baseurl =
562+ clientWithRoute (Proxy :: Proxy api) q t req baseurl
564563
565564
566565instance (HasClient t m api tag, Reflex t)
@@ -569,8 +568,8 @@ instance (HasClient t m api tag, Reflex t)
569568 type Client t m (BasicAuth realm usr :> api) tag = Dynamic t (Maybe BasicAuthData)
570569 -> Client t m api tag
571570
572− clientWithRouteAndResultHandler Proxy q t req baseurl opts wrap authdata =
573− clientWithRouteAndResultHandler (Proxy :: Proxy api) q t req' baseurl opts wrap
571+ clientWithRoute Proxy q t req baseurl opts authdata =
572+ clientWithRoute (Proxy :: Proxy api) q t req' baseurl opts
574573 where
575574 req' = req { authData = Just authdata }
576575
@@ -613,7 +612,7 @@ for empty and one for non-empty lists).
613612instance (HasCookieAuth auths, HasClient t m api tag) => HasClient t m (Auth.Auth auths a :> api) tag where
614613
615614 type Client t m (Auth.Auth auths a :> api) tag = Client t m api tag
616− clientWithRouteAndResultHandler Proxy = clientWithRouteAndResultHandler (Proxy :: Proxy api)
615+ clientWithRoute Proxy = clientWithRoute (Proxy :: Proxy api)
617616
618617
619618type family HasCookieAuth xs :: Constraint where
@@ -622,4 +621,3 @@ type family HasCookieAuth xs :: Constraint where
622621 HasCookieAuth '[] = CookieAuthNotEnabled
623622
624623class CookieAuthNotEnabled
625−