1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\TypeInterface; |
7
|
|
|
use TelegramBot\Api\Types\Inline\ChosenInlineResult; |
8
|
|
|
use TelegramBot\Api\Types\Inline\InlineQuery; |
9
|
|
|
use TelegramBot\Api\Types\Payments\Query\PreCheckoutQuery; |
10
|
|
|
use TelegramBot\Api\Types\Payments\Query\ShippingQuery; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class Update |
14
|
|
|
* This object represents an incoming update. |
15
|
|
|
* Only one of the optional parameters can be present in any given update. |
16
|
|
|
* |
17
|
|
|
* @package TelegramBot\Api\Types |
18
|
|
|
*/ |
19
|
|
|
class Update extends BaseType implements TypeInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* {@inheritdoc} |
23
|
|
|
* |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
static protected $requiredParams = ['update_id']; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
* |
31
|
|
|
* @var array |
32
|
|
|
*/ |
33
|
|
|
static protected $map = [ |
34
|
|
|
'update_id' => true, |
35
|
|
|
'message' => Message::class, |
36
|
|
|
'channel_post' => Message::class, |
37
|
|
|
'inline_query' => InlineQuery::class, |
38
|
|
|
'chosen_inline_result' => ChosenInlineResult::class, |
39
|
|
|
'callback_query' => CallbackQuery::class, |
40
|
|
|
'shipping_query' => ShippingQuery::class, |
41
|
|
|
'pre_checkout_query' => PreCheckoutQuery::class, |
42
|
|
|
]; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* The update‘s unique identifier. |
46
|
|
|
* Update identifiers start from a certain positive number and increase sequentially. |
47
|
|
|
* This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or |
48
|
|
|
* to restore the correct update sequence, should they get out of order. |
49
|
|
|
* |
50
|
|
|
* @var integer |
51
|
|
|
*/ |
52
|
|
|
protected $updateId; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Optional. New incoming message of any kind — text, photo, sticker, etc. |
56
|
|
|
* |
57
|
|
|
* @var Message |
58
|
|
|
*/ |
59
|
|
|
protected $message; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Optional. New channel post of any kind — text, photo, sticker, etc. |
63
|
|
|
* |
64
|
|
|
* @var Message |
65
|
|
|
*/ |
66
|
|
|
protected $channelPost; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Optional. New incoming inline query |
70
|
|
|
* |
71
|
|
|
* @var \TelegramBot\Api\Types\Inline\InlineQuery |
72
|
|
|
*/ |
73
|
|
|
protected $inlineQuery; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Optional. The result of a inline query that was chosen by a user and sent to their chat partner |
77
|
|
|
* |
78
|
|
|
* @var \TelegramBot\Api\Types\Inline\ChosenInlineResult |
79
|
|
|
*/ |
80
|
|
|
protected $chosenInlineResult; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Optional. New incoming callback query |
84
|
|
|
* |
85
|
|
|
* @var \TelegramBot\Api\Types\CallbackQuery |
86
|
|
|
*/ |
87
|
|
|
protected $callbackQuery; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Optional. New incoming shipping query. Only for invoices with flexible price |
91
|
|
|
* |
92
|
|
|
* @var ShippingQuery |
93
|
|
|
*/ |
94
|
|
|
protected $shippingQuery; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Optional. New incoming pre-checkout query. Contains full information about checkout |
98
|
|
|
* |
99
|
|
|
* @var PreCheckoutQuery |
100
|
|
|
*/ |
101
|
|
|
protected $preCheckoutQuery; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return int |
105
|
|
|
*/ |
106
|
|
|
public function getUpdateId() |
107
|
|
|
{ |
108
|
|
|
return $this->updateId; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param int $updateId |
113
|
|
|
*/ |
114
|
3 |
|
public function setUpdateId($updateId) |
115
|
|
|
{ |
116
|
3 |
|
$this->updateId = $updateId; |
117
|
3 |
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return Message |
121
|
|
|
*/ |
122
|
9 |
|
public function getMessage() |
123
|
|
|
{ |
124
|
9 |
|
return $this->message; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param Message $message |
129
|
|
|
*/ |
130
|
3 |
|
public function setMessage(Message $message) |
131
|
|
|
{ |
132
|
3 |
|
$this->message = $message; |
133
|
3 |
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return Message |
137
|
|
|
*/ |
138
|
|
|
public function getChannelPost() |
139
|
|
|
{ |
140
|
|
|
return $this->channelPost; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param Message $channelPost |
145
|
|
|
*/ |
146
|
|
|
public function setChannelPost($channelPost) |
147
|
|
|
{ |
148
|
|
|
$this->channelPost = $channelPost; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return InlineQuery |
153
|
|
|
*/ |
154
|
8 |
|
public function getInlineQuery() |
155
|
|
|
{ |
156
|
8 |
|
return $this->inlineQuery; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param InlineQuery $inlineQuery |
161
|
|
|
*/ |
162
|
1 |
|
public function setInlineQuery($inlineQuery) |
163
|
|
|
{ |
164
|
1 |
|
$this->inlineQuery = $inlineQuery; |
165
|
1 |
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return ChosenInlineResult |
169
|
|
|
*/ |
170
|
|
|
public function getChosenInlineResult() |
171
|
|
|
{ |
172
|
|
|
return $this->chosenInlineResult; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param ChosenInlineResult $chosenInlineResult |
177
|
|
|
*/ |
178
|
|
|
public function setChosenInlineResult($chosenInlineResult) |
179
|
|
|
{ |
180
|
|
|
$this->chosenInlineResult = $chosenInlineResult; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return CallbackQuery |
185
|
|
|
*/ |
186
|
|
|
public function getCallbackQuery() |
187
|
|
|
{ |
188
|
|
|
return $this->callbackQuery; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param CallbackQuery $callbackQuery |
193
|
|
|
*/ |
194
|
|
|
public function setCallbackQuery($callbackQuery) |
195
|
|
|
{ |
196
|
|
|
$this->callbackQuery = $callbackQuery; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @author MY |
201
|
|
|
* @return ShippingQuery |
202
|
|
|
*/ |
203
|
|
|
public function getShippingQuery() |
204
|
|
|
{ |
205
|
|
|
return $this->shippingQuery; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @author MY |
210
|
|
|
* @param ShippingQuery $shippingQuery |
211
|
|
|
*/ |
212
|
|
|
public function setShippingQuery($shippingQuery) |
213
|
|
|
{ |
214
|
|
|
$this->shippingQuery = $shippingQuery; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @author MY |
219
|
|
|
* @return PreCheckoutQuery |
220
|
|
|
*/ |
221
|
|
|
public function getPreCheckoutQuery() |
222
|
|
|
{ |
223
|
|
|
return $this->preCheckoutQuery; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @author MY |
228
|
|
|
* @param PreCheckoutQuery $preCheckoutQuery |
229
|
|
|
*/ |
230
|
|
|
public function setPreCheckoutQuery($preCheckoutQuery) |
231
|
|
|
{ |
232
|
|
|
$this->preCheckoutQuery = $preCheckoutQuery; |
233
|
|
|
} |
234
|
|
|
} |
235
|
|
|
|