| Copyright | (c) 2015 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Google.Auth.Scope
Description
Helpers for specifying and using Scopes with Network.Google.
- allow :: proxy s -> k s -> k s
- forbid :: k `[]` -> k `[]`
- (!) :: proxy xs -> proxy ys -> Proxy (Nub (xs ++ ys))
- type family HasScope s a :: Constraint
- type family HasScope' s a
- type family a ∈ b
- type family xs ++ ys
- type family Nub xs
- type family Delete x xs
- class AllowScopes a where
- allowScopes :: proxy a -> [OAuthScope]
- concatScopes :: [OAuthScope] -> Text
- queryEncodeScopes :: [OAuthScope] -> ByteString
Documentation
type family HasScope s a :: Constraint Source
Determine if _any_ of the scopes a request requires is listed in the scopes the credentials supports.
For error message/presentation purposes, this wraps the result of
the HasScope membership check to show both lists of scopes before
reduction.
Equations
| HasScope s a = (s `HasScope'` Scopes a) ~ True |
type family HasScope' s a Source
Check if any of actual supplied scopes s exist in the required set a.
If the required set a is empty, then succeed.
Membership predicate.
Append two lists.
Remove duplicates from a list.
class AllowScopes a where Source
Methods
allowScopes :: proxy a -> [OAuthScope] Source
Obtain a list of supported OAuthScope values from a proxy.
Instances
| AllowScopes [Symbol] s => AllowScopes * (Credentials s) Source | |
| AllowScopes [k] ([] k) Source | |
| (KnownSymbol x, AllowScopes [Symbol] xs) => AllowScopes [Symbol] ((:) Symbol x xs) Source |
concatScopes :: [OAuthScope] -> Text Source
Concatenate a list of scopes using spaces.
queryEncodeScopes :: [OAuthScope] -> ByteString Source
Encode a list of scopes suitable for embedding in a query string.