module TD.Query.GetTonConnectDAppPendingRequests
  (GetTonConnectDAppPendingRequests(..)
  ) 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 pending requests with a dApp through TON Connect. Returns 'TD.Data.TonConnectRequests.TonConnectRequests'
data GetTonConnectDAppPendingRequests
  = GetTonConnectDAppPendingRequests
    { GetTonConnectDAppPendingRequests -> Maybe Text
dapp_client_id :: Maybe T.Text -- ^ Hex-encoded public X25519 key of the dApp
    }
  deriving (GetTonConnectDAppPendingRequests
-> GetTonConnectDAppPendingRequests -> Bool
(GetTonConnectDAppPendingRequests
 -> GetTonConnectDAppPendingRequests -> Bool)
-> (GetTonConnectDAppPendingRequests
    -> GetTonConnectDAppPendingRequests -> Bool)
-> Eq GetTonConnectDAppPendingRequests
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetTonConnectDAppPendingRequests
-> GetTonConnectDAppPendingRequests -> Bool
== :: GetTonConnectDAppPendingRequests
-> GetTonConnectDAppPendingRequests -> Bool
$c/= :: GetTonConnectDAppPendingRequests
-> GetTonConnectDAppPendingRequests -> Bool
/= :: GetTonConnectDAppPendingRequests
-> GetTonConnectDAppPendingRequests -> Bool
Eq, Int -> GetTonConnectDAppPendingRequests -> ShowS
[GetTonConnectDAppPendingRequests] -> ShowS
GetTonConnectDAppPendingRequests -> String
(Int -> GetTonConnectDAppPendingRequests -> ShowS)
-> (GetTonConnectDAppPendingRequests -> String)
-> ([GetTonConnectDAppPendingRequests] -> ShowS)
-> Show GetTonConnectDAppPendingRequests
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetTonConnectDAppPendingRequests -> ShowS
showsPrec :: Int -> GetTonConnectDAppPendingRequests -> ShowS
$cshow :: GetTonConnectDAppPendingRequests -> String
show :: GetTonConnectDAppPendingRequests -> String
$cshowList :: [GetTonConnectDAppPendingRequests] -> ShowS
showList :: [GetTonConnectDAppPendingRequests] -> ShowS
Show)

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

instance AT.ToJSON GetTonConnectDAppPendingRequests where
  toJSON :: GetTonConnectDAppPendingRequests -> Value
toJSON
    GetTonConnectDAppPendingRequests
      { dapp_client_id :: GetTonConnectDAppPendingRequests -> Maybe Text
dapp_client_id = Maybe Text
dapp_client_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
"getTonConnectDAppPendingRequests"
          , Key
"dapp_client_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
dapp_client_id_
          ]