@@ 14-220 (lines=207) @@ | ||
11 | use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
|
12 | use TelegramBot\Api\Types\Inline\InputMessageContent; |
|
13 | ||
14 | class Contact extends AbstractInlineQueryResult |
|
15 | { |
|
16 | /** |
|
17 | * {@inheritdoc} |
|
18 | * |
|
19 | * @var array |
|
20 | */ |
|
21 | static protected $requiredParams = ['type', 'id', 'phone_number', 'first_name']; |
|
22 | ||
23 | /** |
|
24 | * {@inheritdoc} |
|
25 | * |
|
26 | * @var array |
|
27 | */ |
|
28 | static protected $map = [ |
|
29 | 'type' => true, |
|
30 | 'id' => true, |
|
31 | 'phone_number' => true, |
|
32 | 'first_name' => true, |
|
33 | 'last_name' => true, |
|
34 | 'reply_markup' => InlineKeyboardMarkup::class, |
|
35 | 'input_message_content' => InputMessageContent::class, |
|
36 | 'thumb_url' => true, |
|
37 | 'thumb_width' => true, |
|
38 | 'thumb_height' => true, |
|
39 | ]; |
|
40 | ||
41 | /** |
|
42 | * {@inheritdoc} |
|
43 | * |
|
44 | * @var string |
|
45 | */ |
|
46 | protected $type = 'contact'; |
|
47 | ||
48 | /** |
|
49 | * Contact's phone number |
|
50 | * |
|
51 | * @var string |
|
52 | */ |
|
53 | protected $phoneNumber; |
|
54 | ||
55 | /** |
|
56 | * Contact's first name |
|
57 | * |
|
58 | * @var string |
|
59 | */ |
|
60 | protected $firstName; |
|
61 | ||
62 | /** |
|
63 | * Optional. Contact's last name |
|
64 | * |
|
65 | * @var string |
|
66 | */ |
|
67 | protected $lastName; |
|
68 | ||
69 | /** |
|
70 | * Optional. Url of the thumbnail for the result |
|
71 | * |
|
72 | * @var string |
|
73 | */ |
|
74 | protected $thumbUrl; |
|
75 | ||
76 | /** |
|
77 | * Optional. Thumbnail width |
|
78 | * |
|
79 | * @var int |
|
80 | */ |
|
81 | protected $thumbWidth; |
|
82 | ||
83 | /** |
|
84 | * Optional. Thumbnail height |
|
85 | * |
|
86 | * @var int |
|
87 | */ |
|
88 | protected $thumbHeight; |
|
89 | ||
90 | /** |
|
91 | * Contact constructor. |
|
92 | * @param string $id |
|
93 | * @param string $phoneNumber |
|
94 | * @param string $firstName |
|
95 | * @param string $lastName |
|
96 | * @param string $thumbUrl |
|
97 | * @param int $thumbWidth |
|
98 | * @param int $thumbHeight |
|
99 | * @param InputMessageContent|null $inputMessageContent |
|
100 | * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
|
101 | */ |
|
102 | public function __construct( |
|
103 | $id, |
|
104 | $phoneNumber, |
|
105 | $firstName, |
|
106 | $lastName = null, |
|
107 | $thumbUrl = null, |
|
108 | $thumbWidth = null, |
|
109 | $thumbHeight = null, |
|
110 | $inputMessageContent = null, |
|
111 | $inlineKeyboardMarkup = null |
|
112 | ) |
|
113 | { |
|
114 | parent::__construct($id, null, $inputMessageContent, $inlineKeyboardMarkup); |
|
115 | ||
116 | $this->phoneNumber = $phoneNumber; |
|
117 | $this->firstName = $firstName; |
|
118 | $this->lastName = $lastName; |
|
119 | $this->thumbUrl = $thumbUrl; |
|
120 | $this->thumbWidth = $thumbWidth; |
|
121 | $this->thumbHeight = $thumbHeight; |
|
122 | } |
|
123 | ||
124 | ||
125 | /** |
|
126 | * @return string |
|
127 | */ |
|
128 | public function getPhoneNumber() |
|
129 | { |
|
130 | return $this->phoneNumber; |
|
131 | } |
|
132 | ||
133 | /** |
|
134 | * @param string $phoneNumber |
|
135 | */ |
|
136 | public function setPhoneNumber($phoneNumber) |
|
137 | { |
|
138 | $this->phoneNumber = $phoneNumber; |
|
139 | } |
|
140 | ||
141 | /** |
|
142 | * @return string |
|
143 | */ |
|
144 | public function getFirstName() |
|
145 | { |
|
146 | return $this->firstName; |
|
147 | } |
|
148 | ||
149 | /** |
|
150 | * @param string $firstName |
|
151 | */ |
|
152 | public function setFirstName($firstName) |
|
153 | { |
|
154 | $this->firstName = $firstName; |
|
155 | } |
|
156 | ||
157 | /** |
|
158 | * @return string |
|
159 | */ |
|
160 | public function getLastName() |
|
161 | { |
|
162 | return $this->lastName; |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * @param string $lastName |
|
167 | */ |
|
168 | public function setLastName($lastName) |
|
169 | { |
|
170 | $this->lastName = $lastName; |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * @return string |
|
175 | */ |
|
176 | public function getThumbUrl() |
|
177 | { |
|
178 | return $this->thumbUrl; |
|
179 | } |
|
180 | ||
181 | /** |
|
182 | * @param string $thumbUrl |
|
183 | */ |
|
184 | public function setThumbUrl($thumbUrl) |
|
185 | { |
|
186 | $this->thumbUrl = $thumbUrl; |
|
187 | } |
|
188 | ||
189 | /** |
|
190 | * @return int |
|
191 | */ |
|
192 | public function getThumbWidth() |
|
193 | { |
|
194 | return $this->thumbWidth; |
|
195 | } |
|
196 | ||
197 | /** |
|
198 | * @param int $thumbWidth |
|
199 | */ |
|
200 | public function setThumbWidth($thumbWidth) |
|
201 | { |
|
202 | $this->thumbWidth = $thumbWidth; |
|
203 | } |
|
204 | ||
205 | /** |
|
206 | * @return int |
|
207 | */ |
|
208 | public function getThumbHeight() |
|
209 | { |
|
210 | return $this->thumbHeight; |
|
211 | } |
|
212 | ||
213 | /** |
|
214 | * @param int $thumbHeight |
|
215 | */ |
|
216 | public function setThumbHeight($thumbHeight) |
|
217 | { |
|
218 | $this->thumbHeight = $thumbHeight; |
|
219 | } |
|
220 | } |
|
221 |
@@ 15-224 (lines=210) @@ | ||
12 | * |
|
13 | * @package TelegramBot\Api\Types\Inline |
|
14 | */ |
|
15 | class Photo extends AbstractInlineQueryResult |
|
16 | { |
|
17 | /** |
|
18 | * {@inheritdoc} |
|
19 | * |
|
20 | * @var array |
|
21 | */ |
|
22 | static protected $requiredParams = ['type', 'id', 'photo_url', 'thumb_url']; |
|
23 | ||
24 | /** |
|
25 | * {@inheritdoc} |
|
26 | * |
|
27 | * @var array |
|
28 | */ |
|
29 | static protected $map = [ |
|
30 | 'type' => true, |
|
31 | 'id' => true, |
|
32 | 'photo_url' => true, |
|
33 | 'thumb_url' => true, |
|
34 | 'photo_width' => true, |
|
35 | 'photo_height' => true, |
|
36 | 'title' => true, |
|
37 | 'description' => true, |
|
38 | 'caption' => true, |
|
39 | 'input_message_content' => InputMessageContent::class, |
|
40 | 'reply_markup' => InlineKeyboardMarkup::class, |
|
41 | ]; |
|
42 | ||
43 | /** |
|
44 | * {@inheritdoc} |
|
45 | * |
|
46 | * @var string |
|
47 | */ |
|
48 | protected $type = 'photo'; |
|
49 | ||
50 | /** |
|
51 | * A valid URL of the photo. Photo size must not exceed 5MB |
|
52 | * |
|
53 | * @var string |
|
54 | */ |
|
55 | protected $photoUrl; |
|
56 | ||
57 | /** |
|
58 | * Optional. Width of the photo |
|
59 | * |
|
60 | * @var int |
|
61 | */ |
|
62 | protected $photoWidth; |
|
63 | ||
64 | /** |
|
65 | * Optional. Height of the photo |
|
66 | * |
|
67 | * @var int |
|
68 | */ |
|
69 | protected $photoHeight; |
|
70 | ||
71 | /** |
|
72 | * URL of the thumbnail for the photo |
|
73 | * |
|
74 | * @var |
|
75 | */ |
|
76 | protected $thumbUrl; |
|
77 | ||
78 | /** |
|
79 | * Optional. Short description of the result |
|
80 | * |
|
81 | * @var string |
|
82 | */ |
|
83 | protected $description; |
|
84 | ||
85 | /** |
|
86 | * Optional. Caption of the photo to be sent, 0-200 characters |
|
87 | * |
|
88 | * @var string |
|
89 | */ |
|
90 | protected $caption; |
|
91 | ||
92 | /** |
|
93 | * InlineQueryResultPhoto constructor. |
|
94 | * |
|
95 | * @param string $id |
|
96 | * @param string $photoUrl |
|
97 | * @param string $thumbUrl |
|
98 | * @param int|null $photoWidth |
|
99 | * @param int|null $photoHeight |
|
100 | * @param string|null $title |
|
101 | * @param string|null $description |
|
102 | * @param string|null $caption |
|
103 | * @param InputMessageContent|null $inputMessageContent |
|
104 | * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
|
105 | */ |
|
106 | public function __construct( |
|
107 | $id, |
|
108 | $photoUrl, |
|
109 | $thumbUrl, |
|
110 | $photoWidth = null, |
|
111 | $photoHeight = null, |
|
112 | $title = null, |
|
113 | $description = null, |
|
114 | $caption = null, |
|
115 | $inputMessageContent = null, |
|
116 | $inlineKeyboardMarkup = null |
|
117 | ) { |
|
118 | parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
|
119 | ||
120 | $this->photoUrl = $photoUrl; |
|
121 | $this->thumbUrl = $thumbUrl; |
|
122 | $this->photoWidth = $photoWidth; |
|
123 | $this->photoHeight = $photoHeight; |
|
124 | $this->description = $description; |
|
125 | $this->caption = $caption; |
|
126 | } |
|
127 | ||
128 | ||
129 | /** |
|
130 | * @return string |
|
131 | */ |
|
132 | public function getPhotoUrl() |
|
133 | { |
|
134 | return $this->photoUrl; |
|
135 | } |
|
136 | ||
137 | /** |
|
138 | * @param string $photoUrl |
|
139 | */ |
|
140 | public function setPhotoUrl($photoUrl) |
|
141 | { |
|
142 | $this->photoUrl = $photoUrl; |
|
143 | } |
|
144 | ||
145 | /** |
|
146 | * @return int |
|
147 | */ |
|
148 | public function getPhotoWidth() |
|
149 | { |
|
150 | return $this->photoWidth; |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * @param int $photoWidth |
|
155 | */ |
|
156 | public function setPhotoWidth($photoWidth) |
|
157 | { |
|
158 | $this->photoWidth = $photoWidth; |
|
159 | } |
|
160 | ||
161 | /** |
|
162 | * @return int |
|
163 | */ |
|
164 | public function getPhotoHeight() |
|
165 | { |
|
166 | return $this->photoHeight; |
|
167 | } |
|
168 | ||
169 | /** |
|
170 | * @param int $photoHeight |
|
171 | */ |
|
172 | public function setPhotoHeight($photoHeight) |
|
173 | { |
|
174 | $this->photoHeight = $photoHeight; |
|
175 | } |
|
176 | ||
177 | /** |
|
178 | * @return mixed |
|
179 | */ |
|
180 | public function getThumbUrl() |
|
181 | { |
|
182 | return $this->thumbUrl; |
|
183 | } |
|
184 | ||
185 | /** |
|
186 | * @param mixed $thumbUrl |
|
187 | */ |
|
188 | public function setThumbUrl($thumbUrl) |
|
189 | { |
|
190 | $this->thumbUrl = $thumbUrl; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * @return string |
|
195 | */ |
|
196 | public function getDescription() |
|
197 | { |
|
198 | return $this->description; |
|
199 | } |
|
200 | ||
201 | /** |
|
202 | * @param string $description |
|
203 | */ |
|
204 | public function setDescription($description) |
|
205 | { |
|
206 | $this->description = $description; |
|
207 | } |
|
208 | ||
209 | /** |
|
210 | * @return string |
|
211 | */ |
|
212 | public function getCaption() |
|
213 | { |
|
214 | return $this->caption; |
|
215 | } |
|
216 | ||
217 | /** |
|
218 | * @param string $caption |
|
219 | */ |
|
220 | public function setCaption($caption) |
|
221 | { |
|
222 | $this->caption = $caption; |
|
223 | } |
|
224 | } |
|
225 |