module TD.Query.PostStory
(PostStory(..)
, defaultPostStory
) 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.InputStoryContent as InputStoryContent
import qualified TD.Data.InputStoryAreas as InputStoryAreas
import qualified TD.Data.FormattedText as FormattedText
import qualified TD.Data.InputAudio as InputAudio
import qualified TD.Data.StoryPrivacySettings as StoryPrivacySettings
import qualified TD.Data.StoryFullId as StoryFullId
data PostStory
= PostStory
{ PostStory -> Maybe Int
chat_id :: Maybe Int
, PostStory -> Maybe InputStoryContent
content :: Maybe InputStoryContent.InputStoryContent
, PostStory -> Maybe InputStoryAreas
areas :: Maybe InputStoryAreas.InputStoryAreas
, PostStory -> Maybe FormattedText
caption :: Maybe FormattedText.FormattedText
, PostStory -> Maybe InputAudio
music :: Maybe InputAudio.InputAudio
, PostStory -> Maybe StoryPrivacySettings
privacy_settings :: Maybe StoryPrivacySettings.StoryPrivacySettings
, PostStory -> Maybe [Int]
album_ids :: Maybe [Int]
, PostStory -> Maybe Int
active_period :: Maybe Int
, PostStory -> Maybe StoryFullId
from_story_full_id :: Maybe StoryFullId.StoryFullId
, PostStory -> Maybe Bool
is_posted_to_chat_page :: Maybe Bool
, PostStory -> Maybe Bool
protect_content :: Maybe Bool
}
deriving (PostStory -> PostStory -> Bool
(PostStory -> PostStory -> Bool)
-> (PostStory -> PostStory -> Bool) -> Eq PostStory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PostStory -> PostStory -> Bool
== :: PostStory -> PostStory -> Bool
$c/= :: PostStory -> PostStory -> Bool
/= :: PostStory -> PostStory -> Bool
Eq, Int -> PostStory -> ShowS
[PostStory] -> ShowS
PostStory -> String
(Int -> PostStory -> ShowS)
-> (PostStory -> String)
-> ([PostStory] -> ShowS)
-> Show PostStory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PostStory -> ShowS
showsPrec :: Int -> PostStory -> ShowS
$cshow :: PostStory -> String
show :: PostStory -> String
$cshowList :: [PostStory] -> ShowS
showList :: [PostStory] -> ShowS
Show)
instance I.ShortShow PostStory where
shortShow :: PostStory -> String
shortShow
PostStory
{ chat_id :: PostStory -> Maybe Int
chat_id = Maybe Int
chat_id_
, content :: PostStory -> Maybe InputStoryContent
content = Maybe InputStoryContent
content_
, areas :: PostStory -> Maybe InputStoryAreas
areas = Maybe InputStoryAreas
areas_
, caption :: PostStory -> Maybe FormattedText
caption = Maybe FormattedText
caption_
, music :: PostStory -> Maybe InputAudio
music = Maybe InputAudio
music_
, privacy_settings :: PostStory -> Maybe StoryPrivacySettings
privacy_settings = Maybe StoryPrivacySettings
privacy_settings_
, album_ids :: PostStory -> Maybe [Int]
album_ids = Maybe [Int]
album_ids_
, active_period :: PostStory -> Maybe Int
active_period = Maybe Int
active_period_
, from_story_full_id :: PostStory -> Maybe StoryFullId
from_story_full_id = Maybe StoryFullId
from_story_full_id_
, is_posted_to_chat_page :: PostStory -> Maybe Bool
is_posted_to_chat_page = Maybe Bool
is_posted_to_chat_page_
, protect_content :: PostStory -> Maybe Bool
protect_content = Maybe Bool
protect_content_
}
= String
"PostStory"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"content" String -> Maybe InputStoryContent -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputStoryContent
content_
, String
"areas" String -> Maybe InputStoryAreas -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputStoryAreas
areas_
, String
"caption" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
caption_
, String
"music" String -> Maybe InputAudio -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputAudio
music_
, String
"privacy_settings" String -> Maybe StoryPrivacySettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StoryPrivacySettings
privacy_settings_
, String
"album_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
album_ids_
, String
"active_period" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
active_period_
, String
"from_story_full_id" String -> Maybe StoryFullId -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StoryFullId
from_story_full_id_
, String
"is_posted_to_chat_page" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_posted_to_chat_page_
, String
"protect_content" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
protect_content_
]
instance AT.ToJSON PostStory where
toJSON :: PostStory -> Value
toJSON
PostStory
{ chat_id :: PostStory -> Maybe Int
chat_id = Maybe Int
chat_id_
, content :: PostStory -> Maybe InputStoryContent
content = Maybe InputStoryContent
content_
, areas :: PostStory -> Maybe InputStoryAreas
areas = Maybe InputStoryAreas
areas_
, caption :: PostStory -> Maybe FormattedText
caption = Maybe FormattedText
caption_
, music :: PostStory -> Maybe InputAudio
music = Maybe InputAudio
music_
, privacy_settings :: PostStory -> Maybe StoryPrivacySettings
privacy_settings = Maybe StoryPrivacySettings
privacy_settings_
, album_ids :: PostStory -> Maybe [Int]
album_ids = Maybe [Int]
album_ids_
, active_period :: PostStory -> Maybe Int
active_period = Maybe Int
active_period_
, from_story_full_id :: PostStory -> Maybe StoryFullId
from_story_full_id = Maybe StoryFullId
from_story_full_id_
, is_posted_to_chat_page :: PostStory -> Maybe Bool
is_posted_to_chat_page = Maybe Bool
is_posted_to_chat_page_
, protect_content :: PostStory -> Maybe Bool
protect_content = Maybe Bool
protect_content_
}
= [Pair] -> Value
A.object
[ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"postStory"
, Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
, Key
"content" Key -> Maybe InputStoryContent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputStoryContent
content_
, Key
"areas" Key -> Maybe InputStoryAreas -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputStoryAreas
areas_
, Key
"caption" Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
caption_
, Key
"music" Key -> Maybe InputAudio -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputAudio
music_
, Key
"privacy_settings" Key -> Maybe StoryPrivacySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StoryPrivacySettings
privacy_settings_
, Key
"album_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
album_ids_
, Key
"active_period" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
active_period_
, Key
"from_story_full_id" Key -> Maybe StoryFullId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StoryFullId
from_story_full_id_
, Key
"is_posted_to_chat_page" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_posted_to_chat_page_
, Key
"protect_content" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
protect_content_
]
defaultPostStory :: PostStory
defaultPostStory :: PostStory
defaultPostStory =
PostStory
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, content :: Maybe InputStoryContent
content = Maybe InputStoryContent
forall a. Maybe a
Nothing
, areas :: Maybe InputStoryAreas
areas = Maybe InputStoryAreas
forall a. Maybe a
Nothing
, caption :: Maybe FormattedText
caption = Maybe FormattedText
forall a. Maybe a
Nothing
, music :: Maybe InputAudio
music = Maybe InputAudio
forall a. Maybe a
Nothing
, privacy_settings :: Maybe StoryPrivacySettings
privacy_settings = Maybe StoryPrivacySettings
forall a. Maybe a
Nothing
, album_ids :: Maybe [Int]
album_ids = Maybe [Int]
forall a. Maybe a
Nothing
, active_period :: Maybe Int
active_period = Maybe Int
forall a. Maybe a
Nothing
, from_story_full_id :: Maybe StoryFullId
from_story_full_id = Maybe StoryFullId
forall a. Maybe a
Nothing
, is_posted_to_chat_page :: Maybe Bool
is_posted_to_chat_page = Maybe Bool
forall a. Maybe a
Nothing
, protect_content :: Maybe Bool
protect_content = Maybe Bool
forall a. Maybe a
Nothing
}