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 |

Helpers for specifying and using `Scope`

s with Network.Google.

## Synopsis

- allow :: proxy s -> k s -> k s
- forbid :: k '[] -> k '[]
- (!) :: proxy xs -> proxy ys -> Proxy (Nub (xs ++ ys))
- type family HasScope (s :: [Symbol]) a :: Constraint where ...
- type family HasScope' s a where ...
- type family a ∈ b where ...
- type family xs ++ ys where ...
- type family Nub xs where ...
- type family Delete x xs where ...
- class AllowScopes a where
- allowScopes :: proxy a -> [OAuthScope]

- concatScopes :: [OAuthScope] -> Text
- queryEncodeScopes :: [OAuthScope] -> ByteString

# Documentation

type family HasScope (s :: [Symbol]) a :: Constraint where ... 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.

HasScope s a = (s `HasScope'` Scopes a) ~ True |

type family HasScope' s a where ... Source #

Check if any of actual supplied scopes `s`

exist in the required set `a`

.
If the required set `a`

is empty, then succeed.

class AllowScopes a where Source #

allowScopes :: proxy a -> [OAuthScope] Source #

Obtain a list of supported `OAuthScope`

values from a proxy.

## Instances

AllowScopes ([] :: [k]) Source # | |

Defined in Network.Google.Auth.Scope allowScopes :: proxy [] -> [OAuthScope] Source # | |

AllowScopes s => AllowScopes (Credentials s :: Type) Source # | |

Defined in Network.Google.Auth.Scope allowScopes :: proxy (Credentials s) -> [OAuthScope] Source # | |

(KnownSymbol x, AllowScopes xs) => AllowScopes (x ': xs :: [Symbol]) Source # | |

Defined in Network.Google.Auth.Scope allowScopes :: proxy (x ': xs) -> [OAuthScope] 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.