mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2025-01-05 18:38:19 +01:00
Update content of files
This commit is contained in:
parent
3b24acd8ec
commit
4df2fb524c
4 changed files with 1960 additions and 123 deletions
|
@ -72,7 +72,6 @@
|
|||
<li><a href="/tdlib/docs/">Library documentation</a></li>
|
||||
<li><a href="/tdlib/options">List of available options</a></li>
|
||||
<li><a href="/tdlib/notification-api/">Notification API documentation</a></li>
|
||||
<li><a href="/tdlib/tdlib.zip">Prebuilt library for Android</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ $(function() {
|
|||
<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>Cross-platform</b>: <code>TDLib</code> can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, illumos, Windows Phone, WebAssembly, watchOS, tvOS, visionOS, 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>
|
||||
|
@ -129,7 +129,7 @@ $(function() {
|
|||
<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>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.30 REQUIRED)</div><div class="line">target_link_libraries(YourTarget PRIVATE Td::TdStatic)</div></div><!-- fragment --><p> See <a href="https://github.com/tdlib/td/blob/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>
|
||||
|
@ -139,7 +139,7 @@ $(function() {
|
|||
<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>See <a href="https://github.com/tdlib/td/blob/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 -->
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -87,11 +87,11 @@ $(function() {
|
|||
<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>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>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">
|
||||
|
@ -138,8 +138,8 @@ Functions</h2></td></tr>
|
|||
<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>
|
||||
<tr><td class="paramname">verbosity_level</td><td>Log verbosity level with which the message was added from -1 up to 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 UTF-8-encoded string with the message added to the log. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
@ -402,7 +402,7 @@ Functions</h2></td></tr>
|
|||
</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">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>
|
||||
|
|
Loading…
Reference in a new issue