Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
Synopsis
- get :: FromJSON a => [Text] -> Option 'Https -> AccessToken -> Req a
- getLbs :: [Text] -> Option 'Https -> AccessToken -> Req ByteString
- getE :: FromJSON a => [Text] -> Option 'Https -> AccessToken -> Req (Either HttpException a)
- post :: (ToJSON a, FromJSON b) => [Text] -> Option 'Https -> a -> AccessToken -> Req b
- postE :: (ToJSON a, FromJSON b) => [Text] -> Option 'Https -> a -> AccessToken -> Req (Either HttpException b)
- runReq :: MonadIO m => HttpConfig -> Req a -> m a
- tryReq :: Req a -> Req (Either HttpException a)
- data Collection a = Collection {
- cValue :: [a]
- aesonOptions :: String -> Options
GET
GET https://graph.microsoft.com/v1.0/...
:: [Text] | URI path segments |
-> Option 'Https | |
-> AccessToken | |
-> Req 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
catch HTTP exceptions
:: FromJSON a | |
=> [Text] | URI path segments |
-> Option 'Https | |
-> AccessToken | |
-> Req (Either HttpException a) |
Like get
but catches HttpException
s to allow pattern matching
POST
:: (ToJSON a, FromJSON b) | |
=> [Text] | URI path segments |
-> Option 'Https | |
-> a | request body |
-> AccessToken | |
-> Req b |
POST https://graph.microsoft.com/v1.0/...
catch HTTP exceptions
:: (ToJSON a, FromJSON b) | |
=> [Text] | URI path segments |
-> Option 'Https | |
-> a | |
-> AccessToken | |
-> Req (Either HttpException b) |
Like post
but catches HttpException
s to allow pattern matching
running requests
:: MonadIO m | |
=> HttpConfig |
|
-> Req a | Computation to run |
-> m a |
Run a computation in the Req
monad with the given HttpConfig
. In
the case of an exceptional situation an HttpException
will be thrown.
Since: req-0.4.0
tryReq :: Req a -> Req (Either HttpException a) Source #
Specialized version of try
to HttpException
s
This can be used to catch exceptions of composite Req
statements, e.g. around a do
block
JSON : aeson helpers
data Collection a Source #
a collection of items with key value
Collection | |
|
Instances
drop the prefix and lowercase first character
e.g. userDisplayName
->
displayName