module TD.Query.GetTonWalletNfts
  (GetTonWalletNfts(..)
  , defaultGetTonWalletNfts
  ) 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 NFTs stored on the TON wallet of the user; can be used only if getOption("can_use_ton_wallet"). Returns 'TD.Data.TonNfts.TonNfts'
data GetTonWalletNfts
  = GetTonWalletNfts
    { GetTonWalletNfts -> Maybe Text
offset :: Maybe T.Text -- ^ Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
    , GetTonWalletNfts -> Maybe Int
limit  :: Maybe Int    -- ^ The maximum number of NFTs to be returned; must be positive and can't be greater than 20
    }
  deriving (GetTonWalletNfts -> GetTonWalletNfts -> Bool
(GetTonWalletNfts -> GetTonWalletNfts -> Bool)
-> (GetTonWalletNfts -> GetTonWalletNfts -> Bool)
-> Eq GetTonWalletNfts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetTonWalletNfts -> GetTonWalletNfts -> Bool
== :: GetTonWalletNfts -> GetTonWalletNfts -> Bool
$c/= :: GetTonWalletNfts -> GetTonWalletNfts -> Bool
/= :: GetTonWalletNfts -> GetTonWalletNfts -> Bool
Eq, Int -> GetTonWalletNfts -> ShowS
[GetTonWalletNfts] -> ShowS
GetTonWalletNfts -> String
(Int -> GetTonWalletNfts -> ShowS)
-> (GetTonWalletNfts -> String)
-> ([GetTonWalletNfts] -> ShowS)
-> Show GetTonWalletNfts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetTonWalletNfts -> ShowS
showsPrec :: Int -> GetTonWalletNfts -> ShowS
$cshow :: GetTonWalletNfts -> String
show :: GetTonWalletNfts -> String
$cshowList :: [GetTonWalletNfts] -> ShowS
showList :: [GetTonWalletNfts] -> ShowS
Show)

instance I.ShortShow GetTonWalletNfts where
  shortShow :: GetTonWalletNfts -> String
shortShow
    GetTonWalletNfts
      { offset :: GetTonWalletNfts -> Maybe Text
offset = Maybe Text
offset_
      , limit :: GetTonWalletNfts -> Maybe Int
limit  = Maybe Int
limit_
      }
        = String
"GetTonWalletNfts"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"offset" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
offset_
          , String
"limit"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetTonWalletNfts where
  toJSON :: GetTonWalletNfts -> Value
toJSON
    GetTonWalletNfts
      { offset :: GetTonWalletNfts -> Maybe Text
offset = Maybe Text
offset_
      , limit :: GetTonWalletNfts -> Maybe Int
limit  = Maybe Int
limit_
      }
        = [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
"getTonWalletNfts"
          , Key
"offset" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
offset_
          , Key
"limit"  Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetTonWalletNfts :: GetTonWalletNfts
defaultGetTonWalletNfts :: GetTonWalletNfts
defaultGetTonWalletNfts =
  GetTonWalletNfts
    { offset :: Maybe Text
offset = Maybe Text
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit  = Maybe Int
forall a. Maybe a
Nothing
    }