1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\Types\Location; |
7
|
|
|
use TelegramBot\Api\Types\User; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class InlineQuery |
11
|
|
|
* This object represents an incoming inline query. |
12
|
|
|
* When the user sends an empty query, your bot could return some default or trending results. |
13
|
|
|
* |
14
|
|
|
* @package TelegramBot\Api\Types |
15
|
|
|
*/ |
16
|
|
|
class InlineQuery extends BaseType |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* {@inheritdoc} |
20
|
|
|
* |
21
|
|
|
* @var array |
22
|
|
|
*/ |
23
|
|
|
protected static $requiredParams = ['id', 'from', 'query', 'offset']; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
* |
28
|
|
|
* @var array |
29
|
|
|
*/ |
30
|
|
|
protected static $map = [ |
31
|
|
|
'id' => true, |
32
|
|
|
'from' => User::class, |
33
|
|
|
'location' => Location::class, |
34
|
|
|
'query' => true, |
35
|
|
|
'offset' => true, |
36
|
|
|
]; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Unique identifier for this query |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $id; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Sender |
47
|
|
|
* |
48
|
|
|
* @var User |
49
|
|
|
*/ |
50
|
|
|
protected $from; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Optional. Sender location, only for bots that request user location |
54
|
|
|
* |
55
|
|
|
* @var Location|null |
56
|
|
|
*/ |
57
|
|
|
protected $location; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Text of the query |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $query; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Offset of the results to be returned, can be controlled by the bot |
68
|
|
|
* |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
protected $offset; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getId() |
77
|
3 |
|
{ |
78
|
|
|
return $this->id; |
79
|
3 |
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $id |
83
|
|
|
* |
84
|
|
|
* @return void |
85
|
5 |
|
*/ |
86
|
|
|
public function setId($id) |
87
|
5 |
|
{ |
88
|
5 |
|
$this->id = $id; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return User |
93
|
3 |
|
*/ |
94
|
|
|
public function getFrom() |
95
|
3 |
|
{ |
96
|
|
|
return $this->from; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param User $from |
101
|
5 |
|
* |
102
|
|
|
* @return void |
103
|
5 |
|
*/ |
104
|
5 |
|
public function setFrom(User $from) |
105
|
|
|
{ |
106
|
|
|
$this->from = $from; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return Location|null |
111
|
|
|
*/ |
112
|
|
|
public function getLocation() |
113
|
|
|
{ |
114
|
|
|
return $this->location; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param Location $location |
119
|
|
|
* |
120
|
|
|
* @return void |
121
|
|
|
*/ |
122
|
|
|
public function setLocation($location) |
123
|
|
|
{ |
124
|
|
|
$this->location = $location; |
125
|
1 |
|
} |
126
|
|
|
|
127
|
1 |
|
/** |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
|
|
public function getQuery() |
131
|
|
|
{ |
132
|
|
|
return $this->query; |
133
|
5 |
|
} |
134
|
|
|
|
135
|
5 |
|
/** |
136
|
5 |
|
* @param string $query |
137
|
|
|
* |
138
|
|
|
* @return void |
139
|
|
|
*/ |
140
|
|
|
public function setQuery($query) |
141
|
3 |
|
{ |
142
|
|
|
$this->query = $query; |
143
|
3 |
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return string |
147
|
|
|
*/ |
148
|
|
|
public function getOffset() |
149
|
5 |
|
{ |
150
|
|
|
return $this->offset; |
151
|
5 |
|
} |
152
|
5 |
|
|
153
|
|
|
/** |
154
|
|
|
* @param string $offset |
155
|
|
|
* |
156
|
|
|
* @return void |
157
|
|
|
*/ |
158
|
|
|
public function setOffset($offset) |
159
|
|
|
{ |
160
|
|
|
$this->offset = $offset; |
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|