module Network.Google.Gmail.Types.Product where
import Network.Google.Gmail.Types.Sum
import Network.Google.Prelude
newtype BatchDeleteMessagesRequest = BatchDeleteMessagesRequest'
{ _bdmrIds :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
batchDeleteMessagesRequest
:: BatchDeleteMessagesRequest
batchDeleteMessagesRequest =
BatchDeleteMessagesRequest'
{ _bdmrIds = Nothing
}
bdmrIds :: Lens' BatchDeleteMessagesRequest [Text]
bdmrIds
= lens _bdmrIds (\ s a -> s{_bdmrIds = a}) . _Default
. _Coerce
instance FromJSON BatchDeleteMessagesRequest where
parseJSON
= withObject "BatchDeleteMessagesRequest"
(\ o ->
BatchDeleteMessagesRequest' <$>
(o .:? "ids" .!= mempty))
instance ToJSON BatchDeleteMessagesRequest where
toJSON BatchDeleteMessagesRequest'{..}
= object (catMaybes [("ids" .=) <$> _bdmrIds])
data ModifyThreadRequest = ModifyThreadRequest'
{ _mtrRemoveLabelIds :: !(Maybe [Text])
, _mtrAddLabelIds :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
modifyThreadRequest
:: ModifyThreadRequest
modifyThreadRequest =
ModifyThreadRequest'
{ _mtrRemoveLabelIds = Nothing
, _mtrAddLabelIds = Nothing
}
mtrRemoveLabelIds :: Lens' ModifyThreadRequest [Text]
mtrRemoveLabelIds
= lens _mtrRemoveLabelIds
(\ s a -> s{_mtrRemoveLabelIds = a})
. _Default
. _Coerce
mtrAddLabelIds :: Lens' ModifyThreadRequest [Text]
mtrAddLabelIds
= lens _mtrAddLabelIds
(\ s a -> s{_mtrAddLabelIds = a})
. _Default
. _Coerce
instance FromJSON ModifyThreadRequest where
parseJSON
= withObject "ModifyThreadRequest"
(\ o ->
ModifyThreadRequest' <$>
(o .:? "removeLabelIds" .!= mempty) <*>
(o .:? "addLabelIds" .!= mempty))
instance ToJSON ModifyThreadRequest where
toJSON ModifyThreadRequest'{..}
= object
(catMaybes
[("removeLabelIds" .=) <$> _mtrRemoveLabelIds,
("addLabelIds" .=) <$> _mtrAddLabelIds])
newtype ListFiltersResponse = ListFiltersResponse'
{ _lfrFilter :: Maybe [Filter]
} deriving (Eq,Show,Data,Typeable,Generic)
listFiltersResponse
:: ListFiltersResponse
listFiltersResponse =
ListFiltersResponse'
{ _lfrFilter = Nothing
}
lfrFilter :: Lens' ListFiltersResponse [Filter]
lfrFilter
= lens _lfrFilter (\ s a -> s{_lfrFilter = a}) .
_Default
. _Coerce
instance FromJSON ListFiltersResponse where
parseJSON
= withObject "ListFiltersResponse"
(\ o ->
ListFiltersResponse' <$> (o .:? "filter" .!= mempty))
instance ToJSON ListFiltersResponse where
toJSON ListFiltersResponse'{..}
= object (catMaybes [("filter" .=) <$> _lfrFilter])
data ModifyMessageRequest = ModifyMessageRequest'
{ _mmrRemoveLabelIds :: !(Maybe [Text])
, _mmrAddLabelIds :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
modifyMessageRequest
:: ModifyMessageRequest
modifyMessageRequest =
ModifyMessageRequest'
{ _mmrRemoveLabelIds = Nothing
, _mmrAddLabelIds = Nothing
}
mmrRemoveLabelIds :: Lens' ModifyMessageRequest [Text]
mmrRemoveLabelIds
= lens _mmrRemoveLabelIds
(\ s a -> s{_mmrRemoveLabelIds = a})
. _Default
. _Coerce
mmrAddLabelIds :: Lens' ModifyMessageRequest [Text]
mmrAddLabelIds
= lens _mmrAddLabelIds
(\ s a -> s{_mmrAddLabelIds = a})
. _Default
. _Coerce
instance FromJSON ModifyMessageRequest where
parseJSON
= withObject "ModifyMessageRequest"
(\ o ->
ModifyMessageRequest' <$>
(o .:? "removeLabelIds" .!= mempty) <*>
(o .:? "addLabelIds" .!= mempty))
instance ToJSON ModifyMessageRequest where
toJSON ModifyMessageRequest'{..}
= object
(catMaybes
[("removeLabelIds" .=) <$> _mmrRemoveLabelIds,
("addLabelIds" .=) <$> _mmrAddLabelIds])
newtype ListForwardingAddressesResponse = ListForwardingAddressesResponse'
{ _lfarForwardingAddresses :: Maybe [ForwardingAddress]
} deriving (Eq,Show,Data,Typeable,Generic)
listForwardingAddressesResponse
:: ListForwardingAddressesResponse
listForwardingAddressesResponse =
ListForwardingAddressesResponse'
{ _lfarForwardingAddresses = Nothing
}
lfarForwardingAddresses :: Lens' ListForwardingAddressesResponse [ForwardingAddress]
lfarForwardingAddresses
= lens _lfarForwardingAddresses
(\ s a -> s{_lfarForwardingAddresses = a})
. _Default
. _Coerce
instance FromJSON ListForwardingAddressesResponse
where
parseJSON
= withObject "ListForwardingAddressesResponse"
(\ o ->
ListForwardingAddressesResponse' <$>
(o .:? "forwardingAddresses" .!= mempty))
instance ToJSON ListForwardingAddressesResponse where
toJSON ListForwardingAddressesResponse'{..}
= object
(catMaybes
[("forwardingAddresses" .=) <$>
_lfarForwardingAddresses])
data PopSettings = PopSettings'
{ _psAccessWindow :: !(Maybe PopSettingsAccessWindow)
, _psDisPosition :: !(Maybe PopSettingsDisPosition)
} deriving (Eq,Show,Data,Typeable,Generic)
popSettings
:: PopSettings
popSettings =
PopSettings'
{ _psAccessWindow = Nothing
, _psDisPosition = Nothing
}
psAccessWindow :: Lens' PopSettings (Maybe PopSettingsAccessWindow)
psAccessWindow
= lens _psAccessWindow
(\ s a -> s{_psAccessWindow = a})
psDisPosition :: Lens' PopSettings (Maybe PopSettingsDisPosition)
psDisPosition
= lens _psDisPosition
(\ s a -> s{_psDisPosition = a})
instance FromJSON PopSettings where
parseJSON
= withObject "PopSettings"
(\ o ->
PopSettings' <$>
(o .:? "accessWindow") <*> (o .:? "disposition"))
instance ToJSON PopSettings where
toJSON PopSettings'{..}
= object
(catMaybes
[("accessWindow" .=) <$> _psAccessWindow,
("disposition" .=) <$> _psDisPosition])
data History = History'
{ _hLabelsRemoved :: !(Maybe [HistoryLabelRemoved])
, _hMessagesDeleted :: !(Maybe [HistoryMessageDeleted])
, _hMessagesAdded :: !(Maybe [HistoryMessageAdded])
, _hLabelsAdded :: !(Maybe [HistoryLabelAdded])
, _hId :: !(Maybe (Textual Word64))
, _hMessages :: !(Maybe [Message])
} deriving (Eq,Show,Data,Typeable,Generic)
history
:: History
history =
History'
{ _hLabelsRemoved = Nothing
, _hMessagesDeleted = Nothing
, _hMessagesAdded = Nothing
, _hLabelsAdded = Nothing
, _hId = Nothing
, _hMessages = Nothing
}
hLabelsRemoved :: Lens' History [HistoryLabelRemoved]
hLabelsRemoved
= lens _hLabelsRemoved
(\ s a -> s{_hLabelsRemoved = a})
. _Default
. _Coerce
hMessagesDeleted :: Lens' History [HistoryMessageDeleted]
hMessagesDeleted
= lens _hMessagesDeleted
(\ s a -> s{_hMessagesDeleted = a})
. _Default
. _Coerce
hMessagesAdded :: Lens' History [HistoryMessageAdded]
hMessagesAdded
= lens _hMessagesAdded
(\ s a -> s{_hMessagesAdded = a})
. _Default
. _Coerce
hLabelsAdded :: Lens' History [HistoryLabelAdded]
hLabelsAdded
= lens _hLabelsAdded (\ s a -> s{_hLabelsAdded = a})
. _Default
. _Coerce
hId :: Lens' History (Maybe Word64)
hId
= lens _hId (\ s a -> s{_hId = a}) . mapping _Coerce
hMessages :: Lens' History [Message]
hMessages
= lens _hMessages (\ s a -> s{_hMessages = a}) .
_Default
. _Coerce
instance FromJSON History where
parseJSON
= withObject "History"
(\ o ->
History' <$>
(o .:? "labelsRemoved" .!= mempty) <*>
(o .:? "messagesDeleted" .!= mempty)
<*> (o .:? "messagesAdded" .!= mempty)
<*> (o .:? "labelsAdded" .!= mempty)
<*> (o .:? "id")
<*> (o .:? "messages" .!= mempty))
instance ToJSON History where
toJSON History'{..}
= object
(catMaybes
[("labelsRemoved" .=) <$> _hLabelsRemoved,
("messagesDeleted" .=) <$> _hMessagesDeleted,
("messagesAdded" .=) <$> _hMessagesAdded,
("labelsAdded" .=) <$> _hLabelsAdded,
("id" .=) <$> _hId, ("messages" .=) <$> _hMessages])
data FilterCriteria = FilterCriteria'
{ _fcSizeComparison :: !(Maybe FilterCriteriaSizeComparison)
, _fcSubject :: !(Maybe Text)
, _fcSize :: !(Maybe (Textual Int32))
, _fcExcludeChats :: !(Maybe Bool)
, _fcTo :: !(Maybe Text)
, _fcFrom :: !(Maybe Text)
, _fcQuery :: !(Maybe Text)
, _fcNegatedQuery :: !(Maybe Text)
, _fcHasAttachment :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
filterCriteria
:: FilterCriteria
filterCriteria =
FilterCriteria'
{ _fcSizeComparison = Nothing
, _fcSubject = Nothing
, _fcSize = Nothing
, _fcExcludeChats = Nothing
, _fcTo = Nothing
, _fcFrom = Nothing
, _fcQuery = Nothing
, _fcNegatedQuery = Nothing
, _fcHasAttachment = Nothing
}
fcSizeComparison :: Lens' FilterCriteria (Maybe FilterCriteriaSizeComparison)
fcSizeComparison
= lens _fcSizeComparison
(\ s a -> s{_fcSizeComparison = a})
fcSubject :: Lens' FilterCriteria (Maybe Text)
fcSubject
= lens _fcSubject (\ s a -> s{_fcSubject = a})
fcSize :: Lens' FilterCriteria (Maybe Int32)
fcSize
= lens _fcSize (\ s a -> s{_fcSize = a}) .
mapping _Coerce
fcExcludeChats :: Lens' FilterCriteria (Maybe Bool)
fcExcludeChats
= lens _fcExcludeChats
(\ s a -> s{_fcExcludeChats = a})
fcTo :: Lens' FilterCriteria (Maybe Text)
fcTo = lens _fcTo (\ s a -> s{_fcTo = a})
fcFrom :: Lens' FilterCriteria (Maybe Text)
fcFrom = lens _fcFrom (\ s a -> s{_fcFrom = a})
fcQuery :: Lens' FilterCriteria (Maybe Text)
fcQuery = lens _fcQuery (\ s a -> s{_fcQuery = a})
fcNegatedQuery :: Lens' FilterCriteria (Maybe Text)
fcNegatedQuery
= lens _fcNegatedQuery
(\ s a -> s{_fcNegatedQuery = a})
fcHasAttachment :: Lens' FilterCriteria (Maybe Bool)
fcHasAttachment
= lens _fcHasAttachment
(\ s a -> s{_fcHasAttachment = a})
instance FromJSON FilterCriteria where
parseJSON
= withObject "FilterCriteria"
(\ o ->
FilterCriteria' <$>
(o .:? "sizeComparison") <*> (o .:? "subject") <*>
(o .:? "size")
<*> (o .:? "excludeChats")
<*> (o .:? "to")
<*> (o .:? "from")
<*> (o .:? "query")
<*> (o .:? "negatedQuery")
<*> (o .:? "hasAttachment"))
instance ToJSON FilterCriteria where
toJSON FilterCriteria'{..}
= object
(catMaybes
[("sizeComparison" .=) <$> _fcSizeComparison,
("subject" .=) <$> _fcSubject,
("size" .=) <$> _fcSize,
("excludeChats" .=) <$> _fcExcludeChats,
("to" .=) <$> _fcTo, ("from" .=) <$> _fcFrom,
("query" .=) <$> _fcQuery,
("negatedQuery" .=) <$> _fcNegatedQuery,
("hasAttachment" .=) <$> _fcHasAttachment])
data ProFile = ProFile'
{ _pfMessagesTotal :: !(Maybe (Textual Int32))
, _pfThreadsTotal :: !(Maybe (Textual Int32))
, _pfHistoryId :: !(Maybe (Textual Word64))
, _pfEmailAddress :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
proFile
:: ProFile
proFile =
ProFile'
{ _pfMessagesTotal = Nothing
, _pfThreadsTotal = Nothing
, _pfHistoryId = Nothing
, _pfEmailAddress = Nothing
}
pfMessagesTotal :: Lens' ProFile (Maybe Int32)
pfMessagesTotal
= lens _pfMessagesTotal
(\ s a -> s{_pfMessagesTotal = a})
. mapping _Coerce
pfThreadsTotal :: Lens' ProFile (Maybe Int32)
pfThreadsTotal
= lens _pfThreadsTotal
(\ s a -> s{_pfThreadsTotal = a})
. mapping _Coerce
pfHistoryId :: Lens' ProFile (Maybe Word64)
pfHistoryId
= lens _pfHistoryId (\ s a -> s{_pfHistoryId = a}) .
mapping _Coerce
pfEmailAddress :: Lens' ProFile (Maybe Text)
pfEmailAddress
= lens _pfEmailAddress
(\ s a -> s{_pfEmailAddress = a})
instance FromJSON ProFile where
parseJSON
= withObject "ProFile"
(\ o ->
ProFile' <$>
(o .:? "messagesTotal") <*> (o .:? "threadsTotal")
<*> (o .:? "historyId")
<*> (o .:? "emailAddress"))
instance ToJSON ProFile where
toJSON ProFile'{..}
= object
(catMaybes
[("messagesTotal" .=) <$> _pfMessagesTotal,
("threadsTotal" .=) <$> _pfThreadsTotal,
("historyId" .=) <$> _pfHistoryId,
("emailAddress" .=) <$> _pfEmailAddress])
data MessagePartHeader = MessagePartHeader'
{ _mphValue :: !(Maybe Text)
, _mphName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
messagePartHeader
:: MessagePartHeader
messagePartHeader =
MessagePartHeader'
{ _mphValue = Nothing
, _mphName = Nothing
}
mphValue :: Lens' MessagePartHeader (Maybe Text)
mphValue = lens _mphValue (\ s a -> s{_mphValue = a})
mphName :: Lens' MessagePartHeader (Maybe Text)
mphName = lens _mphName (\ s a -> s{_mphName = a})
instance FromJSON MessagePartHeader where
parseJSON
= withObject "MessagePartHeader"
(\ o ->
MessagePartHeader' <$>
(o .:? "value") <*> (o .:? "name"))
instance ToJSON MessagePartHeader where
toJSON MessagePartHeader'{..}
= object
(catMaybes
[("value" .=) <$> _mphValue,
("name" .=) <$> _mphName])
data ListHistoryResponse = ListHistoryResponse'
{ _lhrNextPageToken :: !(Maybe Text)
, _lhrHistory :: !(Maybe [History])
, _lhrHistoryId :: !(Maybe (Textual Word64))
} deriving (Eq,Show,Data,Typeable,Generic)
listHistoryResponse
:: ListHistoryResponse
listHistoryResponse =
ListHistoryResponse'
{ _lhrNextPageToken = Nothing
, _lhrHistory = Nothing
, _lhrHistoryId = Nothing
}
lhrNextPageToken :: Lens' ListHistoryResponse (Maybe Text)
lhrNextPageToken
= lens _lhrNextPageToken
(\ s a -> s{_lhrNextPageToken = a})
lhrHistory :: Lens' ListHistoryResponse [History]
lhrHistory
= lens _lhrHistory (\ s a -> s{_lhrHistory = a}) .
_Default
. _Coerce
lhrHistoryId :: Lens' ListHistoryResponse (Maybe Word64)
lhrHistoryId
= lens _lhrHistoryId (\ s a -> s{_lhrHistoryId = a})
. mapping _Coerce
instance FromJSON ListHistoryResponse where
parseJSON
= withObject "ListHistoryResponse"
(\ o ->
ListHistoryResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "history" .!= mempty)
<*> (o .:? "historyId"))
instance ToJSON ListHistoryResponse where
toJSON ListHistoryResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lhrNextPageToken,
("history" .=) <$> _lhrHistory,
("historyId" .=) <$> _lhrHistoryId])
data SendAs = SendAs'
{ _saSignature :: !(Maybe Text)
, _saReplyToAddress :: !(Maybe Text)
, _saTreatAsAlias :: !(Maybe Bool)
, _saSendAsEmail :: !(Maybe Text)
, _saDisplayName :: !(Maybe Text)
, _saVerificationStatus :: !(Maybe SendAsVerificationStatus)
, _saSmtpMsa :: !(Maybe SmtpMsa)
, _saIsPrimary :: !(Maybe Bool)
, _saIsDefault :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
sendAs
:: SendAs
sendAs =
SendAs'
{ _saSignature = Nothing
, _saReplyToAddress = Nothing
, _saTreatAsAlias = Nothing
, _saSendAsEmail = Nothing
, _saDisplayName = Nothing
, _saVerificationStatus = Nothing
, _saSmtpMsa = Nothing
, _saIsPrimary = Nothing
, _saIsDefault = Nothing
}
saSignature :: Lens' SendAs (Maybe Text)
saSignature
= lens _saSignature (\ s a -> s{_saSignature = a})
saReplyToAddress :: Lens' SendAs (Maybe Text)
saReplyToAddress
= lens _saReplyToAddress
(\ s a -> s{_saReplyToAddress = a})
saTreatAsAlias :: Lens' SendAs (Maybe Bool)
saTreatAsAlias
= lens _saTreatAsAlias
(\ s a -> s{_saTreatAsAlias = a})
saSendAsEmail :: Lens' SendAs (Maybe Text)
saSendAsEmail
= lens _saSendAsEmail
(\ s a -> s{_saSendAsEmail = a})
saDisplayName :: Lens' SendAs (Maybe Text)
saDisplayName
= lens _saDisplayName
(\ s a -> s{_saDisplayName = a})
saVerificationStatus :: Lens' SendAs (Maybe SendAsVerificationStatus)
saVerificationStatus
= lens _saVerificationStatus
(\ s a -> s{_saVerificationStatus = a})
saSmtpMsa :: Lens' SendAs (Maybe SmtpMsa)
saSmtpMsa
= lens _saSmtpMsa (\ s a -> s{_saSmtpMsa = a})
saIsPrimary :: Lens' SendAs (Maybe Bool)
saIsPrimary
= lens _saIsPrimary (\ s a -> s{_saIsPrimary = a})
saIsDefault :: Lens' SendAs (Maybe Bool)
saIsDefault
= lens _saIsDefault (\ s a -> s{_saIsDefault = a})
instance FromJSON SendAs where
parseJSON
= withObject "SendAs"
(\ o ->
SendAs' <$>
(o .:? "signature") <*> (o .:? "replyToAddress") <*>
(o .:? "treatAsAlias")
<*> (o .:? "sendAsEmail")
<*> (o .:? "displayName")
<*> (o .:? "verificationStatus")
<*> (o .:? "smtpMsa")
<*> (o .:? "isPrimary")
<*> (o .:? "isDefault"))
instance ToJSON SendAs where
toJSON SendAs'{..}
= object
(catMaybes
[("signature" .=) <$> _saSignature,
("replyToAddress" .=) <$> _saReplyToAddress,
("treatAsAlias" .=) <$> _saTreatAsAlias,
("sendAsEmail" .=) <$> _saSendAsEmail,
("displayName" .=) <$> _saDisplayName,
("verificationStatus" .=) <$> _saVerificationStatus,
("smtpMsa" .=) <$> _saSmtpMsa,
("isPrimary" .=) <$> _saIsPrimary,
("isDefault" .=) <$> _saIsDefault])
data ListThreadsResponse = ListThreadsResponse'
{ _ltrNextPageToken :: !(Maybe Text)
, _ltrResultSizeEstimate :: !(Maybe (Textual Word32))
, _ltrThreads :: !(Maybe [Thread])
} deriving (Eq,Show,Data,Typeable,Generic)
listThreadsResponse
:: ListThreadsResponse
listThreadsResponse =
ListThreadsResponse'
{ _ltrNextPageToken = Nothing
, _ltrResultSizeEstimate = Nothing
, _ltrThreads = Nothing
}
ltrNextPageToken :: Lens' ListThreadsResponse (Maybe Text)
ltrNextPageToken
= lens _ltrNextPageToken
(\ s a -> s{_ltrNextPageToken = a})
ltrResultSizeEstimate :: Lens' ListThreadsResponse (Maybe Word32)
ltrResultSizeEstimate
= lens _ltrResultSizeEstimate
(\ s a -> s{_ltrResultSizeEstimate = a})
. mapping _Coerce
ltrThreads :: Lens' ListThreadsResponse [Thread]
ltrThreads
= lens _ltrThreads (\ s a -> s{_ltrThreads = a}) .
_Default
. _Coerce
instance FromJSON ListThreadsResponse where
parseJSON
= withObject "ListThreadsResponse"
(\ o ->
ListThreadsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "resultSizeEstimate")
<*> (o .:? "threads" .!= mempty))
instance ToJSON ListThreadsResponse where
toJSON ListThreadsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ltrNextPageToken,
("resultSizeEstimate" .=) <$> _ltrResultSizeEstimate,
("threads" .=) <$> _ltrThreads])
data MessagePart = MessagePart'
{ _mpParts :: !(Maybe [MessagePart])
, _mpBody :: !(Maybe MessagePartBody)
, _mpMimeType :: !(Maybe Text)
, _mpHeaders :: !(Maybe [MessagePartHeader])
, _mpPartId :: !(Maybe Text)
, _mpFilename :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
messagePart
:: MessagePart
messagePart =
MessagePart'
{ _mpParts = Nothing
, _mpBody = Nothing
, _mpMimeType = Nothing
, _mpHeaders = Nothing
, _mpPartId = Nothing
, _mpFilename = Nothing
}
mpParts :: Lens' MessagePart [MessagePart]
mpParts
= lens _mpParts (\ s a -> s{_mpParts = a}) . _Default
. _Coerce
mpBody :: Lens' MessagePart (Maybe MessagePartBody)
mpBody = lens _mpBody (\ s a -> s{_mpBody = a})
mpMimeType :: Lens' MessagePart (Maybe Text)
mpMimeType
= lens _mpMimeType (\ s a -> s{_mpMimeType = a})
mpHeaders :: Lens' MessagePart [MessagePartHeader]
mpHeaders
= lens _mpHeaders (\ s a -> s{_mpHeaders = a}) .
_Default
. _Coerce
mpPartId :: Lens' MessagePart (Maybe Text)
mpPartId = lens _mpPartId (\ s a -> s{_mpPartId = a})
mpFilename :: Lens' MessagePart (Maybe Text)
mpFilename
= lens _mpFilename (\ s a -> s{_mpFilename = a})
instance FromJSON MessagePart where
parseJSON
= withObject "MessagePart"
(\ o ->
MessagePart' <$>
(o .:? "parts" .!= mempty) <*> (o .:? "body") <*>
(o .:? "mimeType")
<*> (o .:? "headers" .!= mempty)
<*> (o .:? "partId")
<*> (o .:? "filename"))
instance ToJSON MessagePart where
toJSON MessagePart'{..}
= object
(catMaybes
[("parts" .=) <$> _mpParts, ("body" .=) <$> _mpBody,
("mimeType" .=) <$> _mpMimeType,
("headers" .=) <$> _mpHeaders,
("partId" .=) <$> _mpPartId,
("filename" .=) <$> _mpFilename])
data HistoryLabelAdded = HistoryLabelAdded'
{ _hlaLabelIds :: !(Maybe [Text])
, _hlaMessage :: !(Maybe Message)
} deriving (Eq,Show,Data,Typeable,Generic)
historyLabelAdded
:: HistoryLabelAdded
historyLabelAdded =
HistoryLabelAdded'
{ _hlaLabelIds = Nothing
, _hlaMessage = Nothing
}
hlaLabelIds :: Lens' HistoryLabelAdded [Text]
hlaLabelIds
= lens _hlaLabelIds (\ s a -> s{_hlaLabelIds = a}) .
_Default
. _Coerce
hlaMessage :: Lens' HistoryLabelAdded (Maybe Message)
hlaMessage
= lens _hlaMessage (\ s a -> s{_hlaMessage = a})
instance FromJSON HistoryLabelAdded where
parseJSON
= withObject "HistoryLabelAdded"
(\ o ->
HistoryLabelAdded' <$>
(o .:? "labelIds" .!= mempty) <*> (o .:? "message"))
instance ToJSON HistoryLabelAdded where
toJSON HistoryLabelAdded'{..}
= object
(catMaybes
[("labelIds" .=) <$> _hlaLabelIds,
("message" .=) <$> _hlaMessage])
newtype ListLabelsResponse = ListLabelsResponse'
{ _llrLabels :: Maybe [Label]
} deriving (Eq,Show,Data,Typeable,Generic)
listLabelsResponse
:: ListLabelsResponse
listLabelsResponse =
ListLabelsResponse'
{ _llrLabels = Nothing
}
llrLabels :: Lens' ListLabelsResponse [Label]
llrLabels
= lens _llrLabels (\ s a -> s{_llrLabels = a}) .
_Default
. _Coerce
instance FromJSON ListLabelsResponse where
parseJSON
= withObject "ListLabelsResponse"
(\ o ->
ListLabelsResponse' <$> (o .:? "labels" .!= mempty))
instance ToJSON ListLabelsResponse where
toJSON ListLabelsResponse'{..}
= object (catMaybes [("labels" .=) <$> _llrLabels])
data VacationSettings = VacationSettings'
{ _vsEnableAutoReply :: !(Maybe Bool)
, _vsResponseBodyPlainText :: !(Maybe Text)
, _vsRestrictToDomain :: !(Maybe Bool)
, _vsStartTime :: !(Maybe (Textual Int64))
, _vsResponseBodyHTML :: !(Maybe Text)
, _vsRestrictToContacts :: !(Maybe Bool)
, _vsResponseSubject :: !(Maybe Text)
, _vsEndTime :: !(Maybe (Textual Int64))
} deriving (Eq,Show,Data,Typeable,Generic)
vacationSettings
:: VacationSettings
vacationSettings =
VacationSettings'
{ _vsEnableAutoReply = Nothing
, _vsResponseBodyPlainText = Nothing
, _vsRestrictToDomain = Nothing
, _vsStartTime = Nothing
, _vsResponseBodyHTML = Nothing
, _vsRestrictToContacts = Nothing
, _vsResponseSubject = Nothing
, _vsEndTime = Nothing
}
vsEnableAutoReply :: Lens' VacationSettings (Maybe Bool)
vsEnableAutoReply
= lens _vsEnableAutoReply
(\ s a -> s{_vsEnableAutoReply = a})
vsResponseBodyPlainText :: Lens' VacationSettings (Maybe Text)
vsResponseBodyPlainText
= lens _vsResponseBodyPlainText
(\ s a -> s{_vsResponseBodyPlainText = a})
vsRestrictToDomain :: Lens' VacationSettings (Maybe Bool)
vsRestrictToDomain
= lens _vsRestrictToDomain
(\ s a -> s{_vsRestrictToDomain = a})
vsStartTime :: Lens' VacationSettings (Maybe Int64)
vsStartTime
= lens _vsStartTime (\ s a -> s{_vsStartTime = a}) .
mapping _Coerce
vsResponseBodyHTML :: Lens' VacationSettings (Maybe Text)
vsResponseBodyHTML
= lens _vsResponseBodyHTML
(\ s a -> s{_vsResponseBodyHTML = a})
vsRestrictToContacts :: Lens' VacationSettings (Maybe Bool)
vsRestrictToContacts
= lens _vsRestrictToContacts
(\ s a -> s{_vsRestrictToContacts = a})
vsResponseSubject :: Lens' VacationSettings (Maybe Text)
vsResponseSubject
= lens _vsResponseSubject
(\ s a -> s{_vsResponseSubject = a})
vsEndTime :: Lens' VacationSettings (Maybe Int64)
vsEndTime
= lens _vsEndTime (\ s a -> s{_vsEndTime = a}) .
mapping _Coerce
instance FromJSON VacationSettings where
parseJSON
= withObject "VacationSettings"
(\ o ->
VacationSettings' <$>
(o .:? "enableAutoReply") <*>
(o .:? "responseBodyPlainText")
<*> (o .:? "restrictToDomain")
<*> (o .:? "startTime")
<*> (o .:? "responseBodyHtml")
<*> (o .:? "restrictToContacts")
<*> (o .:? "responseSubject")
<*> (o .:? "endTime"))
instance ToJSON VacationSettings where
toJSON VacationSettings'{..}
= object
(catMaybes
[("enableAutoReply" .=) <$> _vsEnableAutoReply,
("responseBodyPlainText" .=) <$>
_vsResponseBodyPlainText,
("restrictToDomain" .=) <$> _vsRestrictToDomain,
("startTime" .=) <$> _vsStartTime,
("responseBodyHtml" .=) <$> _vsResponseBodyHTML,
("restrictToContacts" .=) <$> _vsRestrictToContacts,
("responseSubject" .=) <$> _vsResponseSubject,
("endTime" .=) <$> _vsEndTime])
newtype HistoryMessageDeleted = HistoryMessageDeleted'
{ _hmdMessage :: Maybe Message
} deriving (Eq,Show,Data,Typeable,Generic)
historyMessageDeleted
:: HistoryMessageDeleted
historyMessageDeleted =
HistoryMessageDeleted'
{ _hmdMessage = Nothing
}
hmdMessage :: Lens' HistoryMessageDeleted (Maybe Message)
hmdMessage
= lens _hmdMessage (\ s a -> s{_hmdMessage = a})
instance FromJSON HistoryMessageDeleted where
parseJSON
= withObject "HistoryMessageDeleted"
(\ o -> HistoryMessageDeleted' <$> (o .:? "message"))
instance ToJSON HistoryMessageDeleted where
toJSON HistoryMessageDeleted'{..}
= object (catMaybes [("message" .=) <$> _hmdMessage])
data MessagePartBody = MessagePartBody'
{ _mpbSize :: !(Maybe (Textual Int32))
, _mpbData :: !(Maybe Bytes)
, _mpbAttachmentId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
messagePartBody
:: MessagePartBody
messagePartBody =
MessagePartBody'
{ _mpbSize = Nothing
, _mpbData = Nothing
, _mpbAttachmentId = Nothing
}
mpbSize :: Lens' MessagePartBody (Maybe Int32)
mpbSize
= lens _mpbSize (\ s a -> s{_mpbSize = a}) .
mapping _Coerce
mpbData :: Lens' MessagePartBody (Maybe ByteString)
mpbData
= lens _mpbData (\ s a -> s{_mpbData = a}) .
mapping _Bytes
mpbAttachmentId :: Lens' MessagePartBody (Maybe Text)
mpbAttachmentId
= lens _mpbAttachmentId
(\ s a -> s{_mpbAttachmentId = a})
instance FromJSON MessagePartBody where
parseJSON
= withObject "MessagePartBody"
(\ o ->
MessagePartBody' <$>
(o .:? "size") <*> (o .:? "data") <*>
(o .:? "attachmentId"))
instance ToJSON MessagePartBody where
toJSON MessagePartBody'{..}
= object
(catMaybes
[("size" .=) <$> _mpbSize, ("data" .=) <$> _mpbData,
("attachmentId" .=) <$> _mpbAttachmentId])
data AutoForwarding = AutoForwarding'
{ _afEnabled :: !(Maybe Bool)
, _afDisPosition :: !(Maybe AutoForwardingDisPosition)
, _afEmailAddress :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
autoForwarding
:: AutoForwarding
autoForwarding =
AutoForwarding'
{ _afEnabled = Nothing
, _afDisPosition = Nothing
, _afEmailAddress = Nothing
}
afEnabled :: Lens' AutoForwarding (Maybe Bool)
afEnabled
= lens _afEnabled (\ s a -> s{_afEnabled = a})
afDisPosition :: Lens' AutoForwarding (Maybe AutoForwardingDisPosition)
afDisPosition
= lens _afDisPosition
(\ s a -> s{_afDisPosition = a})
afEmailAddress :: Lens' AutoForwarding (Maybe Text)
afEmailAddress
= lens _afEmailAddress
(\ s a -> s{_afEmailAddress = a})
instance FromJSON AutoForwarding where
parseJSON
= withObject "AutoForwarding"
(\ o ->
AutoForwarding' <$>
(o .:? "enabled") <*> (o .:? "disposition") <*>
(o .:? "emailAddress"))
instance ToJSON AutoForwarding where
toJSON AutoForwarding'{..}
= object
(catMaybes
[("enabled" .=) <$> _afEnabled,
("disposition" .=) <$> _afDisPosition,
("emailAddress" .=) <$> _afEmailAddress])
data ListDraftsResponse = ListDraftsResponse'
{ _ldrNextPageToken :: !(Maybe Text)
, _ldrResultSizeEstimate :: !(Maybe (Textual Word32))
, _ldrDrafts :: !(Maybe [Draft])
} deriving (Eq,Show,Data,Typeable,Generic)
listDraftsResponse
:: ListDraftsResponse
listDraftsResponse =
ListDraftsResponse'
{ _ldrNextPageToken = Nothing
, _ldrResultSizeEstimate = Nothing
, _ldrDrafts = Nothing
}
ldrNextPageToken :: Lens' ListDraftsResponse (Maybe Text)
ldrNextPageToken
= lens _ldrNextPageToken
(\ s a -> s{_ldrNextPageToken = a})
ldrResultSizeEstimate :: Lens' ListDraftsResponse (Maybe Word32)
ldrResultSizeEstimate
= lens _ldrResultSizeEstimate
(\ s a -> s{_ldrResultSizeEstimate = a})
. mapping _Coerce
ldrDrafts :: Lens' ListDraftsResponse [Draft]
ldrDrafts
= lens _ldrDrafts (\ s a -> s{_ldrDrafts = a}) .
_Default
. _Coerce
instance FromJSON ListDraftsResponse where
parseJSON
= withObject "ListDraftsResponse"
(\ o ->
ListDraftsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "resultSizeEstimate")
<*> (o .:? "drafts" .!= mempty))
instance ToJSON ListDraftsResponse where
toJSON ListDraftsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ldrNextPageToken,
("resultSizeEstimate" .=) <$> _ldrResultSizeEstimate,
("drafts" .=) <$> _ldrDrafts])
newtype ListSendAsResponse = ListSendAsResponse'
{ _lsarSendAs :: Maybe [SendAs]
} deriving (Eq,Show,Data,Typeable,Generic)
listSendAsResponse
:: ListSendAsResponse
listSendAsResponse =
ListSendAsResponse'
{ _lsarSendAs = Nothing
}
lsarSendAs :: Lens' ListSendAsResponse [SendAs]
lsarSendAs
= lens _lsarSendAs (\ s a -> s{_lsarSendAs = a}) .
_Default
. _Coerce
instance FromJSON ListSendAsResponse where
parseJSON
= withObject "ListSendAsResponse"
(\ o ->
ListSendAsResponse' <$> (o .:? "sendAs" .!= mempty))
instance ToJSON ListSendAsResponse where
toJSON ListSendAsResponse'{..}
= object (catMaybes [("sendAs" .=) <$> _lsarSendAs])
data WatchResponse = WatchResponse'
{ _wrExpiration :: !(Maybe (Textual Int64))
, _wrHistoryId :: !(Maybe (Textual Word64))
} deriving (Eq,Show,Data,Typeable,Generic)
watchResponse
:: WatchResponse
watchResponse =
WatchResponse'
{ _wrExpiration = Nothing
, _wrHistoryId = Nothing
}
wrExpiration :: Lens' WatchResponse (Maybe Int64)
wrExpiration
= lens _wrExpiration (\ s a -> s{_wrExpiration = a})
. mapping _Coerce
wrHistoryId :: Lens' WatchResponse (Maybe Word64)
wrHistoryId
= lens _wrHistoryId (\ s a -> s{_wrHistoryId = a}) .
mapping _Coerce
instance FromJSON WatchResponse where
parseJSON
= withObject "WatchResponse"
(\ o ->
WatchResponse' <$>
(o .:? "expiration") <*> (o .:? "historyId"))
instance ToJSON WatchResponse where
toJSON WatchResponse'{..}
= object
(catMaybes
[("expiration" .=) <$> _wrExpiration,
("historyId" .=) <$> _wrHistoryId])
data BatchModifyMessagesRequest = BatchModifyMessagesRequest'
{ _bmmrIds :: !(Maybe [Text])
, _bmmrRemoveLabelIds :: !(Maybe [Text])
, _bmmrAddLabelIds :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
batchModifyMessagesRequest
:: BatchModifyMessagesRequest
batchModifyMessagesRequest =
BatchModifyMessagesRequest'
{ _bmmrIds = Nothing
, _bmmrRemoveLabelIds = Nothing
, _bmmrAddLabelIds = Nothing
}
bmmrIds :: Lens' BatchModifyMessagesRequest [Text]
bmmrIds
= lens _bmmrIds (\ s a -> s{_bmmrIds = a}) . _Default
. _Coerce
bmmrRemoveLabelIds :: Lens' BatchModifyMessagesRequest [Text]
bmmrRemoveLabelIds
= lens _bmmrRemoveLabelIds
(\ s a -> s{_bmmrRemoveLabelIds = a})
. _Default
. _Coerce
bmmrAddLabelIds :: Lens' BatchModifyMessagesRequest [Text]
bmmrAddLabelIds
= lens _bmmrAddLabelIds
(\ s a -> s{_bmmrAddLabelIds = a})
. _Default
. _Coerce
instance FromJSON BatchModifyMessagesRequest where
parseJSON
= withObject "BatchModifyMessagesRequest"
(\ o ->
BatchModifyMessagesRequest' <$>
(o .:? "ids" .!= mempty) <*>
(o .:? "removeLabelIds" .!= mempty)
<*> (o .:? "addLabelIds" .!= mempty))
instance ToJSON BatchModifyMessagesRequest where
toJSON BatchModifyMessagesRequest'{..}
= object
(catMaybes
[("ids" .=) <$> _bmmrIds,
("removeLabelIds" .=) <$> _bmmrRemoveLabelIds,
("addLabelIds" .=) <$> _bmmrAddLabelIds])
data Draft = Draft'
{ _dId :: !(Maybe Text)
, _dMessage :: !(Maybe Message)
} deriving (Eq,Show,Data,Typeable,Generic)
draft
:: Draft
draft =
Draft'
{ _dId = Nothing
, _dMessage = Nothing
}
dId :: Lens' Draft (Maybe Text)
dId = lens _dId (\ s a -> s{_dId = a})
dMessage :: Lens' Draft (Maybe Message)
dMessage = lens _dMessage (\ s a -> s{_dMessage = a})
instance FromJSON Draft where
parseJSON
= withObject "Draft"
(\ o ->
Draft' <$> (o .:? "id") <*> (o .:? "message"))
instance ToJSON Draft where
toJSON Draft'{..}
= object
(catMaybes
[("id" .=) <$> _dId, ("message" .=) <$> _dMessage])
data SmtpMsa = SmtpMsa'
{ _smSecurityMode :: !(Maybe SmtpMsaSecurityMode)
, _smUsername :: !(Maybe Text)
, _smPassword :: !(Maybe Text)
, _smHost :: !(Maybe Text)
, _smPort :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
smtpMsa
:: SmtpMsa
smtpMsa =
SmtpMsa'
{ _smSecurityMode = Nothing
, _smUsername = Nothing
, _smPassword = Nothing
, _smHost = Nothing
, _smPort = Nothing
}
smSecurityMode :: Lens' SmtpMsa (Maybe SmtpMsaSecurityMode)
smSecurityMode
= lens _smSecurityMode
(\ s a -> s{_smSecurityMode = a})
smUsername :: Lens' SmtpMsa (Maybe Text)
smUsername
= lens _smUsername (\ s a -> s{_smUsername = a})
smPassword :: Lens' SmtpMsa (Maybe Text)
smPassword
= lens _smPassword (\ s a -> s{_smPassword = a})
smHost :: Lens' SmtpMsa (Maybe Text)
smHost = lens _smHost (\ s a -> s{_smHost = a})
smPort :: Lens' SmtpMsa (Maybe Int32)
smPort
= lens _smPort (\ s a -> s{_smPort = a}) .
mapping _Coerce
instance FromJSON SmtpMsa where
parseJSON
= withObject "SmtpMsa"
(\ o ->
SmtpMsa' <$>
(o .:? "securityMode") <*> (o .:? "username") <*>
(o .:? "password")
<*> (o .:? "host")
<*> (o .:? "port"))
instance ToJSON SmtpMsa where
toJSON SmtpMsa'{..}
= object
(catMaybes
[("securityMode" .=) <$> _smSecurityMode,
("username" .=) <$> _smUsername,
("password" .=) <$> _smPassword,
("host" .=) <$> _smHost, ("port" .=) <$> _smPort])
data ForwardingAddress = ForwardingAddress'
{ _faForwardingEmail :: !(Maybe Text)
, _faVerificationStatus :: !(Maybe ForwardingAddressVerificationStatus)
} deriving (Eq,Show,Data,Typeable,Generic)
forwardingAddress
:: ForwardingAddress
forwardingAddress =
ForwardingAddress'
{ _faForwardingEmail = Nothing
, _faVerificationStatus = Nothing
}
faForwardingEmail :: Lens' ForwardingAddress (Maybe Text)
faForwardingEmail
= lens _faForwardingEmail
(\ s a -> s{_faForwardingEmail = a})
faVerificationStatus :: Lens' ForwardingAddress (Maybe ForwardingAddressVerificationStatus)
faVerificationStatus
= lens _faVerificationStatus
(\ s a -> s{_faVerificationStatus = a})
instance FromJSON ForwardingAddress where
parseJSON
= withObject "ForwardingAddress"
(\ o ->
ForwardingAddress' <$>
(o .:? "forwardingEmail") <*>
(o .:? "verificationStatus"))
instance ToJSON ForwardingAddress where
toJSON ForwardingAddress'{..}
= object
(catMaybes
[("forwardingEmail" .=) <$> _faForwardingEmail,
("verificationStatus" .=) <$> _faVerificationStatus])
data Filter = Filter'
{ _fAction :: !(Maybe FilterAction)
, _fId :: !(Maybe Text)
, _fCriteria :: !(Maybe FilterCriteria)
} deriving (Eq,Show,Data,Typeable,Generic)
filter'
:: Filter
filter' =
Filter'
{ _fAction = Nothing
, _fId = Nothing
, _fCriteria = Nothing
}
fAction :: Lens' Filter (Maybe FilterAction)
fAction = lens _fAction (\ s a -> s{_fAction = a})
fId :: Lens' Filter (Maybe Text)
fId = lens _fId (\ s a -> s{_fId = a})
fCriteria :: Lens' Filter (Maybe FilterCriteria)
fCriteria
= lens _fCriteria (\ s a -> s{_fCriteria = a})
instance FromJSON Filter where
parseJSON
= withObject "Filter"
(\ o ->
Filter' <$>
(o .:? "action") <*> (o .:? "id") <*>
(o .:? "criteria"))
instance ToJSON Filter where
toJSON Filter'{..}
= object
(catMaybes
[("action" .=) <$> _fAction, ("id" .=) <$> _fId,
("criteria" .=) <$> _fCriteria])
data WatchRequest = WatchRequest'
{ _wrLabelFilterAction :: !(Maybe WatchRequestLabelFilterAction)
, _wrTopicName :: !(Maybe Text)
, _wrLabelIds :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
watchRequest
:: WatchRequest
watchRequest =
WatchRequest'
{ _wrLabelFilterAction = Nothing
, _wrTopicName = Nothing
, _wrLabelIds = Nothing
}
wrLabelFilterAction :: Lens' WatchRequest (Maybe WatchRequestLabelFilterAction)
wrLabelFilterAction
= lens _wrLabelFilterAction
(\ s a -> s{_wrLabelFilterAction = a})
wrTopicName :: Lens' WatchRequest (Maybe Text)
wrTopicName
= lens _wrTopicName (\ s a -> s{_wrTopicName = a})
wrLabelIds :: Lens' WatchRequest [Text]
wrLabelIds
= lens _wrLabelIds (\ s a -> s{_wrLabelIds = a}) .
_Default
. _Coerce
instance FromJSON WatchRequest where
parseJSON
= withObject "WatchRequest"
(\ o ->
WatchRequest' <$>
(o .:? "labelFilterAction") <*> (o .:? "topicName")
<*> (o .:? "labelIds" .!= mempty))
instance ToJSON WatchRequest where
toJSON WatchRequest'{..}
= object
(catMaybes
[("labelFilterAction" .=) <$> _wrLabelFilterAction,
("topicName" .=) <$> _wrTopicName,
("labelIds" .=) <$> _wrLabelIds])
data ImapSettings = ImapSettings'
{ _isEnabled :: !(Maybe Bool)
, _isExpungeBehavior :: !(Maybe ImapSettingsExpungeBehavior)
, _isAutoExpunge :: !(Maybe Bool)
, _isMaxFolderSize :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
imapSettings
:: ImapSettings
imapSettings =
ImapSettings'
{ _isEnabled = Nothing
, _isExpungeBehavior = Nothing
, _isAutoExpunge = Nothing
, _isMaxFolderSize = Nothing
}
isEnabled :: Lens' ImapSettings (Maybe Bool)
isEnabled
= lens _isEnabled (\ s a -> s{_isEnabled = a})
isExpungeBehavior :: Lens' ImapSettings (Maybe ImapSettingsExpungeBehavior)
isExpungeBehavior
= lens _isExpungeBehavior
(\ s a -> s{_isExpungeBehavior = a})
isAutoExpunge :: Lens' ImapSettings (Maybe Bool)
isAutoExpunge
= lens _isAutoExpunge
(\ s a -> s{_isAutoExpunge = a})
isMaxFolderSize :: Lens' ImapSettings (Maybe Int32)
isMaxFolderSize
= lens _isMaxFolderSize
(\ s a -> s{_isMaxFolderSize = a})
. mapping _Coerce
instance FromJSON ImapSettings where
parseJSON
= withObject "ImapSettings"
(\ o ->
ImapSettings' <$>
(o .:? "enabled") <*> (o .:? "expungeBehavior") <*>
(o .:? "autoExpunge")
<*> (o .:? "maxFolderSize"))
instance ToJSON ImapSettings where
toJSON ImapSettings'{..}
= object
(catMaybes
[("enabled" .=) <$> _isEnabled,
("expungeBehavior" .=) <$> _isExpungeBehavior,
("autoExpunge" .=) <$> _isAutoExpunge,
("maxFolderSize" .=) <$> _isMaxFolderSize])
data Message = Message'
{ _mRaw :: !(Maybe Bytes)
, _mSnippet :: !(Maybe Text)
, _mSizeEstimate :: !(Maybe (Textual Int32))
, _mPayload :: !(Maybe MessagePart)
, _mHistoryId :: !(Maybe (Textual Word64))
, _mId :: !(Maybe Text)
, _mLabelIds :: !(Maybe [Text])
, _mThreadId :: !(Maybe Text)
, _mInternalDate :: !(Maybe (Textual Int64))
} deriving (Eq,Show,Data,Typeable,Generic)
message
:: Message
message =
Message'
{ _mRaw = Nothing
, _mSnippet = Nothing
, _mSizeEstimate = Nothing
, _mPayload = Nothing
, _mHistoryId = Nothing
, _mId = Nothing
, _mLabelIds = Nothing
, _mThreadId = Nothing
, _mInternalDate = Nothing
}
mRaw :: Lens' Message (Maybe ByteString)
mRaw
= lens _mRaw (\ s a -> s{_mRaw = a}) . mapping _Bytes
mSnippet :: Lens' Message (Maybe Text)
mSnippet = lens _mSnippet (\ s a -> s{_mSnippet = a})
mSizeEstimate :: Lens' Message (Maybe Int32)
mSizeEstimate
= lens _mSizeEstimate
(\ s a -> s{_mSizeEstimate = a})
. mapping _Coerce
mPayload :: Lens' Message (Maybe MessagePart)
mPayload = lens _mPayload (\ s a -> s{_mPayload = a})
mHistoryId :: Lens' Message (Maybe Word64)
mHistoryId
= lens _mHistoryId (\ s a -> s{_mHistoryId = a}) .
mapping _Coerce
mId :: Lens' Message (Maybe Text)
mId = lens _mId (\ s a -> s{_mId = a})
mLabelIds :: Lens' Message [Text]
mLabelIds
= lens _mLabelIds (\ s a -> s{_mLabelIds = a}) .
_Default
. _Coerce
mThreadId :: Lens' Message (Maybe Text)
mThreadId
= lens _mThreadId (\ s a -> s{_mThreadId = a})
mInternalDate :: Lens' Message (Maybe Int64)
mInternalDate
= lens _mInternalDate
(\ s a -> s{_mInternalDate = a})
. mapping _Coerce
instance FromJSON Message where
parseJSON
= withObject "Message"
(\ o ->
Message' <$>
(o .:? "raw") <*> (o .:? "snippet") <*>
(o .:? "sizeEstimate")
<*> (o .:? "payload")
<*> (o .:? "historyId")
<*> (o .:? "id")
<*> (o .:? "labelIds" .!= mempty)
<*> (o .:? "threadId")
<*> (o .:? "internalDate"))
instance ToJSON Message where
toJSON Message'{..}
= object
(catMaybes
[("raw" .=) <$> _mRaw, ("snippet" .=) <$> _mSnippet,
("sizeEstimate" .=) <$> _mSizeEstimate,
("payload" .=) <$> _mPayload,
("historyId" .=) <$> _mHistoryId, ("id" .=) <$> _mId,
("labelIds" .=) <$> _mLabelIds,
("threadId" .=) <$> _mThreadId,
("internalDate" .=) <$> _mInternalDate])
data HistoryLabelRemoved = HistoryLabelRemoved'
{ _hlrLabelIds :: !(Maybe [Text])
, _hlrMessage :: !(Maybe Message)
} deriving (Eq,Show,Data,Typeable,Generic)
historyLabelRemoved
:: HistoryLabelRemoved
historyLabelRemoved =
HistoryLabelRemoved'
{ _hlrLabelIds = Nothing
, _hlrMessage = Nothing
}
hlrLabelIds :: Lens' HistoryLabelRemoved [Text]
hlrLabelIds
= lens _hlrLabelIds (\ s a -> s{_hlrLabelIds = a}) .
_Default
. _Coerce
hlrMessage :: Lens' HistoryLabelRemoved (Maybe Message)
hlrMessage
= lens _hlrMessage (\ s a -> s{_hlrMessage = a})
instance FromJSON HistoryLabelRemoved where
parseJSON
= withObject "HistoryLabelRemoved"
(\ o ->
HistoryLabelRemoved' <$>
(o .:? "labelIds" .!= mempty) <*> (o .:? "message"))
instance ToJSON HistoryLabelRemoved where
toJSON HistoryLabelRemoved'{..}
= object
(catMaybes
[("labelIds" .=) <$> _hlrLabelIds,
("message" .=) <$> _hlrMessage])
data Thread = Thread'
{ _tSnippet :: !(Maybe Text)
, _tHistoryId :: !(Maybe (Textual Word64))
, _tId :: !(Maybe Text)
, _tMessages :: !(Maybe [Message])
} deriving (Eq,Show,Data,Typeable,Generic)
thread
:: Thread
thread =
Thread'
{ _tSnippet = Nothing
, _tHistoryId = Nothing
, _tId = Nothing
, _tMessages = Nothing
}
tSnippet :: Lens' Thread (Maybe Text)
tSnippet = lens _tSnippet (\ s a -> s{_tSnippet = a})
tHistoryId :: Lens' Thread (Maybe Word64)
tHistoryId
= lens _tHistoryId (\ s a -> s{_tHistoryId = a}) .
mapping _Coerce
tId :: Lens' Thread (Maybe Text)
tId = lens _tId (\ s a -> s{_tId = a})
tMessages :: Lens' Thread [Message]
tMessages
= lens _tMessages (\ s a -> s{_tMessages = a}) .
_Default
. _Coerce
instance FromJSON Thread where
parseJSON
= withObject "Thread"
(\ o ->
Thread' <$>
(o .:? "snippet") <*> (o .:? "historyId") <*>
(o .:? "id")
<*> (o .:? "messages" .!= mempty))
instance ToJSON Thread where
toJSON Thread'{..}
= object
(catMaybes
[("snippet" .=) <$> _tSnippet,
("historyId" .=) <$> _tHistoryId, ("id" .=) <$> _tId,
("messages" .=) <$> _tMessages])
data FilterAction = FilterAction'
{ _faForward :: !(Maybe Text)
, _faRemoveLabelIds :: !(Maybe [Text])
, _faAddLabelIds :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
filterAction
:: FilterAction
filterAction =
FilterAction'
{ _faForward = Nothing
, _faRemoveLabelIds = Nothing
, _faAddLabelIds = Nothing
}
faForward :: Lens' FilterAction (Maybe Text)
faForward
= lens _faForward (\ s a -> s{_faForward = a})
faRemoveLabelIds :: Lens' FilterAction [Text]
faRemoveLabelIds
= lens _faRemoveLabelIds
(\ s a -> s{_faRemoveLabelIds = a})
. _Default
. _Coerce
faAddLabelIds :: Lens' FilterAction [Text]
faAddLabelIds
= lens _faAddLabelIds
(\ s a -> s{_faAddLabelIds = a})
. _Default
. _Coerce
instance FromJSON FilterAction where
parseJSON
= withObject "FilterAction"
(\ o ->
FilterAction' <$>
(o .:? "forward") <*>
(o .:? "removeLabelIds" .!= mempty)
<*> (o .:? "addLabelIds" .!= mempty))
instance ToJSON FilterAction where
toJSON FilterAction'{..}
= object
(catMaybes
[("forward" .=) <$> _faForward,
("removeLabelIds" .=) <$> _faRemoveLabelIds,
("addLabelIds" .=) <$> _faAddLabelIds])
data Label = Label'
{ _lThreadsUnread :: !(Maybe (Textual Int32))
, _lMessageListVisibility :: !(Maybe LabelMessageListVisibility)
, _lMessagesTotal :: !(Maybe (Textual Int32))
, _lMessagesUnread :: !(Maybe (Textual Int32))
, _lName :: !(Maybe Text)
, _lThreadsTotal :: !(Maybe (Textual Int32))
, _lLabelListVisibility :: !(Maybe LabelLabelListVisibility)
, _lId :: !(Maybe Text)
, _lType :: !(Maybe LabelType)
} deriving (Eq,Show,Data,Typeable,Generic)
label
:: Label
label =
Label'
{ _lThreadsUnread = Nothing
, _lMessageListVisibility = Nothing
, _lMessagesTotal = Nothing
, _lMessagesUnread = Nothing
, _lName = Nothing
, _lThreadsTotal = Nothing
, _lLabelListVisibility = Nothing
, _lId = Nothing
, _lType = Nothing
}
lThreadsUnread :: Lens' Label (Maybe Int32)
lThreadsUnread
= lens _lThreadsUnread
(\ s a -> s{_lThreadsUnread = a})
. mapping _Coerce
lMessageListVisibility :: Lens' Label (Maybe LabelMessageListVisibility)
lMessageListVisibility
= lens _lMessageListVisibility
(\ s a -> s{_lMessageListVisibility = a})
lMessagesTotal :: Lens' Label (Maybe Int32)
lMessagesTotal
= lens _lMessagesTotal
(\ s a -> s{_lMessagesTotal = a})
. mapping _Coerce
lMessagesUnread :: Lens' Label (Maybe Int32)
lMessagesUnread
= lens _lMessagesUnread
(\ s a -> s{_lMessagesUnread = a})
. mapping _Coerce
lName :: Lens' Label (Maybe Text)
lName = lens _lName (\ s a -> s{_lName = a})
lThreadsTotal :: Lens' Label (Maybe Int32)
lThreadsTotal
= lens _lThreadsTotal
(\ s a -> s{_lThreadsTotal = a})
. mapping _Coerce
lLabelListVisibility :: Lens' Label (Maybe LabelLabelListVisibility)
lLabelListVisibility
= lens _lLabelListVisibility
(\ s a -> s{_lLabelListVisibility = a})
lId :: Lens' Label (Maybe Text)
lId = lens _lId (\ s a -> s{_lId = a})
lType :: Lens' Label (Maybe LabelType)
lType = lens _lType (\ s a -> s{_lType = a})
instance FromJSON Label where
parseJSON
= withObject "Label"
(\ o ->
Label' <$>
(o .:? "threadsUnread") <*>
(o .:? "messageListVisibility")
<*> (o .:? "messagesTotal")
<*> (o .:? "messagesUnread")
<*> (o .:? "name")
<*> (o .:? "threadsTotal")
<*> (o .:? "labelListVisibility")
<*> (o .:? "id")
<*> (o .:? "type"))
instance ToJSON Label where
toJSON Label'{..}
= object
(catMaybes
[("threadsUnread" .=) <$> _lThreadsUnread,
("messageListVisibility" .=) <$>
_lMessageListVisibility,
("messagesTotal" .=) <$> _lMessagesTotal,
("messagesUnread" .=) <$> _lMessagesUnread,
("name" .=) <$> _lName,
("threadsTotal" .=) <$> _lThreadsTotal,
("labelListVisibility" .=) <$> _lLabelListVisibility,
("id" .=) <$> _lId, ("type" .=) <$> _lType])
data ListMessagesResponse = ListMessagesResponse'
{ _lmrNextPageToken :: !(Maybe Text)
, _lmrResultSizeEstimate :: !(Maybe (Textual Word32))
, _lmrMessages :: !(Maybe [Message])
} deriving (Eq,Show,Data,Typeable,Generic)
listMessagesResponse
:: ListMessagesResponse
listMessagesResponse =
ListMessagesResponse'
{ _lmrNextPageToken = Nothing
, _lmrResultSizeEstimate = Nothing
, _lmrMessages = Nothing
}
lmrNextPageToken :: Lens' ListMessagesResponse (Maybe Text)
lmrNextPageToken
= lens _lmrNextPageToken
(\ s a -> s{_lmrNextPageToken = a})
lmrResultSizeEstimate :: Lens' ListMessagesResponse (Maybe Word32)
lmrResultSizeEstimate
= lens _lmrResultSizeEstimate
(\ s a -> s{_lmrResultSizeEstimate = a})
. mapping _Coerce
lmrMessages :: Lens' ListMessagesResponse [Message]
lmrMessages
= lens _lmrMessages (\ s a -> s{_lmrMessages = a}) .
_Default
. _Coerce
instance FromJSON ListMessagesResponse where
parseJSON
= withObject "ListMessagesResponse"
(\ o ->
ListMessagesResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "resultSizeEstimate")
<*> (o .:? "messages" .!= mempty))
instance ToJSON ListMessagesResponse where
toJSON ListMessagesResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lmrNextPageToken,
("resultSizeEstimate" .=) <$> _lmrResultSizeEstimate,
("messages" .=) <$> _lmrMessages])
newtype HistoryMessageAdded = HistoryMessageAdded'
{ _hmaMessage :: Maybe Message
} deriving (Eq,Show,Data,Typeable,Generic)
historyMessageAdded
:: HistoryMessageAdded
historyMessageAdded =
HistoryMessageAdded'
{ _hmaMessage = Nothing
}
hmaMessage :: Lens' HistoryMessageAdded (Maybe Message)
hmaMessage
= lens _hmaMessage (\ s a -> s{_hmaMessage = a})
instance FromJSON HistoryMessageAdded where
parseJSON
= withObject "HistoryMessageAdded"
(\ o -> HistoryMessageAdded' <$> (o .:? "message"))
instance ToJSON HistoryMessageAdded where
toJSON HistoryMessageAdded'{..}
= object (catMaybes [("message" .=) <$> _hmaMessage])