From 0027f399a52842c1767f1eca367a95bf1041804e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 3 Jun 2017 16:46:49 +0200 Subject: [PATCH] Update docs --- docs/API_docs/constructors/index.md | 6 +- docs/API_docs/types/DocumentAttribute.md | 6 ++ docs/index.md | 93 +++++++++++++++++++++++- 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/docs/API_docs/constructors/index.md b/docs/API_docs/constructors/index.md index 470ea2bd..ebc9c9cd 100644 --- a/docs/API_docs/constructors/index.md +++ b/docs/API_docs/constructors/index.md @@ -367,7 +367,7 @@ description: List of constructors

[$documentAttributeAnimated\_23](../constructors/documentAttributeAnimated_23.md) = \[\]; *** -

[$documentAttributeAudio\_23](../constructors/documentAttributeAudio_23.md) = \['duration' => [int](../types/int.md), \]; +

[$documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md) = \['duration' => [int](../types/int.md), 'title' => [string](../types/string.md), 'performer' => [string](../types/string.md), \]; ***

[$documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md) = \['file_name' => [string](../types/string.md), \]; @@ -379,10 +379,10 @@ description: List of constructors

[$documentAttributeImageSize\_23](../constructors/documentAttributeImageSize_23.md) = \['w' => [int](../types/int.md), 'h' => [int](../types/int.md), \]; *** -

[$documentAttributeSticker\_23](../constructors/documentAttributeSticker_23.md) = \[\]; +

[$documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md) = \['alt' => [string](../types/string.md), 'stickerset' => [InputStickerSet](../types/InputStickerSet.md), \]; *** -

[$documentAttributeVideo\_23](../constructors/documentAttributeVideo_23.md) = \['duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \]; +

[$documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md) = \['round_message' => [Bool](../types/Bool.md), 'duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \]; ***

[$documentEmpty](../constructors/documentEmpty.md) = \['id' => [long](../types/long.md), \]; diff --git a/docs/API_docs/types/DocumentAttribute.md b/docs/API_docs/types/DocumentAttribute.md index cddf948e..98e1741b 100644 --- a/docs/API_docs/types/DocumentAttribute.md +++ b/docs/API_docs/types/DocumentAttribute.md @@ -35,6 +35,12 @@ description: constructors and methods of type DocumentAttribute [documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md) +[documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md) + +[documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md) + +[documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md) + ### Methods that return an object of this type (methods): diff --git a/docs/index.md b/docs/index.md index 920934d7..51aa07de 100644 --- a/docs/index.md +++ b/docs/index.md @@ -121,7 +121,7 @@ $MadelineProto = new \danog\MadelineProto\API(); ### Settings The constructor accepts an optional parameter, which is the settings array. This array contains some other arrays, which are the settings for a specific MadelineProto function. -See [here](https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProto.php#L232) for the default values for the settings arrays and explanations for every setting. +See [here](https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProto.php#L405) for the default values for the settings arrays and explanations for every setting. You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values. Example: @@ -274,6 +274,97 @@ array(3) { To specify a custom callback change the correct value in the settings. The specified callable must accept one parameter for the update. +### Using a proxy + +You can use a proxy with MadelineProto. + +To do that, simply create a class that implements the `\danog\MadelineProto\Proxy` interface, and enter its name in the settings. + +Your proxy class MUST use the `\Socket` class for all TCP/UDP communications. + +Your proxy class can also have a setExtra method that accepts an array as the first parameter, to pass the values provided in the proxy_extra setting. + +The `\Socket` class has the following methods (all of the following methods must also be implemented by your proxy class): + + +```public function __construct(int $domain, int $type, int $protocol);``` + +Works exactly like the [socket_connect](http://php.net/manual/en/function.socket-connect.php) function. + + + +```public function setOption(int $level, int $name, $value);``` + +Works exactly like the [socket_set_option](http://php.net/manual/en/function.socket-set-option.php) function. + + + +```public function getOption(int $name, $value);``` + +Works exactly like the [socket_get_option](http://php.net/manual/en/function.socket-get-option.php) function. + + + +```public function setBlocking(bool $blocking);``` + +Works like the [socket_block](http://php.net/manual/en/function.socket-set-block.php) or [socket_nonblock](http://php.net/manual/en/function.socket-set-nonblock.php) functions. + + + +```public function bind(string $address, [ int $port = 0 ]);``` + +Works exactly like the [socket_bind](http://php.net/manual/en/function.socket-bind.php) function. + + + +```public function listen([ int $backlog = 0 ]);``` + +Works exactly like the [socket_listen](http://php.net/manual/en/function.socket-listen.php) function. + + + +```public function accept();``` + +Works exactly like the [socket_accept](http://php.net/manual/en/function.socket-accept.php) function. + + + +```public function connect(string $address, [ int $port = 0 ]);``` + +Works exactly like the [socket_accept](http://php.net/manual/en/function.socket-connect.php) function. + + + +```public function select(array &$read, array &$write, array &$except, int $tv_sec, int $tv_usec = 0);``` + +Works exactly like the [socket_select](http://php.net/manual/en/function.socket-select.php) function. + + + +```public function read(int $length, [ int $flags = 0 ]);``` + +Works exactly like the [socket_read](http://php.net/manual/en/function.socket-read.php) function. + + + +```public function write(string $buffer, [ int $length ]);``` + +Works exactly like the [socket_read](http://php.net/manual/en/function.socket-write.php) function. + + + +```public function send(string $data, int $length, int $flags);``` + +Works exactly like the [socket_send](http://php.net/manual/en/function.socket-send.php) function. + + + +```public function close();``` + +Works exactly like the [socket_close](http://php.net/manual/en/function.socket-close.php) function. + + + ### Uploading and downloading files MadelineProto provides wrapper methods to upload and download files that support bot API file ids.