on develop help sign in
Renaming Allow -> AllowScopes for documentation purposes
commitcac1cdefa87f594d2b46d479d252077c9fbdcc47 authorBrendan Hay <brendan.g.hay@gmail.com> dateMon 21 Mar 2016, 07:14 (11 years ago) parent10262f6
3 files changed+10−9
gogol/src/Network/Google/Auth.hs+5−5 gogol/src/Network/Google/Auth/InstalledApplication.hs+3−2 gogol/src/Network/Google/Internal/HTTP.hs+2−2
gogol/src/Network/Google/Auth.hs+5−5
@@ -115,7 +115,7 @@ newtype Store (s :: [Symbol]) = Store (MVar (Auth s))
115115
116116-- | Construct storage containing the credentials which have not yet been
117117-- exchanged or refreshed.
118−initStore :: (MonadIO m, MonadCatch m, Allow s)
118+initStore :: (MonadIO m, MonadCatch m, AllowScopes s)
119119 => Credentials s
120120 -> Logger
121121 -> Manager
@@ -124,7 +124,7 @@ initStore c l m = exchange c l m >>= fmap Store . liftIO . newMVar
124124
125125-- | Concurrently read the current token, and if expired, then
126126-- safely perform a single serial refresh.
127−getToken :: (MonadIO m, MonadCatch m, Allow s)
127+getToken :: (MonadIO m, MonadCatch m, AllowScopes s)
128128 => Store s
129129 -> Logger
130130 -> Manager
@@ -144,7 +144,7 @@ getToken (Store s) l m = do
144144
145145-- | Perform the initial credentials exchange to obtain a valid 'OAuthToken'
146146-- suitable for authorizing requests.
147−exchange :: (MonadIO m, MonadCatch m, Allow s)
147+exchange :: (MonadIO m, MonadCatch m, AllowScopes s)
148148 => Credentials s
149149 -> Logger
150150 -> Manager
@@ -158,7 +158,7 @@ exchange c l = fmap (Auth c) . action l
158158 FromUser u -> authorizedUserToken u Nothing
159159
160160-- | Refresh an existing 'OAuthToken' using
161−refresh :: (MonadIO m, MonadCatch m, Allow s)
161+refresh :: (MonadIO m, MonadCatch m, AllowScopes s)
162162 => Auth s
163163 -> Logger
164164 -> Manager
@@ -173,7 +173,7 @@ refresh (Auth c t) l = fmap (Auth c) . action l
173173
174174-- | Apply the (by way of possible token refresh) a bearer token to the
175175-- authentication header of a request.
176−authorize :: (MonadIO m, MonadCatch m, Allow s)
176+authorize :: (MonadIO m, MonadCatch m, AllowScopes s)
177177 => Client.Request
178178 -> Store s
179179 -> Logger
gogol/src/Network/Google/Auth/InstalledApplication.hs+3−2
@@ -13,7 +13,8 @@ module Network.Google.Auth.InstalledApplication where
1313import Control.Monad.Catch (MonadCatch)
1414import Control.Monad.IO.Class (MonadIO)
1515import qualified Data.Text.Encoding as Text
16−import Network.Google.Auth.Scope (Allow (..), queryEncodeScopes)
16+import Network.Google.Auth.Scope (AllowScopes (..),
17+ queryEncodeScopes)
1718import Network.Google.Internal.Auth
1819import Network.Google.Internal.Logger (Logger)
1920import Network.Google.Prelude
@@ -30,7 +31,7 @@ redirectURI = "urn:ietf:wg:oauth:2.0:oob"
3031-- with 'exchangeCode'.
3132--
3233-- /See:/ <https://developers.google.com/accounts/docs/OAuth2InstalledApp#formingtheurl Forming the URL>.
33−formURL :: Allow s => OAuthClient -> proxy s -> Text
34+formURL :: AllowScopes s => OAuthClient -> proxy s -> Text
3435formURL c = formURLWith c . allowScopes
3536
3637-- | Form a URL using 'OAuthScope' values.
gogol/src/Network/Google/Internal/HTTP.hs+2−2
@@ -25,7 +25,7 @@ import qualified Data.Text.Encoding as Text
2525import qualified Data.Text.Lazy as LText
2626import qualified Data.Text.Lazy.Builder as Build
2727import GHC.Exts (toList)
28−import Network.Google.Auth (Allow, authorize)
28+import Network.Google.Auth (AllowScopes, authorize)
2929import Network.Google.Env (Env (..))
3030import Network.Google.Internal.Logger (logDebug)
3131import Network.Google.Internal.Multipart
@@ -43,7 +43,7 @@ import Network.HTTP.Types
4343--
4444-- "resumable" or "multipart" needs to go into the "uploadType" param
4545
46−perform :: (MonadCatch m, MonadResource m, Allow s, GoogleRequest a)
46+perform :: (MonadCatch m, MonadResource m, AllowScopes s, GoogleRequest a)
4747 => Env s
4848 -> a
4949 -> m (Either Error (Rs a))