Update content of files

This commit is contained in:
GitHub Action 2022-11-02 14:18:55 +00:00
parent b530b6e477
commit fbc1e6351e
3 changed files with 712 additions and 14 deletions

View file

@ -1,14 +0,0 @@
91.108.56.0/22
91.108.4.0/22
91.108.8.0/22
91.108.16.0/22
91.108.12.0/22
149.154.160.0/20
91.105.192.0/23
91.108.20.0/22
185.76.151.0/24
2001:b28:f23d::/48
2001:b28:f23f::/48
2001:67c:4e8::/48
2001:b28:f23c::/48
2a0a:f280::/32

View file

@ -0,0 +1,210 @@
<!-- HTML header for doxygen 1.8.14-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TDLib: TDLib</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript" src="tg_doxygen.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tg_doxygen.css" rel="stylesheet" type="text/css"/>
<link href="tg_tabs.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<div class="tg_navbar clearfix">
<div class="tg_navbar_inner">
<div class="tg_container clearfix">
<ul class="tg_nav tg_navbar_nav tg_navbar_right tg_hidden_xs">
<li class="tg_navbar_twitter"><a href="https://twitter.com/telegram" target="_blank"><i class="tg_icon_twitter"></i><span> Twitter</span></a></li></ul>
<ul class="tg_nav tg_navbar_nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="tg_hidden_xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="tg_hidden_xs"><a href="//telegram.org/apps">Apps</a></li>
<li><a href="/api">API</a></li>
<li><a href="/mtproto">Protocol</a></li>
<li><a href="/schema">Schema</a></li>
<li class="active"><a href="/tdlib">TDLib</a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">TDLib </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>TDLib (Telegram Database library) is a cross-platform library for building <a href="https://telegram.org">Telegram</a> clients. It can be easily used from almost any programming language.</p>
<h2>Table of Contents</h2>
<ul>
<li><a href="#features">Features</a></li>
<li><a href="#usage">Examples and documentation</a></li>
<li><a href="#dependencies">Dependencies</a></li>
<li><a href="#building">Building</a></li>
<li><a href="#using-cxx">Using in CMake C++ projects</a></li>
<li><a href="#using-java">Using in Java projects</a></li>
<li><a href="#using-dotnet">Using in .NET projects</a></li>
<li><a href="#using-json">Using with other programming languages</a></li>
<li><a href="#license">License</a></li>
</ul>
<p><a class="anchor" id="features"></a> </p><h2>Features</h2>
<p><code>TDLib</code> has many advantages. Notably <code>TDLib</code> is:</p>
<ul>
<li><b>Cross-platform</b>: <code>TDLib</code> can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, illumos, Windows Phone, WebAssembly, watchOS, tvOS, Tizen, Cygwin. It should also work on other *nix systems with or without minimal effort.</li>
<li><b>Multilanguage</b>: <code>TDLib</code> can be easily used with any programming language that is able to execute C functions. Additionally it already has native Java (using <code>JNI</code>) bindings and .NET (using <code>C++/CLI</code> and <code>C++/CX</code>) bindings.</li>
<li><b>Easy to use</b>: <code>TDLib</code> takes care of all network implementation details, encryption and local data storage.</li>
<li><b>High-performance</b>: in the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>, each <code>TDLib</code> instance handles more than 24000 active bots simultaneously.</li>
<li><b>Well-documented</b>: all <code>TDLib</code> API methods and public interfaces are fully documented.</li>
<li><b>Consistent</b>: <code>TDLib</code> guarantees that all updates are delivered in the right order.</li>
<li><b>Reliable</b>: <code>TDLib</code> remains stable on slow and unreliable Internet connections.</li>
<li><b>Secure</b>: all local data is encrypted using a user-provided encryption key.</li>
<li><b>Fully-asynchronous</b>: requests to <code>TDLib</code> don't block each other or anything else, responses are sent when they are available.</li>
</ul>
<p><a class="anchor" id="usage"></a> </p><h2>Examples and documentation</h2>
<p>See our <a href="https://core.telegram.org/tdlib/getting-started">Getting Started</a> tutorial for a description of basic TDLib concepts.</p>
<p>Take a look at our <a href="https://github.com/tdlib/td/blob/master/example/README.md#tdlib-usage-and-build-examples">examples</a>.</p>
<p>See a <a href="https://tdlib.github.io/td/build.html">TDLib build instructions generator</a> for detailed instructions on how to build TDLib.</p>
<p>See description of our <a href="#using-json">JSON</a>, <a href="#using-cxx">C++</a>, <a href="#using-java">Java</a> and <a href="#using-dotnet">.NET</a> interfaces.</p>
<p>See the <a href="https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl">td_api.tl</a> scheme or the automatically generated <a href="https://core.telegram.org/tdlib/docs/td__api_8h.html">HTML documentation</a> for a list of all available <code>TDLib</code> <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html">methods</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html">classes</a>.</p>
<p><a class="anchor" id="dependencies"></a> </p><h2>Dependencies</h2>
<p><code>TDLib</code> depends on:</p>
<ul>
<li>C++14 compatible compiler (Clang 3.4+, GCC 4.9+, MSVC 19.0+ (Visual Studio 2015+), Intel C++ Compiler 17+)</li>
<li>OpenSSL</li>
<li>zlib</li>
<li>gperf (build only)</li>
<li>CMake (3.0.2+, build only)</li>
<li>PHP (optional, for documentation generation)</li>
</ul>
<p><a class="anchor" id="building"></a> </p><h2>Building</h2>
<p>The simplest way to build <code>TDLib</code> is to use our <a href="https://tdlib.github.io/td/build.html">TDLib build instructions generator</a>. You need only to choose your programming language and target operating system to receive complete build instructions.</p>
<p>In general, you need to install all <code>TDLib</code> <a href="#dependencies">dependencies</a>, enter directory containing <code>TDLib</code> sources and compile them using CMake:</p>
<div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake -DCMAKE_BUILD_TYPE=Release ..</div><div class="line">cmake --build .</div></div><!-- fragment --><p>To build <code>TDLib</code> on low memory devices you can run <a href="https://github.com/tdlib/td/blob/master/SplitSource.php">SplitSource.php</a> script before compiling main <code>TDLib</code> source code and compile only needed targets: </p><div class="fragment"><div class="line">mkdir build</div><div class="line">cd build</div><div class="line">cmake -DCMAKE_BUILD_TYPE=Release ..</div><div class="line">cmake --build . --target prepare_cross_compiling</div><div class="line">cd ..</div><div class="line">php SplitSource.php</div><div class="line">cd build</div><div class="line">cmake --build . --target tdjson</div><div class="line">cmake --build . --target tdjson_static</div><div class="line">cd ..</div><div class="line">php SplitSource.php --undo</div></div><!-- fragment --><p> In our tests clang 6.0 with libc++ required less than 500 MB of RAM per file and GCC 4.9/6.3 used less than 1 GB of RAM per file.</p>
<p><a class="anchor" id="using-cxx"></a> </p><h2>Using in CMake C++ projects</h2>
<p>For C++ projects that use CMake, the best approach is to build <code>TDLib</code> as part of your project or to install it system-wide.</p>
<p>There are several libraries that you could use in your CMake project:</p>
<ul>
<li>Td::TdJson, Td::TdJsonStatic — dynamic and static version of a JSON interface. This has a simple C interface, so it can be easily used with any programming language that is able to execute C functions. See <a href="https://core.telegram.org/tdlib/docs/td__json__client_8h.html">td_json_client</a> documentation for more information.</li>
<li>Td::TdStatic — static library with C++ interface for general usage. See <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_client_manager.html">ClientManager</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1_client.html">Client</a> documentation for more information.</li>
</ul>
<p>For example, part of your CMakeLists.txt may look like this: </p><div class="fragment"><div class="line">add_subdirectory(td)</div><div class="line">target_link_libraries(YourTarget PRIVATE Td::TdStatic)</div></div><!-- fragment --><p>Or you could install <code>TDLib</code> and then reference it in your CMakeLists.txt like this: </p><div class="fragment"><div class="line">find_package(Td 1.8.0 REQUIRED)</div><div class="line">target_link_libraries(YourTarget PRIVATE Td::TdStatic)</div></div><!-- fragment --><p> See <a href="https://github.com/tdlib/td/tree/master/example/cpp/CMakeLists.txt">example/cpp/CMakeLists.txt</a>.</p>
<p><a class="anchor" id="using-java"></a> </p><h2>Using in Java projects</h2>
<p><code>TDLib</code> provides native Java interface through JNI. To enable it, specify option <code>-DTD_ENABLE_JNI=ON</code> to CMake.</p>
<p>See <a href="https://github.com/tdlib/td/tree/master/example/java">example/java</a> for example of using <code>TDLib</code> from Java and detailed build and usage instructions.</p>
<p><a class="anchor" id="using-dotnet"></a> </p><h2>Using in .NET projects</h2>
<p><code>TDLib</code> provides native .NET interface through <code>C++/CLI</code> and <code>C++/CX</code>. To enable it, specify option <code>-DTD_ENABLE_DOTNET=ON</code> to CMake. .NET Core supports <code>C++/CLI</code> only since version 3.1 and only on Windows, so if older .NET Core is used or portability is needed, then <code>TDLib</code> JSON interface should be used through P/Invoke instead.</p>
<p>See <a href="https://github.com/tdlib/td/tree/master/example/csharp">example/csharp</a> for example of using <code>TDLib</code> from C# and detailed build and usage instructions. See <a href="https://github.com/tdlib/td/tree/master/example/uwp">example/uwp</a> for example of using <code>TDLib</code> from C# UWP application and detailed build and usage instructions for Visual Studio Extension "TDLib for Universal Windows Platform".</p>
<p>When <code>TDLib</code> is built with <code>TD_ENABLE_DOTNET</code> option enabled, <code>C++</code> documentation is removed from some files. You need to checkout these files to return <code>C++</code> documentation back: </p><div class="fragment"><div class="line">git checkout td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h</div></div><!-- fragment --><p><a class="anchor" id="using-json"></a> </p><h2>Using from other programming languages</h2>
<p><code>TDLib</code> provides efficient native C++, Java, and .NET interfaces. But for most use cases we suggest to use the JSON interface, which can be easily used with any programming language that is able to execute C functions. See <a href="https://core.telegram.org/tdlib/docs/td__json__client_8h.html">td_json_client</a> documentation for detailed JSON interface description, the <a href="https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl">td_api.tl</a> scheme or the automatically generated <a href="https://core.telegram.org/tdlib/docs/td__api_8h.html">HTML documentation</a> for a list of all available <code>TDLib</code> <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html">methods</a> and <a href="https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html">classes</a>.</p>
<p><code>TDLib</code> JSON interface adheres to semantic versioning and versions with the same major version number are binary and backward compatible, but the underlying <code>TDLib</code> API can be different for different minor and even patch versions. If you need to support different <code>TDLib</code> versions, then you can use a value of the <code>version</code> option to find exact <code>TDLib</code> version to use appropriate API methods.</p>
<p>See <a href="https://github.com/tdlib/td/tree/master/example/python/tdjson_example.py">example/python/tdjson_example.py</a> for an example of such usage.</p>
<p><a class="anchor" id="license"></a> </p><h2>License</h2>
<p><code>TDLib</code> is licensed under the terms of the Boost Software License. See <a href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a> for more information. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<hr class="footer"/>
<div class="tg_footer_wrap">
<div class="tg_footer_columns_wrap clearfix tg_footer_desktop">
<div class="tg_footer_column tg_footer_column_telegram">
<h5>Telegram</h5>
<div class="tg_footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</ul>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="tg_footer_column tg_footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="tg_footer_columns_wrap clearfix tg_footer_mobile">
<div class="tg_footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//twitter.com/telegram" target="_blank">Twitter</a></h5>
</div>
</div>
</div>
<script type="text/javascript">tgApplyFixes();</script>
</body>
</html>

View file

@ -0,0 +1,502 @@
<!-- HTML header for doxygen 1.8.14-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TDLib: td/telegram/td_json_client.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript" src="tg_doxygen.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tg_doxygen.css" rel="stylesheet" type="text/css"/>
<link href="tg_tabs.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<div class="tg_navbar clearfix">
<div class="tg_navbar_inner">
<div class="tg_container clearfix">
<ul class="tg_nav tg_navbar_nav tg_navbar_right tg_hidden_xs">
<li class="tg_navbar_twitter"><a href="https://twitter.com/telegram" target="_blank"><i class="tg_icon_twitter"></i><span> Twitter</span></a></li></ul>
<ul class="tg_nav tg_navbar_nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="tg_hidden_xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="tg_hidden_xs"><a href="//telegram.org/apps">Apps</a></li>
<li><a href="/api">API</a></li>
<li><a href="/mtproto">Protocol</a></li>
<li><a href="/schema">Schema</a></li>
<li class="active"><a href="/tdlib">TDLib</a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_05b22fcca9bb47fde58f0d0dd2892ac6.html">td</a></li><li class="navelem"><a class="el" href="dir_a49186d4b022e03550aa19f8980c74c2.html">telegram</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">td_json_client.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<div class="textblock"><p>C interface for interaction with TDLib via JSON-serialized objects. Can be used to easily integrate TDLib with any programming language which supports calling C functions and is able to work with JSON.</p>
<p>The JSON serialization of TDLib API objects is straightforward: all API objects are represented as JSON objects with the same keys as the API object field names. The object type name is stored in the special field "@type" which is optional in places where type is uniquely determined by the context. Fields of Bool type are stored as Boolean, fields of int32, int53, and double types are stored as Number, fields of int64 and string types are stored as String, fields of bytes type are base64 encoded and then stored as String, fields of array type are stored as Array.</p>
<p>The main TDLib interface is asynchronous. To match requests with a corresponding response, the field "@extra" can be added to the request object. The corresponding response will have an "@extra" field with exactly the same value. Each returned object will have an "@client_id" field, containing the identifier of the client for which a response or an update was received.</p>
<p>A TDLib client instance can be created through td_create_client_id. Requests can be sent using td_send and the received client identifier. New updates and responses to requests can be received through td_receive from any thread after the first request has been sent to the client instance. This function must not be called simultaneously from two different threads. Also note that all updates and responses to requests must be applied in the order they were received for consistency. Some TDLib requests can be executed synchronously from any thread using td_execute. TDLib client instances are destroyed automatically after they are closed. All TDLib client instances must be closed before application termination to ensure data consistency.</p>
<p>General pattern of usage: </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> client_id = <a class="code" href="td__json__client_8h.html#a7feda953a66eee36bc207eb71a55c490">td_create_client_id</a>();</div><div class="line"><span class="comment">// share the client_id with other threads, which will be able to send requests via td_send</span></div><div class="line"></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> WAIT_TIMEOUT = 10.0; <span class="comment">// seconds</span></div><div class="line"><span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *result = <a class="code" href="td__json__client_8h.html#a62715bea8e41a554d1bac763c187b662">td_receive</a>(WAIT_TIMEOUT);</div><div class="line"> <span class="keywordflow">if</span> (result) {</div><div class="line"> <span class="comment">// parse the result as a JSON object and process it as an incoming update or the answer to a previously sent request</span></div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p>Alternatively, you can use old TDLib JSON interface, which will be removed in TDLib 2.0.0.</p>
<p>Objects and functions serialization to JSON is the same for both JSON interfaces.</p>
<p>The main TDLib interface is asynchronous. To match requests with a corresponding response a field "@extra" can be added to the request object. The corresponding response will have an "@extra" field with exactly the same value.</p>
<p>A TDLib client instance can be created through td_json_client_create. Requests then can be sent using td_json_client_send from any thread. New updates and request responses can be received through td_json_client_receive from any thread. This function must not be called simultaneously from two different threads. Also note that all updates and request responses must be applied in the order they were received to ensure consistency. Given this information, it's advisable to call this function from a dedicated thread. Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute. The TDLib client instance can be destroyed via td_json_client_destroy.</p>
<p>General pattern of usage: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> *client = <a class="code" href="td__json__client_8h.html#a45cd6979ada11b7690d9dcb1ddc841a0">td_json_client_create</a>();</div><div class="line"><span class="comment">// somehow share the client with other threads, which will be able to send requests via td_json_client_send</span></div><div class="line"></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> WAIT_TIMEOUT = 10.0; <span class="comment">// seconds</span></div><div class="line"><span class="keywordtype">int</span> is_closed = 0; <span class="comment">// should be set to 1, when updateAuthorizationState with authorizationStateClosed is received</span></div><div class="line"><span class="keywordflow">while</span> (!is_closed) {</div><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *result = <a class="code" href="td__json__client_8h.html#a9e0cb36bfa2bc2249905aebd7d07a4ac">td_json_client_receive</a>(client, WAIT_TIMEOUT);</div><div class="line"> <span class="keywordflow">if</span> (result) {</div><div class="line"> <span class="comment">// parse the result as JSON object and process it as an incoming update or an answer to a previously sent request</span></div><div class="line"> }</div><div class="line">}</div><div class="line"><a class="code" href="td__json__client_8h.html#a75c765a44f3bdf6a724d90c2e7f75ecf">td_json_client_destroy</a>(client);</div></div><!-- fragment --> </div>
<p><a href="td__json__client_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a967769864d76b43cf3ad779b801971d5"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a967769864d76b43cf3ad779b801971d5">td_log_message_callback_ptr</a>) (int verbosity_level, const char *message)</td></tr>
<tr class="separator:a967769864d76b43cf3ad779b801971d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7feda953a66eee36bc207eb71a55c490"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a7feda953a66eee36bc207eb71a55c490">td_create_client_id</a> ()</td></tr>
<tr class="separator:a7feda953a66eee36bc207eb71a55c490"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8a6b2061559c80887af75381abdbddf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#aa8a6b2061559c80887af75381abdbddf">td_send</a> (int client_id, const char *request)</td></tr>
<tr class="separator:aa8a6b2061559c80887af75381abdbddf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62715bea8e41a554d1bac763c187b662"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a62715bea8e41a554d1bac763c187b662">td_receive</a> (double timeout)</td></tr>
<tr class="separator:a62715bea8e41a554d1bac763c187b662"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aff3d28f8896cf0b74f7825e3198f5b3e"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#aff3d28f8896cf0b74f7825e3198f5b3e">td_execute</a> (const char *request)</td></tr>
<tr class="separator:aff3d28f8896cf0b74f7825e3198f5b3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c7d765c53703b3c082bbd6f77eb2de6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a1c7d765c53703b3c082bbd6f77eb2de6">td_set_log_message_callback</a> (int max_verbosity_level, <a class="el" href="td__json__client_8h.html#a967769864d76b43cf3ad779b801971d5">td_log_message_callback_ptr</a> callback)</td></tr>
<tr class="separator:a1c7d765c53703b3c082bbd6f77eb2de6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45cd6979ada11b7690d9dcb1ddc841a0"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a45cd6979ada11b7690d9dcb1ddc841a0">td_json_client_create</a> ()</td></tr>
<tr class="separator:a45cd6979ada11b7690d9dcb1ddc841a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fea1f986bf950d19eee3032c24cce83"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a1fea1f986bf950d19eee3032c24cce83">td_json_client_send</a> (void *client, const char *request)</td></tr>
<tr class="separator:a1fea1f986bf950d19eee3032c24cce83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9e0cb36bfa2bc2249905aebd7d07a4ac"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a9e0cb36bfa2bc2249905aebd7d07a4ac">td_json_client_receive</a> (void *client, double timeout)</td></tr>
<tr class="separator:a9e0cb36bfa2bc2249905aebd7d07a4ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d6c76380793072d4a9ce3c71ba0f1cf"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a6d6c76380793072d4a9ce3c71ba0f1cf">td_json_client_execute</a> (void *client, const char *request)</td></tr>
<tr class="separator:a6d6c76380793072d4a9ce3c71ba0f1cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75c765a44f3bdf6a724d90c2e7f75ecf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="td__json__client_8h.html#a75c765a44f3bdf6a724d90c2e7f75ecf">td_json_client_destroy</a> (void *client)</td></tr>
<tr class="separator:a75c765a44f3bdf6a724d90c2e7f75ecf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a967769864d76b43cf3ad779b801971d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a967769864d76b43cf3ad779b801971d5">&#9670;&nbsp;</a></span>td_log_message_callback_ptr</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void(* td_log_message_callback_ptr) (int verbosity_level, const char *message)</td>
</tr>
</table>
</div><div class="memdoc">
<p>A type of callback function that will be called when a message is added to the internal TDLib log.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">verbosity_level</td><td>Log verbosity level with which the message was added (-1 - 1024). If 0, then TDLib will crash as soon as the callback returns. None of the TDLib methods can be called from the callback. </td></tr>
<tr><td class="paramname">message</td><td>Null-terminated string with the logged message. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a7feda953a66eee36bc207eb71a55c490"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7feda953a66eee36bc207eb71a55c490">&#9670;&nbsp;</a></span>td_create_client_id()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int td_create_client_id </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns an opaque identifier of a new TDLib instance. The TDLib instance will not send updates until the first request is sent to it. </p><dl class="section return"><dt>Returns</dt><dd>Opaque identifier of a new TDLib instance. </dd></dl>
</div>
</div>
<a id="aa8a6b2061559c80887af75381abdbddf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa8a6b2061559c80887af75381abdbddf">&#9670;&nbsp;</a></span>td_send()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void td_send </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>client_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>request</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sends request to the TDLib client. May be called from any thread. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">client_id</td><td>TDLib client identifier. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">request</td><td>JSON-serialized null-terminated request to TDLib. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a62715bea8e41a554d1bac763c187b662"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a62715bea8e41a554d1bac763c187b662">&#9670;&nbsp;</a></span>td_receive()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* td_receive </td>
<td>(</td>
<td class="paramtype">double&#160;</td>
<td class="paramname"><em>timeout</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Receives incoming updates and request responses. Must not be called simultaneously from two different threads. The returned pointer can be used until the next call to td_receive or td_execute, after which it will be deallocated by TDLib. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The maximum number of seconds allowed for this function to wait for new data. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>JSON-serialized null-terminated incoming update or request response. May be NULL if the timeout expires. </dd></dl>
</div>
</div>
<a id="aff3d28f8896cf0b74f7825e3198f5b3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aff3d28f8896cf0b74f7825e3198f5b3e">&#9670;&nbsp;</a></span>td_execute()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* td_execute </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>request</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Synchronously executes a TDLib request. A request can be executed synchronously, only if it is documented with "Can be called synchronously". The returned pointer can be used until the next call to td_receive or td_execute, after which it will be deallocated by TDLib. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">request</td><td>JSON-serialized null-terminated request to TDLib. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>JSON-serialized null-terminated request response. </dd></dl>
</div>
</div>
<a id="a1c7d765c53703b3c082bbd6f77eb2de6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c7d765c53703b3c082bbd6f77eb2de6">&#9670;&nbsp;</a></span>td_set_log_message_callback()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void td_set_log_message_callback </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>max_verbosity_level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="td__json__client_8h.html#a967769864d76b43cf3ad779b801971d5">td_log_message_callback_ptr</a>&#160;</td>
<td class="paramname"><em>callback</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the callback that will be called when a message is added to the internal TDLib log. None of the TDLib methods can be called from the callback. By default the callback is not set.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">max_verbosity_level</td><td>The maximum verbosity level of messages for which the callback will be called. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>Callback that will be called when a message is added to the internal TDLib log. Pass nullptr to remove the callback. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a45cd6979ada11b7690d9dcb1ddc841a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a45cd6979ada11b7690d9dcb1ddc841a0">&#9670;&nbsp;</a></span>td_json_client_create()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* td_json_client_create </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new instance of TDLib. </p><dl class="section return"><dt>Returns</dt><dd>Pointer to the created instance of TDLib. </dd></dl>
</div>
</div>
<a id="a1fea1f986bf950d19eee3032c24cce83"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1fea1f986bf950d19eee3032c24cce83">&#9670;&nbsp;</a></span>td_json_client_send()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void td_json_client_send </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>client</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>request</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sends request to the TDLib client. May be called from any thread. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">client</td><td>The client. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">request</td><td>JSON-serialized null-terminated request to TDLib. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a9e0cb36bfa2bc2249905aebd7d07a4ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9e0cb36bfa2bc2249905aebd7d07a4ac">&#9670;&nbsp;</a></span>td_json_client_receive()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* td_json_client_receive </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>client</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double&#160;</td>
<td class="paramname"><em>timeout</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Receives incoming updates and request responses from the TDLib client. May be called from any thread, but must not be called simultaneously from two different threads. Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute in the same thread, so it can't be used after that. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">client</td><td>The client. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The maximum number of seconds allowed for this function to wait for new data. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>JSON-serialized null-terminated incoming update or request response. May be NULL if the timeout expires. </dd></dl>
</div>
</div>
<a id="a6d6c76380793072d4a9ce3c71ba0f1cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d6c76380793072d4a9ce3c71ba0f1cf">&#9670;&nbsp;</a></span>td_json_client_execute()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* td_json_client_execute </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>client</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>request</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Synchronously executes TDLib request. May be called from any thread. Only a few requests can be executed synchronously. Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute in the same thread, so it can't be used after that. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">client</td><td>The client. Currently ignored for all requests, so NULL can be passed. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">request</td><td>JSON-serialized null-terminated request to TDLib. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>JSON-serialized null-terminated request response. </dd></dl>
</div>
</div>
<a id="a75c765a44f3bdf6a724d90c2e7f75ecf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a75c765a44f3bdf6a724d90c2e7f75ecf">&#9670;&nbsp;</a></span>td_json_client_destroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void td_json_client_destroy </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>client</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destroys the TDLib client instance. After this is called the client instance must not be used anymore. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">client</td><td>The client. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<hr class="footer"/>
<div class="tg_footer_wrap">
<div class="tg_footer_columns_wrap clearfix tg_footer_desktop">
<div class="tg_footer_column tg_footer_column_telegram">
<h5>Telegram</h5>
<div class="tg_footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/blog">Blog</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</ul>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</a></li>
</ul>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="tg_footer_column tg_footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="tg_footer_columns_wrap clearfix tg_footer_mobile">
<div class="tg_footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="tg_footer_column">
<h5><a href="//twitter.com/telegram" target="_blank">Twitter</a></h5>
</div>
</div>
</div>
<script type="text/javascript">tgApplyFixes();</script>
</body>
</html>