module TD.Data.PageBlock
  (PageBlock(..)) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.RichText as RichText
import qualified Data.Text as T
import {-# SOURCE #-} qualified TD.Data.PageBlockListItem as PageBlockListItem
import qualified TD.Data.Animation as Animation
import qualified TD.Data.PageBlockCaption as PageBlockCaption
import qualified TD.Data.Audio as Audio
import qualified TD.Data.Photo as Photo
import qualified TD.Data.Video as Video
import qualified TD.Data.VoiceNote as VoiceNote
import qualified TD.Data.ChatPhotoInfo as ChatPhotoInfo
import qualified TD.Data.PageBlockTableCell as PageBlockTableCell
import qualified TD.Data.PageBlockRelatedArticle as PageBlockRelatedArticle
import qualified TD.Data.Location as Location

-- | Describes a block of an instant view for a web page
data PageBlock
  = PageBlockTitle -- ^ The title of a page
    { PageBlock -> Maybe RichText
title :: Maybe RichText.RichText -- ^ Title
    }
  | PageBlockSubtitle -- ^ The subtitle of a page
    { PageBlock -> Maybe RichText
subtitle :: Maybe RichText.RichText -- ^ Subtitle
    }
  | PageBlockAuthorDate -- ^ The author and publishing date of a page
    { PageBlock -> Maybe RichText
author       :: Maybe RichText.RichText -- ^ Author
    , PageBlock -> Maybe Int
publish_date :: Maybe Int               -- ^ Point in time (Unix timestamp) when the article was published; 0 if unknown
    }
  | PageBlockHeader -- ^ A header
    { PageBlock -> Maybe RichText
header :: Maybe RichText.RichText -- ^ Header
    }
  | PageBlockSubheader -- ^ A subheader
    { PageBlock -> Maybe RichText
subheader :: Maybe RichText.RichText -- ^ Subheader
    }
  | PageBlockKicker -- ^ A kicker
    { PageBlock -> Maybe RichText
kicker :: Maybe RichText.RichText -- ^ Kicker
    }
  | PageBlockParagraph -- ^ A text paragraph
    { PageBlock -> Maybe RichText
text :: Maybe RichText.RichText -- ^ Paragraph text
    }
  | PageBlockPreformatted -- ^ A preformatted text paragraph
    { text     :: Maybe RichText.RichText -- ^ Paragraph text
    , PageBlock -> Maybe Text
language :: Maybe T.Text            -- ^ Programming language for which the text needs to be formatted
    }
  | PageBlockFooter -- ^ The footer of a page
    { PageBlock -> Maybe RichText
footer :: Maybe RichText.RichText -- ^ Footer
    }
  | PageBlockDivider -- ^ An empty block separating a page
  | PageBlockAnchor -- ^ An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor
    { PageBlock -> Maybe Text
name :: Maybe T.Text -- ^ Name of the anchor
    }
  | PageBlockList -- ^ A list of data blocks
    { PageBlock -> Maybe [PageBlockListItem]
items :: Maybe [PageBlockListItem.PageBlockListItem] -- ^ The items of the list
    }
  | PageBlockBlockQuote -- ^ A block quote
    { text   :: Maybe RichText.RichText -- ^ Quote text
    , PageBlock -> Maybe RichText
credit :: Maybe RichText.RichText -- ^ Quote credit
    }
  | PageBlockPullQuote -- ^ A pull quote
    { text   :: Maybe RichText.RichText -- ^ Quote text
    , credit :: Maybe RichText.RichText -- ^ Quote credit
    }
  | PageBlockAnimation -- ^ An animation
    { PageBlock -> Maybe Animation
animation     :: Maybe Animation.Animation               -- ^ Animation file; may be null
    , PageBlock -> Maybe PageBlockCaption
caption       :: Maybe PageBlockCaption.PageBlockCaption -- ^ Animation caption
    , PageBlock -> Maybe Bool
need_autoplay :: Maybe Bool                              -- ^ True, if the animation must be played automatically
    }
  | PageBlockAudio -- ^ An audio file
    { PageBlock -> Maybe Audio
audio   :: Maybe Audio.Audio                       -- ^ Audio file; may be null
    , caption :: Maybe PageBlockCaption.PageBlockCaption -- ^ Audio file caption
    }
  | PageBlockPhoto -- ^ A photo
    { PageBlock -> Maybe Photo
photo   :: Maybe Photo.Photo                       -- ^ Photo file; may be null
    , caption :: Maybe PageBlockCaption.PageBlockCaption -- ^ Photo caption
    , PageBlock -> Maybe Text
url     :: Maybe T.Text                            -- ^ URL that needs to be opened when the photo is clicked
    }
  | PageBlockVideo -- ^ A video
    { PageBlock -> Maybe Video
video         :: Maybe Video.Video                       -- ^ Video file; may be null
    , caption       :: Maybe PageBlockCaption.PageBlockCaption -- ^ Video caption
    , need_autoplay :: Maybe Bool                              -- ^ True, if the video must be played automatically
    , PageBlock -> Maybe Bool
is_looped     :: Maybe Bool                              -- ^ True, if the video must be looped
    }
  | PageBlockVoiceNote -- ^ A voice note
    { PageBlock -> Maybe VoiceNote
voice_note :: Maybe VoiceNote.VoiceNote               -- ^ Voice note; may be null
    , caption    :: Maybe PageBlockCaption.PageBlockCaption -- ^ Voice note caption
    }
  | PageBlockCover -- ^ A page cover
    { PageBlock -> Maybe PageBlock
cover :: Maybe PageBlock -- ^ Cover
    }
  | PageBlockEmbedded -- ^ An embedded web page
    { url             :: Maybe T.Text                            -- ^ URL of the embedded page, if available
    , PageBlock -> Maybe Text
html            :: Maybe T.Text                            -- ^ HTML-markup of the embedded page
    , PageBlock -> Maybe Photo
poster_photo    :: Maybe Photo.Photo                       -- ^ Poster photo, if available; may be null
    , PageBlock -> Maybe Int
width           :: Maybe Int                               -- ^ Block width; 0 if unknown
    , PageBlock -> Maybe Int
height          :: Maybe Int                               -- ^ Block height; 0 if unknown
    , caption         :: Maybe PageBlockCaption.PageBlockCaption -- ^ Block caption
    , PageBlock -> Maybe Bool
is_full_width   :: Maybe Bool                              -- ^ True, if the block must be full width
    , PageBlock -> Maybe Bool
allow_scrolling :: Maybe Bool                              -- ^ True, if scrolling needs to be allowed
    }
  | PageBlockEmbeddedPost -- ^ An embedded post
    { url          :: Maybe T.Text                            -- ^ URL of the embedded post
    , PageBlock -> Maybe Text
_author      :: Maybe T.Text                            -- ^ Post author
    , PageBlock -> Maybe Photo
author_photo :: Maybe Photo.Photo                       -- ^ Post author photo; may be null
    , PageBlock -> Maybe Int
date         :: Maybe Int                               -- ^ Point in time (Unix timestamp) when the post was created; 0 if unknown
    , PageBlock -> Maybe [PageBlock]
page_blocks  :: Maybe [PageBlock]                       -- ^ Post content
    , caption      :: Maybe PageBlockCaption.PageBlockCaption -- ^ Post caption
    }
  | PageBlockCollage -- ^ A collage
    { page_blocks :: Maybe [PageBlock]                       -- ^ Collage item contents
    , caption     :: Maybe PageBlockCaption.PageBlockCaption -- ^ Block caption
    }
  | PageBlockSlideshow -- ^ A slideshow
    { page_blocks :: Maybe [PageBlock]                       -- ^ Slideshow item contents
    , caption     :: Maybe PageBlockCaption.PageBlockCaption -- ^ Block caption
    }
  | PageBlockChatLink -- ^ A link to a chat
    { PageBlock -> Maybe Text
_title          :: Maybe T.Text                      -- ^ Chat title
    , PageBlock -> Maybe ChatPhotoInfo
_photo          :: Maybe ChatPhotoInfo.ChatPhotoInfo -- ^ Chat photo; may be null
    , PageBlock -> Maybe Int
accent_color_id :: Maybe Int                         -- ^ Identifier of the accent color for chat title and background of chat photo
    , PageBlock -> Maybe Text
username        :: Maybe T.Text                      -- ^ Chat username by which all other information about the chat can be resolved
    }
  | PageBlockTable -- ^ A table
    { PageBlock -> Maybe RichText
_caption    :: Maybe RichText.RichText                         -- ^ Table caption
    , PageBlock -> Maybe [[PageBlockTableCell]]
cells       :: Maybe [[PageBlockTableCell.PageBlockTableCell]] -- ^ Table cells
    , PageBlock -> Maybe Bool
is_bordered :: Maybe Bool                                      -- ^ True, if the table is bordered
    , PageBlock -> Maybe Bool
is_striped  :: Maybe Bool                                      -- ^ True, if the table is striped
    }
  | PageBlockDetails -- ^ A collapsible block
    { header      :: Maybe RichText.RichText -- ^ Always visible heading for the block
    , page_blocks :: Maybe [PageBlock]       -- ^ Block contents
    , PageBlock -> Maybe Bool
is_open     :: Maybe Bool              -- ^ True, if the block is open by default
    }
  | PageBlockRelatedArticles -- ^ Related articles
    { header   :: Maybe RichText.RichText                                 -- ^ Block header
    , PageBlock -> Maybe [PageBlockRelatedArticle]
articles :: Maybe [PageBlockRelatedArticle.PageBlockRelatedArticle] -- ^ List of related articles
    }
  | PageBlockMap -- ^ A map
    { PageBlock -> Maybe Location
location :: Maybe Location.Location                 -- ^ Location of the map center
    , PageBlock -> Maybe Int
zoom     :: Maybe Int                               -- ^ Map zoom level
    , width    :: Maybe Int                               -- ^ Map width
    , height   :: Maybe Int                               -- ^ Map height
    , caption  :: Maybe PageBlockCaption.PageBlockCaption -- ^ Block caption
    }
  deriving (PageBlock -> PageBlock -> Bool
(PageBlock -> PageBlock -> Bool)
-> (PageBlock -> PageBlock -> Bool) -> Eq PageBlock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PageBlock -> PageBlock -> Bool
== :: PageBlock -> PageBlock -> Bool
$c/= :: PageBlock -> PageBlock -> Bool
/= :: PageBlock -> PageBlock -> Bool
Eq, Int -> PageBlock -> ShowS
[PageBlock] -> ShowS
PageBlock -> String
(Int -> PageBlock -> ShowS)
-> (PageBlock -> String)
-> ([PageBlock] -> ShowS)
-> Show PageBlock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PageBlock -> ShowS
showsPrec :: Int -> PageBlock -> ShowS
$cshow :: PageBlock -> String
show :: PageBlock -> String
$cshowList :: [PageBlock] -> ShowS
showList :: [PageBlock] -> ShowS
Show)

instance I.ShortShow PageBlock where
  shortShow :: PageBlock -> String
shortShow PageBlockTitle
    { title :: PageBlock -> Maybe RichText
title = Maybe RichText
title_
    }
      = String
"PageBlockTitle"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"title" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
title_
        ]
  shortShow PageBlockSubtitle
    { subtitle :: PageBlock -> Maybe RichText
subtitle = Maybe RichText
subtitle_
    }
      = String
"PageBlockSubtitle"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"subtitle" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
subtitle_
        ]
  shortShow PageBlockAuthorDate
    { author :: PageBlock -> Maybe RichText
author       = Maybe RichText
author_
    , publish_date :: PageBlock -> Maybe Int
publish_date = Maybe Int
publish_date_
    }
      = String
"PageBlockAuthorDate"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"author"       String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
author_
        , String
"publish_date" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
publish_date_
        ]
  shortShow PageBlockHeader
    { header :: PageBlock -> Maybe RichText
header = Maybe RichText
header_
    }
      = String
"PageBlockHeader"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"header" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
header_
        ]
  shortShow PageBlockSubheader
    { subheader :: PageBlock -> Maybe RichText
subheader = Maybe RichText
subheader_
    }
      = String
"PageBlockSubheader"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"subheader" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
subheader_
        ]
  shortShow PageBlockKicker
    { kicker :: PageBlock -> Maybe RichText
kicker = Maybe RichText
kicker_
    }
      = String
"PageBlockKicker"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"kicker" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
kicker_
        ]
  shortShow PageBlockParagraph
    { text :: PageBlock -> Maybe RichText
text = Maybe RichText
text_
    }
      = String
"PageBlockParagraph"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"text" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
text_
        ]
  shortShow PageBlockPreformatted
    { text :: PageBlock -> Maybe RichText
text     = Maybe RichText
text_
    , language :: PageBlock -> Maybe Text
language = Maybe Text
language_
    }
      = String
"PageBlockPreformatted"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"text"     String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
text_
        , String
"language" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_
        ]
  shortShow PageBlockFooter
    { footer :: PageBlock -> Maybe RichText
footer = Maybe RichText
footer_
    }
      = String
"PageBlockFooter"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"footer" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
footer_
        ]
  shortShow PageBlock
PageBlockDivider
      = String
"PageBlockDivider"
  shortShow PageBlockAnchor
    { name :: PageBlock -> Maybe Text
name = Maybe Text
name_
    }
      = String
"PageBlockAnchor"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
        ]
  shortShow PageBlockList
    { items :: PageBlock -> Maybe [PageBlockListItem]
items = Maybe [PageBlockListItem]
items_
    }
      = String
"PageBlockList"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"items" String -> Maybe [PageBlockListItem] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlockListItem]
items_
        ]
  shortShow PageBlockBlockQuote
    { text :: PageBlock -> Maybe RichText
text   = Maybe RichText
text_
    , credit :: PageBlock -> Maybe RichText
credit = Maybe RichText
credit_
    }
      = String
"PageBlockBlockQuote"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"text"   String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
text_
        , String
"credit" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
credit_
        ]
  shortShow PageBlockPullQuote
    { text :: PageBlock -> Maybe RichText
text   = Maybe RichText
text_
    , credit :: PageBlock -> Maybe RichText
credit = Maybe RichText
credit_
    }
      = String
"PageBlockPullQuote"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"text"   String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
text_
        , String
"credit" String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
credit_
        ]
  shortShow PageBlockAnimation
    { animation :: PageBlock -> Maybe Animation
animation     = Maybe Animation
animation_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption       = Maybe PageBlockCaption
caption_
    , need_autoplay :: PageBlock -> Maybe Bool
need_autoplay = Maybe Bool
need_autoplay_
    }
      = String
"PageBlockAnimation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"animation"     String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
        , String
"caption"       String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        , String
"need_autoplay" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_autoplay_
        ]
  shortShow PageBlockAudio
    { audio :: PageBlock -> Maybe Audio
audio   = Maybe Audio
audio_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockAudio"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"audio"   String -> Maybe Audio -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Audio
audio_
        , String
"caption" String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]
  shortShow PageBlockPhoto
    { photo :: PageBlock -> Maybe Photo
photo   = Maybe Photo
photo_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption = Maybe PageBlockCaption
caption_
    , url :: PageBlock -> Maybe Text
url     = Maybe Text
url_
    }
      = String
"PageBlockPhoto"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"photo"   String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        , String
"caption" String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        , String
"url"     String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        ]
  shortShow PageBlockVideo
    { video :: PageBlock -> Maybe Video
video         = Maybe Video
video_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption       = Maybe PageBlockCaption
caption_
    , need_autoplay :: PageBlock -> Maybe Bool
need_autoplay = Maybe Bool
need_autoplay_
    , is_looped :: PageBlock -> Maybe Bool
is_looped     = Maybe Bool
is_looped_
    }
      = String
"PageBlockVideo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"video"         String -> Maybe Video -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Video
video_
        , String
"caption"       String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        , String
"need_autoplay" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_autoplay_
        , String
"is_looped"     String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_looped_
        ]
  shortShow PageBlockVoiceNote
    { voice_note :: PageBlock -> Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption    = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockVoiceNote"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"voice_note" String -> Maybe VoiceNote -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe VoiceNote
voice_note_
        , String
"caption"    String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]
  shortShow PageBlockCover
    { cover :: PageBlock -> Maybe PageBlock
cover = Maybe PageBlock
cover_
    }
      = String
"PageBlockCover"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"cover" String -> Maybe PageBlock -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlock
cover_
        ]
  shortShow PageBlockEmbedded
    { url :: PageBlock -> Maybe Text
url             = Maybe Text
url_
    , html :: PageBlock -> Maybe Text
html            = Maybe Text
html_
    , poster_photo :: PageBlock -> Maybe Photo
poster_photo    = Maybe Photo
poster_photo_
    , width :: PageBlock -> Maybe Int
width           = Maybe Int
width_
    , height :: PageBlock -> Maybe Int
height          = Maybe Int
height_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption         = Maybe PageBlockCaption
caption_
    , is_full_width :: PageBlock -> Maybe Bool
is_full_width   = Maybe Bool
is_full_width_
    , allow_scrolling :: PageBlock -> Maybe Bool
allow_scrolling = Maybe Bool
allow_scrolling_
    }
      = String
"PageBlockEmbedded"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"             String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"html"            String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
html_
        , String
"poster_photo"    String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
poster_photo_
        , String
"width"           String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
width_
        , String
"height"          String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
height_
        , String
"caption"         String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        , String
"is_full_width"   String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_full_width_
        , String
"allow_scrolling" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
allow_scrolling_
        ]
  shortShow PageBlockEmbeddedPost
    { url :: PageBlock -> Maybe Text
url          = Maybe Text
url_
    , _author :: PageBlock -> Maybe Text
_author      = Maybe Text
_author_
    , author_photo :: PageBlock -> Maybe Photo
author_photo = Maybe Photo
author_photo_
    , date :: PageBlock -> Maybe Int
date         = Maybe Int
date_
    , page_blocks :: PageBlock -> Maybe [PageBlock]
page_blocks  = Maybe [PageBlock]
page_blocks_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption      = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockEmbeddedPost"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"          String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"_author"      String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_author_
        , String
"author_photo" String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
author_photo_
        , String
"date"         String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
date_
        , String
"page_blocks"  String -> Maybe [PageBlock] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlock]
page_blocks_
        , String
"caption"      String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]
  shortShow PageBlockCollage
    { page_blocks :: PageBlock -> Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption     = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockCollage"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"page_blocks" String -> Maybe [PageBlock] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlock]
page_blocks_
        , String
"caption"     String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]
  shortShow PageBlockSlideshow
    { page_blocks :: PageBlock -> Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption     = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockSlideshow"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"page_blocks" String -> Maybe [PageBlock] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlock]
page_blocks_
        , String
"caption"     String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]
  shortShow PageBlockChatLink
    { _title :: PageBlock -> Maybe Text
_title          = Maybe Text
_title_
    , _photo :: PageBlock -> Maybe ChatPhotoInfo
_photo          = Maybe ChatPhotoInfo
_photo_
    , accent_color_id :: PageBlock -> Maybe Int
accent_color_id = Maybe Int
accent_color_id_
    , username :: PageBlock -> Maybe Text
username        = Maybe Text
username_
    }
      = String
"PageBlockChatLink"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_title"          String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
_title_
        , String
"_photo"          String -> Maybe ChatPhotoInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhotoInfo
_photo_
        , String
"accent_color_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
accent_color_id_
        , String
"username"        String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
username_
        ]
  shortShow PageBlockTable
    { _caption :: PageBlock -> Maybe RichText
_caption    = Maybe RichText
_caption_
    , cells :: PageBlock -> Maybe [[PageBlockTableCell]]
cells       = Maybe [[PageBlockTableCell]]
cells_
    , is_bordered :: PageBlock -> Maybe Bool
is_bordered = Maybe Bool
is_bordered_
    , is_striped :: PageBlock -> Maybe Bool
is_striped  = Maybe Bool
is_striped_
    }
      = String
"PageBlockTable"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_caption"    String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
_caption_
        , String
"cells"       String -> Maybe [[PageBlockTableCell]] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [[PageBlockTableCell]]
cells_
        , String
"is_bordered" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_bordered_
        , String
"is_striped"  String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_striped_
        ]
  shortShow PageBlockDetails
    { header :: PageBlock -> Maybe RichText
header      = Maybe RichText
header_
    , page_blocks :: PageBlock -> Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
    , is_open :: PageBlock -> Maybe Bool
is_open     = Maybe Bool
is_open_
    }
      = String
"PageBlockDetails"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"header"      String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
header_
        , String
"page_blocks" String -> Maybe [PageBlock] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlock]
page_blocks_
        , String
"is_open"     String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_open_
        ]
  shortShow PageBlockRelatedArticles
    { header :: PageBlock -> Maybe RichText
header   = Maybe RichText
header_
    , articles :: PageBlock -> Maybe [PageBlockRelatedArticle]
articles = Maybe [PageBlockRelatedArticle]
articles_
    }
      = String
"PageBlockRelatedArticles"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"header"   String -> Maybe RichText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RichText
header_
        , String
"articles" String -> Maybe [PageBlockRelatedArticle] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PageBlockRelatedArticle]
articles_
        ]
  shortShow PageBlockMap
    { location :: PageBlock -> Maybe Location
location = Maybe Location
location_
    , zoom :: PageBlock -> Maybe Int
zoom     = Maybe Int
zoom_
    , width :: PageBlock -> Maybe Int
width    = Maybe Int
width_
    , height :: PageBlock -> Maybe Int
height   = Maybe Int
height_
    , caption :: PageBlock -> Maybe PageBlockCaption
caption  = Maybe PageBlockCaption
caption_
    }
      = String
"PageBlockMap"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"location" String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
        , String
"zoom"     String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
zoom_
        , String
"width"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
width_
        , String
"height"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
height_
        , String
"caption"  String -> Maybe PageBlockCaption -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PageBlockCaption
caption_
        ]

instance AT.FromJSON PageBlock where
  parseJSON :: Value -> Parser PageBlock
parseJSON v :: Value
v@(AT.Object Object
obj) = do
    String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String

    case String
t of
      String
"pageBlockTitle"           -> Value -> Parser PageBlock
parsePageBlockTitle Value
v
      String
"pageBlockSubtitle"        -> Value -> Parser PageBlock
parsePageBlockSubtitle Value
v
      String
"pageBlockAuthorDate"      -> Value -> Parser PageBlock
parsePageBlockAuthorDate Value
v
      String
"pageBlockHeader"          -> Value -> Parser PageBlock
parsePageBlockHeader Value
v
      String
"pageBlockSubheader"       -> Value -> Parser PageBlock
parsePageBlockSubheader Value
v
      String
"pageBlockKicker"          -> Value -> Parser PageBlock
parsePageBlockKicker Value
v
      String
"pageBlockParagraph"       -> Value -> Parser PageBlock
parsePageBlockParagraph Value
v
      String
"pageBlockPreformatted"    -> Value -> Parser PageBlock
parsePageBlockPreformatted Value
v
      String
"pageBlockFooter"          -> Value -> Parser PageBlock
parsePageBlockFooter Value
v
      String
"pageBlockDivider"         -> PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PageBlock
PageBlockDivider
      String
"pageBlockAnchor"          -> Value -> Parser PageBlock
parsePageBlockAnchor Value
v
      String
"pageBlockList"            -> Value -> Parser PageBlock
parsePageBlockList Value
v
      String
"pageBlockBlockQuote"      -> Value -> Parser PageBlock
parsePageBlockBlockQuote Value
v
      String
"pageBlockPullQuote"       -> Value -> Parser PageBlock
parsePageBlockPullQuote Value
v
      String
"pageBlockAnimation"       -> Value -> Parser PageBlock
parsePageBlockAnimation Value
v
      String
"pageBlockAudio"           -> Value -> Parser PageBlock
parsePageBlockAudio Value
v
      String
"pageBlockPhoto"           -> Value -> Parser PageBlock
parsePageBlockPhoto Value
v
      String
"pageBlockVideo"           -> Value -> Parser PageBlock
parsePageBlockVideo Value
v
      String
"pageBlockVoiceNote"       -> Value -> Parser PageBlock
parsePageBlockVoiceNote Value
v
      String
"pageBlockCover"           -> Value -> Parser PageBlock
parsePageBlockCover Value
v
      String
"pageBlockEmbedded"        -> Value -> Parser PageBlock
parsePageBlockEmbedded Value
v
      String
"pageBlockEmbeddedPost"    -> Value -> Parser PageBlock
parsePageBlockEmbeddedPost Value
v
      String
"pageBlockCollage"         -> Value -> Parser PageBlock
parsePageBlockCollage Value
v
      String
"pageBlockSlideshow"       -> Value -> Parser PageBlock
parsePageBlockSlideshow Value
v
      String
"pageBlockChatLink"        -> Value -> Parser PageBlock
parsePageBlockChatLink Value
v
      String
"pageBlockTable"           -> Value -> Parser PageBlock
parsePageBlockTable Value
v
      String
"pageBlockDetails"         -> Value -> Parser PageBlock
parsePageBlockDetails Value
v
      String
"pageBlockRelatedArticles" -> Value -> Parser PageBlock
parsePageBlockRelatedArticles Value
v
      String
"pageBlockMap"             -> Value -> Parser PageBlock
parsePageBlockMap Value
v
      String
_                          -> Parser PageBlock
forall a. Monoid a => a
mempty
    
    where
      parsePageBlockTitle :: A.Value -> AT.Parser PageBlock
      parsePageBlockTitle :: Value -> Parser PageBlock
parsePageBlockTitle = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockTitle" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
title_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"title"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockTitle
          { title :: Maybe RichText
title = Maybe RichText
title_
          }
      parsePageBlockSubtitle :: A.Value -> AT.Parser PageBlock
      parsePageBlockSubtitle :: Value -> Parser PageBlock
parsePageBlockSubtitle = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockSubtitle" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
subtitle_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"subtitle"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockSubtitle
          { subtitle :: Maybe RichText
subtitle = Maybe RichText
subtitle_
          }
      parsePageBlockAuthorDate :: A.Value -> AT.Parser PageBlock
      parsePageBlockAuthorDate :: Value -> Parser PageBlock
parsePageBlockAuthorDate = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockAuthorDate" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
author_       <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"author"
        Maybe Int
publish_date_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"publish_date"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockAuthorDate
          { author :: Maybe RichText
author       = Maybe RichText
author_
          , publish_date :: Maybe Int
publish_date = Maybe Int
publish_date_
          }
      parsePageBlockHeader :: A.Value -> AT.Parser PageBlock
      parsePageBlockHeader :: Value -> Parser PageBlock
parsePageBlockHeader = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockHeader" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
header_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"header"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockHeader
          { header :: Maybe RichText
header = Maybe RichText
header_
          }
      parsePageBlockSubheader :: A.Value -> AT.Parser PageBlock
      parsePageBlockSubheader :: Value -> Parser PageBlock
parsePageBlockSubheader = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockSubheader" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
subheader_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"subheader"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockSubheader
          { subheader :: Maybe RichText
subheader = Maybe RichText
subheader_
          }
      parsePageBlockKicker :: A.Value -> AT.Parser PageBlock
      parsePageBlockKicker :: Value -> Parser PageBlock
parsePageBlockKicker = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockKicker" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
kicker_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"kicker"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockKicker
          { kicker :: Maybe RichText
kicker = Maybe RichText
kicker_
          }
      parsePageBlockParagraph :: A.Value -> AT.Parser PageBlock
      parsePageBlockParagraph :: Value -> Parser PageBlock
parsePageBlockParagraph = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockParagraph" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
text_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockParagraph
          { text :: Maybe RichText
text = Maybe RichText
text_
          }
      parsePageBlockPreformatted :: A.Value -> AT.Parser PageBlock
      parsePageBlockPreformatted :: Value -> Parser PageBlock
parsePageBlockPreformatted = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockPreformatted" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
text_     <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        Maybe Text
language_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"language"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockPreformatted
          { text :: Maybe RichText
text     = Maybe RichText
text_
          , language :: Maybe Text
language = Maybe Text
language_
          }
      parsePageBlockFooter :: A.Value -> AT.Parser PageBlock
      parsePageBlockFooter :: Value -> Parser PageBlock
parsePageBlockFooter = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockFooter" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
footer_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"footer"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockFooter
          { footer :: Maybe RichText
footer = Maybe RichText
footer_
          }
      parsePageBlockAnchor :: A.Value -> AT.Parser PageBlock
      parsePageBlockAnchor :: Value -> Parser PageBlock
parsePageBlockAnchor = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockAnchor" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
name_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"name"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockAnchor
          { name :: Maybe Text
name = Maybe Text
name_
          }
      parsePageBlockList :: A.Value -> AT.Parser PageBlock
      parsePageBlockList :: Value -> Parser PageBlock
parsePageBlockList = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockList" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [PageBlockListItem]
items_ <- Object
o Object -> Key -> Parser (Maybe [PageBlockListItem])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"items"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockList
          { items :: Maybe [PageBlockListItem]
items = Maybe [PageBlockListItem]
items_
          }
      parsePageBlockBlockQuote :: A.Value -> AT.Parser PageBlock
      parsePageBlockBlockQuote :: Value -> Parser PageBlock
parsePageBlockBlockQuote = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockBlockQuote" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
text_   <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        Maybe RichText
credit_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"credit"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockBlockQuote
          { text :: Maybe RichText
text   = Maybe RichText
text_
          , credit :: Maybe RichText
credit = Maybe RichText
credit_
          }
      parsePageBlockPullQuote :: A.Value -> AT.Parser PageBlock
      parsePageBlockPullQuote :: Value -> Parser PageBlock
parsePageBlockPullQuote = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockPullQuote" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
text_   <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"text"
        Maybe RichText
credit_ <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"credit"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockPullQuote
          { text :: Maybe RichText
text   = Maybe RichText
text_
          , credit :: Maybe RichText
credit = Maybe RichText
credit_
          }
      parsePageBlockAnimation :: A.Value -> AT.Parser PageBlock
      parsePageBlockAnimation :: Value -> Parser PageBlock
parsePageBlockAnimation = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockAnimation" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Animation
animation_     <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"animation"
        Maybe PageBlockCaption
caption_       <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        Maybe Bool
need_autoplay_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"need_autoplay"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockAnimation
          { animation :: Maybe Animation
animation     = Maybe Animation
animation_
          , caption :: Maybe PageBlockCaption
caption       = Maybe PageBlockCaption
caption_
          , need_autoplay :: Maybe Bool
need_autoplay = Maybe Bool
need_autoplay_
          }
      parsePageBlockAudio :: A.Value -> AT.Parser PageBlock
      parsePageBlockAudio :: Value -> Parser PageBlock
parsePageBlockAudio = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockAudio" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Audio
audio_   <- Object
o Object -> Key -> Parser (Maybe Audio)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"audio"
        Maybe PageBlockCaption
caption_ <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockAudio
          { audio :: Maybe Audio
audio   = Maybe Audio
audio_
          , caption :: Maybe PageBlockCaption
caption = Maybe PageBlockCaption
caption_
          }
      parsePageBlockPhoto :: A.Value -> AT.Parser PageBlock
      parsePageBlockPhoto :: Value -> Parser PageBlock
parsePageBlockPhoto = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockPhoto" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Photo
photo_   <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe PageBlockCaption
caption_ <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        Maybe Text
url_     <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockPhoto
          { photo :: Maybe Photo
photo   = Maybe Photo
photo_
          , caption :: Maybe PageBlockCaption
caption = Maybe PageBlockCaption
caption_
          , url :: Maybe Text
url     = Maybe Text
url_
          }
      parsePageBlockVideo :: A.Value -> AT.Parser PageBlock
      parsePageBlockVideo :: Value -> Parser PageBlock
parsePageBlockVideo = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockVideo" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Video
video_         <- Object
o Object -> Key -> Parser (Maybe Video)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"video"
        Maybe PageBlockCaption
caption_       <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        Maybe Bool
need_autoplay_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"need_autoplay"
        Maybe Bool
is_looped_     <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_looped"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockVideo
          { video :: Maybe Video
video         = Maybe Video
video_
          , caption :: Maybe PageBlockCaption
caption       = Maybe PageBlockCaption
caption_
          , need_autoplay :: Maybe Bool
need_autoplay = Maybe Bool
need_autoplay_
          , is_looped :: Maybe Bool
is_looped     = Maybe Bool
is_looped_
          }
      parsePageBlockVoiceNote :: A.Value -> AT.Parser PageBlock
      parsePageBlockVoiceNote :: Value -> Parser PageBlock
parsePageBlockVoiceNote = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockVoiceNote" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe VoiceNote
voice_note_ <- Object
o Object -> Key -> Parser (Maybe VoiceNote)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"voice_note"
        Maybe PageBlockCaption
caption_    <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockVoiceNote
          { voice_note :: Maybe VoiceNote
voice_note = Maybe VoiceNote
voice_note_
          , caption :: Maybe PageBlockCaption
caption    = Maybe PageBlockCaption
caption_
          }
      parsePageBlockCover :: A.Value -> AT.Parser PageBlock
      parsePageBlockCover :: Value -> Parser PageBlock
parsePageBlockCover = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockCover" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe PageBlock
cover_ <- Object
o Object -> Key -> Parser (Maybe PageBlock)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"cover"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockCover
          { cover :: Maybe PageBlock
cover = Maybe PageBlock
cover_
          }
      parsePageBlockEmbedded :: A.Value -> AT.Parser PageBlock
      parsePageBlockEmbedded :: Value -> Parser PageBlock
parsePageBlockEmbedded = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockEmbedded" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_             <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Text
html_            <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"html"
        Maybe Photo
poster_photo_    <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"poster_photo"
        Maybe Int
width_           <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"width"
        Maybe Int
height_          <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"height"
        Maybe PageBlockCaption
caption_         <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        Maybe Bool
is_full_width_   <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_full_width"
        Maybe Bool
allow_scrolling_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"allow_scrolling"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockEmbedded
          { url :: Maybe Text
url             = Maybe Text
url_
          , html :: Maybe Text
html            = Maybe Text
html_
          , poster_photo :: Maybe Photo
poster_photo    = Maybe Photo
poster_photo_
          , width :: Maybe Int
width           = Maybe Int
width_
          , height :: Maybe Int
height          = Maybe Int
height_
          , caption :: Maybe PageBlockCaption
caption         = Maybe PageBlockCaption
caption_
          , is_full_width :: Maybe Bool
is_full_width   = Maybe Bool
is_full_width_
          , allow_scrolling :: Maybe Bool
allow_scrolling = Maybe Bool
allow_scrolling_
          }
      parsePageBlockEmbeddedPost :: A.Value -> AT.Parser PageBlock
      parsePageBlockEmbeddedPost :: Value -> Parser PageBlock
parsePageBlockEmbeddedPost = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockEmbeddedPost" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_          <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Text
_author_      <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"author"
        Maybe Photo
author_photo_ <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"author_photo"
        Maybe Int
date_         <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"date"
        Maybe [PageBlock]
page_blocks_  <- Object
o Object -> Key -> Parser (Maybe [PageBlock])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"page_blocks"
        Maybe PageBlockCaption
caption_      <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockEmbeddedPost
          { url :: Maybe Text
url          = Maybe Text
url_
          , _author :: Maybe Text
_author      = Maybe Text
_author_
          , author_photo :: Maybe Photo
author_photo = Maybe Photo
author_photo_
          , date :: Maybe Int
date         = Maybe Int
date_
          , page_blocks :: Maybe [PageBlock]
page_blocks  = Maybe [PageBlock]
page_blocks_
          , caption :: Maybe PageBlockCaption
caption      = Maybe PageBlockCaption
caption_
          }
      parsePageBlockCollage :: A.Value -> AT.Parser PageBlock
      parsePageBlockCollage :: Value -> Parser PageBlock
parsePageBlockCollage = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockCollage" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [PageBlock]
page_blocks_ <- Object
o Object -> Key -> Parser (Maybe [PageBlock])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"page_blocks"
        Maybe PageBlockCaption
caption_     <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockCollage
          { page_blocks :: Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
          , caption :: Maybe PageBlockCaption
caption     = Maybe PageBlockCaption
caption_
          }
      parsePageBlockSlideshow :: A.Value -> AT.Parser PageBlock
      parsePageBlockSlideshow :: Value -> Parser PageBlock
parsePageBlockSlideshow = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockSlideshow" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe [PageBlock]
page_blocks_ <- Object
o Object -> Key -> Parser (Maybe [PageBlock])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"page_blocks"
        Maybe PageBlockCaption
caption_     <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockSlideshow
          { page_blocks :: Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
          , caption :: Maybe PageBlockCaption
caption     = Maybe PageBlockCaption
caption_
          }
      parsePageBlockChatLink :: A.Value -> AT.Parser PageBlock
      parsePageBlockChatLink :: Value -> Parser PageBlock
parsePageBlockChatLink = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockChatLink" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
_title_          <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"title"
        Maybe ChatPhotoInfo
_photo_          <- Object
o Object -> Key -> Parser (Maybe ChatPhotoInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe Int
accent_color_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"accent_color_id"
        Maybe Text
username_        <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"username"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockChatLink
          { _title :: Maybe Text
_title          = Maybe Text
_title_
          , _photo :: Maybe ChatPhotoInfo
_photo          = Maybe ChatPhotoInfo
_photo_
          , accent_color_id :: Maybe Int
accent_color_id = Maybe Int
accent_color_id_
          , username :: Maybe Text
username        = Maybe Text
username_
          }
      parsePageBlockTable :: A.Value -> AT.Parser PageBlock
      parsePageBlockTable :: Value -> Parser PageBlock
parsePageBlockTable = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockTable" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
_caption_    <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        Maybe [[PageBlockTableCell]]
cells_       <- Object
o Object -> Key -> Parser (Maybe [[PageBlockTableCell]])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"cells"
        Maybe Bool
is_bordered_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_bordered"
        Maybe Bool
is_striped_  <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_striped"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockTable
          { _caption :: Maybe RichText
_caption    = Maybe RichText
_caption_
          , cells :: Maybe [[PageBlockTableCell]]
cells       = Maybe [[PageBlockTableCell]]
cells_
          , is_bordered :: Maybe Bool
is_bordered = Maybe Bool
is_bordered_
          , is_striped :: Maybe Bool
is_striped  = Maybe Bool
is_striped_
          }
      parsePageBlockDetails :: A.Value -> AT.Parser PageBlock
      parsePageBlockDetails :: Value -> Parser PageBlock
parsePageBlockDetails = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockDetails" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
header_      <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"header"
        Maybe [PageBlock]
page_blocks_ <- Object
o Object -> Key -> Parser (Maybe [PageBlock])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"page_blocks"
        Maybe Bool
is_open_     <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_open"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockDetails
          { header :: Maybe RichText
header      = Maybe RichText
header_
          , page_blocks :: Maybe [PageBlock]
page_blocks = Maybe [PageBlock]
page_blocks_
          , is_open :: Maybe Bool
is_open     = Maybe Bool
is_open_
          }
      parsePageBlockRelatedArticles :: A.Value -> AT.Parser PageBlock
      parsePageBlockRelatedArticles :: Value -> Parser PageBlock
parsePageBlockRelatedArticles = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockRelatedArticles" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RichText
header_   <- Object
o Object -> Key -> Parser (Maybe RichText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"header"
        Maybe [PageBlockRelatedArticle]
articles_ <- Object
o Object -> Key -> Parser (Maybe [PageBlockRelatedArticle])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"articles"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockRelatedArticles
          { header :: Maybe RichText
header   = Maybe RichText
header_
          , articles :: Maybe [PageBlockRelatedArticle]
articles = Maybe [PageBlockRelatedArticle]
articles_
          }
      parsePageBlockMap :: A.Value -> AT.Parser PageBlock
      parsePageBlockMap :: Value -> Parser PageBlock
parsePageBlockMap = String -> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"PageBlockMap" ((Object -> Parser PageBlock) -> Value -> Parser PageBlock)
-> (Object -> Parser PageBlock) -> Value -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Location
location_ <- Object
o Object -> Key -> Parser (Maybe Location)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"location"
        Maybe Int
zoom_     <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"zoom"
        Maybe Int
width_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"width"
        Maybe Int
height_   <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"height"
        Maybe PageBlockCaption
caption_  <- Object
o Object -> Key -> Parser (Maybe PageBlockCaption)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"caption"
        PageBlock -> Parser PageBlock
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PageBlock -> Parser PageBlock) -> PageBlock -> Parser PageBlock
forall a b. (a -> b) -> a -> b
$ PageBlockMap
          { location :: Maybe Location
location = Maybe Location
location_
          , zoom :: Maybe Int
zoom     = Maybe Int
zoom_
          , width :: Maybe Int
width    = Maybe Int
width_
          , height :: Maybe Int
height   = Maybe Int
height_
          , caption :: Maybe PageBlockCaption
caption  = Maybe PageBlockCaption
caption_
          }
  parseJSON Value
_ = Parser PageBlock
forall a. Monoid a => a
mempty