module TD.Query.ReportStory
(ReportStory(..)
, defaultReportStory
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.ByteString as BS
import qualified Data.Text as T
data ReportStory
= ReportStory
{ ReportStory -> Maybe Int
story_sender_chat_id :: Maybe Int
, ReportStory -> Maybe Int
story_id :: Maybe Int
, ReportStory -> Maybe ByteString
option_id :: Maybe BS.ByteString
, ReportStory -> Maybe Text
text :: Maybe T.Text
}
deriving (ReportStory -> ReportStory -> Bool
(ReportStory -> ReportStory -> Bool)
-> (ReportStory -> ReportStory -> Bool) -> Eq ReportStory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReportStory -> ReportStory -> Bool
== :: ReportStory -> ReportStory -> Bool
$c/= :: ReportStory -> ReportStory -> Bool
/= :: ReportStory -> ReportStory -> Bool
Eq, Int -> ReportStory -> ShowS
[ReportStory] -> ShowS
ReportStory -> String
(Int -> ReportStory -> ShowS)
-> (ReportStory -> String)
-> ([ReportStory] -> ShowS)
-> Show ReportStory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReportStory -> ShowS
showsPrec :: Int -> ReportStory -> ShowS
$cshow :: ReportStory -> String
show :: ReportStory -> String
$cshowList :: [ReportStory] -> ShowS
showList :: [ReportStory] -> ShowS
Show)
instance I.ShortShow ReportStory where
shortShow :: ReportStory -> String
shortShow
ReportStory
{ story_sender_chat_id :: ReportStory -> Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
, story_id :: ReportStory -> Maybe Int
story_id = Maybe Int
story_id_
, option_id :: ReportStory -> Maybe ByteString
option_id = Maybe ByteString
option_id_
, text :: ReportStory -> Maybe Text
text = Maybe Text
text_
}
= String
"ReportStory"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"story_sender_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_sender_chat_id_
, String
"story_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_id_
, String
"option_id" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
option_id_
, String
"text" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
text_
]
instance AT.ToJSON ReportStory where
toJSON :: ReportStory -> Value
toJSON
ReportStory
{ story_sender_chat_id :: ReportStory -> Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
, story_id :: ReportStory -> Maybe Int
story_id = Maybe Int
story_id_
, option_id :: ReportStory -> Maybe ByteString
option_id = Maybe ByteString
option_id_
, text :: ReportStory -> Maybe Text
text = Maybe Text
text_
}
= [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
"reportStory"
, Key
"story_sender_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
story_sender_chat_id_
, Key
"story_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
story_id_
, Key
"option_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
option_id_
, Key
"text" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
text_
]
defaultReportStory :: ReportStory
defaultReportStory :: ReportStory
defaultReportStory =
ReportStory
{ story_sender_chat_id :: Maybe Int
story_sender_chat_id = Maybe Int
forall a. Maybe a
Nothing
, story_id :: Maybe Int
story_id = Maybe Int
forall a. Maybe a
Nothing
, option_id :: Maybe ByteString
option_id = Maybe ByteString
forall a. Maybe a
Nothing
, text :: Maybe Text
text = Maybe Text
forall a. Maybe a
Nothing
}