module TD.Query.SetTdlibParameters
(SetTdlibParameters(..)
, defaultSetTdlibParameters
) 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
import qualified Data.ByteString as BS
data SetTdlibParameters
= SetTdlibParameters
{ SetTdlibParameters -> Maybe Bool
use_test_dc :: Maybe Bool
, SetTdlibParameters -> Maybe Text
database_directory :: Maybe T.Text
, SetTdlibParameters -> Maybe Text
files_directory :: Maybe T.Text
, SetTdlibParameters -> Maybe ByteString
database_encryption_key :: Maybe BS.ByteString
, SetTdlibParameters -> Maybe Bool
use_file_database :: Maybe Bool
, SetTdlibParameters -> Maybe Bool
use_chat_info_database :: Maybe Bool
, SetTdlibParameters -> Maybe Bool
use_message_database :: Maybe Bool
, SetTdlibParameters -> Maybe Bool
use_secret_chats :: Maybe Bool
, SetTdlibParameters -> Maybe Int
api_id :: Maybe Int
, SetTdlibParameters -> Maybe Text
api_hash :: Maybe T.Text
, SetTdlibParameters -> Maybe Text
system_language_code :: Maybe T.Text
, SetTdlibParameters -> Maybe Text
device_model :: Maybe T.Text
, SetTdlibParameters -> Maybe Text
system_version :: Maybe T.Text
, SetTdlibParameters -> Maybe Text
application_version :: Maybe T.Text
}
deriving (SetTdlibParameters -> SetTdlibParameters -> Bool
(SetTdlibParameters -> SetTdlibParameters -> Bool)
-> (SetTdlibParameters -> SetTdlibParameters -> Bool)
-> Eq SetTdlibParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetTdlibParameters -> SetTdlibParameters -> Bool
== :: SetTdlibParameters -> SetTdlibParameters -> Bool
$c/= :: SetTdlibParameters -> SetTdlibParameters -> Bool
/= :: SetTdlibParameters -> SetTdlibParameters -> Bool
Eq, Int -> SetTdlibParameters -> ShowS
[SetTdlibParameters] -> ShowS
SetTdlibParameters -> String
(Int -> SetTdlibParameters -> ShowS)
-> (SetTdlibParameters -> String)
-> ([SetTdlibParameters] -> ShowS)
-> Show SetTdlibParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetTdlibParameters -> ShowS
showsPrec :: Int -> SetTdlibParameters -> ShowS
$cshow :: SetTdlibParameters -> String
show :: SetTdlibParameters -> String
$cshowList :: [SetTdlibParameters] -> ShowS
showList :: [SetTdlibParameters] -> ShowS
Show)
instance I.ShortShow SetTdlibParameters where
shortShow :: SetTdlibParameters -> String
shortShow
SetTdlibParameters
{ use_test_dc :: SetTdlibParameters -> Maybe Bool
use_test_dc = Maybe Bool
use_test_dc_
, database_directory :: SetTdlibParameters -> Maybe Text
database_directory = Maybe Text
database_directory_
, files_directory :: SetTdlibParameters -> Maybe Text
files_directory = Maybe Text
files_directory_
, database_encryption_key :: SetTdlibParameters -> Maybe ByteString
database_encryption_key = Maybe ByteString
database_encryption_key_
, use_file_database :: SetTdlibParameters -> Maybe Bool
use_file_database = Maybe Bool
use_file_database_
, use_chat_info_database :: SetTdlibParameters -> Maybe Bool
use_chat_info_database = Maybe Bool
use_chat_info_database_
, use_message_database :: SetTdlibParameters -> Maybe Bool
use_message_database = Maybe Bool
use_message_database_
, use_secret_chats :: SetTdlibParameters -> Maybe Bool
use_secret_chats = Maybe Bool
use_secret_chats_
, api_id :: SetTdlibParameters -> Maybe Int
api_id = Maybe Int
api_id_
, api_hash :: SetTdlibParameters -> Maybe Text
api_hash = Maybe Text
api_hash_
, system_language_code :: SetTdlibParameters -> Maybe Text
system_language_code = Maybe Text
system_language_code_
, device_model :: SetTdlibParameters -> Maybe Text
device_model = Maybe Text
device_model_
, system_version :: SetTdlibParameters -> Maybe Text
system_version = Maybe Text
system_version_
, application_version :: SetTdlibParameters -> Maybe Text
application_version = Maybe Text
application_version_
}
= String
"SetTdlibParameters"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"use_test_dc" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_test_dc_
, String
"database_directory" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
database_directory_
, String
"files_directory" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
files_directory_
, String
"database_encryption_key" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
database_encryption_key_
, String
"use_file_database" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_file_database_
, String
"use_chat_info_database" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_chat_info_database_
, String
"use_message_database" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_message_database_
, String
"use_secret_chats" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_secret_chats_
, String
"api_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
api_id_
, String
"api_hash" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
api_hash_
, String
"system_language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
system_language_code_
, String
"device_model" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
device_model_
, String
"system_version" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
system_version_
, String
"application_version" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
application_version_
]
instance AT.ToJSON SetTdlibParameters where
toJSON :: SetTdlibParameters -> Value
toJSON
SetTdlibParameters
{ use_test_dc :: SetTdlibParameters -> Maybe Bool
use_test_dc = Maybe Bool
use_test_dc_
, database_directory :: SetTdlibParameters -> Maybe Text
database_directory = Maybe Text
database_directory_
, files_directory :: SetTdlibParameters -> Maybe Text
files_directory = Maybe Text
files_directory_
, database_encryption_key :: SetTdlibParameters -> Maybe ByteString
database_encryption_key = Maybe ByteString
database_encryption_key_
, use_file_database :: SetTdlibParameters -> Maybe Bool
use_file_database = Maybe Bool
use_file_database_
, use_chat_info_database :: SetTdlibParameters -> Maybe Bool
use_chat_info_database = Maybe Bool
use_chat_info_database_
, use_message_database :: SetTdlibParameters -> Maybe Bool
use_message_database = Maybe Bool
use_message_database_
, use_secret_chats :: SetTdlibParameters -> Maybe Bool
use_secret_chats = Maybe Bool
use_secret_chats_
, api_id :: SetTdlibParameters -> Maybe Int
api_id = Maybe Int
api_id_
, api_hash :: SetTdlibParameters -> Maybe Text
api_hash = Maybe Text
api_hash_
, system_language_code :: SetTdlibParameters -> Maybe Text
system_language_code = Maybe Text
system_language_code_
, device_model :: SetTdlibParameters -> Maybe Text
device_model = Maybe Text
device_model_
, system_version :: SetTdlibParameters -> Maybe Text
system_version = Maybe Text
system_version_
, application_version :: SetTdlibParameters -> Maybe Text
application_version = Maybe Text
application_version_
}
= [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
"setTdlibParameters"
, Key
"use_test_dc" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_test_dc_
, Key
"database_directory" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
database_directory_
, Key
"files_directory" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
files_directory_
, Key
"database_encryption_key" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (ByteString -> Value) -> Maybe ByteString -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> Value
I.writeBytes Maybe ByteString
database_encryption_key_
, Key
"use_file_database" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_file_database_
, Key
"use_chat_info_database" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_chat_info_database_
, Key
"use_message_database" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_message_database_
, Key
"use_secret_chats" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_secret_chats_
, Key
"api_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
api_id_
, Key
"api_hash" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
api_hash_
, Key
"system_language_code" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
system_language_code_
, Key
"device_model" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
device_model_
, Key
"system_version" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
system_version_
, Key
"application_version" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
application_version_
]
defaultSetTdlibParameters :: SetTdlibParameters
defaultSetTdlibParameters :: SetTdlibParameters
defaultSetTdlibParameters =
SetTdlibParameters
{ use_test_dc :: Maybe Bool
use_test_dc = Maybe Bool
forall a. Maybe a
Nothing
, database_directory :: Maybe Text
database_directory = Maybe Text
forall a. Maybe a
Nothing
, files_directory :: Maybe Text
files_directory = Maybe Text
forall a. Maybe a
Nothing
, database_encryption_key :: Maybe ByteString
database_encryption_key = Maybe ByteString
forall a. Maybe a
Nothing
, use_file_database :: Maybe Bool
use_file_database = Maybe Bool
forall a. Maybe a
Nothing
, use_chat_info_database :: Maybe Bool
use_chat_info_database = Maybe Bool
forall a. Maybe a
Nothing
, use_message_database :: Maybe Bool
use_message_database = Maybe Bool
forall a. Maybe a
Nothing
, use_secret_chats :: Maybe Bool
use_secret_chats = Maybe Bool
forall a. Maybe a
Nothing
, api_id :: Maybe Int
api_id = Maybe Int
forall a. Maybe a
Nothing
, api_hash :: Maybe Text
api_hash = Maybe Text
forall a. Maybe a
Nothing
, system_language_code :: Maybe Text
system_language_code = Maybe Text
forall a. Maybe a
Nothing
, device_model :: Maybe Text
device_model = Maybe Text
forall a. Maybe a
Nothing
, system_version :: Maybe Text
system_version = Maybe Text
forall a. Maybe a
Nothing
, application_version :: Maybe Text
application_version = Maybe Text
forall a. Maybe a
Nothing
}