Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
MSGraphAPI.Internal.Common
Description
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/...
Arguments
:: [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
Arguments
:: FromJSON a | |
=> [Text] | URI path segments |
-> Option 'Https | |
-> AccessToken | |
-> Req (Either HttpException a) |
Like get
but catches HttpException
s to allow pattern matching
POST
Arguments
:: (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
Arguments
:: (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
Arguments
:: 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
Constructors
Collection | |
Fields
|
Instances
FromJSON a => FromJSON (Collection a) Source # | |
Defined in MSGraphAPI.Internal.Common Methods parseJSON :: Value -> Parser (Collection a) # parseJSONList :: Value -> Parser [Collection a] # | |
Generic (Collection a) Source # | |
Defined in MSGraphAPI.Internal.Common Associated Types type Rep (Collection a) :: Type -> Type # | |
Show a => Show (Collection a) Source # | |
Defined in MSGraphAPI.Internal.Common Methods showsPrec :: Int -> Collection a -> ShowS # show :: Collection a -> String # showList :: [Collection a] -> ShowS # | |
Eq a => Eq (Collection a) Source # | |
Defined in MSGraphAPI.Internal.Common | |
type Rep (Collection a) Source # | |
Defined in MSGraphAPI.Internal.Common type Rep (Collection a) = D1 ('MetaData "Collection" "MSGraphAPI.Internal.Common" "ms-graph-api-0.5.0.0-92hg9qxfYXvKWdKxfo4q6z" 'False) (C1 ('MetaCons "Collection" 'PrefixI 'True) (S1 ('MetaSel ('Just "cValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]))) |
drop the prefix and lowercase first character
e.g. userDisplayName
->
displayName