module TD.Query.SetChatBackground
(SetChatBackground(..)
, defaultSetChatBackground
) 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.InputBackground as InputBackground
import qualified TD.Data.BackgroundType as BackgroundType
data SetChatBackground
= SetChatBackground
{ SetChatBackground -> Maybe Int
chat_id :: Maybe Int
, SetChatBackground -> Maybe InputBackground
background :: Maybe InputBackground.InputBackground
, SetChatBackground -> Maybe BackgroundType
_type :: Maybe BackgroundType.BackgroundType
, SetChatBackground -> Maybe Int
dark_theme_dimming :: Maybe Int
, SetChatBackground -> Maybe Bool
only_for_self :: Maybe Bool
}
deriving (SetChatBackground -> SetChatBackground -> Bool
(SetChatBackground -> SetChatBackground -> Bool)
-> (SetChatBackground -> SetChatBackground -> Bool)
-> Eq SetChatBackground
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatBackground -> SetChatBackground -> Bool
== :: SetChatBackground -> SetChatBackground -> Bool
$c/= :: SetChatBackground -> SetChatBackground -> Bool
/= :: SetChatBackground -> SetChatBackground -> Bool
Eq, Int -> SetChatBackground -> ShowS
[SetChatBackground] -> ShowS
SetChatBackground -> String
(Int -> SetChatBackground -> ShowS)
-> (SetChatBackground -> String)
-> ([SetChatBackground] -> ShowS)
-> Show SetChatBackground
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatBackground -> ShowS
showsPrec :: Int -> SetChatBackground -> ShowS
$cshow :: SetChatBackground -> String
show :: SetChatBackground -> String
$cshowList :: [SetChatBackground] -> ShowS
showList :: [SetChatBackground] -> ShowS
Show)
instance I.ShortShow SetChatBackground where
shortShow :: SetChatBackground -> String
shortShow
SetChatBackground
{ chat_id :: SetChatBackground -> Maybe Int
chat_id = Maybe Int
chat_id_
, background :: SetChatBackground -> Maybe InputBackground
background = Maybe InputBackground
background_
, _type :: SetChatBackground -> Maybe BackgroundType
_type = Maybe BackgroundType
_type_
, dark_theme_dimming :: SetChatBackground -> Maybe Int
dark_theme_dimming = Maybe Int
dark_theme_dimming_
, only_for_self :: SetChatBackground -> Maybe Bool
only_for_self = Maybe Bool
only_for_self_
}
= String
"SetChatBackground"
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
"background" String -> Maybe InputBackground -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputBackground
background_
, String
"_type" String -> Maybe BackgroundType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BackgroundType
_type_
, String
"dark_theme_dimming" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
dark_theme_dimming_
, String
"only_for_self" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
only_for_self_
]
instance AT.ToJSON SetChatBackground where
toJSON :: SetChatBackground -> Value
toJSON
SetChatBackground
{ chat_id :: SetChatBackground -> Maybe Int
chat_id = Maybe Int
chat_id_
, background :: SetChatBackground -> Maybe InputBackground
background = Maybe InputBackground
background_
, _type :: SetChatBackground -> Maybe BackgroundType
_type = Maybe BackgroundType
_type_
, dark_theme_dimming :: SetChatBackground -> Maybe Int
dark_theme_dimming = Maybe Int
dark_theme_dimming_
, only_for_self :: SetChatBackground -> Maybe Bool
only_for_self = Maybe Bool
only_for_self_
}
= [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
"setChatBackground"
, 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
"background" Key -> Maybe InputBackground -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputBackground
background_
, Key
"type" Key -> Maybe BackgroundType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe BackgroundType
_type_
, Key
"dark_theme_dimming" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
dark_theme_dimming_
, Key
"only_for_self" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
only_for_self_
]
defaultSetChatBackground :: SetChatBackground
defaultSetChatBackground :: SetChatBackground
defaultSetChatBackground =
SetChatBackground
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, background :: Maybe InputBackground
background = Maybe InputBackground
forall a. Maybe a
Nothing
, _type :: Maybe BackgroundType
_type = Maybe BackgroundType
forall a. Maybe a
Nothing
, dark_theme_dimming :: Maybe Int
dark_theme_dimming = Maybe Int
forall a. Maybe a
Nothing
, only_for_self :: Maybe Bool
only_for_self = Maybe Bool
forall a. Maybe a
Nothing
}