module TD.Query.OpenStory
(OpenStory(..)
, defaultOpenStory
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data OpenStory
= OpenStory
{ OpenStory -> Maybe Int
story_sender_chat_id :: Maybe Int
, OpenStory -> Maybe Int
story_id :: Maybe Int
}
deriving (OpenStory -> OpenStory -> Bool
(OpenStory -> OpenStory -> Bool)
-> (OpenStory -> OpenStory -> Bool) -> Eq OpenStory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OpenStory -> OpenStory -> Bool
== :: OpenStory -> OpenStory -> Bool
$c/= :: OpenStory -> OpenStory -> Bool
/= :: OpenStory -> OpenStory -> Bool
Eq, Int -> OpenStory -> ShowS
[OpenStory] -> ShowS
OpenStory -> String
(Int -> OpenStory -> ShowS)
-> (OpenStory -> String)
-> ([OpenStory] -> ShowS)
-> Show OpenStory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpenStory -> ShowS
showsPrec :: Int -> OpenStory -> ShowS
$cshow :: OpenStory -> String
show :: OpenStory -> String
$cshowList :: [OpenStory] -> ShowS
showList :: [OpenStory] -> ShowS
Show)
instance I.ShortShow OpenStory where
shortShow :: OpenStory -> String
shortShow
OpenStory
{ story_sender_chat_id :: OpenStory -> Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
, story_id :: OpenStory -> Maybe Int
story_id = Maybe Int
story_id_
}
= String
"OpenStory"
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_
]
instance AT.ToJSON OpenStory where
toJSON :: OpenStory -> Value
toJSON
OpenStory
{ story_sender_chat_id :: OpenStory -> Maybe Int
story_sender_chat_id = Maybe Int
story_sender_chat_id_
, story_id :: OpenStory -> Maybe Int
story_id = Maybe Int
story_id_
}
= [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
"openStory"
, 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_
]
defaultOpenStory :: OpenStory
defaultOpenStory :: OpenStory
defaultOpenStory =
OpenStory
{ 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
}