telegram-crawler/data/corefork.telegram.org/api/requests.html
2021-09-10 16:27:56 +00:00

133 lines
8.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Requests </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Let&#39;s consider several typical interaction scenarios for two users.
One user knows the other&#39;s number
User A knows phone…">
<meta property="og:title" content="Requests ">
<meta property="og:image" content="">
<meta property="og:description" content="Let&#39;s consider several typical interaction scenarios for two users.
One user knows the other&#39;s number
User A knows phone…">
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?212" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<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="/api/requests" >Requests </a></li></ul></div>
<h1 id="dev_page_title">Requests </h1>
<div id="dev_page_content"><p>Let's consider several typical interaction scenarios for two users.</p>
<h4><a class="anchor" href="#one-user-knows-the-others-number" id="one-user-knows-the-others-number" name="one-user-knows-the-others-number"><i class="anchor-icon"></i></a>One user knows the other's number</h4>
<p>User A knows phone number of B (for instance, A has B's number in the phone book). But B does not know А's number. User A sends message to B. Immediately prior to sending a message relevant check is executed at the server side and the link between A and B will change automatically: A's number becomes available for B (user A is then presented as constructor <a href="/constructor/userRequest">userRequest</a>).
The same happens if user B not having A's number sends a message to the latter. A's number also becomes available to B.</p>
<h4><a class="anchor" href="#users-do-not-know-numbers-of-each-other" id="users-do-not-know-numbers-of-each-other" name="users-do-not-know-numbers-of-each-other"><i class="anchor-icon"></i></a>Users do not know numbers of each other</h4>
<p>User A has found user B in a chat, geochat or any other way. For both of them phone numbers are not available (in API - constructor <a href="/constructor/userForeign">userForeign</a>). A starts chat with B. When messaging A's number will not become available for B and vice versa. To provide B with A's number it is necessary to send him personal message with contact info (phone number should be transferred in constructor <a href="/constructor/inputMediaContact">inputMediaContact</a> using method <a href="/method/messages.sendMedia">messages.sendMedia</a>).
Now B having personal message with A's phone number can store it in his phone book and import it using method <a href="/method/contacts.importContacts">contacts.importContacts</a> to have it in contacts. With all that, it is not mandatory for him to send his number: after any message later between them B's number will be available for A (see <a href="#nomer-odnogo-iz-sobesednikov-izvesten-drugomu">One user knows the other's number</a>).</p>
<h4><a class="anchor" href="#both-user-know-each-other-number" id="both-user-know-each-other-number" name="both-user-know-each-other-number"><i class="anchor-icon"></i></a>Both user know each other number</h4>
<p>This is quite obvious: messaging does not change links since target state has been reached.</p>
<h3><a class="anchor" href="#technical-features" id="technical-features" name="technical-features"><i class="anchor-icon"></i></a>Technical features</h3>
<p>Since when sending messages to a current user updates on changed links are not sent constructors containing updated links were added to resulting types of messaging methods:</p>
<pre><code><a href='/constructor/messages.statedMessagesLinks'>messages.statedMessagesLinks</a> messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Message'>Message</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; links:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/contacts.Link'>contacts.Link</a>&gt; pts:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/messages.StatedMessages'>messages.StatedMessages</a>;
<a href='/constructor/messages.statedMessageLink'>messages.statedMessageLink</a> message:<a href='/type/Message'>Message</a> chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; links:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/contacts.Link'>contacts.Link</a>&gt; pts:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> = <a href='/type/messages.StatedMessage'>messages.StatedMessage</a>;
<a href='/constructor/messages.sentMessageLink'>messages.sentMessageLink</a> id:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> pts:<a href='/type/int'>int</a> seq:<a href='/type/int'>int</a> links:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/contacts.Link'>contacts.Link</a>&gt; = <a href='/type/messages.SentMessage'>messages.SentMessage</a>;</code></pre>
<p>To indicate for clients that these constructors are supported one should use <a href="/api/layers#3y-sloy">3rd layer</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="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/jobs">Jobs</a></li>
</ul>
</div>
<div class="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="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="footer_column footer_column_platform">
<h5><a href="//core.telegram.org/">Platform</a></h5>
<ul>
<li><a href="//core.telegram.org/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="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="//core.telegram.org/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?42"></script>
<script>backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>