module TD.Query.SendBusinessMessage
(SendBusinessMessage(..)
, defaultSendBusinessMessage
) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.InputMessageReplyTo as InputMessageReplyTo
import qualified TD.Data.ReplyMarkup as ReplyMarkup
import qualified TD.Data.InputMessageContent as InputMessageContent
data SendBusinessMessage
= SendBusinessMessage
{ SendBusinessMessage -> Maybe Text
business_connection_id :: Maybe T.Text
, SendBusinessMessage -> Maybe Int
chat_id :: Maybe Int
, SendBusinessMessage -> Maybe InputMessageReplyTo
reply_to :: Maybe InputMessageReplyTo.InputMessageReplyTo
, SendBusinessMessage -> Maybe Bool
disable_notification :: Maybe Bool
, SendBusinessMessage -> Maybe Bool
protect_content :: Maybe Bool
, SendBusinessMessage -> Maybe Int
effect_id :: Maybe Int
, SendBusinessMessage -> Maybe ReplyMarkup
reply_markup :: Maybe ReplyMarkup.ReplyMarkup
, SendBusinessMessage -> Maybe InputMessageContent
input_message_content :: Maybe InputMessageContent.InputMessageContent
}
deriving (SendBusinessMessage -> SendBusinessMessage -> Bool
(SendBusinessMessage -> SendBusinessMessage -> Bool)
-> (SendBusinessMessage -> SendBusinessMessage -> Bool)
-> Eq SendBusinessMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendBusinessMessage -> SendBusinessMessage -> Bool
== :: SendBusinessMessage -> SendBusinessMessage -> Bool
$c/= :: SendBusinessMessage -> SendBusinessMessage -> Bool
/= :: SendBusinessMessage -> SendBusinessMessage -> Bool
Eq, Int -> SendBusinessMessage -> ShowS
[SendBusinessMessage] -> ShowS
SendBusinessMessage -> String
(Int -> SendBusinessMessage -> ShowS)
-> (SendBusinessMessage -> String)
-> ([SendBusinessMessage] -> ShowS)
-> Show SendBusinessMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendBusinessMessage -> ShowS
showsPrec :: Int -> SendBusinessMessage -> ShowS
$cshow :: SendBusinessMessage -> String
show :: SendBusinessMessage -> String
$cshowList :: [SendBusinessMessage] -> ShowS
showList :: [SendBusinessMessage] -> ShowS
Show)
instance I.ShortShow SendBusinessMessage where
shortShow :: SendBusinessMessage -> String
shortShow
SendBusinessMessage
{ business_connection_id :: SendBusinessMessage -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
, chat_id :: SendBusinessMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, reply_to :: SendBusinessMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, disable_notification :: SendBusinessMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, protect_content :: SendBusinessMessage -> Maybe Bool
protect_content = Maybe Bool
protect_content_
, effect_id :: SendBusinessMessage -> Maybe Int
effect_id = Maybe Int
effect_id_
, reply_markup :: SendBusinessMessage -> Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
reply_markup_
, input_message_content :: SendBusinessMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
}
= String
"SendBusinessMessage"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
, String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
, String
"reply_to" String -> Maybe InputMessageReplyTo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageReplyTo
reply_to_
, String
"disable_notification" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
disable_notification_
, String
"protect_content" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
protect_content_
, String
"effect_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
effect_id_
, String
"reply_markup" String -> Maybe ReplyMarkup -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReplyMarkup
reply_markup_
, String
"input_message_content" String -> Maybe InputMessageContent -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputMessageContent
input_message_content_
]
instance AT.ToJSON SendBusinessMessage where
toJSON :: SendBusinessMessage -> Value
toJSON
SendBusinessMessage
{ business_connection_id :: SendBusinessMessage -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
, chat_id :: SendBusinessMessage -> Maybe Int
chat_id = Maybe Int
chat_id_
, reply_to :: SendBusinessMessage -> Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
reply_to_
, disable_notification :: SendBusinessMessage -> Maybe Bool
disable_notification = Maybe Bool
disable_notification_
, protect_content :: SendBusinessMessage -> Maybe Bool
protect_content = Maybe Bool
protect_content_
, effect_id :: SendBusinessMessage -> Maybe Int
effect_id = Maybe Int
effect_id_
, reply_markup :: SendBusinessMessage -> Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
reply_markup_
, input_message_content :: SendBusinessMessage -> Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
input_message_content_
}
= [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
"sendBusinessMessage"
, Key
"business_connection_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
business_connection_id_
, 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
"reply_to" Key -> Maybe InputMessageReplyTo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputMessageReplyTo
reply_to_
, Key
"disable_notification" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
disable_notification_
, Key
"protect_content" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
protect_content_
, Key
"effect_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 Maybe Int
effect_id_
, Key
"reply_markup" Key -> Maybe ReplyMarkup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReplyMarkup
reply_markup_
, Key
"input_message_content" Key -> Maybe InputMessageContent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputMessageContent
input_message_content_
]
defaultSendBusinessMessage :: SendBusinessMessage
defaultSendBusinessMessage :: SendBusinessMessage
defaultSendBusinessMessage =
SendBusinessMessage
{ business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
, chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
, reply_to :: Maybe InputMessageReplyTo
reply_to = Maybe InputMessageReplyTo
forall a. Maybe a
Nothing
, disable_notification :: Maybe Bool
disable_notification = Maybe Bool
forall a. Maybe a
Nothing
, protect_content :: Maybe Bool
protect_content = Maybe Bool
forall a. Maybe a
Nothing
, effect_id :: Maybe Int
effect_id = Maybe Int
forall a. Maybe a
Nothing
, reply_markup :: Maybe ReplyMarkup
reply_markup = Maybe ReplyMarkup
forall a. Maybe a
Nothing
, input_message_content :: Maybe InputMessageContent
input_message_content = Maybe InputMessageContent
forall a. Maybe a
Nothing
}