module TD.Query.GetVideoChatRtmpUrl
  (GetVideoChatRtmpUrl(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns RTMP URL for streaming to the chat; requires owner privileges. Returns 'TD.Data.RtmpUrl.RtmpUrl'
data GetVideoChatRtmpUrl
  = GetVideoChatRtmpUrl
    { GetVideoChatRtmpUrl -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool
(GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool)
-> (GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool)
-> Eq GetVideoChatRtmpUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool
== :: GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool
$c/= :: GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool
/= :: GetVideoChatRtmpUrl -> GetVideoChatRtmpUrl -> Bool
Eq, Int -> GetVideoChatRtmpUrl -> ShowS
[GetVideoChatRtmpUrl] -> ShowS
GetVideoChatRtmpUrl -> String
(Int -> GetVideoChatRtmpUrl -> ShowS)
-> (GetVideoChatRtmpUrl -> String)
-> ([GetVideoChatRtmpUrl] -> ShowS)
-> Show GetVideoChatRtmpUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetVideoChatRtmpUrl -> ShowS
showsPrec :: Int -> GetVideoChatRtmpUrl -> ShowS
$cshow :: GetVideoChatRtmpUrl -> String
show :: GetVideoChatRtmpUrl -> String
$cshowList :: [GetVideoChatRtmpUrl] -> ShowS
showList :: [GetVideoChatRtmpUrl] -> ShowS
Show)

instance I.ShortShow GetVideoChatRtmpUrl where
  shortShow :: GetVideoChatRtmpUrl -> String
shortShow
    GetVideoChatRtmpUrl
      { chat_id :: GetVideoChatRtmpUrl -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = String
"GetVideoChatRtmpUrl"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          ]

instance AT.ToJSON GetVideoChatRtmpUrl where
  toJSON :: GetVideoChatRtmpUrl -> Value
toJSON
    GetVideoChatRtmpUrl
      { chat_id :: GetVideoChatRtmpUrl -> Maybe Int
chat_id = Maybe Int
chat_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
"getVideoChatRtmpUrl"
          , Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
          ]