on develop help sign in
Using ServiceConfig inplace of ambiguous Service
commit26772c77e76cc253f8cfd374b0bd8b3e5301aeb0 authorBrendan Hay <brendan.g.hay@gmail.com> dateSun 20 Mar 2016, 16:45 (11 years ago) parentd0389e7
2 files changed+7−8
gogol/src/Network/Google/Env.hs+4−4 gogol/src/Network/Google/Internal/HTTP.hs+3−4
gogol/src/Network/Google/Env.hs+4−4
@@ -29,7 +29,7 @@ import Network.HTTP.Conduit
2929
3030-- | The environment containing the parameters required to make Google requests.
3131data Env (s :: [Symbol]) = Env
32− { _envOverride :: !(Dual (Endo Service))
32+ { _envOverride :: !(Dual (Endo ServiceConfig))
3333 , _envLogger :: !Logger
3434 , _envManager :: !Manager
3535 , _envStore :: !(Store s)
@@ -68,7 +68,7 @@ instance HasEnv s (Env s) where
6868-- To override a specific service, it's suggested you use
6969-- either 'configure' or 'reconfigure' with a modified version of the default
7070-- service, such as @Network.Google.Gmail.gmailService@.
71−override :: HasEnv s a => (Service -> Service) -> a -> a
71+override :: HasEnv s a => (Service -> ServiceConfig) -> a -> a
7272override f = envOverride <>~ Dual (Endo f)
7373
7474-- | Configure a specific service. All requests belonging to the
@@ -78,7 +78,7 @@ override f = envOverride <>~ Dual (Endo f)
7878-- as @Network.Google.Gmail.gmailService@.
7979--
8080-- /See:/ 'reconfigure'.
81−configure :: HasEnv s a => Service -> a -> a
81+configure :: HasEnv s a => ServiceConfig -> a -> a
8282configure s = override f
8383 where
8484 f x | on (==) _svcId s x = s
@@ -91,7 +91,7 @@ configure s = override f
9191-- as @Network.Google.Gmail.gmailService@.
9292--
9393-- /See:/ 'configure'.
94−reconfigure :: (MonadReader r m, HasEnv s r) => Service -> m a -> m a
94+reconfigure :: (MonadReader r m, HasEnv s r) => ServiceConfig -> m a -> m a
9595reconfigure = local . configure
9696
9797-- | Scope an action such that any HTTP response will use this timeout value.
gogol/src/Network/Google/Internal/HTTP.hs+3−4
@@ -49,10 +49,9 @@ perform :: (MonadCatch m, MonadResource m, Allow s, GoogleRequest a)
4949 -> m (Either Error (Rs a))
5050perform Env{..} x = catches go handlers
5151 where
52− Request {..} = _cliRequest
53− Service {..} = _cliService
54−
55− Client {..} = requestClient x
52+ Request {..} = _cliRequest
53+ ServiceConfig {..} = _cliService
54+ Client {..} = requestClient x
5655 & clientService %~ appEndo (getDual _envOverride)
5756
5857 go = liftResourceT $ do