{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.DriveActivity.Types.Product where
import Network.Google.DriveActivity.Types.Sum
import Network.Google.Prelude
newtype Suggestion = Suggestion'
{ _sSubtype :: Maybe SuggestionSubtype
} deriving (Eq,Show,Data,Typeable,Generic)
suggestion
:: Suggestion
suggestion =
Suggestion'
{ _sSubtype = Nothing
}
sSubtype :: Lens' Suggestion (Maybe SuggestionSubtype)
sSubtype = lens _sSubtype (\ s a -> s{_sSubtype = a})
instance FromJSON Suggestion where
parseJSON
= withObject "Suggestion"
(\ o -> Suggestion' <$> (o .:? "subtype"))
instance ToJSON Suggestion where
toJSON Suggestion'{..}
= object (catMaybes [("subtype" .=) <$> _sSubtype])
newtype Impersonation = Impersonation'
{ _iImpersonatedUser :: Maybe User
} deriving (Eq,Show,Data,Typeable,Generic)
impersonation
:: Impersonation
impersonation =
Impersonation'
{ _iImpersonatedUser = Nothing
}
iImpersonatedUser :: Lens' Impersonation (Maybe User)
iImpersonatedUser
= lens _iImpersonatedUser
(\ s a -> s{_iImpersonatedUser = a})
instance FromJSON Impersonation where
parseJSON
= withObject "Impersonation"
(\ o ->
Impersonation' <$> (o .:? "impersonatedUser"))
instance ToJSON Impersonation where
toJSON Impersonation'{..}
= object
(catMaybes
[("impersonatedUser" .=) <$> _iImpersonatedUser])
data Edit =
Edit'
deriving (Eq,Show,Data,Typeable,Generic)
edit
:: Edit
edit = Edit'
instance FromJSON Edit where
parseJSON = withObject "Edit" (\ o -> pure Edit')
instance ToJSON Edit where
toJSON = const emptyObject
data ActionDetail = ActionDetail'
{ _adEdit :: !(Maybe Edit)
, _adPermissionChange :: !(Maybe PermissionChange)
, _adRestore :: !(Maybe Restore)
, _adReference :: !(Maybe ApplicationReference)
, _adCreate :: !(Maybe Create)
, _adRename :: !(Maybe Rename)
, _adComment :: !(Maybe Comment)
, _adSettingsChange :: !(Maybe SettingsChange)
, _adDlpChange :: !(Maybe DataLeakPreventionChange)
, _adDelete :: !(Maybe Delete')
, _adMove :: !(Maybe Move)
} deriving (Eq,Show,Data,Typeable,Generic)
actionDetail
:: ActionDetail
actionDetail =
ActionDetail'
{ _adEdit = Nothing
, _adPermissionChange = Nothing
, _adRestore = Nothing
, _adReference = Nothing
, _adCreate = Nothing
, _adRename = Nothing
, _adComment = Nothing
, _adSettingsChange = Nothing
, _adDlpChange = Nothing
, _adDelete = Nothing
, _adMove = Nothing
}
adEdit :: Lens' ActionDetail (Maybe Edit)
adEdit = lens _adEdit (\ s a -> s{_adEdit = a})
adPermissionChange :: Lens' ActionDetail (Maybe PermissionChange)
adPermissionChange
= lens _adPermissionChange
(\ s a -> s{_adPermissionChange = a})
adRestore :: Lens' ActionDetail (Maybe Restore)
adRestore
= lens _adRestore (\ s a -> s{_adRestore = a})
adReference :: Lens' ActionDetail (Maybe ApplicationReference)
adReference
= lens _adReference (\ s a -> s{_adReference = a})
adCreate :: Lens' ActionDetail (Maybe Create)
adCreate = lens _adCreate (\ s a -> s{_adCreate = a})
adRename :: Lens' ActionDetail (Maybe Rename)
adRename = lens _adRename (\ s a -> s{_adRename = a})
adComment :: Lens' ActionDetail (Maybe Comment)
adComment
= lens _adComment (\ s a -> s{_adComment = a})
adSettingsChange :: Lens' ActionDetail (Maybe SettingsChange)
adSettingsChange
= lens _adSettingsChange
(\ s a -> s{_adSettingsChange = a})
adDlpChange :: Lens' ActionDetail (Maybe DataLeakPreventionChange)
adDlpChange
= lens _adDlpChange (\ s a -> s{_adDlpChange = a})
adDelete :: Lens' ActionDetail (Maybe Delete')
adDelete = lens _adDelete (\ s a -> s{_adDelete = a})
adMove :: Lens' ActionDetail (Maybe Move)
adMove = lens _adMove (\ s a -> s{_adMove = a})
instance FromJSON ActionDetail where
parseJSON
= withObject "ActionDetail"
(\ o ->
ActionDetail' <$>
(o .:? "edit") <*> (o .:? "permissionChange") <*>
(o .:? "restore")
<*> (o .:? "reference")
<*> (o .:? "create")
<*> (o .:? "rename")
<*> (o .:? "comment")
<*> (o .:? "settingsChange")
<*> (o .:? "dlpChange")
<*> (o .:? "delete")
<*> (o .:? "move"))
instance ToJSON ActionDetail where
toJSON ActionDetail'{..}
= object
(catMaybes
[("edit" .=) <$> _adEdit,
("permissionChange" .=) <$> _adPermissionChange,
("restore" .=) <$> _adRestore,
("reference" .=) <$> _adReference,
("create" .=) <$> _adCreate,
("rename" .=) <$> _adRename,
("comment" .=) <$> _adComment,
("settingsChange" .=) <$> _adSettingsChange,
("dlpChange" .=) <$> _adDlpChange,
("delete" .=) <$> _adDelete,
("move" .=) <$> _adMove])
data Group = Group'
{ _gEmail :: !(Maybe Text)
, _gTitle :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
group'
:: Group
group' =
Group'
{ _gEmail = Nothing
, _gTitle = Nothing
}
gEmail :: Lens' Group (Maybe Text)
gEmail = lens _gEmail (\ s a -> s{_gEmail = a})
gTitle :: Lens' Group (Maybe Text)
gTitle = lens _gTitle (\ s a -> s{_gTitle = a})
instance FromJSON Group where
parseJSON
= withObject "Group"
(\ o ->
Group' <$> (o .:? "email") <*> (o .:? "title"))
instance ToJSON Group where
toJSON Group'{..}
= object
(catMaybes
[("email" .=) <$> _gEmail, ("title" .=) <$> _gTitle])
data TimeRange = TimeRange'
{ _trStartTime :: !(Maybe DateTime')
, _trEndTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
timeRange
:: TimeRange
timeRange =
TimeRange'
{ _trStartTime = Nothing
, _trEndTime = Nothing
}
trStartTime :: Lens' TimeRange (Maybe UTCTime)
trStartTime
= lens _trStartTime (\ s a -> s{_trStartTime = a}) .
mapping _DateTime
trEndTime :: Lens' TimeRange (Maybe UTCTime)
trEndTime
= lens _trEndTime (\ s a -> s{_trEndTime = a}) .
mapping _DateTime
instance FromJSON TimeRange where
parseJSON
= withObject "TimeRange"
(\ o ->
TimeRange' <$>
(o .:? "startTime") <*> (o .:? "endTime"))
instance ToJSON TimeRange where
toJSON TimeRange'{..}
= object
(catMaybes
[("startTime" .=) <$> _trStartTime,
("endTime" .=) <$> _trEndTime])
data QueryDriveActivityRequest = QueryDriveActivityRequest'
{ _qdarAncestorName :: !(Maybe Text)
, _qdarItemName :: !(Maybe Text)
, _qdarConsolidationStrategy :: !(Maybe ConsolidationStrategy)
, _qdarFilter :: !(Maybe Text)
, _qdarPageToken :: !(Maybe Text)
, _qdarPageSize :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
queryDriveActivityRequest
:: QueryDriveActivityRequest
queryDriveActivityRequest =
QueryDriveActivityRequest'
{ _qdarAncestorName = Nothing
, _qdarItemName = Nothing
, _qdarConsolidationStrategy = Nothing
, _qdarFilter = Nothing
, _qdarPageToken = Nothing
, _qdarPageSize = Nothing
}
qdarAncestorName :: Lens' QueryDriveActivityRequest (Maybe Text)
qdarAncestorName
= lens _qdarAncestorName
(\ s a -> s{_qdarAncestorName = a})
qdarItemName :: Lens' QueryDriveActivityRequest (Maybe Text)
qdarItemName
= lens _qdarItemName (\ s a -> s{_qdarItemName = a})
qdarConsolidationStrategy :: Lens' QueryDriveActivityRequest (Maybe ConsolidationStrategy)
qdarConsolidationStrategy
= lens _qdarConsolidationStrategy
(\ s a -> s{_qdarConsolidationStrategy = a})
qdarFilter :: Lens' QueryDriveActivityRequest (Maybe Text)
qdarFilter
= lens _qdarFilter (\ s a -> s{_qdarFilter = a})
qdarPageToken :: Lens' QueryDriveActivityRequest (Maybe Text)
qdarPageToken
= lens _qdarPageToken
(\ s a -> s{_qdarPageToken = a})
qdarPageSize :: Lens' QueryDriveActivityRequest (Maybe Int32)
qdarPageSize
= lens _qdarPageSize (\ s a -> s{_qdarPageSize = a})
. mapping _Coerce
instance FromJSON QueryDriveActivityRequest where
parseJSON
= withObject "QueryDriveActivityRequest"
(\ o ->
QueryDriveActivityRequest' <$>
(o .:? "ancestorName") <*> (o .:? "itemName") <*>
(o .:? "consolidationStrategy")
<*> (o .:? "filter")
<*> (o .:? "pageToken")
<*> (o .:? "pageSize"))
instance ToJSON QueryDriveActivityRequest where
toJSON QueryDriveActivityRequest'{..}
= object
(catMaybes
[("ancestorName" .=) <$> _qdarAncestorName,
("itemName" .=) <$> _qdarItemName,
("consolidationStrategy" .=) <$>
_qdarConsolidationStrategy,
("filter" .=) <$> _qdarFilter,
("pageToken" .=) <$> _qdarPageToken,
("pageSize" .=) <$> _qdarPageSize])
data DriveItemReference = DriveItemReference'
{ _dirFolder :: !(Maybe Folder)
, _dirName :: !(Maybe Text)
, _dirTitle :: !(Maybe Text)
, _dirFile :: !(Maybe File)
} deriving (Eq,Show,Data,Typeable,Generic)
driveItemReference
:: DriveItemReference
driveItemReference =
DriveItemReference'
{ _dirFolder = Nothing
, _dirName = Nothing
, _dirTitle = Nothing
, _dirFile = Nothing
}
dirFolder :: Lens' DriveItemReference (Maybe Folder)
dirFolder
= lens _dirFolder (\ s a -> s{_dirFolder = a})
dirName :: Lens' DriveItemReference (Maybe Text)
dirName = lens _dirName (\ s a -> s{_dirName = a})
dirTitle :: Lens' DriveItemReference (Maybe Text)
dirTitle = lens _dirTitle (\ s a -> s{_dirTitle = a})
dirFile :: Lens' DriveItemReference (Maybe File)
dirFile = lens _dirFile (\ s a -> s{_dirFile = a})
instance FromJSON DriveItemReference where
parseJSON
= withObject "DriveItemReference"
(\ o ->
DriveItemReference' <$>
(o .:? "folder") <*> (o .:? "name") <*>
(o .:? "title")
<*> (o .:? "file"))
instance ToJSON DriveItemReference where
toJSON DriveItemReference'{..}
= object
(catMaybes
[("folder" .=) <$> _dirFolder,
("name" .=) <$> _dirName, ("title" .=) <$> _dirTitle,
("file" .=) <$> _dirFile])
data KnownUser = KnownUser'
{ _kuPersonName :: !(Maybe Text)
, _kuIsCurrentUser :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
knownUser
:: KnownUser
knownUser =
KnownUser'
{ _kuPersonName = Nothing
, _kuIsCurrentUser = Nothing
}
kuPersonName :: Lens' KnownUser (Maybe Text)
kuPersonName
= lens _kuPersonName (\ s a -> s{_kuPersonName = a})
kuIsCurrentUser :: Lens' KnownUser (Maybe Bool)
kuIsCurrentUser
= lens _kuIsCurrentUser
(\ s a -> s{_kuIsCurrentUser = a})
instance FromJSON KnownUser where
parseJSON
= withObject "KnownUser"
(\ o ->
KnownUser' <$>
(o .:? "personName") <*> (o .:? "isCurrentUser"))
instance ToJSON KnownUser where
toJSON KnownUser'{..}
= object
(catMaybes
[("personName" .=) <$> _kuPersonName,
("isCurrentUser" .=) <$> _kuIsCurrentUser])
data TargetReference = TargetReference'
{ _trTeamDrive :: !(Maybe TeamDriveReference)
, _trDriveItem :: !(Maybe DriveItemReference)
} deriving (Eq,Show,Data,Typeable,Generic)
targetReference
:: TargetReference
targetReference =
TargetReference'
{ _trTeamDrive = Nothing
, _trDriveItem = Nothing
}
trTeamDrive :: Lens' TargetReference (Maybe TeamDriveReference)
trTeamDrive
= lens _trTeamDrive (\ s a -> s{_trTeamDrive = a})
trDriveItem :: Lens' TargetReference (Maybe DriveItemReference)
trDriveItem
= lens _trDriveItem (\ s a -> s{_trDriveItem = a})
instance FromJSON TargetReference where
parseJSON
= withObject "TargetReference"
(\ o ->
TargetReference' <$>
(o .:? "teamDrive") <*> (o .:? "driveItem"))
instance ToJSON TargetReference where
toJSON TargetReference'{..}
= object
(catMaybes
[("teamDrive" .=) <$> _trTeamDrive,
("driveItem" .=) <$> _trDriveItem])
newtype Copy = Copy'
{ _cOriginalObject :: Maybe TargetReference
} deriving (Eq,Show,Data,Typeable,Generic)
copy
:: Copy
copy =
Copy'
{ _cOriginalObject = Nothing
}
cOriginalObject :: Lens' Copy (Maybe TargetReference)
cOriginalObject
= lens _cOriginalObject
(\ s a -> s{_cOriginalObject = a})
instance FromJSON Copy where
parseJSON
= withObject "Copy"
(\ o -> Copy' <$> (o .:? "originalObject"))
instance ToJSON Copy where
toJSON Copy'{..}
= object
(catMaybes
[("originalObject" .=) <$> _cOriginalObject])
data PermissionChange = PermissionChange'
{ _pcAddedPermissions :: !(Maybe [Permission])
, _pcRemovedPermissions :: !(Maybe [Permission])
} deriving (Eq,Show,Data,Typeable,Generic)
permissionChange
:: PermissionChange
permissionChange =
PermissionChange'
{ _pcAddedPermissions = Nothing
, _pcRemovedPermissions = Nothing
}
pcAddedPermissions :: Lens' PermissionChange [Permission]
pcAddedPermissions
= lens _pcAddedPermissions
(\ s a -> s{_pcAddedPermissions = a})
. _Default
. _Coerce
pcRemovedPermissions :: Lens' PermissionChange [Permission]
pcRemovedPermissions
= lens _pcRemovedPermissions
(\ s a -> s{_pcRemovedPermissions = a})
. _Default
. _Coerce
instance FromJSON PermissionChange where
parseJSON
= withObject "PermissionChange"
(\ o ->
PermissionChange' <$>
(o .:? "addedPermissions" .!= mempty) <*>
(o .:? "removedPermissions" .!= mempty))
instance ToJSON PermissionChange where
toJSON PermissionChange'{..}
= object
(catMaybes
[("addedPermissions" .=) <$> _pcAddedPermissions,
("removedPermissions" .=) <$> _pcRemovedPermissions])
data QueryDriveActivityResponse = QueryDriveActivityResponse'
{ _qdarNextPageToken :: !(Maybe Text)
, _qdarActivities :: !(Maybe [DriveActivity])
} deriving (Eq,Show,Data,Typeable,Generic)
queryDriveActivityResponse
:: QueryDriveActivityResponse
queryDriveActivityResponse =
QueryDriveActivityResponse'
{ _qdarNextPageToken = Nothing
, _qdarActivities = Nothing
}
qdarNextPageToken :: Lens' QueryDriveActivityResponse (Maybe Text)
qdarNextPageToken
= lens _qdarNextPageToken
(\ s a -> s{_qdarNextPageToken = a})
qdarActivities :: Lens' QueryDriveActivityResponse [DriveActivity]
qdarActivities
= lens _qdarActivities
(\ s a -> s{_qdarActivities = a})
. _Default
. _Coerce
instance FromJSON QueryDriveActivityResponse where
parseJSON
= withObject "QueryDriveActivityResponse"
(\ o ->
QueryDriveActivityResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "activities" .!= mempty))
instance ToJSON QueryDriveActivityResponse where
toJSON QueryDriveActivityResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _qdarNextPageToken,
("activities" .=) <$> _qdarActivities])
newtype Post' = Post''
{ _pSubtype :: Maybe PostSubtype
} deriving (Eq,Show,Data,Typeable,Generic)
post
:: Post'
post =
Post''
{ _pSubtype = Nothing
}
pSubtype :: Lens' Post' (Maybe PostSubtype)
pSubtype = lens _pSubtype (\ s a -> s{_pSubtype = a})
instance FromJSON Post' where
parseJSON
= withObject "Post"
(\ o -> Post'' <$> (o .:? "subtype"))
instance ToJSON Post' where
toJSON Post''{..}
= object (catMaybes [("subtype" .=) <$> _pSubtype])
newtype Restore = Restore'
{ _rType :: Maybe RestoreType
} deriving (Eq,Show,Data,Typeable,Generic)
restore
:: Restore
restore =
Restore'
{ _rType = Nothing
}
rType :: Lens' Restore (Maybe RestoreType)
rType = lens _rType (\ s a -> s{_rType = a})
instance FromJSON Restore where
parseJSON
= withObject "Restore"
(\ o -> Restore' <$> (o .:? "type"))
instance ToJSON Restore where
toJSON Restore'{..}
= object (catMaybes [("type" .=) <$> _rType])
data Domain = Domain'
{ _dLegacyId :: !(Maybe Text)
, _dName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
domain
:: Domain
domain =
Domain'
{ _dLegacyId = Nothing
, _dName = Nothing
}
dLegacyId :: Lens' Domain (Maybe Text)
dLegacyId
= lens _dLegacyId (\ s a -> s{_dLegacyId = a})
dName :: Lens' Domain (Maybe Text)
dName = lens _dName (\ s a -> s{_dName = a})
instance FromJSON Domain where
parseJSON
= withObject "Domain"
(\ o ->
Domain' <$> (o .:? "legacyId") <*> (o .:? "name"))
instance ToJSON Domain where
toJSON Domain'{..}
= object
(catMaybes
[("legacyId" .=) <$> _dLegacyId,
("name" .=) <$> _dName])
data Administrator =
Administrator'
deriving (Eq,Show,Data,Typeable,Generic)
administrator
:: Administrator
administrator = Administrator'
instance FromJSON Administrator where
parseJSON
= withObject "Administrator"
(\ o -> pure Administrator')
instance ToJSON Administrator where
toJSON = const emptyObject
newtype DataLeakPreventionChange = DataLeakPreventionChange'
{ _dlpcType :: Maybe DataLeakPreventionChangeType
} deriving (Eq,Show,Data,Typeable,Generic)
dataLeakPreventionChange
:: DataLeakPreventionChange
dataLeakPreventionChange =
DataLeakPreventionChange'
{ _dlpcType = Nothing
}
dlpcType :: Lens' DataLeakPreventionChange (Maybe DataLeakPreventionChangeType)
dlpcType = lens _dlpcType (\ s a -> s{_dlpcType = a})
instance FromJSON DataLeakPreventionChange where
parseJSON
= withObject "DataLeakPreventionChange"
(\ o -> DataLeakPreventionChange' <$> (o .:? "type"))
instance ToJSON DataLeakPreventionChange where
toJSON DataLeakPreventionChange'{..}
= object (catMaybes [("type" .=) <$> _dlpcType])
data Actor = Actor'
{ _aImpersonation :: !(Maybe Impersonation)
, _aSystem :: !(Maybe SystemEvent)
, _aAdministrator :: !(Maybe Administrator)
, _aUser :: !(Maybe User)
, _aAnonymous :: !(Maybe AnonymousUser)
} deriving (Eq,Show,Data,Typeable,Generic)
actor
:: Actor
actor =
Actor'
{ _aImpersonation = Nothing
, _aSystem = Nothing
, _aAdministrator = Nothing
, _aUser = Nothing
, _aAnonymous = Nothing
}
aImpersonation :: Lens' Actor (Maybe Impersonation)
aImpersonation
= lens _aImpersonation
(\ s a -> s{_aImpersonation = a})
aSystem :: Lens' Actor (Maybe SystemEvent)
aSystem = lens _aSystem (\ s a -> s{_aSystem = a})
aAdministrator :: Lens' Actor (Maybe Administrator)
aAdministrator
= lens _aAdministrator
(\ s a -> s{_aAdministrator = a})
aUser :: Lens' Actor (Maybe User)
aUser = lens _aUser (\ s a -> s{_aUser = a})
aAnonymous :: Lens' Actor (Maybe AnonymousUser)
aAnonymous
= lens _aAnonymous (\ s a -> s{_aAnonymous = a})
instance FromJSON Actor where
parseJSON
= withObject "Actor"
(\ o ->
Actor' <$>
(o .:? "impersonation") <*> (o .:? "system") <*>
(o .:? "administrator")
<*> (o .:? "user")
<*> (o .:? "anonymous"))
instance ToJSON Actor where
toJSON Actor'{..}
= object
(catMaybes
[("impersonation" .=) <$> _aImpersonation,
("system" .=) <$> _aSystem,
("administrator" .=) <$> _aAdministrator,
("user" .=) <$> _aUser,
("anonymous" .=) <$> _aAnonymous])
newtype Folder = Folder'
{ _fType :: Maybe FolderType
} deriving (Eq,Show,Data,Typeable,Generic)
folder
:: Folder
folder =
Folder'
{ _fType = Nothing
}
fType :: Lens' Folder (Maybe FolderType)
fType = lens _fType (\ s a -> s{_fType = a})
instance FromJSON Folder where
parseJSON
= withObject "Folder"
(\ o -> Folder' <$> (o .:? "type"))
instance ToJSON Folder where
toJSON Folder'{..}
= object (catMaybes [("type" .=) <$> _fType])
data Action = Action'
{ _aTimeRange :: !(Maybe TimeRange)
, _aActor :: !(Maybe Actor)
, _aTimestamp :: !(Maybe DateTime')
, _aTarget :: !(Maybe Target)
, _aDetail :: !(Maybe ActionDetail)
} deriving (Eq,Show,Data,Typeable,Generic)
action
:: Action
action =
Action'
{ _aTimeRange = Nothing
, _aActor = Nothing
, _aTimestamp = Nothing
, _aTarget = Nothing
, _aDetail = Nothing
}
aTimeRange :: Lens' Action (Maybe TimeRange)
aTimeRange
= lens _aTimeRange (\ s a -> s{_aTimeRange = a})
aActor :: Lens' Action (Maybe Actor)
aActor = lens _aActor (\ s a -> s{_aActor = a})
aTimestamp :: Lens' Action (Maybe UTCTime)
aTimestamp
= lens _aTimestamp (\ s a -> s{_aTimestamp = a}) .
mapping _DateTime
aTarget :: Lens' Action (Maybe Target)
aTarget = lens _aTarget (\ s a -> s{_aTarget = a})
aDetail :: Lens' Action (Maybe ActionDetail)
aDetail = lens _aDetail (\ s a -> s{_aDetail = a})
instance FromJSON Action where
parseJSON
= withObject "Action"
(\ o ->
Action' <$>
(o .:? "timeRange") <*> (o .:? "actor") <*>
(o .:? "timestamp")
<*> (o .:? "target")
<*> (o .:? "detail"))
instance ToJSON Action where
toJSON Action'{..}
= object
(catMaybes
[("timeRange" .=) <$> _aTimeRange,
("actor" .=) <$> _aActor,
("timestamp" .=) <$> _aTimestamp,
("target" .=) <$> _aTarget,
("detail" .=) <$> _aDetail])
data TeamDrive = TeamDrive'
{ _tdRoot :: !(Maybe DriveItem)
, _tdName :: !(Maybe Text)
, _tdTitle :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
teamDrive
:: TeamDrive
teamDrive =
TeamDrive'
{ _tdRoot = Nothing
, _tdName = Nothing
, _tdTitle = Nothing
}
tdRoot :: Lens' TeamDrive (Maybe DriveItem)
tdRoot = lens _tdRoot (\ s a -> s{_tdRoot = a})
tdName :: Lens' TeamDrive (Maybe Text)
tdName = lens _tdName (\ s a -> s{_tdName = a})
tdTitle :: Lens' TeamDrive (Maybe Text)
tdTitle = lens _tdTitle (\ s a -> s{_tdTitle = a})
instance FromJSON TeamDrive where
parseJSON
= withObject "TeamDrive"
(\ o ->
TeamDrive' <$>
(o .:? "root") <*> (o .:? "name") <*>
(o .:? "title"))
instance ToJSON TeamDrive where
toJSON TeamDrive'{..}
= object
(catMaybes
[("root" .=) <$> _tdRoot, ("name" .=) <$> _tdName,
("title" .=) <$> _tdTitle])
data UnknownUser =
UnknownUser'
deriving (Eq,Show,Data,Typeable,Generic)
unknownUser
:: UnknownUser
unknownUser = UnknownUser'
instance FromJSON UnknownUser where
parseJSON
= withObject "UnknownUser" (\ o -> pure UnknownUser')
instance ToJSON UnknownUser where
toJSON = const emptyObject
data Owner = Owner'
{ _oDomain :: !(Maybe Domain)
, _oTeamDrive :: !(Maybe TeamDriveReference)
, _oUser :: !(Maybe User)
} deriving (Eq,Show,Data,Typeable,Generic)
owner
:: Owner
owner =
Owner'
{ _oDomain = Nothing
, _oTeamDrive = Nothing
, _oUser = Nothing
}
oDomain :: Lens' Owner (Maybe Domain)
oDomain = lens _oDomain (\ s a -> s{_oDomain = a})
oTeamDrive :: Lens' Owner (Maybe TeamDriveReference)
oTeamDrive
= lens _oTeamDrive (\ s a -> s{_oTeamDrive = a})
oUser :: Lens' Owner (Maybe User)
oUser = lens _oUser (\ s a -> s{_oUser = a})
instance FromJSON Owner where
parseJSON
= withObject "Owner"
(\ o ->
Owner' <$>
(o .:? "domain") <*> (o .:? "teamDrive") <*>
(o .:? "user"))
instance ToJSON Owner where
toJSON Owner'{..}
= object
(catMaybes
[("domain" .=) <$> _oDomain,
("teamDrive" .=) <$> _oTeamDrive,
("user" .=) <$> _oUser])
newtype ApplicationReference = ApplicationReference'
{ _arType :: Maybe ApplicationReferenceType
} deriving (Eq,Show,Data,Typeable,Generic)
applicationReference
:: ApplicationReference
applicationReference =
ApplicationReference'
{ _arType = Nothing
}
arType :: Lens' ApplicationReference (Maybe ApplicationReferenceType)
arType = lens _arType (\ s a -> s{_arType = a})
instance FromJSON ApplicationReference where
parseJSON
= withObject "ApplicationReference"
(\ o -> ApplicationReference' <$> (o .:? "type"))
instance ToJSON ApplicationReference where
toJSON ApplicationReference'{..}
= object (catMaybes [("type" .=) <$> _arType])
data ConsolidationStrategy = ConsolidationStrategy'
{ _csNone :: !(Maybe NoConsolidation)
, _csLegacy :: !(Maybe Legacy)
} deriving (Eq,Show,Data,Typeable,Generic)
consolidationStrategy
:: ConsolidationStrategy
consolidationStrategy =
ConsolidationStrategy'
{ _csNone = Nothing
, _csLegacy = Nothing
}
csNone :: Lens' ConsolidationStrategy (Maybe NoConsolidation)
csNone = lens _csNone (\ s a -> s{_csNone = a})
csLegacy :: Lens' ConsolidationStrategy (Maybe Legacy)
csLegacy = lens _csLegacy (\ s a -> s{_csLegacy = a})
instance FromJSON ConsolidationStrategy where
parseJSON
= withObject "ConsolidationStrategy"
(\ o ->
ConsolidationStrategy' <$>
(o .:? "none") <*> (o .:? "legacy"))
instance ToJSON ConsolidationStrategy where
toJSON ConsolidationStrategy'{..}
= object
(catMaybes
[("none" .=) <$> _csNone,
("legacy" .=) <$> _csLegacy])
data User = User'
{ _uKnownUser :: !(Maybe KnownUser)
, _uUnknownUser :: !(Maybe UnknownUser)
, _uDeletedUser :: !(Maybe DeletedUser)
} deriving (Eq,Show,Data,Typeable,Generic)
user
:: User
user =
User'
{ _uKnownUser = Nothing
, _uUnknownUser = Nothing
, _uDeletedUser = Nothing
}
uKnownUser :: Lens' User (Maybe KnownUser)
uKnownUser
= lens _uKnownUser (\ s a -> s{_uKnownUser = a})
uUnknownUser :: Lens' User (Maybe UnknownUser)
uUnknownUser
= lens _uUnknownUser (\ s a -> s{_uUnknownUser = a})
uDeletedUser :: Lens' User (Maybe DeletedUser)
uDeletedUser
= lens _uDeletedUser (\ s a -> s{_uDeletedUser = a})
instance FromJSON User where
parseJSON
= withObject "User"
(\ o ->
User' <$>
(o .:? "knownUser") <*> (o .:? "unknownUser") <*>
(o .:? "deletedUser"))
instance ToJSON User where
toJSON User'{..}
= object
(catMaybes
[("knownUser" .=) <$> _uKnownUser,
("unknownUser" .=) <$> _uUnknownUser,
("deletedUser" .=) <$> _uDeletedUser])
data DeletedUser =
DeletedUser'
deriving (Eq,Show,Data,Typeable,Generic)
deletedUser
:: DeletedUser
deletedUser = DeletedUser'
instance FromJSON DeletedUser where
parseJSON
= withObject "DeletedUser" (\ o -> pure DeletedUser')
instance ToJSON DeletedUser where
toJSON = const emptyObject
data Create = Create'
{ _cCopy :: !(Maybe Copy)
, _cNew :: !(Maybe New)
, _cUpload :: !(Maybe Upload)
} deriving (Eq,Show,Data,Typeable,Generic)
create
:: Create
create =
Create'
{ _cCopy = Nothing
, _cNew = Nothing
, _cUpload = Nothing
}
cCopy :: Lens' Create (Maybe Copy)
cCopy = lens _cCopy (\ s a -> s{_cCopy = a})
cNew :: Lens' Create (Maybe New)
cNew = lens _cNew (\ s a -> s{_cNew = a})
cUpload :: Lens' Create (Maybe Upload)
cUpload = lens _cUpload (\ s a -> s{_cUpload = a})
instance FromJSON Create where
parseJSON
= withObject "Create"
(\ o ->
Create' <$>
(o .:? "copy") <*> (o .:? "new") <*>
(o .:? "upload"))
instance ToJSON Create where
toJSON Create'{..}
= object
(catMaybes
[("copy" .=) <$> _cCopy, ("new" .=) <$> _cNew,
("upload" .=) <$> _cUpload])
data New =
New'
deriving (Eq,Show,Data,Typeable,Generic)
new
:: New
new = New'
instance FromJSON New where
parseJSON = withObject "New" (\ o -> pure New')
instance ToJSON New where
toJSON = const emptyObject
data TeamDriveReference = TeamDriveReference'
{ _tdrName :: !(Maybe Text)
, _tdrTitle :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
teamDriveReference
:: TeamDriveReference
teamDriveReference =
TeamDriveReference'
{ _tdrName = Nothing
, _tdrTitle = Nothing
}
tdrName :: Lens' TeamDriveReference (Maybe Text)
tdrName = lens _tdrName (\ s a -> s{_tdrName = a})
tdrTitle :: Lens' TeamDriveReference (Maybe Text)
tdrTitle = lens _tdrTitle (\ s a -> s{_tdrTitle = a})
instance FromJSON TeamDriveReference where
parseJSON
= withObject "TeamDriveReference"
(\ o ->
TeamDriveReference' <$>
(o .:? "name") <*> (o .:? "title"))
instance ToJSON TeamDriveReference where
toJSON TeamDriveReference'{..}
= object
(catMaybes
[("name" .=) <$> _tdrName,
("title" .=) <$> _tdrTitle])
data AnonymousUser =
AnonymousUser'
deriving (Eq,Show,Data,Typeable,Generic)
anonymousUser
:: AnonymousUser
anonymousUser = AnonymousUser'
instance FromJSON AnonymousUser where
parseJSON
= withObject "AnonymousUser"
(\ o -> pure AnonymousUser')
instance ToJSON AnonymousUser where
toJSON = const emptyObject
data Anyone =
Anyone'
deriving (Eq,Show,Data,Typeable,Generic)
anyone
:: Anyone
anyone = Anyone'
instance FromJSON Anyone where
parseJSON = withObject "Anyone" (\ o -> pure Anyone')
instance ToJSON Anyone where
toJSON = const emptyObject
data RestrictionChange = RestrictionChange'
{ _rcFeature :: !(Maybe RestrictionChangeFeature)
, _rcNewRestriction :: !(Maybe RestrictionChangeNewRestriction)
} deriving (Eq,Show,Data,Typeable,Generic)
restrictionChange
:: RestrictionChange
restrictionChange =
RestrictionChange'
{ _rcFeature = Nothing
, _rcNewRestriction = Nothing
}
rcFeature :: Lens' RestrictionChange (Maybe RestrictionChangeFeature)
rcFeature
= lens _rcFeature (\ s a -> s{_rcFeature = a})
rcNewRestriction :: Lens' RestrictionChange (Maybe RestrictionChangeNewRestriction)
rcNewRestriction
= lens _rcNewRestriction
(\ s a -> s{_rcNewRestriction = a})
instance FromJSON RestrictionChange where
parseJSON
= withObject "RestrictionChange"
(\ o ->
RestrictionChange' <$>
(o .:? "feature") <*> (o .:? "newRestriction"))
instance ToJSON RestrictionChange where
toJSON RestrictionChange'{..}
= object
(catMaybes
[("feature" .=) <$> _rcFeature,
("newRestriction" .=) <$> _rcNewRestriction])
data Legacy =
Legacy'
deriving (Eq,Show,Data,Typeable,Generic)
legacy
:: Legacy
legacy = Legacy'
instance FromJSON Legacy where
parseJSON = withObject "Legacy" (\ o -> pure Legacy')
instance ToJSON Legacy where
toJSON = const emptyObject
data FileComment = FileComment'
{ _fcParent :: !(Maybe DriveItem)
, _fcLegacyDiscussionId :: !(Maybe Text)
, _fcLegacyCommentId :: !(Maybe Text)
, _fcLinkToDiscussion :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
fileComment
:: FileComment
fileComment =
FileComment'
{ _fcParent = Nothing
, _fcLegacyDiscussionId = Nothing
, _fcLegacyCommentId = Nothing
, _fcLinkToDiscussion = Nothing
}
fcParent :: Lens' FileComment (Maybe DriveItem)
fcParent = lens _fcParent (\ s a -> s{_fcParent = a})
fcLegacyDiscussionId :: Lens' FileComment (Maybe Text)
fcLegacyDiscussionId
= lens _fcLegacyDiscussionId
(\ s a -> s{_fcLegacyDiscussionId = a})
fcLegacyCommentId :: Lens' FileComment (Maybe Text)
fcLegacyCommentId
= lens _fcLegacyCommentId
(\ s a -> s{_fcLegacyCommentId = a})
fcLinkToDiscussion :: Lens' FileComment (Maybe Text)
fcLinkToDiscussion
= lens _fcLinkToDiscussion
(\ s a -> s{_fcLinkToDiscussion = a})
instance FromJSON FileComment where
parseJSON
= withObject "FileComment"
(\ o ->
FileComment' <$>
(o .:? "parent") <*> (o .:? "legacyDiscussionId") <*>
(o .:? "legacyCommentId")
<*> (o .:? "linkToDiscussion"))
instance ToJSON FileComment where
toJSON FileComment'{..}
= object
(catMaybes
[("parent" .=) <$> _fcParent,
("legacyDiscussionId" .=) <$> _fcLegacyDiscussionId,
("legacyCommentId" .=) <$> _fcLegacyCommentId,
("linkToDiscussion" .=) <$> _fcLinkToDiscussion])
data Rename = Rename'
{ _rNewTitle :: !(Maybe Text)
, _rOldTitle :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
rename
:: Rename
rename =
Rename'
{ _rNewTitle = Nothing
, _rOldTitle = Nothing
}
rNewTitle :: Lens' Rename (Maybe Text)
rNewTitle
= lens _rNewTitle (\ s a -> s{_rNewTitle = a})
rOldTitle :: Lens' Rename (Maybe Text)
rOldTitle
= lens _rOldTitle (\ s a -> s{_rOldTitle = a})
instance FromJSON Rename where
parseJSON
= withObject "Rename"
(\ o ->
Rename' <$>
(o .:? "newTitle") <*> (o .:? "oldTitle"))
instance ToJSON Rename where
toJSON Rename'{..}
= object
(catMaybes
[("newTitle" .=) <$> _rNewTitle,
("oldTitle" .=) <$> _rOldTitle])
data Upload =
Upload'
deriving (Eq,Show,Data,Typeable,Generic)
upload
:: Upload
upload = Upload'
instance FromJSON Upload where
parseJSON = withObject "Upload" (\ o -> pure Upload')
instance ToJSON Upload where
toJSON = const emptyObject
data NoConsolidation =
NoConsolidation'
deriving (Eq,Show,Data,Typeable,Generic)
noConsolidation
:: NoConsolidation
noConsolidation = NoConsolidation'
instance FromJSON NoConsolidation where
parseJSON
= withObject "NoConsolidation"
(\ o -> pure NoConsolidation')
instance ToJSON NoConsolidation where
toJSON = const emptyObject
newtype Assignment = Assignment'
{ _aSubtype :: Maybe AssignmentSubtype
} deriving (Eq,Show,Data,Typeable,Generic)
assignment
:: Assignment
assignment =
Assignment'
{ _aSubtype = Nothing
}
aSubtype :: Lens' Assignment (Maybe AssignmentSubtype)
aSubtype = lens _aSubtype (\ s a -> s{_aSubtype = a})
instance FromJSON Assignment where
parseJSON
= withObject "Assignment"
(\ o -> Assignment' <$> (o .:? "subtype"))
instance ToJSON Assignment where
toJSON Assignment'{..}
= object (catMaybes [("subtype" .=) <$> _aSubtype])
newtype SettingsChange = SettingsChange'
{ _scRestrictionChanges :: Maybe [RestrictionChange]
} deriving (Eq,Show,Data,Typeable,Generic)
settingsChange
:: SettingsChange
settingsChange =
SettingsChange'
{ _scRestrictionChanges = Nothing
}
scRestrictionChanges :: Lens' SettingsChange [RestrictionChange]
scRestrictionChanges
= lens _scRestrictionChanges
(\ s a -> s{_scRestrictionChanges = a})
. _Default
. _Coerce
instance FromJSON SettingsChange where
parseJSON
= withObject "SettingsChange"
(\ o ->
SettingsChange' <$>
(o .:? "restrictionChanges" .!= mempty))
instance ToJSON SettingsChange where
toJSON SettingsChange'{..}
= object
(catMaybes
[("restrictionChanges" .=) <$>
_scRestrictionChanges])
data Comment = Comment'
{ _cSuggestion :: !(Maybe Suggestion)
, _cPost :: !(Maybe Post')
, _cMentionedUsers :: !(Maybe [User])
, _cAssignment :: !(Maybe Assignment)
} deriving (Eq,Show,Data,Typeable,Generic)
comment
:: Comment
comment =
Comment'
{ _cSuggestion = Nothing
, _cPost = Nothing
, _cMentionedUsers = Nothing
, _cAssignment = Nothing
}
cSuggestion :: Lens' Comment (Maybe Suggestion)
cSuggestion
= lens _cSuggestion (\ s a -> s{_cSuggestion = a})
cPost :: Lens' Comment (Maybe Post')
cPost = lens _cPost (\ s a -> s{_cPost = a})
cMentionedUsers :: Lens' Comment [User]
cMentionedUsers
= lens _cMentionedUsers
(\ s a -> s{_cMentionedUsers = a})
. _Default
. _Coerce
cAssignment :: Lens' Comment (Maybe Assignment)
cAssignment
= lens _cAssignment (\ s a -> s{_cAssignment = a})
instance FromJSON Comment where
parseJSON
= withObject "Comment"
(\ o ->
Comment' <$>
(o .:? "suggestion") <*> (o .:? "post") <*>
(o .:? "mentionedUsers" .!= mempty)
<*> (o .:? "assignment"))
instance ToJSON Comment where
toJSON Comment'{..}
= object
(catMaybes
[("suggestion" .=) <$> _cSuggestion,
("post" .=) <$> _cPost,
("mentionedUsers" .=) <$> _cMentionedUsers,
("assignment" .=) <$> _cAssignment])
data Permission = Permission'
{ _pGroup :: !(Maybe Group)
, _pDomain :: !(Maybe Domain)
, _pUser :: !(Maybe User)
, _pRole :: !(Maybe PermissionRole)
, _pAnyone :: !(Maybe Anyone)
, _pAllowDiscovery :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
permission
:: Permission
permission =
Permission'
{ _pGroup = Nothing
, _pDomain = Nothing
, _pUser = Nothing
, _pRole = Nothing
, _pAnyone = Nothing
, _pAllowDiscovery = Nothing
}
pGroup :: Lens' Permission (Maybe Group)
pGroup = lens _pGroup (\ s a -> s{_pGroup = a})
pDomain :: Lens' Permission (Maybe Domain)
pDomain = lens _pDomain (\ s a -> s{_pDomain = a})
pUser :: Lens' Permission (Maybe User)
pUser = lens _pUser (\ s a -> s{_pUser = a})
pRole :: Lens' Permission (Maybe PermissionRole)
pRole = lens _pRole (\ s a -> s{_pRole = a})
pAnyone :: Lens' Permission (Maybe Anyone)
pAnyone = lens _pAnyone (\ s a -> s{_pAnyone = a})
pAllowDiscovery :: Lens' Permission (Maybe Bool)
pAllowDiscovery
= lens _pAllowDiscovery
(\ s a -> s{_pAllowDiscovery = a})
instance FromJSON Permission where
parseJSON
= withObject "Permission"
(\ o ->
Permission' <$>
(o .:? "group") <*> (o .:? "domain") <*>
(o .:? "user")
<*> (o .:? "role")
<*> (o .:? "anyone")
<*> (o .:? "allowDiscovery"))
instance ToJSON Permission where
toJSON Permission'{..}
= object
(catMaybes
[("group" .=) <$> _pGroup,
("domain" .=) <$> _pDomain, ("user" .=) <$> _pUser,
("role" .=) <$> _pRole, ("anyone" .=) <$> _pAnyone,
("allowDiscovery" .=) <$> _pAllowDiscovery])
data File =
File'
deriving (Eq,Show,Data,Typeable,Generic)
file
:: File
file = File'
instance FromJSON File where
parseJSON = withObject "File" (\ o -> pure File')
instance ToJSON File where
toJSON = const emptyObject
newtype Delete' = Delete''
{ _dType :: Maybe DeleteType
} deriving (Eq,Show,Data,Typeable,Generic)
delete'
:: Delete'
delete' =
Delete''
{ _dType = Nothing
}
dType :: Lens' Delete' (Maybe DeleteType)
dType = lens _dType (\ s a -> s{_dType = a})
instance FromJSON Delete' where
parseJSON
= withObject "Delete"
(\ o -> Delete'' <$> (o .:? "type"))
instance ToJSON Delete' where
toJSON Delete''{..}
= object (catMaybes [("type" .=) <$> _dType])
data Target = Target'
{ _tTeamDrive :: !(Maybe TeamDrive)
, _tFileComment :: !(Maybe FileComment)
, _tDriveItem :: !(Maybe DriveItem)
} deriving (Eq,Show,Data,Typeable,Generic)
target
:: Target
target =
Target'
{ _tTeamDrive = Nothing
, _tFileComment = Nothing
, _tDriveItem = Nothing
}
tTeamDrive :: Lens' Target (Maybe TeamDrive)
tTeamDrive
= lens _tTeamDrive (\ s a -> s{_tTeamDrive = a})
tFileComment :: Lens' Target (Maybe FileComment)
tFileComment
= lens _tFileComment (\ s a -> s{_tFileComment = a})
tDriveItem :: Lens' Target (Maybe DriveItem)
tDriveItem
= lens _tDriveItem (\ s a -> s{_tDriveItem = a})
instance FromJSON Target where
parseJSON
= withObject "Target"
(\ o ->
Target' <$>
(o .:? "teamDrive") <*> (o .:? "fileComment") <*>
(o .:? "driveItem"))
instance ToJSON Target where
toJSON Target'{..}
= object
(catMaybes
[("teamDrive" .=) <$> _tTeamDrive,
("fileComment" .=) <$> _tFileComment,
("driveItem" .=) <$> _tDriveItem])
data Move = Move'
{ _mAddedParents :: !(Maybe [TargetReference])
, _mRemovedParents :: !(Maybe [TargetReference])
} deriving (Eq,Show,Data,Typeable,Generic)
move
:: Move
move =
Move'
{ _mAddedParents = Nothing
, _mRemovedParents = Nothing
}
mAddedParents :: Lens' Move [TargetReference]
mAddedParents
= lens _mAddedParents
(\ s a -> s{_mAddedParents = a})
. _Default
. _Coerce
mRemovedParents :: Lens' Move [TargetReference]
mRemovedParents
= lens _mRemovedParents
(\ s a -> s{_mRemovedParents = a})
. _Default
. _Coerce
instance FromJSON Move where
parseJSON
= withObject "Move"
(\ o ->
Move' <$>
(o .:? "addedParents" .!= mempty) <*>
(o .:? "removedParents" .!= mempty))
instance ToJSON Move where
toJSON Move'{..}
= object
(catMaybes
[("addedParents" .=) <$> _mAddedParents,
("removedParents" .=) <$> _mRemovedParents])
data DriveActivity = DriveActivity'
{ _daTimeRange :: !(Maybe TimeRange)
, _daActions :: !(Maybe [Action])
, _daActors :: !(Maybe [Actor])
, _daTargets :: !(Maybe [Target])
, _daPrimaryActionDetail :: !(Maybe ActionDetail)
, _daTimestamp :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
driveActivity
:: DriveActivity
driveActivity =
DriveActivity'
{ _daTimeRange = Nothing
, _daActions = Nothing
, _daActors = Nothing
, _daTargets = Nothing
, _daPrimaryActionDetail = Nothing
, _daTimestamp = Nothing
}
daTimeRange :: Lens' DriveActivity (Maybe TimeRange)
daTimeRange
= lens _daTimeRange (\ s a -> s{_daTimeRange = a})
daActions :: Lens' DriveActivity [Action]
daActions
= lens _daActions (\ s a -> s{_daActions = a}) .
_Default
. _Coerce
daActors :: Lens' DriveActivity [Actor]
daActors
= lens _daActors (\ s a -> s{_daActors = a}) .
_Default
. _Coerce
daTargets :: Lens' DriveActivity [Target]
daTargets
= lens _daTargets (\ s a -> s{_daTargets = a}) .
_Default
. _Coerce
daPrimaryActionDetail :: Lens' DriveActivity (Maybe ActionDetail)
daPrimaryActionDetail
= lens _daPrimaryActionDetail
(\ s a -> s{_daPrimaryActionDetail = a})
daTimestamp :: Lens' DriveActivity (Maybe UTCTime)
daTimestamp
= lens _daTimestamp (\ s a -> s{_daTimestamp = a}) .
mapping _DateTime
instance FromJSON DriveActivity where
parseJSON
= withObject "DriveActivity"
(\ o ->
DriveActivity' <$>
(o .:? "timeRange") <*> (o .:? "actions" .!= mempty)
<*> (o .:? "actors" .!= mempty)
<*> (o .:? "targets" .!= mempty)
<*> (o .:? "primaryActionDetail")
<*> (o .:? "timestamp"))
instance ToJSON DriveActivity where
toJSON DriveActivity'{..}
= object
(catMaybes
[("timeRange" .=) <$> _daTimeRange,
("actions" .=) <$> _daActions,
("actors" .=) <$> _daActors,
("targets" .=) <$> _daTargets,
("primaryActionDetail" .=) <$>
_daPrimaryActionDetail,
("timestamp" .=) <$> _daTimestamp])
data DriveItem = DriveItem'
{ _diFolder :: !(Maybe Folder)
, _diOwner :: !(Maybe Owner)
, _diMimeType :: !(Maybe Text)
, _diName :: !(Maybe Text)
, _diTitle :: !(Maybe Text)
, _diFile :: !(Maybe File)
} deriving (Eq,Show,Data,Typeable,Generic)
driveItem
:: DriveItem
driveItem =
DriveItem'
{ _diFolder = Nothing
, _diOwner = Nothing
, _diMimeType = Nothing
, _diName = Nothing
, _diTitle = Nothing
, _diFile = Nothing
}
diFolder :: Lens' DriveItem (Maybe Folder)
diFolder = lens _diFolder (\ s a -> s{_diFolder = a})
diOwner :: Lens' DriveItem (Maybe Owner)
diOwner = lens _diOwner (\ s a -> s{_diOwner = a})
diMimeType :: Lens' DriveItem (Maybe Text)
diMimeType
= lens _diMimeType (\ s a -> s{_diMimeType = a})
diName :: Lens' DriveItem (Maybe Text)
diName = lens _diName (\ s a -> s{_diName = a})
diTitle :: Lens' DriveItem (Maybe Text)
diTitle = lens _diTitle (\ s a -> s{_diTitle = a})
diFile :: Lens' DriveItem (Maybe File)
diFile = lens _diFile (\ s a -> s{_diFile = a})
instance FromJSON DriveItem where
parseJSON
= withObject "DriveItem"
(\ o ->
DriveItem' <$>
(o .:? "folder") <*> (o .:? "owner") <*>
(o .:? "mimeType")
<*> (o .:? "name")
<*> (o .:? "title")
<*> (o .:? "file"))
instance ToJSON DriveItem where
toJSON DriveItem'{..}
= object
(catMaybes
[("folder" .=) <$> _diFolder,
("owner" .=) <$> _diOwner,
("mimeType" .=) <$> _diMimeType,
("name" .=) <$> _diName, ("title" .=) <$> _diTitle,
("file" .=) <$> _diFile])
newtype SystemEvent = SystemEvent'
{ _seType :: Maybe SystemEventType
} deriving (Eq,Show,Data,Typeable,Generic)
systemEvent
:: SystemEvent
systemEvent =
SystemEvent'
{ _seType = Nothing
}
seType :: Lens' SystemEvent (Maybe SystemEventType)
seType = lens _seType (\ s a -> s{_seType = a})
instance FromJSON SystemEvent where
parseJSON
= withObject "SystemEvent"
(\ o -> SystemEvent' <$> (o .:? "type"))
instance ToJSON SystemEvent where
toJSON SystemEvent'{..}
= object (catMaybes [("type" .=) <$> _seType])