module TD.Query.GetBusinessConnection
  (GetBusinessConnection(..)
  ) 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 information about a business connection by its identifier; for bots only. Returns 'TD.Data.BusinessConnection.BusinessConnection'
data GetBusinessConnection
  = GetBusinessConnection
    { GetBusinessConnection -> Maybe Text
connection_id :: Maybe T.Text -- ^ Identifier of the business connection to return
    }
  deriving (GetBusinessConnection -> GetBusinessConnection -> Bool
(GetBusinessConnection -> GetBusinessConnection -> Bool)
-> (GetBusinessConnection -> GetBusinessConnection -> Bool)
-> Eq GetBusinessConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetBusinessConnection -> GetBusinessConnection -> Bool
== :: GetBusinessConnection -> GetBusinessConnection -> Bool
$c/= :: GetBusinessConnection -> GetBusinessConnection -> Bool
/= :: GetBusinessConnection -> GetBusinessConnection -> Bool
Eq, Int -> GetBusinessConnection -> ShowS
[GetBusinessConnection] -> ShowS
GetBusinessConnection -> String
(Int -> GetBusinessConnection -> ShowS)
-> (GetBusinessConnection -> String)
-> ([GetBusinessConnection] -> ShowS)
-> Show GetBusinessConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetBusinessConnection -> ShowS
showsPrec :: Int -> GetBusinessConnection -> ShowS
$cshow :: GetBusinessConnection -> String
show :: GetBusinessConnection -> String
$cshowList :: [GetBusinessConnection] -> ShowS
showList :: [GetBusinessConnection] -> ShowS
Show)

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

instance AT.ToJSON GetBusinessConnection where
  toJSON :: GetBusinessConnection -> Value
toJSON
    GetBusinessConnection
      { connection_id :: GetBusinessConnection -> Maybe Text
connection_id = Maybe Text
connection_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
"getBusinessConnection"
          , Key
"connection_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
connection_id_
          ]