This commit is contained in:
Daniil Gentili 2020-02-26 15:46:13 +01:00
parent 8792a4fe6a
commit a17ccba895
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
7 changed files with 26 additions and 18 deletions

View File

@ -12,7 +12,7 @@ redirect_from: /bot_login.html
|----------|---------------| |----------|---------------|
|token| A string with the bot token| |token| A string with the bot token|
### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) ### Return type: [auth.Authorization](API_docs/types/auth.Authorization.md)
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)): ### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):

View File

@ -2,6 +2,8 @@
title: complete2falogin title: complete2falogin
description: complete2falogin parameters, return type and example description: complete2falogin parameters, return type and example
redirect_from: /complete_2fa_login.html redirect_from: /complete_2fa_login.html
redirect_from: /complete2falogin.html
redirect_from: /complete2FAlogin.html
--- ---
## Method: complete2falogin ## Method: complete2falogin
@ -12,7 +14,7 @@ redirect_from: /complete_2fa_login.html
|----------|---------------| |----------|---------------|
|password| A string with the password| |password| A string with the password|
### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) ### Return type: [auth.Authorization](API_docs/types/auth.Authorization.md)
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)): ### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):

View File

@ -12,7 +12,7 @@ redirect_from: /complete_phone_login.html
|----------|---------------| |----------|---------------|
|code| A string with the phone code| |code| A string with the phone code|
### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) or [account.Password](http://docs.madelineproto.xyz/API_docs/types/account_Password.html) or `['_' => 'account.needSignup']` ### Return type: [auth.Authorization](API_docs/types/auth.Authorization.md) or [account.Password](http://docs.madelineproto.xyz/API_docs/types/account_Password.html) or `['_' => 'account.needSignup']`
You must then use [complete2falogin](complete2FALogin.md) or [completeSignup](completeSignup.md) to login or signup, or simply start using `$MadelineProto` if the result is a `auth.Authorization` object. You must then use [complete2falogin](complete2FALogin.md) or [completeSignup](completeSignup.md) to login or signup, or simply start using `$MadelineProto` if the result is a `auth.Authorization` object.

View File

@ -13,7 +13,7 @@ redirect_from: /complete_signup.html
|first_name| A string with the first name| |first_name| A string with the first name|
|last_name| Optional, string with the last name| |last_name| Optional, string with the last name|
### Return type: [auth.Authorization](API_docs/types/auth_Authorization.md) ### Return type: [auth.Authorization](API_docs/types/auth.Authorization.md)
### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)): ### Example ([now fully async!](https://docs.madelineproto.xyz/docs/ASYNC.html)):

View File

@ -373,27 +373,33 @@ The callable should return the number of written bytes.
`$MessageMedia`can be either a [Message](https://docs.madelineproto.xyz/API_docs/types/Message.html), an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), a [MessageMedia](https://docs.madelineproto.xyz/API_docs/types/MessageMedia.html) object, or a bot API file ID. `$MessageMedia`can be either a [Message](https://docs.madelineproto.xyz/API_docs/types/Message.html), an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), a [MessageMedia](https://docs.madelineproto.xyz/API_docs/types/MessageMedia.html) object, or a bot API file ID.
### Download to browser with streams ### Download to http-server
```php ```php
$info = yield $MadelineProto->getDownloadInfo($MessageMedia); yield $MadelineProto->downloadToResponse($MessageMedia, $request, $cb);
header('Content-Length: '.$info['size']);
header('Content-Type: '.$info['mime']);
$stream = fopen('php://output', 'w');
yield $MadelineProto->downloadToStream($MessageMedia, $stream, $cb, $offset, $endoffset);
``` ```
This downloads the given file to the browser, sending also information about the file's type and size. This downloads the given file, replying to the specified [async http-server](https://amphp.org/http-server) request.
Automatically supports HEAD requests and content-ranges for parallel and resumed downloads.
`$MessageMedia` can be either a [Message](https://docs.madelineproto.xyz/API_docs/types/Message.html), an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), a [MessageMedia](https://docs.madelineproto.xyz/API_docs/types/MessageMedia.html) object, or a bot API file ID. `$MessageMedia` can be either a [Message](https://docs.madelineproto.xyz/API_docs/types/Message.html), an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), a [MessageMedia](https://docs.madelineproto.xyz/API_docs/types/MessageMedia.html) object, or a bot API file ID.
`$stream` must be a writeable stream `$request` is the [Request](https://amphp.org/http-server/classes/request) object returned by [http-server](https://amphp.org/http-server).
`$cb` is an optional parameter can be a callback for download progress, but it shouldn't be used, the new [FileCallback](#getting-progress) should be used instead `$cb` is an optional parameter can be a callback for download progress, but it shouldn't be used, the new [FileCallback](#getting-progress) should be used instead
`$offset` is an optional parameter that specifies the byte from which to start downloading
`$endoffset` is an optional parameter that specifies the byte where to stop downloading (non-inclusive)
### Download to browser
```php
yield $MadelineProto->downloadToBrowser($MessageMedia, $cb);
```
This downloads the given file to the browser, sending also information about the file's type and size.
Automatically supports HEAD requests and content-ranges for parallel and resumed downloads.
`$MessageMedia` can be either a [Message](https://docs.madelineproto.xyz/API_docs/types/Message.html), an [Update](https://docs.madelineproto.xyz/API_docs/types/Update.html), a [MessageMedia](https://docs.madelineproto.xyz/API_docs/types/MessageMedia.html) object, or a bot API file ID.
`$cb` is an optional parameter can be a callback for download progress, but it shouldn't be used, the new [FileCallback](#getting-progress) should be used instead
## Getting progress ## Getting progress

View File

@ -358,7 +358,7 @@ Description: maximum number of allowed MTProto messages in the outgoing message
### `$settings['msg_array_limit']['call_queue']` ### `$settings['msg_array_limit']['call_queue']`
Default: 200 Default: 200
Description: maximum number of allowed MTProto messages in any [call queue](USING_METHOD.html#call-queues) Description: maximum number of allowed MTProto messages in any [call queue](USING_METHODS.html#call-queues)
<hr> <hr>
@ -439,4 +439,4 @@ The settings array can be accessed and modified in the instantiated class by acc
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching $MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
``` ```
<a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a> <a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a>

View File

@ -12,7 +12,7 @@ redirect_from: /phone_login.html
|----------|---------------| |----------|---------------|
|number| A string with the phone number, including the country code| |number| A string with the phone number, including the country code|
### Return type: [auth.SentCode](API_docs/types/auth_SentCode.md) ### Return type: [auth.SentCode](API_docs/types/auth.SentCode.md)
You must then use [completePhoneLogin](completePhoneLogin.md) You must then use [completePhoneLogin](completePhoneLogin.md)