Added object \TgBotLib\Objects\Telegram > InputContactMessageContent to represent the content of a contact message to be sent as the result of an inline query.

This commit is contained in:
Netkas 2023-04-23 15:02:03 -04:00
parent ec93f9ffd7
commit 1b569e4972
2 changed files with 105 additions and 0 deletions

View file

@ -13,6 +13,7 @@ This update accompanies the release of the [Telegram Bot API 6.7](https://core.t
* Added object `\TgBotLib\Objects\Telegram > InputTextMessageContent` to represent the content of a text message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram > InputLocationMessageContent` to represent the content of a location message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram > InputVenueMessageContent` to represent the content of a venue message to be sent as the result of an inline query.
* Added object `\TgBotLib\Objects\Telegram > InputContactMessageContent` to represent the content of a contact message to be sent as the result of an inline query.
## [6.6.0] - 2023-04-10

View file

@ -0,0 +1,104 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace TgBotLib\Objects\Telegram;
use TgBotLib\Interfaces\ObjectTypeInterface;
class InputContactMessageContent implements ObjectTypeInterface
{
/**
* @var string
*/
private $phone_number;
/**
* @var string
*/
private $first_name;
/**
* @var string|null
*/
private $last_name;
/**
* @var string|null
*/
private $vcard;
/**
* Contact's phone number
*
* @return string
*/
public function getPhoneNumber(): string
{
return $this->phone_number;
}
/**
* Contact's first name
*
* @return string
*/
public function getFirstName(): string
{
return $this->first_name;
}
/**
* Optional. Contact's last name
*
* @return string|null
*/
public function getLastName(): ?string
{
return $this->last_name;
}
/**
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
*
* @see https://en.wikipedia.org/wiki/VCard
* @return string|null
*/
public function getVcard(): ?string
{
return $this->vcard;
}
/**
* Returns an array representation of the object
*
* @return array
*/
public function toArray(): array
{
return [
'phone_number' => $this->phone_number,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'vcard' => $this->vcard,
];
}
/**
* Constructs object from an array representation
*
* @param array $data
* @return ObjectTypeInterface
*/
public static function fromArray(array $data): ObjectTypeInterface
{
$object = new self();
$object->phone_number = $data['phone_number'] ?? null;
$object->first_name = $data['first_name'] ?? null;
$object->last_name = $data['last_name'] ?? null;
$object->vcard = $data['vcard'] ?? null;
return $object;
}
}