1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Method; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Method\Interfaces\HasUpdateTypeVariableInterface; |
8
|
|
|
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class GetUpdatesMethod. |
12
|
|
|
* |
13
|
|
|
* @see https://core.telegram.org/bots/api#getupdates |
14
|
|
|
*/ |
15
|
|
|
class GetUpdatesMethod implements HasUpdateTypeVariableInterface |
16
|
|
|
{ |
17
|
|
|
use FillFromArrayTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Optional. Identifier of the first update to be returned. |
21
|
|
|
* Must be greater by one than the highest among the identifiers of previously received updates. |
22
|
|
|
* By default, updates starting with the earliest unconfirmed update are returned. |
23
|
|
|
* An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. |
24
|
|
|
* The negative offset can be specified to retrieve updates starting from -offset update |
25
|
|
|
* from the end of the updates queue. All previous updates will forgotten. |
26
|
|
|
* |
27
|
|
|
* @var int|null |
28
|
|
|
*/ |
29
|
|
|
public $offset; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
33
|
|
|
* |
34
|
|
|
* @var int|null |
35
|
|
|
*/ |
36
|
|
|
public $limit; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. |
40
|
|
|
* Should be positive, short polling should be used for testing purposes only. |
41
|
|
|
* |
42
|
|
|
* @var int|null |
43
|
|
|
*/ |
44
|
|
|
public $timeout; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Optional. List the types of updates you want your bot to receive. |
48
|
|
|
* For example, specify [“message”, “edited_channel_post”, “callback_query”] |
49
|
|
|
* to only receive updates of these types. |
50
|
|
|
* See Update for a complete list of available update types. |
51
|
|
|
* Specify an empty list to receive all updates regardless of type (default). |
52
|
|
|
* If not specified, the previous setting will be used. |
53
|
|
|
* |
54
|
|
|
* Please note that this parameter doesn't affect updates created before the call to the getUpdates, |
55
|
|
|
* so unwanted updates may be received for a short period of time. |
56
|
|
|
* |
57
|
|
|
* @var string[]|null |
58
|
|
|
*/ |
59
|
|
|
public $allowed_updates; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param array|null $data |
63
|
|
|
* |
64
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
65
|
|
|
* |
66
|
|
|
* @return GetUpdatesMethod |
67
|
|
|
*/ |
68
|
|
|
public static function create(array $data = null): GetUpdatesMethod |
69
|
|
|
{ |
70
|
|
|
$instance = new static(); |
71
|
|
|
if ($data) { |
72
|
|
|
$instance->fill($data); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
return $instance; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|