module TD.Query.GetBotMediaPreviews
  (GetBotMediaPreviews(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns the list of media previews of a bot. Returns 'TD.Data.BotMediaPreviews.BotMediaPreviews'
data GetBotMediaPreviews
  = GetBotMediaPreviews
    { GetBotMediaPreviews -> Maybe Int
bot_user_id :: Maybe Int -- ^ Identifier of the target bot. The bot must have the main Web App
    }
  deriving (GetBotMediaPreviews -> GetBotMediaPreviews -> Bool
(GetBotMediaPreviews -> GetBotMediaPreviews -> Bool)
-> (GetBotMediaPreviews -> GetBotMediaPreviews -> Bool)
-> Eq GetBotMediaPreviews
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetBotMediaPreviews -> GetBotMediaPreviews -> Bool
== :: GetBotMediaPreviews -> GetBotMediaPreviews -> Bool
$c/= :: GetBotMediaPreviews -> GetBotMediaPreviews -> Bool
/= :: GetBotMediaPreviews -> GetBotMediaPreviews -> Bool
Eq, Int -> GetBotMediaPreviews -> ShowS
[GetBotMediaPreviews] -> ShowS
GetBotMediaPreviews -> String
(Int -> GetBotMediaPreviews -> ShowS)
-> (GetBotMediaPreviews -> String)
-> ([GetBotMediaPreviews] -> ShowS)
-> Show GetBotMediaPreviews
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetBotMediaPreviews -> ShowS
showsPrec :: Int -> GetBotMediaPreviews -> ShowS
$cshow :: GetBotMediaPreviews -> String
show :: GetBotMediaPreviews -> String
$cshowList :: [GetBotMediaPreviews] -> ShowS
showList :: [GetBotMediaPreviews] -> ShowS
Show)

instance I.ShortShow GetBotMediaPreviews where
  shortShow :: GetBotMediaPreviews -> String
shortShow
    GetBotMediaPreviews
      { bot_user_id :: GetBotMediaPreviews -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
      }
        = String
"GetBotMediaPreviews"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          ]

instance AT.ToJSON GetBotMediaPreviews where
  toJSON :: GetBotMediaPreviews -> Value
toJSON
    GetBotMediaPreviews
      { bot_user_id :: GetBotMediaPreviews -> Maybe Int
bot_user_id = Maybe Int
bot_user_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
"getBotMediaPreviews"
          , Key
"bot_user_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
bot_user_id_
          ]