module TD.Query.GetGiftCollections
  (GetGiftCollections(..)
  ) 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.MessageSender as MessageSender

-- | Returns collections of gifts owned by the given user or chat. Returns 'TD.Data.GiftCollections.GiftCollections'
data GetGiftCollections
  = GetGiftCollections
    { GetGiftCollections -> Maybe MessageSender
owner_id :: Maybe MessageSender.MessageSender -- ^ Identifier of the user or the channel chat that received the gifts
    }
  deriving (GetGiftCollections -> GetGiftCollections -> Bool
(GetGiftCollections -> GetGiftCollections -> Bool)
-> (GetGiftCollections -> GetGiftCollections -> Bool)
-> Eq GetGiftCollections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGiftCollections -> GetGiftCollections -> Bool
== :: GetGiftCollections -> GetGiftCollections -> Bool
$c/= :: GetGiftCollections -> GetGiftCollections -> Bool
/= :: GetGiftCollections -> GetGiftCollections -> Bool
Eq, Int -> GetGiftCollections -> ShowS
[GetGiftCollections] -> ShowS
GetGiftCollections -> String
(Int -> GetGiftCollections -> ShowS)
-> (GetGiftCollections -> String)
-> ([GetGiftCollections] -> ShowS)
-> Show GetGiftCollections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGiftCollections -> ShowS
showsPrec :: Int -> GetGiftCollections -> ShowS
$cshow :: GetGiftCollections -> String
show :: GetGiftCollections -> String
$cshowList :: [GetGiftCollections] -> ShowS
showList :: [GetGiftCollections] -> ShowS
Show)

instance I.ShortShow GetGiftCollections where
  shortShow :: GetGiftCollections -> String
shortShow
    GetGiftCollections
      { owner_id :: GetGiftCollections -> Maybe MessageSender
owner_id = Maybe MessageSender
owner_id_
      }
        = String
"GetGiftCollections"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"owner_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
owner_id_
          ]

instance AT.ToJSON GetGiftCollections where
  toJSON :: GetGiftCollections -> Value
toJSON
    GetGiftCollections
      { owner_id :: GetGiftCollections -> Maybe MessageSender
owner_id = Maybe MessageSender
owner_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
"getGiftCollections"
          , Key
"owner_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
owner_id_
          ]