mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-28 19:23:11 +01:00
Update content of files
This commit is contained in:
parent
68e0ebb042
commit
ce2e57bd00
13 changed files with 26 additions and 26 deletions
|
@ -41,13 +41,13 @@
|
|||
|
||||
<div id="dev_page_content"><!-- scroll_nav -->
|
||||
|
||||
<p>Authorization is associated with a client’s encryption key identifier: <strong>auth_key_id</strong>. No additional parameters need to be passed into methods following authorization. </p>
|
||||
<p>Authorization is associated with a client's encryption key identifier: <strong>auth_key_id</strong>. No additional parameters need to be passed into methods following authorization. </p>
|
||||
<p>To log in as a <a href="/bots">bot</a>, follow <a href="/api/bots">these instructions »</a>.</p>
|
||||
<h3><a class="anchor" href="#sending-a-verification-code" id="sending-a-verification-code" name="sending-a-verification-code"><i class="anchor-icon"></i></a>Sending a verification code</h3>
|
||||
<p>Example implementations: <a href="https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java">telegram for android</a>, <a href="https://github.com/tdlib/td/tree/master/td/telegram/SendCodeHelper.cpp">tdlib</a>.</p>
|
||||
<p>To show a nicely formatted and validated phone number field, the <a href="/constructor/help.countriesList">help.countriesList</a> constructor can be obtained using the <a href="/method/help.getCountriesList">help.getCountriesList</a> method.<br>
|
||||
The <a href="/constructor/help.countriesList">help.countriesList</a> config is then used as described <a href="/api/config#country-information-and-login-phone-patterns">here »</a>. </p>
|
||||
<p>Authorization requires that a text message containing an authorization code first be sent to the user’s phone.<br>
|
||||
<p>Authorization requires that a text message containing an authorization code first be sent to the user's phone.<br>
|
||||
This may be done using the <a href="/method/auth.sendCode">auth.sendCode</a> method.
|
||||
The system will automatically choose how to send the authorization code; there are four possible ways the code can arrive:</p>
|
||||
<ul>
|
||||
|
@ -110,7 +110,7 @@ In this case, instructions for <a href="/api/srp">SRP 2FA authentication</a> mus
|
|||
<p>To help you with working on production DCs, logins with the same phone number with which the <code>api_id</code> was registered have more generous flood limits.</p>
|
||||
</blockquote>
|
||||
<h3><a class="anchor" href="#we-are-authorized" id="we-are-authorized" name="we-are-authorized"><i class="anchor-icon"></i></a>We are authorized</h3>
|
||||
<p>As a result of authorization, the client key, <strong>auth_key_id</strong>, becomes associated with the user, and each subsequent API call with this key will be executed with that user’s identity. The authorization method itself returns the relevant user. It is best to immediately store the User ID locally in a binding with the key.</p>
|
||||
<p>As a result of authorization, the client key, <strong>auth_key_id</strong>, becomes associated with the user, and each subsequent API call with this key will be executed with that user's identity. The authorization method itself returns the relevant user. It is best to immediately store the User ID locally in a binding with the key.</p>
|
||||
<p>Only a small portion of the API methods are available to <strong>unauthorized</strong> users:</p>
|
||||
<ul>
|
||||
<li><a href="/method/auth.sendCode">auth.sendCode</a></li>
|
||||
|
|
|
@ -54,7 +54,7 @@ Typically, each DC has at least one IPv4 and one IPv6 endpoint available. </p>
|
|||
Having received a <strong>phone_number</strong> from a client, we can find out whether or not it is registered in the system. If it is, then, if necessary, instead of sending a text message, we request that it establish a connection with a different DC first (PHONE_MIGRATE_X error).
|
||||
If we do not yet have a user with this number, we examine its IP-address. We can use it to identify the closest DC. Again, if necessary, we redirect the user to a different DC (NETWORK_MIGRATE_X error).</p>
|
||||
<h4><a class="anchor" href="#testing-redirects" id="testing-redirects" name="testing-redirects"><i class="anchor-icon"></i></a>Testing Redirects</h4>
|
||||
<p>There are reserved phone number prefixes to test the correctness of the application’s handling of redirects between DCs. Read more in <a href="https://core.telegram.org/api/auth#test-phone-numbers">User Authorization</a> article.</p>
|
||||
<p>There are reserved phone number prefixes to test the correctness of the application's handling of redirects between DCs. Read more in <a href="https://core.telegram.org/api/auth#test-phone-numbers">User Authorization</a> article.</p>
|
||||
<h3><a class="anchor" href="#file-access" id="file-access" name="file-access"><i class="anchor-icon"></i></a>File Access</h3>
|
||||
<p>A file saved by a user with <a href="/method/upload.saveFilePart">upload.saveFilePart</a> will be available for direct download only from the DC where the query was executed. That is why each file has a <strong>dc_id</strong> parameter:</p>
|
||||
<pre><code><a href='/constructor/document'>document</a>#1e87342b flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/int'>int</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a><<a href='/type/PhotoSize'>PhotoSize</a>> video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a><<a href='/type/VideoSize'>VideoSize</a>> dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a><<a href='/type/DocumentAttribute'>DocumentAttribute</a>> = <a href='/type/Document'>Document</a>;
|
||||
|
@ -68,7 +68,7 @@ If we do not yet have a user with this number, we examine its IP-address. We can
|
|||
If an attempt is made to download the file over a wrong connection, the FILE_MIGRATE_X error will be returned.</p>
|
||||
<p>Please note that encryption keys are not copied between DCs; therefore, the process of establishing an encrypted connection is started from the very beginning for each new DC. An issued auth_key can be associated with the current authorized user by using an <a href="#authorization-transfer">authorization transfer</a>.</p>
|
||||
<h3><a class="anchor" href="#user-migration" id="user-migration" name="user-migration"><i class="anchor-icon"></i></a>User Migration</h3>
|
||||
<p>During the process of working with the API, user information is accumulated in the DC with which the user is associated. This is the reason a user cannot be associated with a different DC by means of the client. However, in the future, during prolonged communication from an unusual location, we may decide that the user’s data must be moved to a different DC. After some time, the data will be copied and the association will be updated. Once this happens, when executing any query transmitted to the old DC, the API will return the USER_MIGRATE_X error. The client will then have to establish a connection with the new DC and repeat the query.</p>
|
||||
<p>During the process of working with the API, user information is accumulated in the DC with which the user is associated. This is the reason a user cannot be associated with a different DC by means of the client. However, in the future, during prolonged communication from an unusual location, we may decide that the user's data must be moved to a different DC. After some time, the data will be copied and the association will be updated. Once this happens, when executing any query transmitted to the old DC, the API will return the USER_MIGRATE_X error. The client will then have to establish a connection with the new DC and repeat the query.</p>
|
||||
<h3><a class="anchor" href="#authorization-transfer" id="authorization-transfer" name="authorization-transfer"><i class="anchor-icon"></i></a>Authorization Transfer</h3>
|
||||
<p>The following methods can be used to eliminate the need for users to enter the code from a text message every time:</p>
|
||||
<pre><code><a href='/constructor/auth.exportedAuthorization'>auth.exportedAuthorization</a>#b434e2b8 id:<a href='/type/long'>long</a> bytes:<a href='/type/bytes'>bytes</a> = <a href='/type/auth.ExportedAuthorization'>auth.ExportedAuthorization</a>;
|
||||
|
|
|
@ -126,7 +126,7 @@ Data can be autofilled as described in <a href="#2-3-1-autofill">autofill</a>.</
|
|||
<p>If no errors are found in the submitted info, the <a href="/constructor/payments.ValidatedRequestedInfo">response</a> of the method will contain an <code>id</code> flag, to be used later to complete the payment.</p>
|
||||
<p>If the <code>flexible</code> flag of the invoice is set, calling the <a href="/method/payments.validateRequestedInfo">payments.validateRequestedInfo</a> method will send a <a href="/constructor/updateBotShippingQuery">shipping query update</a> to the bot, to which the bot will reply with the available shipping options for the specified address <a href="#2-4-select-delivery-option">as described here »</a>.
|
||||
The return value in this case will also contain a <code>shipping_options</code> field with the available shipping options.</p>
|
||||
<p>If any errors are found in the submmitted data, a <a href="/constructor/updateServiceNotification">service notification</a> will be sent to the user, with a description of the error from the bot.</p>
|
||||
<p>If any errors are found in the submitted data, a <a href="/constructor/updateServiceNotification">service notification</a> will be sent to the user, with a description of the error from the bot.</p>
|
||||
<h4><a class="anchor" href="#231-autofill" id="231-autofill" name="231-autofill"><i class="anchor-icon"></i></a>2.3.1 Autofill</h4>
|
||||
<pre><code><a href='/constructor/payments.savedInfo'>payments.savedInfo</a>#fb8fe43c flags:<a href='/type/%23'>#</a> has_saved_credentials:flags.1?<a href='/constructor/true'>true</a> saved_info:flags.0?<a href='/type/PaymentRequestedInfo'>PaymentRequestedInfo</a> = <a href='/type/payments.SavedInfo'>payments.SavedInfo</a>;
|
||||
|
||||
|
@ -261,7 +261,7 @@ Once the user finishes working with the webpage, the client can <a href="#5-chec
|
|||
<p>The user enters their payment information as described above and presses the final pay button.
|
||||
At this moment the Telegram API sends an <a href="/constructor/updateBotPrecheckoutQuery">updateBotPrecheckoutQuery</a> constructor that contains all the available information about the order to the bot.
|
||||
The bot must reply using <a href="/method/messages.setBotPrecheckoutResults">messages.setBotPrecheckoutResults</a> <strong>within 10 seconds</strong> after receiving this update or the transaction is canceled.</p>
|
||||
<p>The bot may return an error if it can‘t process the order for any reason. We highly recommend specifying a reason for failure to complete the order in human readable form (e.g. "Sorry, we’re all out of rubber ducks! Would you be interested in a steel bear instead?"). Telegram will display this reason to the user.</p>
|
||||
<p>The bot may return an error if it can‘t process the order for any reason. We highly recommend specifying a reason for failure to complete the order in human readable form (e.g. "Sorry, we're all out of rubber ducks! Would you be interested in a steel bear instead?"). Telegram will display this reason to the user.</p>
|
||||
<h3><a class="anchor" href="#5-checkout" id="5-checkout" name="5-checkout"><i class="anchor-icon"></i></a>5. Checkout</h3>
|
||||
<pre><code><a href='/constructor/keyboardButtonBuy'>keyboardButtonBuy</a>#afd93fbb text:<a href='/type/string'>string</a> = <a href='/type/KeyboardButton'>KeyboardButton</a>;
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<p><a href="/bots/payments">Read more about the Payments Platform »</a></p>
|
||||
</blockquote>
|
||||
<h4><a class="anchor" href="#gaming-platform" id="gaming-platform" name="gaming-platform"><i class="anchor-icon"></i></a>Gaming platform</h4>
|
||||
<p>Bots can offer their users <strong>HTML5 games</strong> to play solo or to compete against each other in groups and one-on-one chats. The platform allows your bot to keep track of <strong>high scores</strong> for every game played in every chat. Whenever there’s a new leader in the game, other playing members in the chat are notified that they need to step it up. </p>
|
||||
<p>Bots can offer their users <strong>HTML5 games</strong> to play solo or to compete against each other in groups and one-on-one chats. The platform allows your bot to keep track of <strong>high scores</strong> for every game played in every chat. Whenever there's a new leader in the game, other playing members in the chat are notified that they need to step it up. </p>
|
||||
<div><center>
|
||||
<a href="/file/811140306/1/dkciuEDbpxU.193188/8a0a21b6e9d111be4c" target="_blank"><img src="/file/811140306/1/dkciuEDbpxU.193188/8a0a21b6e9d111be4c" title="Game in a chat" style="width: 250px; padding: 10px 5px"></a>
|
||||
<a href="/file/811140426/1/ZCw3vu_v8s0.109692/04efd9e88644939a4f" target="_blank"><img src="/file/811140426/1/ZCw3vu_v8s0.109692/04efd9e88644939a4f" title="In-game scoreboard and sharing button" style="width: 250px; padding: 10px 5px"></a>
|
||||
|
@ -291,7 +291,7 @@
|
|||
<li><strong>/setdescription</strong> — change the bot's <strong>description</strong>, a short text of up to 512 characters, describing your bot. Users will see this text at the beginning of the conversation with the bot, titled 'What can this bot do?'.</li>
|
||||
<li><strong>/setabouttext</strong> — change the bot's <strong>about info</strong>, an even shorter text of up to 120 characters. Users will see this text on the bot's profile page. When they share your bot with someone, this text is sent together with the link.</li>
|
||||
<li><strong>/setuserpic</strong> — change the bot's profile pictures. It's always nice to put a face to a name.</li>
|
||||
<li><strong>/setcommands</strong> — change the list of commands supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. Each command has a name (must start with a slash ‘/’, alphanumeric plus underscores, no more than 32 characters, case-insensitive), parameters, and a text description. Users will see the list of commands whenever they type '/' in a conversation with your bot.</li>
|
||||
<li><strong>/setcommands</strong> — change the list of commands supported by your bot. Users will see these commands as suggestions when they type <code>/</code> in the chat with your bot. Each command has a name (must start with a slash ‘/', alphanumeric plus underscores, no more than 32 characters, case-insensitive), parameters, and a text description. Users will see the list of commands whenever they type '/' in a conversation with your bot.</li>
|
||||
<li><strong>/deletebot</strong> — delete your bot and free its username.</li>
|
||||
</ul>
|
||||
<p><strong>Edit settings</strong></p>
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
</a></div>
|
||||
<p>Beyond sending commands in private messages or groups, users can interact with your bot via <a href="/bots/api#inline-mode"><strong>inline queries</strong></a>. If inline queries are enabled, users can call your bot by typing its username and a query in the <strong>text input field</strong> in <strong>any</strong> chat. The query is sent to your bot in an update. This way, people can request content from your bot in <strong>any</strong> of their chats, groups, or channels without sending any messages at all.</p>
|
||||
<div><center>
|
||||
<a href="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" target="_blank"><img src="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" title="Users can type the bot’s username in any chat, then type a query without sending any messages" style="width:300px; padding:10px 0px 10px"></a></center>
|
||||
<a href="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" target="_blank"><img src="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" title="Users can type the bot's username in any chat, then type a query without sending any messages" style="width:300px; padding:10px 0px 10px"></a></center>
|
||||
<br></div>
|
||||
<p>To enable this option, send the <code>/setinline</code> command to <a href="https://telegram.me/botfather">@BotFather</a> and provide the placeholder text that the user will see in the input field after typing your bot’s name.</p>
|
||||
<p>To enable this option, send the <code>/setinline</code> command to <a href="https://telegram.me/botfather">@BotFather</a> and provide the placeholder text that the user will see in the input field after typing your bot's name.</p>
|
||||
<blockquote>
|
||||
<p>See the <a href="/bots/api#inline-mode">Bot API Manual</a> for the relevant methods and objects.</p>
|
||||
</blockquote>
|
||||
|
@ -90,7 +90,7 @@
|
|||
<p>To know which of the provided results your users are sending to their chat partners, send <a href="https://telegram.me/botfather">@Botfather</a> the <code>/setinlinefeedback</code> command. With this enabled, you will receive updates on the results chosen by your users.</p>
|
||||
<p>Please note that this can create load issues for popular bots – you may receive more results than actual requests due to caching (see the <em>cache_time</em> parameter in <a href="/bots/api#answerinlinequery">answerInlineQuery</a>). For these cases, we recommend adjusting the probability setting to receive 1/10, 1/100 or 1/1000 of the results.</p>
|
||||
<h3><a class="anchor" href="#inline-bot-samples" id="inline-bot-samples" name="inline-bot-samples"><i class="anchor-icon"></i></a>Inline bot samples</h3>
|
||||
<p>Here are some sample inline bots, in case you’re curious to see one in action. Try any of these:
|
||||
<p>Here are some sample inline bots, in case you're curious to see one in action. Try any of these:
|
||||
<a href="https://telegram.me/gif">@gif</a> – GIF search
|
||||
<a href="https://telegram.me/vid">@vid</a> – Video search
|
||||
<a href="https://telegram.me/pic">@pic</a> – Yandex image search
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<meta charset="utf-8">
|
||||
<title>upload.cdnFileReuploadNeeded</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="description" content="The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded.">
|
||||
<meta property="description" content="The file was cleared from the temporary RAM cache of the CDN and has to be re-uploaded.">
|
||||
<meta property="og:title" content="upload.cdnFileReuploadNeeded">
|
||||
<meta property="og:image" content="">
|
||||
<meta property="og:description" content="The file was cleared from the temporary RAM cache of the CDN and has to be reuploaded.">
|
||||
<meta property="og:description" content="The file was cleared from the temporary RAM cache of the CDN and has to be re-uploaded.">
|
||||
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||
|
||||
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||
|
@ -39,7 +39,7 @@
|
|||
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/upload.cdnFileReuploadNeeded" >upload.cdnFileReuploadNeeded</a></li></ul></div>
|
||||
<h1 id="dev_page_title">upload.cdnFileReuploadNeeded</h1>
|
||||
|
||||
<div id="dev_page_content"><p>The file was cleared from the temporary RAM cache of the <a href="/cdn">CDN</a> and has to be reuploaded.</p>
|
||||
<div id="dev_page_content"><p>The file was cleared from the temporary RAM cache of the <a href="/cdn">CDN</a> and has to be re-uploaded.</p>
|
||||
<p><div class="clearfix">
|
||||
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
|
||||
<li class="dropdown">
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<tr>
|
||||
<td><strong>next_offset</strong></td>
|
||||
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/type/string">string</a></td>
|
||||
<td>Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.</td>
|
||||
<td>Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can't exceed 64 bytes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>switch_pm</strong></td>
|
||||
|
|
|
@ -186,11 +186,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/invokeAfterMsg">invokeAfterMsg</a></td>
|
||||
<td>Invokes a query after successfull completion of one of the previous queries.</td>
|
||||
<td>Invokes a query after successful completion of one of the previous queries.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/invokeAfterMsgs">invokeAfterMsgs</a></td>
|
||||
<td>Invokes a query after a successfull completion of previous queries</td>
|
||||
<td>Invokes a query after a successful completion of previous queries</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/invokeWithLayer">invokeWithLayer</a></td>
|
||||
|
@ -834,7 +834,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/upload.saveFilePart">upload.saveFilePart</a></td>
|
||||
<td>Saves a part of file for futher sending to one of the methods.</td>
|
||||
<td>Saves a part of file for further sending to one of the methods.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/messages.uploadEncryptedFile">messages.uploadEncryptedFile</a></td>
|
||||
|
|
|
@ -42,7 +42,7 @@ In certain cases, types may depend not only on other types (polymorphism), but a
|
|||
<h1 id="dev_page_title">TL-dependent</h1>
|
||||
|
||||
<div id="dev_page_content"><p>Main article: <a href="/mtproto/TL">TL Language</a>.</p>
|
||||
<p>In certain cases, types may depend not only on other types (polymorphism), but also on the parameters of another type (dependent types). The TL language provides very limited support for this functionality: dependence is only allowed on a natural parameter whose type is designated using <code>#</code> (alias <code>nat</code>, but this is private -- TL doesn’t currently support this synonym). Values of type # are serialized as 32-bit signed numbers from 0 to 2^31-1.</p>
|
||||
<p>In certain cases, types may depend not only on other types (polymorphism), but also on the parameters of another type (dependent types). The TL language provides very limited support for this functionality: dependence is only allowed on a natural parameter whose type is designated using <code>#</code> (alias <code>nat</code>, but this is private -- TL doesn't currently support this synonym). Values of type # are serialized as 32-bit signed numbers from 0 to 2^31-1.</p>
|
||||
<h2><a class="anchor" href="#example-integer-tuples-vectors" id="example-integer-tuples-vectors" name="example-integer-tuples-vectors"><i class="anchor-icon"></i></a>Example: integer tuples (vectors)</h2>
|
||||
<p>Suppose we want to use induction to define the types “one integer”, “two integers”, and “three integers”. We could try to define them as follows:</p>
|
||||
<pre><code>empty = Empty;
|
||||
|
@ -133,7 +133,7 @@ Vector : Type -> Type;</code></pre>
|
|||
<p>Moreover, we can define arbitrarily-sized matrices:</p>
|
||||
<pre><code>matrix {X:Type} m:# n:# a:(%Tuple (%Tuple X m) n) = Matrix X;</code></pre>
|
||||
<p>In this case using vector would result in storing the length of a row (<em>m</em>) in each row, e.g. <em>n</em> times.</p>
|
||||
<p>Note that the serializations of values of type <code>%Tuple X n</code> and <code>vector X</code> (also known as <code>%vector X</code> and <code>%Vector X</code>) nearly match when <em>n > 0</em>: in both cases we obtain a single 32-bit number (equal to <em>n-1</em> or <em>n</em> depending on the version) followed by the serializations of <em>n</em> objects of type <em>X</em>. (This is slightly untrue: values of type <code>%Tuple X n</code> can only be serialized if <em>n</em> is a constant or value known from one of the preceding fields of the enclosing entry; but then this <em>n</em> won’t be serialized explicitly anywhere).</p>
|
||||
<p>Note that the serializations of values of type <code>%Tuple X n</code> and <code>vector X</code> (also known as <code>%vector X</code> and <code>%Vector X</code>) nearly match when <em>n > 0</em>: in both cases we obtain a single 32-bit number (equal to <em>n-1</em> or <em>n</em> depending on the version) followed by the serializations of <em>n</em> objects of type <em>X</em>. (This is slightly untrue: values of type <code>%Tuple X n</code> can only be serialized if <em>n</em> is a constant or value known from one of the preceding fields of the enclosing entry; but then this <em>n</em> won't be serialized explicitly anywhere).</p>
|
||||
<h2><a class="anchor" href="#special-syntax-for-repetitions" id="special-syntax-for-repetitions" name="special-syntax-for-repetitions"><i class="anchor-icon"></i></a>Special syntax for repetitions</h2>
|
||||
<p>In view of the importance of the construction presented above, it is built into the TL language in the following manner. A substructure in the form of [ <em>array-field-name</em> ":" ] [ <em>nat-ident</em> "<em>" ] "[" </em>field-descr<em> ... "]” may be used in the declaration of any combinator, where </em>nat-ident* is the name of any previously encountered field of type # (if it is not explicitly indicated, the most recent is used). In abstract, this substructure is equivalent to:</p>
|
||||
<pre><code>aux_type *field-descr* ... = AuxType;
|
||||
|
@ -159,7 +159,7 @@ vector {X:Type} # [ X ] = Vector X;</code></pre>
|
|||
</li>
|
||||
</ul>
|
||||
<p>For example, in <code>cons {X:Type} hd:X tl:(list X) = list X</code> the parameter <code>X</code> may be made optional, because it is located at the very beginning of the argument list and is unambiguously determined by the <code>list X</code> result type. Similarly, in <code>tcons {X:Type} {n:#} hd:X tl:(%Tuple X n) = Tuple X (S n)</code> the values of X and n are completely determined based on the <code>Tuple X (S n)</code> result type, therefore they made be made optional parameters.</p>
|
||||
<p>It usually makes sense to move all of a constructor’s arguments satisfying the second condition to the beginning of the list, arrange them in the order they appear in the result type’s parameters, and make them optional. Given such an approach, the full version of a constructor is rarely needed -- only when we want to transmit the value of the polymorphic or dependent type as a value of type Object. In all other cases, the type of the expected value from the context is already known, which means that all optional parameters can be recovered during decomposition.</p>
|
||||
<p>It usually makes sense to move all of a constructor's arguments satisfying the second condition to the beginning of the list, arrange them in the order they appear in the result type's parameters, and make them optional. Given such an approach, the full version of a constructor is rarely needed -- only when we want to transmit the value of the polymorphic or dependent type as a value of type Object. In all other cases, the type of the expected value from the context is already known, which means that all optional parameters can be recovered during decomposition.</p>
|
||||
<p>See also <a href="/mtproto/TL-optargs">Optional combinator parameters and their values</a>.</p></div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -230,7 +230,7 @@ user_present {flags:#} info:%(User flags) = UserInfo flags;<br>
|
|||
user_absent {flags:#} = UserInfo flags;<br>
|
||||
getUser flags:# id:int = !UserInfo flags; </p>
|
||||
</div>
|
||||
<p>In the future, bits 3 and 4 in the <code>flags</code> field may be used to transmit new fields after changing the names and types of the <code>reserved3</code> and <code>reserved4</code> fields. This will change the <code>user</code> constructor’s number, but this isn’t too important, since the <code>User flags</code> type is only used as a bare type. Transmitting bits 3 or 4 in the <code>flags</code> field in a <code>getUser</code> query before these fields have actually been defined will lead to an error in the (de)serialization of the request.</p>
|
||||
<p>In the future, bits 3 and 4 in the <code>flags</code> field may be used to transmit new fields after changing the names and types of the <code>reserved3</code> and <code>reserved4</code> fields. This will change the <code>user</code> constructor's number, but this isn't too important, since the <code>User flags</code> type is only used as a bare type. Transmitting bits 3 or 4 in the <code>flags</code> field in a <code>getUser</code> query before these fields have actually been defined will lead to an error in the (de)serialization of the request.</p>
|
||||
<ul>
|
||||
<li>The type <code>True</code> with a single null constructor <code>true</code> plays a role similar to the void type in C/C++. It is especially useful as a bare type <code>%True</code>, alias <code>true</code>, because its serialization has zero length. For example, the <code>first_name:flags.1?string</code> constructor used above is in fact shorthand for (the as-yet unsupported) alternative-type general constructor <code>first_name:(flags.1?string:true)</code>.</li>
|
||||
</ul>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<p>A (sub)expression may be serialized/deserialized in one of two ways:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The result type is known (for example, we’re parsing the response to a previously sent RPC query and therefore know the value of some type is expected). In this case, the result type may be used to determine the values of the combinator's implicit parameters.</p>
|
||||
<p>The result type is known (for example, we're parsing the response to a previously sent RPC query and therefore know the value of some type is expected). In this case, the result type may be used to determine the values of the combinator's implicit parameters.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The result type is not known. It is determined as a result of (de)serialization (for example, we are serializing an RPC query). In this case, it is necessary to explicitly specify (and serialize) all of the combinator's optional parameters by using the full version of the combinator.</p>
|
||||
|
|
|
@ -266,7 +266,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/upload.saveFilePart">upload.saveFilePart</a></td>
|
||||
<td>Saves a part of file for futher sending to one of the methods.</td>
|
||||
<td>Saves a part of file for further sending to one of the methods.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/method/messages.discardEncryption">messages.discardEncryption</a></td>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td><a href="/constructor/upload.cdnFileReuploadNeeded">upload.cdnFileReuploadNeeded</a></td>
|
||||
<td>The file was cleared from the temporary RAM cache of the <a href="/cdn">CDN</a> and has to be reuploaded.</td>
|
||||
<td>The file was cleared from the temporary RAM cache of the <a href="/cdn">CDN</a> and has to be re-uploaded.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="/constructor/upload.cdnFile">upload.cdnFile</a></td>
|
||||
|
|
Loading…
Reference in a new issue