1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Type\InlineQueryResult; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait; |
8
|
|
|
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class InlineQueryResultContactType. |
12
|
|
|
* |
13
|
|
|
* Represents a contact with a phone number. By default, this contact will be sent by the user. |
14
|
|
|
* Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. |
15
|
|
|
* |
16
|
|
|
* @see https://core.telegram.org/bots/api#inlinequeryresultcontact |
17
|
|
|
*/ |
18
|
|
|
class InlineQueryResultContactType extends InlineQueryResultType |
19
|
|
|
{ |
20
|
|
|
use FillFromArrayTrait; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Contact's phone number. |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
public $phoneNumber; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Contact's first name. |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
public $firstName; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Optional. Contact's last name. |
38
|
|
|
* |
39
|
|
|
* @var string|null |
40
|
|
|
*/ |
41
|
|
|
public $lastName; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes. |
45
|
|
|
* |
46
|
|
|
* @var string|null |
47
|
|
|
*/ |
48
|
|
|
public $vcard; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Optional. Content of the message to be sent instead of the contact. |
52
|
|
|
* |
53
|
|
|
* @var InputMessageContentType|null |
54
|
|
|
*/ |
55
|
|
|
public $inputMessageContent; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. Url of the thumbnail for the result. |
59
|
|
|
* |
60
|
|
|
* @var string|null |
61
|
|
|
*/ |
62
|
|
|
public $thumbUrl; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Optional. Thumbnail width. |
66
|
|
|
* |
67
|
|
|
* @var int|null |
68
|
|
|
*/ |
69
|
|
|
public $thumbWidth; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Optional. Thumbnail height. |
73
|
|
|
* |
74
|
|
|
* @var int|null |
75
|
|
|
*/ |
76
|
|
|
public $thumbHeight; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $id |
80
|
|
|
* @param string $phoneNumber |
81
|
|
|
* @param string $firstName |
82
|
|
|
* @param array|null $data |
83
|
|
|
* |
84
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
85
|
|
|
* |
86
|
|
|
* @return InlineQueryResultContactType |
87
|
|
|
*/ |
88
|
|
|
public static function create( |
89
|
|
|
string $id, |
90
|
|
|
string $phoneNumber, |
91
|
|
|
string $firstName, |
92
|
|
|
array $data = null |
93
|
|
|
): InlineQueryResultContactType { |
94
|
|
|
$instance = new static(); |
95
|
|
|
$instance->type = static::TYPE_CONTACT; |
96
|
|
|
$instance->id = $id; |
97
|
|
|
$instance->phoneNumber = $phoneNumber; |
98
|
|
|
$instance->$firstName = $firstName; |
99
|
|
|
if ($data) { |
100
|
|
|
$instance->fill($data); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return $instance; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|