module TD.Query.GetAnimatedEmoji
  (GetAnimatedEmoji(..)
  ) 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

-- | Returns an animated emoji corresponding to a given emoji. Returns a 404 error if the emoji has no animated emoji. Returns 'TD.Data.AnimatedEmoji.AnimatedEmoji'
data GetAnimatedEmoji
  = GetAnimatedEmoji
    { GetAnimatedEmoji -> Maybe Text
emoji :: Maybe T.Text -- ^ The emoji
    }
  deriving (GetAnimatedEmoji -> GetAnimatedEmoji -> Bool
(GetAnimatedEmoji -> GetAnimatedEmoji -> Bool)
-> (GetAnimatedEmoji -> GetAnimatedEmoji -> Bool)
-> Eq GetAnimatedEmoji
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetAnimatedEmoji -> GetAnimatedEmoji -> Bool
== :: GetAnimatedEmoji -> GetAnimatedEmoji -> Bool
$c/= :: GetAnimatedEmoji -> GetAnimatedEmoji -> Bool
/= :: GetAnimatedEmoji -> GetAnimatedEmoji -> Bool
Eq, Int -> GetAnimatedEmoji -> ShowS
[GetAnimatedEmoji] -> ShowS
GetAnimatedEmoji -> String
(Int -> GetAnimatedEmoji -> ShowS)
-> (GetAnimatedEmoji -> String)
-> ([GetAnimatedEmoji] -> ShowS)
-> Show GetAnimatedEmoji
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetAnimatedEmoji -> ShowS
showsPrec :: Int -> GetAnimatedEmoji -> ShowS
$cshow :: GetAnimatedEmoji -> String
show :: GetAnimatedEmoji -> String
$cshowList :: [GetAnimatedEmoji] -> ShowS
showList :: [GetAnimatedEmoji] -> ShowS
Show)

instance I.ShortShow GetAnimatedEmoji where
  shortShow :: GetAnimatedEmoji -> String
shortShow
    GetAnimatedEmoji
      { emoji :: GetAnimatedEmoji -> Maybe Text
emoji = Maybe Text
emoji_
      }
        = String
"GetAnimatedEmoji"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"emoji" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
emoji_
          ]

instance AT.ToJSON GetAnimatedEmoji where
  toJSON :: GetAnimatedEmoji -> Value
toJSON
    GetAnimatedEmoji
      { emoji :: GetAnimatedEmoji -> Maybe Text
emoji = Maybe Text
emoji_
      }
        = [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
"getAnimatedEmoji"
          , Key
"emoji" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
emoji_
          ]