{-# 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.Chat.Types.Product where
import Network.Google.Chat.Types.Sum
import Network.Google.Prelude
data Card =
Card'
{ _cCardActions :: !(Maybe [CardAction])
, _cName :: !(Maybe Text)
, _cHeader :: !(Maybe CardHeader)
, _cSections :: !(Maybe [Section])
}
deriving (Eq, Show, Data, Typeable, Generic)
card
:: Card
card =
Card'
{ _cCardActions = Nothing
, _cName = Nothing
, _cHeader = Nothing
, _cSections = Nothing
}
cCardActions :: Lens' Card [CardAction]
cCardActions
= lens _cCardActions (\ s a -> s{_cCardActions = a})
. _Default
. _Coerce
cName :: Lens' Card (Maybe Text)
cName = lens _cName (\ s a -> s{_cName = a})
cHeader :: Lens' Card (Maybe CardHeader)
cHeader = lens _cHeader (\ s a -> s{_cHeader = a})
cSections :: Lens' Card [Section]
cSections
= lens _cSections (\ s a -> s{_cSections = a}) .
_Default
. _Coerce
instance FromJSON Card where
parseJSON
= withObject "Card"
(\ o ->
Card' <$>
(o .:? "cardActions" .!= mempty) <*> (o .:? "name")
<*> (o .:? "header")
<*> (o .:? "sections" .!= mempty))
instance ToJSON Card where
toJSON Card'{..}
= object
(catMaybes
[("cardActions" .=) <$> _cCardActions,
("name" .=) <$> _cName, ("header" .=) <$> _cHeader,
("sections" .=) <$> _cSections])
data Space =
Space'
{ _sName :: !(Maybe Text)
, _sDisplayName :: !(Maybe Text)
, _sType :: !(Maybe SpaceType)
}
deriving (Eq, Show, Data, Typeable, Generic)
space
:: Space
space = Space' {_sName = Nothing, _sDisplayName = Nothing, _sType = Nothing}
sName :: Lens' Space (Maybe Text)
sName = lens _sName (\ s a -> s{_sName = a})
sDisplayName :: Lens' Space (Maybe Text)
sDisplayName
= lens _sDisplayName (\ s a -> s{_sDisplayName = a})
sType :: Lens' Space (Maybe SpaceType)
sType = lens _sType (\ s a -> s{_sType = a})
instance FromJSON Space where
parseJSON
= withObject "Space"
(\ o ->
Space' <$>
(o .:? "name") <*> (o .:? "displayName") <*>
(o .:? "type"))
instance ToJSON Space where
toJSON Space'{..}
= object
(catMaybes
[("name" .=) <$> _sName,
("displayName" .=) <$> _sDisplayName,
("type" .=) <$> _sType])
data KeyValue =
KeyValue'
{ _kvOnClick :: !(Maybe OnClick)
, _kvTopLabel :: !(Maybe Text)
, _kvIcon :: !(Maybe KeyValueIcon)
, _kvButton :: !(Maybe Button)
, _kvContent :: !(Maybe Text)
, _kvIconURL :: !(Maybe Text)
, _kvContentMultiline :: !(Maybe Bool)
, _kvBottomLabel :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
keyValue
:: KeyValue
keyValue =
KeyValue'
{ _kvOnClick = Nothing
, _kvTopLabel = Nothing
, _kvIcon = Nothing
, _kvButton = Nothing
, _kvContent = Nothing
, _kvIconURL = Nothing
, _kvContentMultiline = Nothing
, _kvBottomLabel = Nothing
}
kvOnClick :: Lens' KeyValue (Maybe OnClick)
kvOnClick
= lens _kvOnClick (\ s a -> s{_kvOnClick = a})
kvTopLabel :: Lens' KeyValue (Maybe Text)
kvTopLabel
= lens _kvTopLabel (\ s a -> s{_kvTopLabel = a})
kvIcon :: Lens' KeyValue (Maybe KeyValueIcon)
kvIcon = lens _kvIcon (\ s a -> s{_kvIcon = a})
kvButton :: Lens' KeyValue (Maybe Button)
kvButton = lens _kvButton (\ s a -> s{_kvButton = a})
kvContent :: Lens' KeyValue (Maybe Text)
kvContent
= lens _kvContent (\ s a -> s{_kvContent = a})
kvIconURL :: Lens' KeyValue (Maybe Text)
kvIconURL
= lens _kvIconURL (\ s a -> s{_kvIconURL = a})
kvContentMultiline :: Lens' KeyValue (Maybe Bool)
kvContentMultiline
= lens _kvContentMultiline
(\ s a -> s{_kvContentMultiline = a})
kvBottomLabel :: Lens' KeyValue (Maybe Text)
kvBottomLabel
= lens _kvBottomLabel
(\ s a -> s{_kvBottomLabel = a})
instance FromJSON KeyValue where
parseJSON
= withObject "KeyValue"
(\ o ->
KeyValue' <$>
(o .:? "onClick") <*> (o .:? "topLabel") <*>
(o .:? "icon")
<*> (o .:? "button")
<*> (o .:? "content")
<*> (o .:? "iconUrl")
<*> (o .:? "contentMultiline")
<*> (o .:? "bottomLabel"))
instance ToJSON KeyValue where
toJSON KeyValue'{..}
= object
(catMaybes
[("onClick" .=) <$> _kvOnClick,
("topLabel" .=) <$> _kvTopLabel,
("icon" .=) <$> _kvIcon, ("button" .=) <$> _kvButton,
("content" .=) <$> _kvContent,
("iconUrl" .=) <$> _kvIconURL,
("contentMultiline" .=) <$> _kvContentMultiline,
("bottomLabel" .=) <$> _kvBottomLabel])
data WidgetMarkup =
WidgetMarkup'
{ _wmKeyValue :: !(Maybe KeyValue)
, _wmImage :: !(Maybe Image)
, _wmButtons :: !(Maybe [Button])
, _wmTextParagraph :: !(Maybe TextParagraph)
}
deriving (Eq, Show, Data, Typeable, Generic)
widgetMarkup
:: WidgetMarkup
widgetMarkup =
WidgetMarkup'
{ _wmKeyValue = Nothing
, _wmImage = Nothing
, _wmButtons = Nothing
, _wmTextParagraph = Nothing
}
wmKeyValue :: Lens' WidgetMarkup (Maybe KeyValue)
wmKeyValue
= lens _wmKeyValue (\ s a -> s{_wmKeyValue = a})
wmImage :: Lens' WidgetMarkup (Maybe Image)
wmImage = lens _wmImage (\ s a -> s{_wmImage = a})
wmButtons :: Lens' WidgetMarkup [Button]
wmButtons
= lens _wmButtons (\ s a -> s{_wmButtons = a}) .
_Default
. _Coerce
wmTextParagraph :: Lens' WidgetMarkup (Maybe TextParagraph)
wmTextParagraph
= lens _wmTextParagraph
(\ s a -> s{_wmTextParagraph = a})
instance FromJSON WidgetMarkup where
parseJSON
= withObject "WidgetMarkup"
(\ o ->
WidgetMarkup' <$>
(o .:? "keyValue") <*> (o .:? "image") <*>
(o .:? "buttons" .!= mempty)
<*> (o .:? "textParagraph"))
instance ToJSON WidgetMarkup where
toJSON WidgetMarkup'{..}
= object
(catMaybes
[("keyValue" .=) <$> _wmKeyValue,
("image" .=) <$> _wmImage,
("buttons" .=) <$> _wmButtons,
("textParagraph" .=) <$> _wmTextParagraph])
data OnClick =
OnClick'
{ _ocAction :: !(Maybe FormAction)
, _ocOpenLink :: !(Maybe OpenLink)
}
deriving (Eq, Show, Data, Typeable, Generic)
onClick
:: OnClick
onClick = OnClick' {_ocAction = Nothing, _ocOpenLink = Nothing}
ocAction :: Lens' OnClick (Maybe FormAction)
ocAction = lens _ocAction (\ s a -> s{_ocAction = a})
ocOpenLink :: Lens' OnClick (Maybe OpenLink)
ocOpenLink
= lens _ocOpenLink (\ s a -> s{_ocOpenLink = a})
instance FromJSON OnClick where
parseJSON
= withObject "OnClick"
(\ o ->
OnClick' <$> (o .:? "action") <*> (o .:? "openLink"))
instance ToJSON OnClick where
toJSON OnClick'{..}
= object
(catMaybes
[("action" .=) <$> _ocAction,
("openLink" .=) <$> _ocOpenLink])
data Annotation =
Annotation'
{ _aLength :: !(Maybe (Textual Int32))
, _aType :: !(Maybe AnnotationType)
, _aUserMention :: !(Maybe UserMentionMetadata)
, _aStartIndex :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
annotation
:: Annotation
annotation =
Annotation'
{ _aLength = Nothing
, _aType = Nothing
, _aUserMention = Nothing
, _aStartIndex = Nothing
}
aLength :: Lens' Annotation (Maybe Int32)
aLength
= lens _aLength (\ s a -> s{_aLength = a}) .
mapping _Coerce
aType :: Lens' Annotation (Maybe AnnotationType)
aType = lens _aType (\ s a -> s{_aType = a})
aUserMention :: Lens' Annotation (Maybe UserMentionMetadata)
aUserMention
= lens _aUserMention (\ s a -> s{_aUserMention = a})
aStartIndex :: Lens' Annotation (Maybe Int32)
aStartIndex
= lens _aStartIndex (\ s a -> s{_aStartIndex = a}) .
mapping _Coerce
instance FromJSON Annotation where
parseJSON
= withObject "Annotation"
(\ o ->
Annotation' <$>
(o .:? "length") <*> (o .:? "type") <*>
(o .:? "userMention")
<*> (o .:? "startIndex"))
instance ToJSON Annotation where
toJSON Annotation'{..}
= object
(catMaybes
[("length" .=) <$> _aLength, ("type" .=) <$> _aType,
("userMention" .=) <$> _aUserMention,
("startIndex" .=) <$> _aStartIndex])
data Image =
Image'
{ _iOnClick :: !(Maybe OnClick)
, _iAspectRatio :: !(Maybe (Textual Double))
, _iImageURL :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
image
:: Image
image =
Image' {_iOnClick = Nothing, _iAspectRatio = Nothing, _iImageURL = Nothing}
iOnClick :: Lens' Image (Maybe OnClick)
iOnClick = lens _iOnClick (\ s a -> s{_iOnClick = a})
iAspectRatio :: Lens' Image (Maybe Double)
iAspectRatio
= lens _iAspectRatio (\ s a -> s{_iAspectRatio = a})
. mapping _Coerce
iImageURL :: Lens' Image (Maybe Text)
iImageURL
= lens _iImageURL (\ s a -> s{_iImageURL = a})
instance FromJSON Image where
parseJSON
= withObject "Image"
(\ o ->
Image' <$>
(o .:? "onClick") <*> (o .:? "aspectRatio") <*>
(o .:? "imageUrl"))
instance ToJSON Image where
toJSON Image'{..}
= object
(catMaybes
[("onClick" .=) <$> _iOnClick,
("aspectRatio" .=) <$> _iAspectRatio,
("imageUrl" .=) <$> _iImageURL])
data ActionParameter =
ActionParameter'
{ _apValue :: !(Maybe Text)
, _apKey :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
actionParameter
:: ActionParameter
actionParameter = ActionParameter' {_apValue = Nothing, _apKey = Nothing}
apValue :: Lens' ActionParameter (Maybe Text)
apValue = lens _apValue (\ s a -> s{_apValue = a})
apKey :: Lens' ActionParameter (Maybe Text)
apKey = lens _apKey (\ s a -> s{_apKey = a})
instance FromJSON ActionParameter where
parseJSON
= withObject "ActionParameter"
(\ o ->
ActionParameter' <$>
(o .:? "value") <*> (o .:? "key"))
instance ToJSON ActionParameter where
toJSON ActionParameter'{..}
= object
(catMaybes
[("value" .=) <$> _apValue, ("key" .=) <$> _apKey])
data Membership =
Membership'
{ _mState :: !(Maybe MembershipState)
, _mName :: !(Maybe Text)
, _mMember :: !(Maybe User)
, _mCreateTime :: !(Maybe DateTime')
}
deriving (Eq, Show, Data, Typeable, Generic)
membership
:: Membership
membership =
Membership'
{ _mState = Nothing
, _mName = Nothing
, _mMember = Nothing
, _mCreateTime = Nothing
}
mState :: Lens' Membership (Maybe MembershipState)
mState = lens _mState (\ s a -> s{_mState = a})
mName :: Lens' Membership (Maybe Text)
mName = lens _mName (\ s a -> s{_mName = a})
mMember :: Lens' Membership (Maybe User)
mMember = lens _mMember (\ s a -> s{_mMember = a})
mCreateTime :: Lens' Membership (Maybe UTCTime)
mCreateTime
= lens _mCreateTime (\ s a -> s{_mCreateTime = a}) .
mapping _DateTime
instance FromJSON Membership where
parseJSON
= withObject "Membership"
(\ o ->
Membership' <$>
(o .:? "state") <*> (o .:? "name") <*>
(o .:? "member")
<*> (o .:? "createTime"))
instance ToJSON Membership where
toJSON Membership'{..}
= object
(catMaybes
[("state" .=) <$> _mState, ("name" .=) <$> _mName,
("member" .=) <$> _mMember,
("createTime" .=) <$> _mCreateTime])
data Empty =
Empty'
deriving (Eq, Show, Data, Typeable, Generic)
empty
:: Empty
empty = Empty'
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty')
instance ToJSON Empty where
toJSON = const emptyObject
data DeprecatedEvent =
DeprecatedEvent'
{ _deSpace :: !(Maybe Space)
, _deToken :: !(Maybe Text)
, _deAction :: !(Maybe FormAction)
, _deEventTime :: !(Maybe DateTime')
, _deUser :: !(Maybe User)
, _deConfigCompleteRedirectURL :: !(Maybe Text)
, _deType :: !(Maybe DeprecatedEventType)
, _deMessage :: !(Maybe Message)
, _deThreadKey :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
deprecatedEvent
:: DeprecatedEvent
deprecatedEvent =
DeprecatedEvent'
{ _deSpace = Nothing
, _deToken = Nothing
, _deAction = Nothing
, _deEventTime = Nothing
, _deUser = Nothing
, _deConfigCompleteRedirectURL = Nothing
, _deType = Nothing
, _deMessage = Nothing
, _deThreadKey = Nothing
}
deSpace :: Lens' DeprecatedEvent (Maybe Space)
deSpace = lens _deSpace (\ s a -> s{_deSpace = a})
deToken :: Lens' DeprecatedEvent (Maybe Text)
deToken = lens _deToken (\ s a -> s{_deToken = a})
deAction :: Lens' DeprecatedEvent (Maybe FormAction)
deAction = lens _deAction (\ s a -> s{_deAction = a})
deEventTime :: Lens' DeprecatedEvent (Maybe UTCTime)
deEventTime
= lens _deEventTime (\ s a -> s{_deEventTime = a}) .
mapping _DateTime
deUser :: Lens' DeprecatedEvent (Maybe User)
deUser = lens _deUser (\ s a -> s{_deUser = a})
deConfigCompleteRedirectURL :: Lens' DeprecatedEvent (Maybe Text)
deConfigCompleteRedirectURL
= lens _deConfigCompleteRedirectURL
(\ s a -> s{_deConfigCompleteRedirectURL = a})
deType :: Lens' DeprecatedEvent (Maybe DeprecatedEventType)
deType = lens _deType (\ s a -> s{_deType = a})
deMessage :: Lens' DeprecatedEvent (Maybe Message)
deMessage
= lens _deMessage (\ s a -> s{_deMessage = a})
deThreadKey :: Lens' DeprecatedEvent (Maybe Text)
deThreadKey
= lens _deThreadKey (\ s a -> s{_deThreadKey = a})
instance FromJSON DeprecatedEvent where
parseJSON
= withObject "DeprecatedEvent"
(\ o ->
DeprecatedEvent' <$>
(o .:? "space") <*> (o .:? "token") <*>
(o .:? "action")
<*> (o .:? "eventTime")
<*> (o .:? "user")
<*> (o .:? "configCompleteRedirectUrl")
<*> (o .:? "type")
<*> (o .:? "message")
<*> (o .:? "threadKey"))
instance ToJSON DeprecatedEvent where
toJSON DeprecatedEvent'{..}
= object
(catMaybes
[("space" .=) <$> _deSpace,
("token" .=) <$> _deToken,
("action" .=) <$> _deAction,
("eventTime" .=) <$> _deEventTime,
("user" .=) <$> _deUser,
("configCompleteRedirectUrl" .=) <$>
_deConfigCompleteRedirectURL,
("type" .=) <$> _deType,
("message" .=) <$> _deMessage,
("threadKey" .=) <$> _deThreadKey])
newtype TextParagraph =
TextParagraph'
{ _tpText :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
textParagraph
:: TextParagraph
textParagraph = TextParagraph' {_tpText = Nothing}
tpText :: Lens' TextParagraph (Maybe Text)
tpText = lens _tpText (\ s a -> s{_tpText = a})
instance FromJSON TextParagraph where
parseJSON
= withObject "TextParagraph"
(\ o -> TextParagraph' <$> (o .:? "text"))
instance ToJSON TextParagraph where
toJSON TextParagraph'{..}
= object (catMaybes [("text" .=) <$> _tpText])
data Button =
Button'
{ _bTextButton :: !(Maybe TextButton)
, _bImageButton :: !(Maybe ImageButton)
}
deriving (Eq, Show, Data, Typeable, Generic)
button
:: Button
button = Button' {_bTextButton = Nothing, _bImageButton = Nothing}
bTextButton :: Lens' Button (Maybe TextButton)
bTextButton
= lens _bTextButton (\ s a -> s{_bTextButton = a})
bImageButton :: Lens' Button (Maybe ImageButton)
bImageButton
= lens _bImageButton (\ s a -> s{_bImageButton = a})
instance FromJSON Button where
parseJSON
= withObject "Button"
(\ o ->
Button' <$>
(o .:? "textButton") <*> (o .:? "imageButton"))
instance ToJSON Button where
toJSON Button'{..}
= object
(catMaybes
[("textButton" .=) <$> _bTextButton,
("imageButton" .=) <$> _bImageButton])
data ListSpacesResponse =
ListSpacesResponse'
{ _lsrNextPageToken :: !(Maybe Text)
, _lsrSpaces :: !(Maybe [Space])
}
deriving (Eq, Show, Data, Typeable, Generic)
listSpacesResponse
:: ListSpacesResponse
listSpacesResponse =
ListSpacesResponse' {_lsrNextPageToken = Nothing, _lsrSpaces = Nothing}
lsrNextPageToken :: Lens' ListSpacesResponse (Maybe Text)
lsrNextPageToken
= lens _lsrNextPageToken
(\ s a -> s{_lsrNextPageToken = a})
lsrSpaces :: Lens' ListSpacesResponse [Space]
lsrSpaces
= lens _lsrSpaces (\ s a -> s{_lsrSpaces = a}) .
_Default
. _Coerce
instance FromJSON ListSpacesResponse where
parseJSON
= withObject "ListSpacesResponse"
(\ o ->
ListSpacesResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "spaces" .!= mempty))
instance ToJSON ListSpacesResponse where
toJSON ListSpacesResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lsrNextPageToken,
("spaces" .=) <$> _lsrSpaces])
data User =
User'
{ _uName :: !(Maybe Text)
, _uDisplayName :: !(Maybe Text)
, _uType :: !(Maybe UserType)
}
deriving (Eq, Show, Data, Typeable, Generic)
user
:: User
user = User' {_uName = Nothing, _uDisplayName = Nothing, _uType = Nothing}
uName :: Lens' User (Maybe Text)
uName = lens _uName (\ s a -> s{_uName = a})
uDisplayName :: Lens' User (Maybe Text)
uDisplayName
= lens _uDisplayName (\ s a -> s{_uDisplayName = a})
uType :: Lens' User (Maybe UserType)
uType = lens _uType (\ s a -> s{_uType = a})
instance FromJSON User where
parseJSON
= withObject "User"
(\ o ->
User' <$>
(o .:? "name") <*> (o .:? "displayName") <*>
(o .:? "type"))
instance ToJSON User where
toJSON User'{..}
= object
(catMaybes
[("name" .=) <$> _uName,
("displayName" .=) <$> _uDisplayName,
("type" .=) <$> _uType])
newtype OpenLink =
OpenLink'
{ _olURL :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
openLink
:: OpenLink
openLink = OpenLink' {_olURL = Nothing}
olURL :: Lens' OpenLink (Maybe Text)
olURL = lens _olURL (\ s a -> s{_olURL = a})
instance FromJSON OpenLink where
parseJSON
= withObject "OpenLink"
(\ o -> OpenLink' <$> (o .:? "url"))
instance ToJSON OpenLink where
toJSON OpenLink'{..}
= object (catMaybes [("url" .=) <$> _olURL])
data CardAction =
CardAction'
{ _caOnClick :: !(Maybe OnClick)
, _caActionLabel :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
cardAction
:: CardAction
cardAction = CardAction' {_caOnClick = Nothing, _caActionLabel = Nothing}
caOnClick :: Lens' CardAction (Maybe OnClick)
caOnClick
= lens _caOnClick (\ s a -> s{_caOnClick = a})
caActionLabel :: Lens' CardAction (Maybe Text)
caActionLabel
= lens _caActionLabel
(\ s a -> s{_caActionLabel = a})
instance FromJSON CardAction where
parseJSON
= withObject "CardAction"
(\ o ->
CardAction' <$>
(o .:? "onClick") <*> (o .:? "actionLabel"))
instance ToJSON CardAction where
toJSON CardAction'{..}
= object
(catMaybes
[("onClick" .=) <$> _caOnClick,
("actionLabel" .=) <$> _caActionLabel])
data ActionResponse =
ActionResponse'
{ _arURL :: !(Maybe Text)
, _arType :: !(Maybe ActionResponseType)
}
deriving (Eq, Show, Data, Typeable, Generic)
actionResponse
:: ActionResponse
actionResponse = ActionResponse' {_arURL = Nothing, _arType = Nothing}
arURL :: Lens' ActionResponse (Maybe Text)
arURL = lens _arURL (\ s a -> s{_arURL = a})
arType :: Lens' ActionResponse (Maybe ActionResponseType)
arType = lens _arType (\ s a -> s{_arType = a})
instance FromJSON ActionResponse where
parseJSON
= withObject "ActionResponse"
(\ o ->
ActionResponse' <$> (o .:? "url") <*> (o .:? "type"))
instance ToJSON ActionResponse where
toJSON ActionResponse'{..}
= object
(catMaybes
[("url" .=) <$> _arURL, ("type" .=) <$> _arType])
data FormAction =
FormAction'
{ _faActionMethodName :: !(Maybe Text)
, _faParameters :: !(Maybe [ActionParameter])
}
deriving (Eq, Show, Data, Typeable, Generic)
formAction
:: FormAction
formAction =
FormAction' {_faActionMethodName = Nothing, _faParameters = Nothing}
faActionMethodName :: Lens' FormAction (Maybe Text)
faActionMethodName
= lens _faActionMethodName
(\ s a -> s{_faActionMethodName = a})
faParameters :: Lens' FormAction [ActionParameter]
faParameters
= lens _faParameters (\ s a -> s{_faParameters = a})
. _Default
. _Coerce
instance FromJSON FormAction where
parseJSON
= withObject "FormAction"
(\ o ->
FormAction' <$>
(o .:? "actionMethodName") <*>
(o .:? "parameters" .!= mempty))
instance ToJSON FormAction where
toJSON FormAction'{..}
= object
(catMaybes
[("actionMethodName" .=) <$> _faActionMethodName,
("parameters" .=) <$> _faParameters])
data ListMembershipsResponse =
ListMembershipsResponse'
{ _lmrNextPageToken :: !(Maybe Text)
, _lmrMemberships :: !(Maybe [Membership])
}
deriving (Eq, Show, Data, Typeable, Generic)
listMembershipsResponse
:: ListMembershipsResponse
listMembershipsResponse =
ListMembershipsResponse'
{_lmrNextPageToken = Nothing, _lmrMemberships = Nothing}
lmrNextPageToken :: Lens' ListMembershipsResponse (Maybe Text)
lmrNextPageToken
= lens _lmrNextPageToken
(\ s a -> s{_lmrNextPageToken = a})
lmrMemberships :: Lens' ListMembershipsResponse [Membership]
lmrMemberships
= lens _lmrMemberships
(\ s a -> s{_lmrMemberships = a})
. _Default
. _Coerce
instance FromJSON ListMembershipsResponse where
parseJSON
= withObject "ListMembershipsResponse"
(\ o ->
ListMembershipsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "memberships" .!= mempty))
instance ToJSON ListMembershipsResponse where
toJSON ListMembershipsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lmrNextPageToken,
("memberships" .=) <$> _lmrMemberships])
data Message =
Message'
{ _mesAnnotations :: !(Maybe [Annotation])
, _mesSpace :: !(Maybe Space)
, _mesText :: !(Maybe Text)
, _mesSender :: !(Maybe User)
, _mesName :: !(Maybe Text)
, _mesPreviewText :: !(Maybe Text)
, _mesCards :: !(Maybe [Card])
, _mesActionResponse :: !(Maybe ActionResponse)
, _mesArgumentText :: !(Maybe Text)
, _mesThread :: !(Maybe Thread)
, _mesFallbackText :: !(Maybe Text)
, _mesCreateTime :: !(Maybe DateTime')
}
deriving (Eq, Show, Data, Typeable, Generic)
message
:: Message
message =
Message'
{ _mesAnnotations = Nothing
, _mesSpace = Nothing
, _mesText = Nothing
, _mesSender = Nothing
, _mesName = Nothing
, _mesPreviewText = Nothing
, _mesCards = Nothing
, _mesActionResponse = Nothing
, _mesArgumentText = Nothing
, _mesThread = Nothing
, _mesFallbackText = Nothing
, _mesCreateTime = Nothing
}
mesAnnotations :: Lens' Message [Annotation]
mesAnnotations
= lens _mesAnnotations
(\ s a -> s{_mesAnnotations = a})
. _Default
. _Coerce
mesSpace :: Lens' Message (Maybe Space)
mesSpace = lens _mesSpace (\ s a -> s{_mesSpace = a})
mesText :: Lens' Message (Maybe Text)
mesText = lens _mesText (\ s a -> s{_mesText = a})
mesSender :: Lens' Message (Maybe User)
mesSender
= lens _mesSender (\ s a -> s{_mesSender = a})
mesName :: Lens' Message (Maybe Text)
mesName = lens _mesName (\ s a -> s{_mesName = a})
mesPreviewText :: Lens' Message (Maybe Text)
mesPreviewText
= lens _mesPreviewText
(\ s a -> s{_mesPreviewText = a})
mesCards :: Lens' Message [Card]
mesCards
= lens _mesCards (\ s a -> s{_mesCards = a}) .
_Default
. _Coerce
mesActionResponse :: Lens' Message (Maybe ActionResponse)
mesActionResponse
= lens _mesActionResponse
(\ s a -> s{_mesActionResponse = a})
mesArgumentText :: Lens' Message (Maybe Text)
mesArgumentText
= lens _mesArgumentText
(\ s a -> s{_mesArgumentText = a})
mesThread :: Lens' Message (Maybe Thread)
mesThread
= lens _mesThread (\ s a -> s{_mesThread = a})
mesFallbackText :: Lens' Message (Maybe Text)
mesFallbackText
= lens _mesFallbackText
(\ s a -> s{_mesFallbackText = a})
mesCreateTime :: Lens' Message (Maybe UTCTime)
mesCreateTime
= lens _mesCreateTime
(\ s a -> s{_mesCreateTime = a})
. mapping _DateTime
instance FromJSON Message where
parseJSON
= withObject "Message"
(\ o ->
Message' <$>
(o .:? "annotations" .!= mempty) <*> (o .:? "space")
<*> (o .:? "text")
<*> (o .:? "sender")
<*> (o .:? "name")
<*> (o .:? "previewText")
<*> (o .:? "cards" .!= mempty)
<*> (o .:? "actionResponse")
<*> (o .:? "argumentText")
<*> (o .:? "thread")
<*> (o .:? "fallbackText")
<*> (o .:? "createTime"))
instance ToJSON Message where
toJSON Message'{..}
= object
(catMaybes
[("annotations" .=) <$> _mesAnnotations,
("space" .=) <$> _mesSpace, ("text" .=) <$> _mesText,
("sender" .=) <$> _mesSender,
("name" .=) <$> _mesName,
("previewText" .=) <$> _mesPreviewText,
("cards" .=) <$> _mesCards,
("actionResponse" .=) <$> _mesActionResponse,
("argumentText" .=) <$> _mesArgumentText,
("thread" .=) <$> _mesThread,
("fallbackText" .=) <$> _mesFallbackText,
("createTime" .=) <$> _mesCreateTime])
data CardHeader =
CardHeader'
{ _chSubtitle :: !(Maybe Text)
, _chImageURL :: !(Maybe Text)
, _chTitle :: !(Maybe Text)
, _chImageStyle :: !(Maybe CardHeaderImageStyle)
}
deriving (Eq, Show, Data, Typeable, Generic)
cardHeader
:: CardHeader
cardHeader =
CardHeader'
{ _chSubtitle = Nothing
, _chImageURL = Nothing
, _chTitle = Nothing
, _chImageStyle = Nothing
}
chSubtitle :: Lens' CardHeader (Maybe Text)
chSubtitle
= lens _chSubtitle (\ s a -> s{_chSubtitle = a})
chImageURL :: Lens' CardHeader (Maybe Text)
chImageURL
= lens _chImageURL (\ s a -> s{_chImageURL = a})
chTitle :: Lens' CardHeader (Maybe Text)
chTitle = lens _chTitle (\ s a -> s{_chTitle = a})
chImageStyle :: Lens' CardHeader (Maybe CardHeaderImageStyle)
chImageStyle
= lens _chImageStyle (\ s a -> s{_chImageStyle = a})
instance FromJSON CardHeader where
parseJSON
= withObject "CardHeader"
(\ o ->
CardHeader' <$>
(o .:? "subtitle") <*> (o .:? "imageUrl") <*>
(o .:? "title")
<*> (o .:? "imageStyle"))
instance ToJSON CardHeader where
toJSON CardHeader'{..}
= object
(catMaybes
[("subtitle" .=) <$> _chSubtitle,
("imageUrl" .=) <$> _chImageURL,
("title" .=) <$> _chTitle,
("imageStyle" .=) <$> _chImageStyle])
data TextButton =
TextButton'
{ _tbOnClick :: !(Maybe OnClick)
, _tbText :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
textButton
:: TextButton
textButton = TextButton' {_tbOnClick = Nothing, _tbText = Nothing}
tbOnClick :: Lens' TextButton (Maybe OnClick)
tbOnClick
= lens _tbOnClick (\ s a -> s{_tbOnClick = a})
tbText :: Lens' TextButton (Maybe Text)
tbText = lens _tbText (\ s a -> s{_tbText = a})
instance FromJSON TextButton where
parseJSON
= withObject "TextButton"
(\ o ->
TextButton' <$> (o .:? "onClick") <*> (o .:? "text"))
instance ToJSON TextButton where
toJSON TextButton'{..}
= object
(catMaybes
[("onClick" .=) <$> _tbOnClick,
("text" .=) <$> _tbText])
newtype Thread =
Thread'
{ _tName :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
thread
:: Thread
thread = Thread' {_tName = Nothing}
tName :: Lens' Thread (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a})
instance FromJSON Thread where
parseJSON
= withObject "Thread"
(\ o -> Thread' <$> (o .:? "name"))
instance ToJSON Thread where
toJSON Thread'{..}
= object (catMaybes [("name" .=) <$> _tName])
data UserMentionMetadata =
UserMentionMetadata'
{ _ummUser :: !(Maybe User)
, _ummType :: !(Maybe UserMentionMetadataType)
}
deriving (Eq, Show, Data, Typeable, Generic)
userMentionMetadata
:: UserMentionMetadata
userMentionMetadata =
UserMentionMetadata' {_ummUser = Nothing, _ummType = Nothing}
ummUser :: Lens' UserMentionMetadata (Maybe User)
ummUser = lens _ummUser (\ s a -> s{_ummUser = a})
ummType :: Lens' UserMentionMetadata (Maybe UserMentionMetadataType)
ummType = lens _ummType (\ s a -> s{_ummType = a})
instance FromJSON UserMentionMetadata where
parseJSON
= withObject "UserMentionMetadata"
(\ o ->
UserMentionMetadata' <$>
(o .:? "user") <*> (o .:? "type"))
instance ToJSON UserMentionMetadata where
toJSON UserMentionMetadata'{..}
= object
(catMaybes
[("user" .=) <$> _ummUser, ("type" .=) <$> _ummType])
data ImageButton =
ImageButton'
{ _ibOnClick :: !(Maybe OnClick)
, _ibIcon :: !(Maybe ImageButtonIcon)
, _ibName :: !(Maybe Text)
, _ibIconURL :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
imageButton
:: ImageButton
imageButton =
ImageButton'
{ _ibOnClick = Nothing
, _ibIcon = Nothing
, _ibName = Nothing
, _ibIconURL = Nothing
}
ibOnClick :: Lens' ImageButton (Maybe OnClick)
ibOnClick
= lens _ibOnClick (\ s a -> s{_ibOnClick = a})
ibIcon :: Lens' ImageButton (Maybe ImageButtonIcon)
ibIcon = lens _ibIcon (\ s a -> s{_ibIcon = a})
ibName :: Lens' ImageButton (Maybe Text)
ibName = lens _ibName (\ s a -> s{_ibName = a})
ibIconURL :: Lens' ImageButton (Maybe Text)
ibIconURL
= lens _ibIconURL (\ s a -> s{_ibIconURL = a})
instance FromJSON ImageButton where
parseJSON
= withObject "ImageButton"
(\ o ->
ImageButton' <$>
(o .:? "onClick") <*> (o .:? "icon") <*>
(o .:? "name")
<*> (o .:? "iconUrl"))
instance ToJSON ImageButton where
toJSON ImageButton'{..}
= object
(catMaybes
[("onClick" .=) <$> _ibOnClick,
("icon" .=) <$> _ibIcon, ("name" .=) <$> _ibName,
("iconUrl" .=) <$> _ibIconURL])
data Section =
Section'
{ _sWidgets :: !(Maybe [WidgetMarkup])
, _sHeader :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
section
:: Section
section = Section' {_sWidgets = Nothing, _sHeader = Nothing}
sWidgets :: Lens' Section [WidgetMarkup]
sWidgets
= lens _sWidgets (\ s a -> s{_sWidgets = a}) .
_Default
. _Coerce
sHeader :: Lens' Section (Maybe Text)
sHeader = lens _sHeader (\ s a -> s{_sHeader = a})
instance FromJSON Section where
parseJSON
= withObject "Section"
(\ o ->
Section' <$>
(o .:? "widgets" .!= mempty) <*> (o .:? "header"))
instance ToJSON Section where
toJSON Section'{..}
= object
(catMaybes
[("widgets" .=) <$> _sWidgets,
("header" .=) <$> _sHeader])