module MSGraphAPI.Files.Drive (
listDrivesMe
, listDrivesGroup
, Drive(..)
) where
import GHC.Generics (Generic(..))
import qualified Data.Aeson as A (ToJSON(..), FromJSON(..), genericParseJSON)
import Network.OAuth.OAuth2.Internal (AccessToken(..))
import Network.HTTP.Req (Req)
import Data.Text (Text)
import Data.Time (ZonedTime)
import qualified MSGraphAPI.Internal.Common as MSG (get, Collection, aesonOptions)
data Drive = Drive {
Drive -> Text
dId :: Text
, Drive -> Text
dName :: Text
, Drive -> Text
dDescription :: Text
, Drive -> ZonedTime
dLastModifiedDateTime :: ZonedTime
, Drive -> Text
dDriveType :: Text
} deriving (Int -> Drive -> ShowS
[Drive] -> ShowS
Drive -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Drive] -> ShowS
$cshowList :: [Drive] -> ShowS
show :: Drive -> String
$cshow :: Drive -> String
showsPrec :: Int -> Drive -> ShowS
$cshowsPrec :: Int -> Drive -> ShowS
Show, forall x. Rep Drive x -> Drive
forall x. Drive -> Rep Drive x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Drive x -> Drive
$cfrom :: forall x. Drive -> Rep Drive x
Generic)
instance A.FromJSON Drive where
parseJSON :: Value -> Parser Drive
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
A.genericParseJSON (String -> Options
MSG.aesonOptions String
"d")
instance A.ToJSON Drive
listDrivesMe :: AccessToken -> Req (MSG.Collection Drive)
listDrivesMe :: AccessToken -> Req (Collection Drive)
listDrivesMe = forall a.
FromJSON a =>
[Text] -> Option 'Https -> AccessToken -> Req a
MSG.get [Text
"me", Text
"drives"] forall a. Monoid a => a
mempty
listDrivesGroup :: Text
-> AccessToken -> Req (MSG.Collection Drive)
listDrivesGroup :: Text -> AccessToken -> Req (Collection Drive)
listDrivesGroup Text
gid = forall a.
FromJSON a =>
[Text] -> Option 'Https -> AccessToken -> Req a
MSG.get [Text
"groups", Text
gid, Text
"drives"] forall a. Monoid a => a
mempty