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
|
|
|
'edited_message' => Message::class, |
37
|
|
|
'channel_post' => Message::class, |
38
|
|
|
'edited_channel_post' => Message::class, |
39
|
|
|
'inline_query' => InlineQuery::class, |
40
|
|
|
'chosen_inline_result' => ChosenInlineResult::class, |
41
|
|
|
'callback_query' => CallbackQuery::class, |
42
|
|
|
'shipping_query' => ShippingQuery::class, |
43
|
|
|
'pre_checkout_query' => PreCheckoutQuery::class, |
44
|
|
|
'poll_answer' => PollAnswerQuery::class, |
45
|
|
|
]; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* The update‘s unique identifier. |
49
|
|
|
* Update identifiers start from a certain positive number and increase sequentially. |
50
|
|
|
* This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or |
51
|
|
|
* to restore the correct update sequence, should they get out of order. |
52
|
|
|
* |
53
|
|
|
* @var integer |
54
|
|
|
*/ |
55
|
|
|
protected $updateId; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. New incoming message of any kind — text, photo, sticker, etc. |
59
|
|
|
* |
60
|
|
|
* @var Message |
61
|
|
|
*/ |
62
|
|
|
protected $message; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var PollAnswerQuery |
66
|
|
|
*/ |
67
|
|
|
protected $poll_answer; |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Optional. New version of a message that is known to the bot and was edited |
72
|
|
|
* |
73
|
|
|
* @var Message |
74
|
|
|
*/ |
75
|
|
|
protected $editedMessage; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Optional. New incoming channel post of any kind — text, photo, sticker, etc. |
79
|
|
|
* |
80
|
|
|
* @var Message |
81
|
|
|
*/ |
82
|
|
|
protected $channelPost; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Optional. New version of a channel post that is known to the bot and was edited |
86
|
|
|
* |
87
|
|
|
* @var Message |
88
|
|
|
*/ |
89
|
|
|
protected $editedChannelPost; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Optional. New incoming inline query |
93
|
|
|
* |
94
|
|
|
* @var \TelegramBot\Api\Types\Inline\InlineQuery |
95
|
|
|
*/ |
96
|
|
|
protected $inlineQuery; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Optional. The result of a inline query that was chosen by a user and sent to their chat partner |
100
|
|
|
* |
101
|
|
|
* @var \TelegramBot\Api\Types\Inline\ChosenInlineResult |
102
|
|
|
*/ |
103
|
|
|
protected $chosenInlineResult; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Optional. New incoming callback query |
107
|
|
|
* |
108
|
|
|
* @var \TelegramBot\Api\Types\CallbackQuery |
109
|
|
|
*/ |
110
|
|
|
protected $callbackQuery; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Optional. New incoming shipping query. Only for invoices with flexible price |
114
|
|
|
* |
115
|
|
|
* @var ShippingQuery |
116
|
|
|
*/ |
117
|
|
|
protected $shippingQuery; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Optional. New incoming pre-checkout query. Contains full information about checkout |
121
|
|
|
* |
122
|
|
|
* @var PreCheckoutQuery |
123
|
|
|
*/ |
124
|
|
|
protected $preCheckoutQuery; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return int |
128
|
|
|
*/ |
129
|
|
|
public function getUpdateId() |
130
|
|
|
{ |
131
|
|
|
return $this->updateId; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param int $updateId |
136
|
|
|
*/ |
137
|
3 |
|
public function setUpdateId($updateId) |
138
|
|
|
{ |
139
|
3 |
|
$this->updateId = $updateId; |
140
|
3 |
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @return Message |
144
|
|
|
*/ |
145
|
9 |
|
public function getMessage() |
146
|
|
|
{ |
147
|
9 |
|
return $this->message; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @param Message $message |
152
|
|
|
*/ |
153
|
3 |
|
public function setMessage(Message $message) |
154
|
|
|
{ |
155
|
3 |
|
$this->message = $message; |
156
|
3 |
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @return Message |
160
|
|
|
*/ |
161
|
|
|
public function getEditedMessage() |
162
|
|
|
{ |
163
|
|
|
return $this->editedMessage; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param Message $editedMessage |
168
|
|
|
*/ |
169
|
|
|
public function setEditedMessage($editedMessage) |
170
|
|
|
{ |
171
|
|
|
$this->editedMessage = $editedMessage; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return Message |
176
|
|
|
*/ |
177
|
|
|
public function getChannelPost() |
178
|
|
|
{ |
179
|
|
|
return $this->channelPost; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @param Message $channelPost |
184
|
|
|
*/ |
185
|
|
|
public function setChannelPost($channelPost) |
186
|
|
|
{ |
187
|
|
|
$this->channelPost = $channelPost; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return Message |
192
|
|
|
*/ |
193
|
|
|
public function getPollAnswer() |
194
|
|
|
{ |
195
|
|
|
return $this->poll_answer; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @param PollAnswerQuery $pollAnswer |
200
|
|
|
*/ |
201
|
|
|
public function setPollAnswer($pollAnswer) |
202
|
|
|
{ |
203
|
|
|
$this->poll_answer = $pollAnswer; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return Message |
208
|
|
|
*/ |
209
|
|
|
public function getEditedChannelPost() |
210
|
|
|
{ |
211
|
|
|
return $this->editedChannelPost; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @param Message $editedChannelPost |
216
|
|
|
*/ |
217
|
|
|
public function setEditedChannelPost($editedChannelPost) |
218
|
|
|
{ |
219
|
|
|
$this->editedChannelPost = $editedChannelPost; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return InlineQuery |
224
|
|
|
*/ |
225
|
8 |
|
public function getInlineQuery() |
226
|
|
|
{ |
227
|
8 |
|
return $this->inlineQuery; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @param InlineQuery $inlineQuery |
232
|
|
|
*/ |
233
|
1 |
|
public function setInlineQuery($inlineQuery) |
234
|
|
|
{ |
235
|
1 |
|
$this->inlineQuery = $inlineQuery; |
236
|
1 |
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return ChosenInlineResult |
240
|
|
|
*/ |
241
|
|
|
public function getChosenInlineResult() |
242
|
|
|
{ |
243
|
|
|
return $this->chosenInlineResult; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @param ChosenInlineResult $chosenInlineResult |
248
|
|
|
*/ |
249
|
|
|
public function setChosenInlineResult($chosenInlineResult) |
250
|
|
|
{ |
251
|
|
|
$this->chosenInlineResult = $chosenInlineResult; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @return CallbackQuery |
256
|
|
|
*/ |
257
|
|
|
public function getCallbackQuery() |
258
|
|
|
{ |
259
|
|
|
return $this->callbackQuery; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @param CallbackQuery $callbackQuery |
264
|
|
|
*/ |
265
|
|
|
public function setCallbackQuery($callbackQuery) |
266
|
|
|
{ |
267
|
|
|
$this->callbackQuery = $callbackQuery; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @author MY |
272
|
|
|
* @return ShippingQuery |
273
|
|
|
*/ |
274
|
|
|
public function getShippingQuery() |
275
|
|
|
{ |
276
|
|
|
return $this->shippingQuery; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @author MY |
281
|
|
|
* @param ShippingQuery $shippingQuery |
282
|
|
|
*/ |
283
|
|
|
public function setShippingQuery($shippingQuery) |
284
|
|
|
{ |
285
|
|
|
$this->shippingQuery = $shippingQuery; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @author MY |
290
|
|
|
* @return PreCheckoutQuery |
291
|
|
|
*/ |
292
|
|
|
public function getPreCheckoutQuery() |
293
|
|
|
{ |
294
|
|
|
return $this->preCheckoutQuery; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @author MY |
299
|
|
|
* @param PreCheckoutQuery $preCheckoutQuery |
300
|
|
|
*/ |
301
|
|
|
public function setPreCheckoutQuery($preCheckoutQuery) |
302
|
|
|
{ |
303
|
|
|
$this->preCheckoutQuery = $preCheckoutQuery; |
304
|
|
|
} |
305
|
|
|
} |
306
|
|
|
|