module TD.Query.GetCustomEmojiStickers
  (GetCustomEmojiStickers(..)
  ) 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 custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned. Returns 'TD.Data.Stickers.Stickers'
data GetCustomEmojiStickers
  = GetCustomEmojiStickers
    { GetCustomEmojiStickers -> Maybe [Int]
custom_emoji_ids :: Maybe [Int] -- ^ Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously
    }
  deriving (GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool
(GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool)
-> (GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool)
-> Eq GetCustomEmojiStickers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool
== :: GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool
$c/= :: GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool
/= :: GetCustomEmojiStickers -> GetCustomEmojiStickers -> Bool
Eq, Int -> GetCustomEmojiStickers -> ShowS
[GetCustomEmojiStickers] -> ShowS
GetCustomEmojiStickers -> String
(Int -> GetCustomEmojiStickers -> ShowS)
-> (GetCustomEmojiStickers -> String)
-> ([GetCustomEmojiStickers] -> ShowS)
-> Show GetCustomEmojiStickers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCustomEmojiStickers -> ShowS
showsPrec :: Int -> GetCustomEmojiStickers -> ShowS
$cshow :: GetCustomEmojiStickers -> String
show :: GetCustomEmojiStickers -> String
$cshowList :: [GetCustomEmojiStickers] -> ShowS
showList :: [GetCustomEmojiStickers] -> ShowS
Show)

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

instance AT.ToJSON GetCustomEmojiStickers where
  toJSON :: GetCustomEmojiStickers -> Value
toJSON
    GetCustomEmojiStickers
      { custom_emoji_ids :: GetCustomEmojiStickers -> Maybe [Int]
custom_emoji_ids = Maybe [Int]
custom_emoji_ids_
      }
        = [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
"getCustomEmojiStickers"
          , Key
"custom_emoji_ids" 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) -> [Int] -> [Value]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64 ) Maybe [Int]
custom_emoji_ids_
          ]