module TD.Query.GetChatFolderNewChats
  (GetChatFolderNewChats(..)
  ) where

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

-- | Returns new chats added to a shareable chat folder by its owner. The method must be called at most once in getOption("chat_folder_new_chats_update_period") for the given chat folder. Returns 'TD.Data.Chats.Chats'
data GetChatFolderNewChats
  = GetChatFolderNewChats
    { GetChatFolderNewChats -> Maybe Int
chat_folder_id :: Maybe Int -- ^ Chat folder identifier
    }
  deriving (GetChatFolderNewChats -> GetChatFolderNewChats -> Bool
(GetChatFolderNewChats -> GetChatFolderNewChats -> Bool)
-> (GetChatFolderNewChats -> GetChatFolderNewChats -> Bool)
-> Eq GetChatFolderNewChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatFolderNewChats -> GetChatFolderNewChats -> Bool
== :: GetChatFolderNewChats -> GetChatFolderNewChats -> Bool
$c/= :: GetChatFolderNewChats -> GetChatFolderNewChats -> Bool
/= :: GetChatFolderNewChats -> GetChatFolderNewChats -> Bool
Eq, Int -> GetChatFolderNewChats -> ShowS
[GetChatFolderNewChats] -> ShowS
GetChatFolderNewChats -> String
(Int -> GetChatFolderNewChats -> ShowS)
-> (GetChatFolderNewChats -> String)
-> ([GetChatFolderNewChats] -> ShowS)
-> Show GetChatFolderNewChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatFolderNewChats -> ShowS
showsPrec :: Int -> GetChatFolderNewChats -> ShowS
$cshow :: GetChatFolderNewChats -> String
show :: GetChatFolderNewChats -> String
$cshowList :: [GetChatFolderNewChats] -> ShowS
showList :: [GetChatFolderNewChats] -> ShowS
Show)

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

instance AT.ToJSON GetChatFolderNewChats where
  toJSON :: GetChatFolderNewChats -> Value
toJSON
    GetChatFolderNewChats
      { chat_folder_id :: GetChatFolderNewChats -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_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
"getChatFolderNewChats"
          , Key
"chat_folder_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_folder_id_
          ]