ms-graph-api 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+29/−9 lines, 4 files
Files
- ms-graph-api.cabal +5/−3
- src/MSGraphAPI/Files/DriveItems.hs +4/−1
- src/MSGraphAPI/Internal/Common.hs +8/−3
- src/MSGraphAPI/User.hs +12/−2
ms-graph-api.cabal view
@@ -1,5 +1,5 @@ name: ms-graph-api-version: 0.1.0.0+version: 0.2.0.0 synopsis: Microsoft Graph API description: Bindings to the Microsoft Graph API homepage: https://github.com/unfoldml/ms-graph-api@@ -18,13 +18,15 @@ library default-language: Haskell2010 hs-source-dirs: src- exposed-modules: MSGraphAPI.Internal.Common+ exposed-modules: MSGraphAPI.User MSGraphAPI.Drive MSGraphAPI.Files.DriveItems Network.OAuth2.Provider.AzureAD Network.OAuth2.Session- other-modules: MSGraphAPI.Auth+ MSGraphAPI.Internal.Common+ other-modules: + MSGraphAPI.Auth Network.OAuth2.JWT build-depends: base >= 4.7 && < 5 , aeson
src/MSGraphAPI/Files/DriveItems.hs view
@@ -20,10 +20,13 @@ -- @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 LBS.ByteString+downloadFileMe :: Text -- ^ item ID+ -> AccessToken -> Req LBS.ByteString downloadFileMe itemId = MSG.getLbs ["me", "drive", "items", itemId, "content"] mempty -- | 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 -- ^ drive ID
src/MSGraphAPI/Internal/Common.hs view
@@ -49,7 +49,7 @@ -- | @POST https:\/\/graph.microsoft.com\/v1.0\/...@ post :: (A.FromJSON b, A.ToJSON a) =>- [Text] -- ^ URI segments+ [Text] -- ^ URI path segments -> Option 'Https -> a -- ^ request body -> AccessToken@@ -61,7 +61,7 @@ -- | @GET https:\/\/graph.microsoft.com\/v1.0\/...@ get :: A.FromJSON a =>- [Text] -- ^ URI segments+ [Text] -- ^ URI path segments -> Option 'Https -> AccessToken -> Req a@@ -70,7 +70,12 @@ opts = auth <> params (url, auth) = msGraphReqConfig tok paths -getLbs :: [Text] -> Option 'Https -> AccessToken -> Req LBS.ByteString+-- | @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] -- ^ URI path segments+ -> Option 'Https+ -> AccessToken -> Req LBS.ByteString getLbs paths params tok = responseBody <$> req GET url NoReqBody lbsResponse opts where opts = auth <> params
src/MSGraphAPI/User.hs view
@@ -26,12 +26,22 @@ import qualified MSGraphAPI.Internal.Common as MSG (get, post, aesonOptions) --- | https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#request+-- | 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 -- ^ user id -> AccessToken -> Req User get uid = MSG.get ["users", uid] mempty --- | get signed-in user https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#request-1+-- | 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 getMe = MSG.get ["me"] mempty