module TD.Query.ReportSponsoredChat
(ReportSponsoredChat(..)
, defaultReportSponsoredChat
) 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
data
=
{ :: Maybe Int
, ReportSponsoredChat -> Maybe ByteString
option_id :: Maybe BS.ByteString
}
deriving (ReportSponsoredChat -> ReportSponsoredChat -> Bool
(ReportSponsoredChat -> ReportSponsoredChat -> Bool)
-> (ReportSponsoredChat -> ReportSponsoredChat -> Bool)
-> Eq ReportSponsoredChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReportSponsoredChat -> ReportSponsoredChat -> Bool
== :: ReportSponsoredChat -> ReportSponsoredChat -> Bool
$c/= :: ReportSponsoredChat -> ReportSponsoredChat -> Bool
/= :: ReportSponsoredChat -> ReportSponsoredChat -> Bool
Eq, Int -> ReportSponsoredChat -> ShowS
[ReportSponsoredChat] -> ShowS
ReportSponsoredChat -> String
(Int -> ReportSponsoredChat -> ShowS)
-> (ReportSponsoredChat -> String)
-> ([ReportSponsoredChat] -> ShowS)
-> Show ReportSponsoredChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReportSponsoredChat -> ShowS
showsPrec :: Int -> ReportSponsoredChat -> ShowS
$cshow :: ReportSponsoredChat -> String
show :: ReportSponsoredChat -> String
$cshowList :: [ReportSponsoredChat] -> ShowS
showList :: [ReportSponsoredChat] -> ShowS
Show)
instance I.ShortShow ReportSponsoredChat where
shortShow :: ReportSponsoredChat -> String
shortShow
ReportSponsoredChat
{ sponsored_chat_unique_id :: ReportSponsoredChat -> Maybe Int
sponsored_chat_unique_id = Maybe Int
sponsored_chat_unique_id_
, option_id :: ReportSponsoredChat -> Maybe ByteString
option_id = Maybe ByteString
option_id_
}
= String
"ReportSponsoredChat"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"sponsored_chat_unique_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
sponsored_chat_unique_id_
, String
"option_id" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
option_id_
]
instance AT.ToJSON ReportSponsoredChat where
toJSON :: ReportSponsoredChat -> Value
toJSON
ReportSponsoredChat
{ sponsored_chat_unique_id :: ReportSponsoredChat -> Maybe Int
sponsored_chat_unique_id = Maybe Int
sponsored_chat_unique_id_
, option_id :: ReportSponsoredChat -> Maybe ByteString
option_id = Maybe ByteString
option_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
"reportSponsoredChat"
, Key
"sponsored_chat_unique_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
sponsored_chat_unique_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_
]
defaultReportSponsoredChat :: ReportSponsoredChat
=
ReportSponsoredChat
{ sponsored_chat_unique_id :: Maybe Int
sponsored_chat_unique_id = Maybe Int
forall a. Maybe a
Nothing
, option_id :: Maybe ByteString
option_id = Maybe ByteString
forall a. Maybe a
Nothing
}