-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Microsoft Graph API -- -- Bindings to the Microsoft Graph API @package ms-graph-api @version 0.5.0.0 module Network.OAuth2.Provider.AzureAD -- | Configuration object of the OAuth2 application data OAuthCfg OAuthCfg :: Text -> ClientId -> ClientSecret -> [Scope] -> AuthorizeState -> URI -> OAuthCfg -- | application name [$sel:oacAppName:OAuthCfg] :: OAuthCfg -> Text -- | app client ID : see https://stackoverflow.com/a/70670961 [$sel:oacClientId:OAuthCfg] :: OAuthCfg -> ClientId -- | app client secret " [$sel:oacClientSecret:OAuthCfg] :: OAuthCfg -> ClientSecret -- | OAuth2 and OIDC scopes [$sel:oacScopes:OAuthCfg] :: OAuthCfg -> [Scope] -- | OAuth2 state (a random string, -- https://www.rfc-editor.org/rfc/rfc6749#section-10.12 ) [$sel:oacAuthState:OAuthCfg] :: OAuthCfg -> AuthorizeState -- | OAuth2 redirect URI [$sel:oacRedirectURI:OAuthCfg] :: OAuthCfg -> URI data AzureAD -- | -- https://learn.microsoft.com/en-us/azure/active-directory/develop/userinfo data AzureADUser -- | NB : scopes openid and offline_access are ALWAYS -- requested since the library assumes we have access to refresh tokens -- and ID tokens azureADApp :: OAuthCfg -> IdpApplication 'AuthorizationCode AzureAD instance GHC.Show.Show Network.OAuth2.Provider.AzureAD.AzureAD instance GHC.Classes.Eq Network.OAuth2.Provider.AzureAD.AzureAD instance GHC.Show.Show Network.OAuth2.Provider.AzureAD.AzureADUser instance GHC.Classes.Ord Network.OAuth2.Provider.AzureAD.AzureADUser instance GHC.Classes.Eq Network.OAuth2.Provider.AzureAD.AzureADUser instance Data.Aeson.Types.FromJSON.FromJSON Network.OAuth2.Provider.AzureAD.AzureADUser -- | OAuth user session module Network.OAuth2.Session -- | Decode the App Service ID token header -- X-MS-TOKEN-AAD-ID-TOKEN, look its user up in the local token -- store, supply token t to continuation. If the user -- sub cannot be found in the token store the browser is -- redirected to the login URI. -- -- Special case of aadHeaderIdToken withAADUser :: MonadIO m => Tokens UserSub t -> Text -> (t -> Action m ()) -> Action m () -- | Login endpoint -- -- see azureADApp loginEndpoint :: MonadIO m => IdpApplication 'AuthorizationCode AzureAD -> RoutePattern -> Scotty m () -- | The identity provider redirects the client to the reply -- endpoint as part of the OAuth flow : -- https://learn.microsoft.com/en-us/graph/auth-v2-user?view=graph-rest-1.0&tabs=http#authorization-response -- -- see azureADApp replyEndpoint :: MonadIO m => IdpApplication 'AuthorizationCode AzureAD -> Tokens UserSub OAuth2Token -> Manager -> RoutePattern -> Scotty m () -- | transactional token store type Tokens uid t = TVar (TokensData uid t) -- | Create an empty Tokens object newTokens :: (MonadIO m, Ord uid) => m (Tokens uid t) -- | sub field data UserSub -- | Look up a user identifier and return their current token, if any lookupUser :: (MonadIO m, Ord uid) => Tokens uid t -> uid -> m (Maybe t) -- | Remove a user, i.e. they will have to authenticate once more expireUser :: (MonadIO m, Ord uid) => Tokens uid t -> uid -> m () -- | return a list representation of the Tokens object tokensToList :: MonadIO m => Tokens k a -> m [(k, a)] type Scotty = ScottyT Text type Action = ActionT Text instance GHC.Classes.Eq Network.OAuth2.Session.OAuthSessionError instance (GHC.Show.Show uid, GHC.Show.Show t) => GHC.Show.Show (Network.OAuth2.Session.TokensData uid t) instance (GHC.Classes.Eq uid, GHC.Classes.Eq t) => GHC.Classes.Eq (Network.OAuth2.Session.TokensData uid t) instance GHC.Exception.Type.Exception Network.OAuth2.Session.OAuthSessionError instance GHC.Show.Show Network.OAuth2.Session.OAuthSessionError -- | Common functions for the MS Graph API v1.0 -- -- -- https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0&preserve-view=true module MSGraphAPI.Internal.Common -- |
-- GET https://graph.microsoft.com/v1.0/... --get :: FromJSON a => [Text] -> Option 'Https -> AccessToken -> Req a -- |
-- GET https://graph.microsoft.com/v1.0/... ---- -- Returns the response body as a bytestring, e.g. for endpoints that -- download files or general bytestring payloads getLbs :: [Text] -> Option 'Https -> AccessToken -> Req ByteString -- | Like get but catches HttpExceptions to allow pattern -- matching getE :: FromJSON a => [Text] -> Option 'Https -> AccessToken -> Req (Either HttpException a) -- |
-- POST https://graph.microsoft.com/v1.0/... --post :: (ToJSON a, FromJSON b) => [Text] -> Option 'Https -> a -> AccessToken -> Req b -- | Like post but catches HttpExceptions to allow pattern -- matching postE :: (ToJSON a, FromJSON b) => [Text] -> Option 'Https -> a -> AccessToken -> Req (Either HttpException b) -- | Run a computation in the Req monad with the given -- HttpConfig. In the case of an exceptional situation an -- HttpException will be thrown. runReq :: MonadIO m => HttpConfig -> Req a -> m a -- | Specialized version of try to HttpExceptions -- -- This can be used to catch exceptions of composite Req -- statements, e.g. around a do block tryReq :: Req a -> Req (Either HttpException a) -- | a collection of items with key value data Collection a Collection :: [a] -> Collection a [cValue] :: Collection a -> [a] -- | drop the prefix and lowercase first character -- -- e.g. userDisplayName -> displayName aesonOptions :: String -> Options instance GHC.Generics.Generic (MSGraphAPI.Internal.Common.Collection a) instance GHC.Show.Show a => GHC.Show.Show (MSGraphAPI.Internal.Common.Collection a) instance GHC.Classes.Eq a => GHC.Classes.Eq (MSGraphAPI.Internal.Common.Collection a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (MSGraphAPI.Internal.Common.Collection a) module MSGraphAPI.User -- | Get user information -- --
-- GET /users/{user-id}
--
--
--
-- https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#request
get :: Text -> AccessToken -> Req User
-- | Get information on signed-in user
--
-- Calling the /me endpoint requires a signed-in user and therefore a
-- delegated permission. Application permissions are not supported when
-- using the /me endpoint.
--
-- -- GET /me ---- -- -- https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#request-1 getMe :: AccessToken -> Req User data User User :: Text -> Text -> Text -> User [uId] :: User -> Text [uUserPrincipalName] :: User -> Text [uDisplayName] :: User -> Text instance GHC.Generics.Generic MSGraphAPI.User.User instance GHC.Show.Show MSGraphAPI.User.User instance GHC.Classes.Ord MSGraphAPI.User.User instance GHC.Classes.Eq MSGraphAPI.User.User instance Data.Aeson.Types.FromJSON.FromJSON MSGraphAPI.User.User module MSGraphAPI.Files.DriveItems -- | download a complete file from user's directory -- --
-- GET /me/drive/items/{item-id}/content
--
--
--
-- https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http#request
downloadFileMe :: Text -> AccessToken -> Req ByteString
-- | download a file from a drive
--
--
-- GET /drives/{drive-id}/items/{item-id}/content
--
--
--
-- https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http#request
downloadFile :: Text -> Text -> AccessToken -> Req ByteString
module MSGraphAPI.Drive
-- | Get drive of current user
getDriveMe :: AccessToken -> Req Drive
-- | List children in the root of the current user's drive
--
--
-- https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http#list-children-in-the-root-of-the-current-users-drive
getDriveItemsMe :: AccessToken -> Req (Collection DriveItem)
-- | List children in the root of the current user's drive
--
--
-- GET /drives/{drive-id}/items/{item-id}/children
--
--
--
-- https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http#list-children-in-the-root-of-the-current-users-drive
getDriveItemChildren :: Text -> Text -> AccessToken -> Req (Collection DriveItem)
data Drive
Drive :: Text -> Drive
[dId] :: Drive -> Text
data DriveItem
DriveItem :: Text -> Maybe Int64 -> DriveItem
[diName] :: DriveItem -> Text
[diSize] :: DriveItem -> Maybe Int64
instance GHC.Generics.Generic MSGraphAPI.Drive.Drive
instance GHC.Show.Show MSGraphAPI.Drive.Drive
instance GHC.Classes.Eq MSGraphAPI.Drive.Drive
instance GHC.Generics.Generic MSGraphAPI.Drive.DriveItem
instance GHC.Show.Show MSGraphAPI.Drive.DriveItem
instance GHC.Classes.Eq MSGraphAPI.Drive.DriveItem
instance Data.Aeson.Types.FromJSON.FromJSON MSGraphAPI.Drive.DriveItem
instance Data.Aeson.Types.FromJSON.FromJSON MSGraphAPI.Drive.Drive