module TD.Query.SetChatAffiliateProgram
(SetChatAffiliateProgram(..)
, defaultSetChatAffiliateProgram
) 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.AffiliateProgramParameters as AffiliateProgramParameters
data SetChatAffiliateProgram
= SetChatAffiliateProgram
{ SetChatAffiliateProgram -> Maybe Int
chat_id :: Maybe Int
, SetChatAffiliateProgram -> Maybe AffiliateProgramParameters
parameters :: Maybe AffiliateProgramParameters.AffiliateProgramParameters
}
deriving (SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool
(SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool)
-> (SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool)
-> Eq SetChatAffiliateProgram
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool
== :: SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool
$c/= :: SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool
/= :: SetChatAffiliateProgram -> SetChatAffiliateProgram -> Bool
Eq, Int -> SetChatAffiliateProgram -> ShowS
[SetChatAffiliateProgram] -> ShowS
SetChatAffiliateProgram -> String
(Int -> SetChatAffiliateProgram -> ShowS)
-> (SetChatAffiliateProgram -> String)
-> ([SetChatAffiliateProgram] -> ShowS)
-> Show SetChatAffiliateProgram
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatAffiliateProgram -> ShowS
showsPrec :: Int -> SetChatAffiliateProgram -> ShowS
$cshow :: SetChatAffiliateProgram -> String
show :: SetChatAffiliateProgram -> String
$cshowList :: [SetChatAffiliateProgram] -> ShowS
showList :: [SetChatAffiliateProgram] -> ShowS
Show)
instance I.ShortShow SetChatAffiliateProgram where
shortShow :: SetChatAffiliateProgram -> String
shortShow
SetChatAffiliateProgram
{ chat_id :: SetChatAffiliateProgram -> Maybe Int
chat_id = Maybe Int
chat_id_
, parameters :: SetChatAffiliateProgram -> Maybe AffiliateProgramParameters
parameters = Maybe AffiliateProgramParameters
parameters_
}
= String
"SetChatAffiliateProgram"
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
"parameters" String -> Maybe AffiliateProgramParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateProgramParameters
parameters_
]
instance AT.ToJSON SetChatAffiliateProgram where
toJSON :: SetChatAffiliateProgram -> Value
toJSON
SetChatAffiliateProgram
{ chat_id :: SetChatAffiliateProgram -> Maybe Int
chat_id = Maybe Int
chat_id_
, parameters :: SetChatAffiliateProgram -> Maybe AffiliateProgramParameters
parameters = Maybe AffiliateProgramParameters
parameters_
}
= [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
"setChatAffiliateProgram"
, 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
"parameters" Key -> Maybe AffiliateProgramParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe AffiliateProgramParameters
parameters_
]
defaultSetChatAffiliateProgram :: SetChatAffiliateProgram
defaultSetChatAffiliateProgram :: SetChatAffiliateProgram
defaultSetChatAffiliateProgram =
SetChatAffiliateProgram
{ chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, parameters :: Maybe AffiliateProgramParameters
parameters = Maybe AffiliateProgramParameters
forall a. Maybe a
Nothing
}