From e538b5537980d8a1e28c3143d4059c254ba16660 Mon Sep 17 00:00:00 2001 From: BoShurik Date: Mon, 29 May 2023 18:34:34 +0300 Subject: [PATCH] Support `attach://` and rename `thumb` to `thumbnail` --- CHANGELOG.md | 7 +- src/BotApi.php | 83 +++++++++++++---- src/Types/Animation.php | 32 ++++++- src/Types/Document.php | 32 ++++++- src/Types/Inline/QueryResult/Article.php | 108 +++++++++++++++++----- src/Types/Inline/QueryResult/Contact.php | 108 +++++++++++++++++----- src/Types/Inline/QueryResult/Gif.php | 38 ++++++-- src/Types/Inline/QueryResult/Location.php | 108 +++++++++++++++++----- src/Types/Inline/QueryResult/Mpeg4Gif.php | 38 ++++++-- src/Types/Inline/QueryResult/Photo.php | 38 ++++++-- src/Types/Inline/QueryResult/Venue.php | 108 +++++++++++++++++----- src/Types/Inline/QueryResult/Video.php | 42 +++++++-- src/Types/Sticker.php | 32 ++++++- src/Types/StickerSet.php | 30 +++++- src/Types/Video.php | 38 ++++++-- src/Types/VideoNote.php | 30 +++++- tests/Types/AnimationTest.php | 6 +- tests/Types/DocumentTest.php | 8 +- tests/Types/StickerSetTest.php | 6 +- tests/Types/StickerTest.php | 4 +- tests/Types/VideoNoteTest.php | 6 +- tests/Types/VideoTest.php | 16 ++-- 22 files changed, 727 insertions(+), 191 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b18aa77d..cf5fb8c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,14 @@ All Notable changes to `PHP Telegram Bot Api` will be documented in this file ### Added - Add missing `protect_content` and `allow_sending_without_reply` parameters to `\TelegramBot\Api\BotApi` methods +- Add support `attach://` in `\TelegramBot\Api\BotApi` methods `sendMediaGroup`, `createNewStickerSet`, `addStickerToSet`, `editMessageMedia` +- Rename `thumb` to `thumbnail` parameter in `Animation`, `Document`, `Sticker`, `StickerSet`, `Video`, `VideoNote` types +- Rename `thumb_*` to `thumbnail_*` parameter in `Inline/QueryResult` types - Add missing phpDoc for `$replyMarkup` parameters - +- ### Deprecated +- Deprecate using `thumb*` methods in `\TelegramBot\Api\BotApi` +- Deprecate method `\TelegramBot\Api\BotApi::setStickerSetThumb`. Use `\TelegramBot\Api\BotApi::setStickerSetThumbnail` instead - Deprecate `\TelegramBot\Api\Types\ReplyKeyboardHide` class ## 2.4.0 - 2023-05-11 diff --git a/src/BotApi.php b/src/BotApi.php index 53922bf6..c1c72676 100644 --- a/src/BotApi.php +++ b/src/BotApi.php @@ -914,6 +914,7 @@ public function uploadStickerFile($userId, $pngSticker) * @param string $stickerType Sticker type, one of “png”, “tgs”, or “webp” * @param string $emojis One or more emoji corresponding to the sticker * @param MaskPosition|null $maskPosition A JSON-serialized object for position where the mask should be placed on faces + * @param array $attachments Attachments to use in attach:// * * @throws InvalidArgumentException * @throws Exception @@ -931,7 +932,8 @@ public function createNewStickerSet( $tgsSticker = null, $webmSticker = null, $stickerType = null, - $maskPosition = null + $maskPosition = null, + $attachments = [] ) { return $this->call('createNewStickerSet', [ 'user_id' => $userId, @@ -943,7 +945,7 @@ public function createNewStickerSet( 'sticker_type' => $stickerType, 'emojis' => $emojis, 'mask_position' => is_null($maskPosition) ? $maskPosition : $maskPosition->toJson(), - ]); + ] + $attachments); } /** @@ -960,6 +962,8 @@ public function createNewStickerSet( * @param string|null $tgsSticker * @param string|null $webmSticker * @param MaskPosition|null $maskPosition + * @param array $attachments Attachments to use in attach:// + * * @return bool * @throws Exception * @throws HttpException @@ -972,7 +976,8 @@ public function addStickerToSet( $pngSticker, $tgsSticker = null, $webmSticker = null, - $maskPosition = null + $maskPosition = null, + $attachments = [] ) { return $this->call('addStickerToSet', [ 'user_id' => $userId, @@ -982,7 +987,7 @@ public function addStickerToSet( 'webm_sticker' => $webmSticker, 'emojis' => $emojis, 'mask_position' => is_null($maskPosition) ? $maskPosition : $maskPosition->toJson(), - ]); + ] + $attachments); } /** @@ -1011,24 +1016,46 @@ public function setStickerPositionInSet($sticker, $position) * * @param string $name Sticker set name * @param string $userId User identifier of sticker set owner - * @param File|null $thumb A PNG image with the thumbnail, - * must be up to 128 kilobytes in size and have width and height exactly 100px, - * or a TGS animation with the thumbnail up to 32 kilobytes in size + * @param File|null $thumbnail A PNG image with the thumbnail, + * must be up to 128 kilobytes in size and have width and height exactly 100px, + * or a TGS animation with the thumbnail up to 32 kilobytes in size * * @return bool * * @throws InvalidArgumentException * @throws Exception */ - public function setStickerSetThumb($name, $userId, $thumb = null) + public function setStickerSetThumbnail($name, $userId, $thumbnail = null) { return $this->call('setStickerSetThumb', [ 'name' => $name, 'user_id' => $userId, - 'thumb' => $thumb, + 'thumbnail' => $thumbnail, ]); } + /** + * @deprecated Use setStickerSetThumbnail + * + * Use this method to delete a sticker from a set created by the bot. + * Returns True on success. + * + * @param string $name Sticker set name + * @param string $userId User identifier of sticker set owner + * @param File|null $thumb A PNG image with the thumbnail, + * must be up to 128 kilobytes in size and have width and height exactly 100px, + * or a TGS animation with the thumbnail up to 32 kilobytes in size + * + * @return bool + * + * @throws InvalidArgumentException + * @throws Exception + */ + public function setStickerSetThumb($name, $userId, $thumb = null) + { + return $this->setStickerSetThumbnail($name, $userId, $thumb); + } + /** * Use this method to send video files, * Telegram clients support mp4 videos (other formats may be sent as Document). @@ -1046,6 +1073,7 @@ public function setStickerSetThumb($name, $userId, $thumb = null) * @param int|null $messageThreadId * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param \CURLFile|\CURLStringFile|string|null $thumbnail * * @return Message * @throws InvalidArgumentException @@ -1063,7 +1091,8 @@ public function sendVideo( $parseMode = null, $messageThreadId = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $thumbnail = null ) { return Message::fromResponse($this->call('sendVideo', [ 'chat_id' => $chatId, @@ -1078,6 +1107,7 @@ public function sendVideo( 'parse_mode' => $parseMode, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, + 'thumbnail' => $thumbnail, ])); } @@ -1097,6 +1127,7 @@ public function sendVideo( * @param int|null $messageThreadId * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param \CURLFile|\CURLStringFile|string|null $thumbnail * * @return Message * @throws InvalidArgumentException @@ -1113,7 +1144,8 @@ public function sendAnimation( $parseMode = null, $messageThreadId = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $thumbnail = null ) { return Message::fromResponse($this->call('sendAnimation', [ 'chat_id' => $chatId, @@ -1127,6 +1159,7 @@ public function sendAnimation( 'parse_mode' => $parseMode, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, + 'thumbnail' => $thumbnail, ])); } @@ -1240,6 +1273,7 @@ public function forwardMessage( * @param string|null $parseMode * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param \CURLFile|\CURLStringFile|string|null $thumbnail * * @return Message * @throws InvalidArgumentException @@ -1260,7 +1294,8 @@ public function sendAudio( $disableNotification = false, $parseMode = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $thumbnail = null ) { return Message::fromResponse($this->call('sendAudio', [ 'chat_id' => $chatId, @@ -1274,6 +1309,7 @@ public function sendAudio( 'parse_mode' => $parseMode, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, + 'thumbnail' => $thumbnail, ])); } @@ -1335,6 +1371,7 @@ public function sendPhoto( * @param int|null $messageThreadId * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param \CURLFile|\CURLStringFile|string|null $thumbnail * * @return Message * @throws InvalidArgumentException @@ -1350,7 +1387,8 @@ public function sendDocument( $parseMode = null, $messageThreadId = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $thumbnail = null ) { return Message::fromResponse($this->call('sendDocument', [ 'chat_id' => $chatId, @@ -1363,6 +1401,7 @@ public function sendDocument( 'parse_mode' => $parseMode, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, + 'thumbnail' => $thumbnail, ])); } @@ -1659,6 +1698,8 @@ public function editMessageCaption( * @param InputMedia $media * @param string|null $inlineMessageId * @param InlineKeyboardMarkup|null $replyMarkup + * @param array $attachments Attachments to use in attach:// + * * @return Message|true * * @throws Exception @@ -1670,7 +1711,8 @@ public function editMessageMedia( $messageId, InputMedia $media, $inlineMessageId = null, - $replyMarkup = null + $replyMarkup = null, + $attachments = [] ) { $response = $this->call('editMessageMedia', [ 'chat_id' => $chatId, @@ -1678,7 +1720,7 @@ public function editMessageMedia( 'inline_message_id' => $inlineMessageId, 'media' => $media->toJson(), 'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(), - ]); + ] + $attachments); if ($response === true) { return true; } @@ -2272,6 +2314,7 @@ public function getChatAdministrators($chatId) * @param int|null $messageThreadId * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param \CURLFile|\CURLStringFile|string|null $thumbnail * * @return Message * @throws InvalidArgumentException @@ -2287,7 +2330,8 @@ public function sendVideoNote( $disableNotification = false, $messageThreadId = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $thumbnail = null ) { return Message::fromResponse($this->call('sendVideoNote', [ 'chat_id' => $chatId, @@ -2300,6 +2344,7 @@ public function sendVideoNote( 'disable_notification' => (bool) $disableNotification, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, + 'thumbnail' => $thumbnail, ])); } @@ -2314,6 +2359,7 @@ public function sendVideoNote( * @param int|null $messageThreadId * @param bool|null $protectContent * @param bool|null $allowSendingWithoutReply + * @param array $attachments Attachments to use in attach:// * * @return Message[] * @throws Exception @@ -2325,7 +2371,8 @@ public function sendMediaGroup( $replyToMessageId = null, $messageThreadId = null, $protectContent = null, - $allowSendingWithoutReply = null + $allowSendingWithoutReply = null, + $attachments = [] ) { return ArrayOfMessages::fromResponse($this->call('sendMediaGroup', [ 'chat_id' => $chatId, @@ -2335,7 +2382,7 @@ public function sendMediaGroup( 'disable_notification' => (bool) $disableNotification, 'protect_content' => (bool) $protectContent, 'allow_sending_without_reply' => (bool) $allowSendingWithoutReply, - ])); + ] + $attachments)); } /** diff --git a/src/Types/Animation.php b/src/Types/Animation.php index b412cc95..c33deeba 100644 --- a/src/Types/Animation.php +++ b/src/Types/Animation.php @@ -32,7 +32,7 @@ class Animation extends BaseType implements TypeInterface 'width' => true, 'height' => true, 'duration' => true, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, 'file_name' => true, 'mime_type' => true, 'file_size' => true @@ -78,7 +78,7 @@ class Animation extends BaseType implements TypeInterface * * @var PhotoSize */ - protected $thumb; + protected $thumbnail; /** * Optional. Animation thumbnail as defined by sender @@ -221,18 +221,40 @@ public function setMimeType($mimeType) /** * @return PhotoSize */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize $thumbnail + * @return void + */ + public function setThumbnail(PhotoSize $thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null + */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** + * @deprecated use setThumbnail method + * * @param PhotoSize $thumb + * * @return void */ - public function setThumb(PhotoSize $thumb) + public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } /** diff --git a/src/Types/Document.php b/src/Types/Document.php index a60f6f5b..e7b951bd 100644 --- a/src/Types/Document.php +++ b/src/Types/Document.php @@ -23,7 +23,7 @@ class Document extends BaseType implements TypeInterface protected static $map = [ 'file_id' => true, 'file_unique_id' => true, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, 'file_name' => true, 'mime_type' => true, 'file_size' => true @@ -48,7 +48,7 @@ class Document extends BaseType implements TypeInterface * * @var PhotoSize */ - protected $thumb; + protected $thumbnail; /** * Optional. Original filename as defined by sender @@ -154,18 +154,40 @@ public function setMimeType($mimeType) /** * @return PhotoSize */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize $thumbnail + * @return void + */ + public function setThumbnail(PhotoSize $thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null + */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** + * @deprecated use setThumbnail method + * * @param PhotoSize $thumb + * * @return void */ - public function setThumb(PhotoSize $thumb) + public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } /** diff --git a/src/Types/Inline/QueryResult/Article.php b/src/Types/Inline/QueryResult/Article.php index 411829da..8d48c0df 100644 --- a/src/Types/Inline/QueryResult/Article.php +++ b/src/Types/Inline/QueryResult/Article.php @@ -34,9 +34,9 @@ class Article extends AbstractInlineQueryResult 'url' => true, 'hide_url' => true, 'description' => true, - 'thumb_url' => true, - 'thumb_width' => true, - 'thumb_height' => true, + 'thumbnail_url' => true, + 'thumbnail_width' => true, + 'thumbnail_height' => true, ]; /** @@ -72,21 +72,21 @@ class Article extends AbstractInlineQueryResult * * @var string|null */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Thumbnail width * * @var int|null */ - protected $thumbWidth; + protected $thumbnailWidth; /** * Optional. Thumbnail height * * @var int|null */ - protected $thumbHeight; + protected $thumbnailHeight; /** * InlineQueryResultArticle constructor. @@ -94,9 +94,9 @@ class Article extends AbstractInlineQueryResult * @param string $id * @param string $title * @param string|null $description - * @param string|null $thumbUrl - * @param int|null $thumbWidth - * @param int|null $thumbHeight + * @param string|null $thumbnailUrl + * @param int|null $thumbnailWidth + * @param int|null $thumbnailHeight * @param InputMessageContent $inputMessageContent * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup */ @@ -104,18 +104,18 @@ public function __construct( $id, $title, $description = null, - $thumbUrl = null, - $thumbWidth = null, - $thumbHeight = null, + $thumbnailUrl = null, + $thumbnailWidth = null, + $thumbnailHeight = null, $inputMessageContent = null, $inlineKeyboardMarkup = null ) { parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); $this->description = $description; - $this->thumbUrl = $thumbUrl; - $this->thumbWidth = $thumbWidth; - $this->thumbHeight = $thumbHeight; + $this->thumbnailUrl = $thumbnailUrl; + $this->thumbnailWidth = $thumbnailWidth; + $this->thumbnailHeight = $thumbnailHeight; } /** @@ -175,54 +175,120 @@ public function setDescription($description) /** * @return string|null */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string|null $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string|null + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string|null $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); + } + + /** + * @return int|null + */ + public function getThumbnailWidth() + { + return $this->thumbnailWidth; } /** + * @param int|null $thumbnailWidth + * + * @return void + */ + public function setThumbnailWidth($thumbnailWidth) + { + $this->thumbnailWidth = $thumbnailWidth; + } + + /** + * @deprecated Use getThumbnailWidth + * * @return int|null */ public function getThumbWidth() { - return $this->thumbWidth; + return $this->getThumbnailWidth(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbWidth * * @return void */ public function setThumbWidth($thumbWidth) { - $this->thumbWidth = $thumbWidth; + $this->setThumbnailWidth($thumbWidth); + } + + /** + * @return int|null + */ + public function getThumbnailHeight() + { + return $this->thumbnailHeight; + } + + /** + * @param int|null $thumbnailHeight + * + * @return void + */ + public function setThumbnailHeight($thumbnailHeight) + { + $this->thumbnailHeight = $thumbnailHeight; } /** + * @deprecated Use getThumbnailHeight + * * @return int|null */ public function getThumbHeight() { - return $this->thumbHeight; + return $this->getThumbnailHeight(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbHeight * * @return void */ public function setThumbHeight($thumbHeight) { - $this->thumbHeight = $thumbHeight; + $this->setThumbnailHeight($thumbHeight); } } diff --git a/src/Types/Inline/QueryResult/Contact.php b/src/Types/Inline/QueryResult/Contact.php index f27de9c0..8e0f4347 100644 --- a/src/Types/Inline/QueryResult/Contact.php +++ b/src/Types/Inline/QueryResult/Contact.php @@ -33,9 +33,9 @@ class Contact extends AbstractInlineQueryResult 'last_name' => true, 'reply_markup' => InlineKeyboardMarkup::class, 'input_message_content' => InputMessageContent::class, - 'thumb_url' => true, - 'thumb_width' => true, - 'thumb_height' => true, + 'thumbnail_url' => true, + 'thumbnail_width' => true, + 'thumbnail_height' => true, ]; /** @@ -71,21 +71,21 @@ class Contact extends AbstractInlineQueryResult * * @var string|null */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Thumbnail width * * @var int|null */ - protected $thumbWidth; + protected $thumbnailWidth; /** * Optional. Thumbnail height * * @var int|null */ - protected $thumbHeight; + protected $thumbnailHeight; /** * Contact constructor. @@ -94,9 +94,9 @@ class Contact extends AbstractInlineQueryResult * @param string $phoneNumber * @param string $firstName * @param string $lastName - * @param string $thumbUrl - * @param int $thumbWidth - * @param int $thumbHeight + * @param string $thumbnailUrl + * @param int $thumbnailWidth + * @param int $thumbnailHeight * @param InputMessageContent|null $inputMessageContent * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup */ @@ -105,9 +105,9 @@ public function __construct( $phoneNumber, $firstName, $lastName = null, - $thumbUrl = null, - $thumbWidth = null, - $thumbHeight = null, + $thumbnailUrl = null, + $thumbnailWidth = null, + $thumbnailHeight = null, $inputMessageContent = null, $inlineKeyboardMarkup = null ) { @@ -116,9 +116,9 @@ public function __construct( $this->phoneNumber = $phoneNumber; $this->firstName = $firstName; $this->lastName = $lastName; - $this->thumbUrl = $thumbUrl; - $this->thumbWidth = $thumbWidth; - $this->thumbHeight = $thumbHeight; + $this->thumbnailUrl = $thumbnailUrl; + $this->thumbnailWidth = $thumbnailWidth; + $this->thumbnailHeight = $thumbnailHeight; } /** @@ -178,54 +178,120 @@ public function setLastName($lastName) /** * @return string|null */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string|null $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string|null + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string|null $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); } /** * @return int|null */ + public function getThumbnailWidth() + { + return $this->thumbnailWidth; + } + + /** + * @param int|null $thumbnailWidth + * + * @return void + */ + public function setThumbnailWidth($thumbnailWidth) + { + $this->thumbnailWidth = $thumbnailWidth; + } + + /** + * @deprecated Use getThumbnailWidth + * + * @return int|null + */ public function getThumbWidth() { - return $this->thumbWidth; + return $this->getThumbnailWidth(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbWidth * * @return void */ public function setThumbWidth($thumbWidth) { - $this->thumbWidth = $thumbWidth; + $this->setThumbnailWidth($thumbWidth); + } + + /** + * @return int|null + */ + public function getThumbnailHeight() + { + return $this->thumbnailHeight; } /** + * @param int|null $thumbnailHeight + * + * @return void + */ + public function setThumbnailHeight($thumbnailHeight) + { + $this->thumbnailHeight = $thumbnailHeight; + } + + /** + * @deprecated Use getThumbnailHeight + * * @return int|null */ public function getThumbHeight() { - return $this->thumbHeight; + return $this->getThumbnailHeight(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbHeight * * @return void */ public function setThumbHeight($thumbHeight) { - $this->thumbHeight = $thumbHeight; + $this->setThumbnailHeight($thumbHeight); } } diff --git a/src/Types/Inline/QueryResult/Gif.php b/src/Types/Inline/QueryResult/Gif.php index f23f51cc..1bf388ed 100644 --- a/src/Types/Inline/QueryResult/Gif.php +++ b/src/Types/Inline/QueryResult/Gif.php @@ -20,7 +20,7 @@ class Gif extends AbstractInlineQueryResult * * @var array */ - protected static $requiredParams = ['type', 'id', 'gif_url', 'thumb_url']; + protected static $requiredParams = ['type', 'id', 'gif_url', 'thumbnail_url']; /** * {@inheritdoc} @@ -33,7 +33,7 @@ class Gif extends AbstractInlineQueryResult 'gif_url' => true, 'gif_width' => true, 'gif_height' => true, - 'thumb_url' => true, + 'thumbnail_url' => true, 'title' => true, 'caption' => true, 'reply_markup' => InlineKeyboardMarkup::class, @@ -73,7 +73,7 @@ class Gif extends AbstractInlineQueryResult * * @var string */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Caption of the GIF file to be sent, 0-200 characters @@ -87,7 +87,7 @@ class Gif extends AbstractInlineQueryResult * * @param string $id * @param string $gifUrl - * @param string $thumbUrl + * @param string|null $thumbnailUrl * @param int|null $gifWidth * @param int|null $gifHeight * @param string|null $title @@ -98,7 +98,7 @@ class Gif extends AbstractInlineQueryResult public function __construct( $id, $gifUrl, - $thumbUrl = null, + $thumbnailUrl = null, $title = null, $caption = null, $gifWidth = null, @@ -109,7 +109,7 @@ public function __construct( parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); $this->gifUrl = $gifUrl; - $this->thumbUrl = is_null($thumbUrl) ? $gifUrl : $thumbUrl; + $this->thumbnailUrl = is_null($thumbnailUrl) ? $gifUrl : $thumbnailUrl; $this->gifWidth = $gifWidth; $this->gifHeight = $gifHeight; $this->caption = $caption; @@ -172,19 +172,41 @@ public function setGifHeight($gifHeight) /** * @return string */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); } /** diff --git a/src/Types/Inline/QueryResult/Location.php b/src/Types/Inline/QueryResult/Location.php index a9ddf98b..9c64339e 100644 --- a/src/Types/Inline/QueryResult/Location.php +++ b/src/Types/Inline/QueryResult/Location.php @@ -42,9 +42,9 @@ class Location extends AbstractInlineQueryResult 'latitude' => true, 'longitude' => true, 'title' => true, - 'thumb_url' => true, - 'thumb_width' => true, - 'thumb_height' => true, + 'thumbnail_url' => true, + 'thumbnail_width' => true, + 'thumbnail_height' => true, 'reply_markup' => InlineKeyboardMarkup::class, 'input_message_content' => InputMessageContent::class, ]; @@ -75,21 +75,21 @@ class Location extends AbstractInlineQueryResult * * @var string|null */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Thumbnail width * * @var int|null */ - protected $thumbWidth; + protected $thumbnailWidth; /** * Optional. Thumbnail height * * @var int|null */ - protected $thumbHeight; + protected $thumbnailHeight; /** * Voice constructor @@ -98,9 +98,9 @@ class Location extends AbstractInlineQueryResult * @param float $latitude * @param float $longitude * @param string $title - * @param string|null $thumbUrl - * @param int|null $thumbWidth - * @param int|null $thumbHeight + * @param string|null $thumbnailUrl + * @param int|null $thumbnailWidth + * @param int|null $thumbnailHeight * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup * @param InputMessageContent|null $inputMessageContent */ @@ -109,9 +109,9 @@ public function __construct( $latitude, $longitude, $title, - $thumbUrl = null, - $thumbWidth = null, - $thumbHeight = null, + $thumbnailUrl = null, + $thumbnailWidth = null, + $thumbnailHeight = null, $inlineKeyboardMarkup = null, $inputMessageContent = null ) { @@ -119,9 +119,9 @@ public function __construct( $this->latitude = $latitude; $this->longitude = $longitude; - $this->thumbUrl = $thumbUrl; - $this->thumbWidth = $thumbWidth; - $this->thumbHeight = $thumbHeight; + $this->thumbnailUrl = $thumbnailUrl; + $this->thumbnailWidth = $thumbnailWidth; + $this->thumbnailHeight = $thumbnailHeight; } /** @@ -163,54 +163,120 @@ public function setLongitude($longitude) /** * @return string|null */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string|null $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string|null + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string|null $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); + } + + /** + * @return int|null + */ + public function getThumbnailWidth() + { + return $this->thumbnailWidth; } /** + * @param int|null $thumbnailWidth + * + * @return void + */ + public function setThumbnailWidth($thumbnailWidth) + { + $this->thumbnailWidth = $thumbnailWidth; + } + + /** + * @deprecated Use getThumbnailWidth + * * @return int|null */ public function getThumbWidth() { - return $this->thumbWidth; + return $this->getThumbnailWidth(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbWidth * * @return void */ public function setThumbWidth($thumbWidth) { - $this->thumbWidth = $thumbWidth; + $this->setThumbnailWidth($thumbWidth); + } + + /** + * @return int|null + */ + public function getThumbnailHeight() + { + return $this->thumbnailHeight; + } + + /** + * @param int|null $thumbnailHeight + * + * @return void + */ + public function setThumbnailHeight($thumbnailHeight) + { + $this->thumbnailHeight = $thumbnailHeight; } /** + * @deprecated Use getThumbnailHeight + * * @return int|null */ public function getThumbHeight() { - return $this->thumbHeight; + return $this->getThumbnailHeight(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbHeight * * @return void */ public function setThumbHeight($thumbHeight) { - $this->thumbHeight = $thumbHeight; + $this->setThumbnailHeight($thumbHeight); } } diff --git a/src/Types/Inline/QueryResult/Mpeg4Gif.php b/src/Types/Inline/QueryResult/Mpeg4Gif.php index 59d7b39f..f5e5cce1 100644 --- a/src/Types/Inline/QueryResult/Mpeg4Gif.php +++ b/src/Types/Inline/QueryResult/Mpeg4Gif.php @@ -20,7 +20,7 @@ class Mpeg4Gif extends AbstractInlineQueryResult * * @var array */ - protected static $requiredParams = ['type', 'id', 'mpeg4_url', 'thumb_url']; + protected static $requiredParams = ['type', 'id', 'mpeg4_url', 'thumbnail_url']; /** * {@inheritdoc} @@ -33,7 +33,7 @@ class Mpeg4Gif extends AbstractInlineQueryResult 'mpeg4_url' => true, 'mpeg4_width' => true, 'mpeg4_height' => true, - 'thumb_url' => true, + 'thumbnail_url' => true, 'title' => true, 'caption' => true, 'reply_markup' => InlineKeyboardMarkup::class, @@ -73,7 +73,7 @@ class Mpeg4Gif extends AbstractInlineQueryResult * * @var string */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Caption of the MPEG-4 file to be sent, 0-200 characters @@ -87,7 +87,7 @@ class Mpeg4Gif extends AbstractInlineQueryResult * * @param string $id * @param string $mpeg4Url - * @param string $thumbUrl + * @param string $thumbnailUrl * @param int|null $mpeg4Width * @param int|null $mpeg4Height * @param string|null $caption @@ -98,7 +98,7 @@ class Mpeg4Gif extends AbstractInlineQueryResult public function __construct( $id, $mpeg4Url, - $thumbUrl, + $thumbnailUrl, $title = null, $caption = null, $mpeg4Width = null, @@ -109,7 +109,7 @@ public function __construct( parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); $this->mpeg4Url = $mpeg4Url; - $this->thumbUrl = $thumbUrl; + $this->thumbnailUrl = $thumbnailUrl; $this->mpeg4Width = $mpeg4Width; $this->mpeg4Height = $mpeg4Height; $this->caption = $caption; @@ -172,19 +172,41 @@ public function setMpeg4Height($mpeg4Height) /** * @return string */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); } /** diff --git a/src/Types/Inline/QueryResult/Photo.php b/src/Types/Inline/QueryResult/Photo.php index 97249054..e53d9408 100644 --- a/src/Types/Inline/QueryResult/Photo.php +++ b/src/Types/Inline/QueryResult/Photo.php @@ -19,7 +19,7 @@ class Photo extends AbstractInlineQueryResult * * @var array */ - protected static $requiredParams = ['type', 'id', 'photo_url', 'thumb_url']; + protected static $requiredParams = ['type', 'id', 'photo_url', 'thumbnail_url']; /** * {@inheritdoc} @@ -30,7 +30,7 @@ class Photo extends AbstractInlineQueryResult 'type' => true, 'id' => true, 'photo_url' => true, - 'thumb_url' => true, + 'thumbnail_url' => true, 'photo_width' => true, 'photo_height' => true, 'title' => true, @@ -73,7 +73,7 @@ class Photo extends AbstractInlineQueryResult * * @var string */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Short description of the result @@ -94,7 +94,7 @@ class Photo extends AbstractInlineQueryResult * * @param string $id * @param string $photoUrl - * @param string $thumbUrl + * @param string $thumbnailUrl * @param int|null $photoWidth * @param int|null $photoHeight * @param string|null $title @@ -106,7 +106,7 @@ class Photo extends AbstractInlineQueryResult public function __construct( $id, $photoUrl, - $thumbUrl, + $thumbnailUrl, $photoWidth = null, $photoHeight = null, $title = null, @@ -118,7 +118,7 @@ public function __construct( parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); $this->photoUrl = $photoUrl; - $this->thumbUrl = $thumbUrl; + $this->thumbnailUrl = $thumbnailUrl; $this->photoWidth = $photoWidth; $this->photoHeight = $photoHeight; $this->description = $description; @@ -182,19 +182,41 @@ public function setPhotoHeight($photoHeight) /** * @return string */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); } /** diff --git a/src/Types/Inline/QueryResult/Venue.php b/src/Types/Inline/QueryResult/Venue.php index 48e4e011..34631044 100644 --- a/src/Types/Inline/QueryResult/Venue.php +++ b/src/Types/Inline/QueryResult/Venue.php @@ -44,9 +44,9 @@ class Venue extends AbstractInlineQueryResult 'title' => true, 'address' => true, 'foursquare_id' => true, - 'thumb_url' => true, - 'thumb_width' => true, - 'thumb_height' => true, + 'thumbnail_url' => true, + 'thumbnail_width' => true, + 'thumbnail_height' => true, 'reply_markup' => InlineKeyboardMarkup::class, 'input_message_content' => InputMessageContent::class, ]; @@ -84,21 +84,21 @@ class Venue extends AbstractInlineQueryResult * * @var string|null */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Thumbnail width * * @var int|null */ - protected $thumbWidth; + protected $thumbnailWidth; /** * Optional. Thumbnail height * * @var int|null */ - protected $thumbHeight; + protected $thumbnailHeight; /** * Optional. Foursquare identifier of the venue if known @@ -115,9 +115,9 @@ class Venue extends AbstractInlineQueryResult * @param float $longitude * @param string $title * @param string $address - * @param string|null $thumbUrl - * @param int|null $thumbWidth - * @param int|null $thumbHeight + * @param string|null $thumbnailUrl + * @param int|null $thumbnailWidth + * @param int|null $thumbnailHeight * @param string|null $foursquareId * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup * @param InputMessageContent|null $inputMessageContent @@ -128,9 +128,9 @@ public function __construct( $longitude, $title, $address, - $thumbUrl = null, - $thumbWidth = null, - $thumbHeight = null, + $thumbnailUrl = null, + $thumbnailWidth = null, + $thumbnailHeight = null, $foursquareId = null, $inputMessageContent = null, $inlineKeyboardMarkup = null @@ -140,9 +140,9 @@ public function __construct( $this->latitude = $latitude; $this->longitude = $longitude; $this->address = $address; - $this->thumbUrl = $thumbUrl; - $this->thumbWidth = $thumbWidth; - $this->thumbHeight = $thumbHeight; + $this->thumbnailUrl = $thumbnailUrl; + $this->thumbnailWidth = $thumbnailWidth; + $this->thumbnailHeight = $thumbnailHeight; $this->foursquareId = $foursquareId; } @@ -221,54 +221,120 @@ public function setFoursquareId($foursquareId) /** * @return string|null */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string|null $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string|null + */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** + * @deprecated Use setThumbnailUrl + * * @param string|null $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); + } + + /** + * @return int|null + */ + public function getThumbnailWidth() + { + return $this->thumbnailWidth; } /** + * @param int|null $thumbnailWidth + * + * @return void + */ + public function setThumbnailWidth($thumbnailWidth) + { + $this->thumbnailWidth = $thumbnailWidth; + } + + /** + * @deprecated Use getThumbnailWidth + * * @return int|null */ public function getThumbWidth() { - return $this->thumbWidth; + return $this->getThumbnailWidth(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbWidth * * @return void */ public function setThumbWidth($thumbWidth) { - $this->thumbWidth = $thumbWidth; + $this->setThumbnailWidth($thumbWidth); + } + + /** + * @return int|null + */ + public function getThumbnailHeight() + { + return $this->thumbnailHeight; + } + + /** + * @param int|null $thumbnailHeight + * + * @return void + */ + public function setThumbnailHeight($thumbnailHeight) + { + $this->thumbnailHeight = $thumbnailHeight; } /** + * @deprecated Use getThumbnailHeight + * * @return int|null */ public function getThumbHeight() { - return $this->thumbHeight; + return $this->getThumbnailHeight(); } /** + * @deprecated Use setThumbnailWidth + * * @param int|null $thumbHeight * * @return void */ public function setThumbHeight($thumbHeight) { - $this->thumbHeight = $thumbHeight; + $this->setThumbnailHeight($thumbHeight); } } diff --git a/src/Types/Inline/QueryResult/Video.php b/src/Types/Inline/QueryResult/Video.php index 48cbc8e5..9eec6962 100644 --- a/src/Types/Inline/QueryResult/Video.php +++ b/src/Types/Inline/QueryResult/Video.php @@ -18,7 +18,7 @@ class Video extends AbstractInlineQueryResult * * @var array */ - protected static $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumb_url', 'title']; + protected static $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumbnail_url', 'title']; /** * {@inheritdoc} @@ -30,7 +30,7 @@ class Video extends AbstractInlineQueryResult 'id' => true, 'video_url' => true, 'mime_type' => true, - 'thumb_url' => true, + 'thumbnail_url' => true, 'title' => true, 'caption' => true, 'description' => true, @@ -88,7 +88,7 @@ class Video extends AbstractInlineQueryResult * * @var string */ - protected $thumbUrl; + protected $thumbnailUrl; /** * Optional. Short description of the result @@ -109,7 +109,7 @@ class Video extends AbstractInlineQueryResult * * @param string $id * @param string $videoUrl - * @param string $thumbUrl + * @param string $thumbnailUrl * @param string $mimeType * @param string $title * @param string|null $caption @@ -123,7 +123,7 @@ class Video extends AbstractInlineQueryResult public function __construct( $id, $videoUrl, - $thumbUrl, + $thumbnailUrl, $mimeType, $title, $caption = null, @@ -137,7 +137,7 @@ public function __construct( parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); $this->videoUrl = $videoUrl; - $this->thumbUrl = $thumbUrl; + $this->thumbnailUrl = $thumbnailUrl; $this->caption = $caption; $this->description = $description; $this->mimeType = $mimeType; @@ -237,21 +237,43 @@ public function setVideoDuration($videoDuration) } /** - * @return mixed + * @return string + */ + public function getThumbnailUrl() + { + return $this->thumbnailUrl; + } + + /** + * @param string $thumbnailUrl + * + * @return void + */ + public function setThumbnailUrl($thumbnailUrl) + { + $this->thumbnailUrl = $thumbnailUrl; + } + + /** + * @deprecated Use getThumbnailUrl + * + * @return string */ public function getThumbUrl() { - return $this->thumbUrl; + return $this->getThumbnailUrl(); } /** - * @param mixed $thumbUrl + * @deprecated Use setThumbnailUrl + * + * @param string $thumbUrl * * @return void */ public function setThumbUrl($thumbUrl) { - $this->thumbUrl = $thumbUrl; + $this->setThumbnailUrl($thumbUrl); } /** diff --git a/src/Types/Sticker.php b/src/Types/Sticker.php index 8f2c91ef..3a948caf 100644 --- a/src/Types/Sticker.php +++ b/src/Types/Sticker.php @@ -42,7 +42,7 @@ class Sticker extends BaseType implements TypeInterface 'height' => true, 'is_animated' => true, 'is_video' => true, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, 'file_size' => true, 'premium_animation' => File::class, 'emoji' => true, @@ -77,7 +77,7 @@ class Sticker extends BaseType implements TypeInterface * * @var PhotoSize|null */ - protected $thumb; + protected $thumbnail; /** * Optional. File size @@ -221,19 +221,41 @@ public function setHeight($height) /** * @return PhotoSize|null */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize $thumbnail + * + * @return void + */ + public function setThumbnail(PhotoSize $thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null + */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** + * @deprecated use setThumbnail method + * * @param PhotoSize $thumb * * @return void */ - public function setThumb(PhotoSize $thumb) + public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } /** diff --git a/src/Types/StickerSet.php b/src/Types/StickerSet.php index 5127238f..6f038bea 100644 --- a/src/Types/StickerSet.php +++ b/src/Types/StickerSet.php @@ -33,7 +33,7 @@ class StickerSet extends BaseType implements TypeInterface 'is_animated' => true, 'is_video' => true, 'stickers' => ArrayOfSticker::class, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, ]; /** @@ -83,7 +83,7 @@ class StickerSet extends BaseType implements TypeInterface * * @var PhotoSize|null */ - protected $thumb; + protected $thumbnail; /** * @return string @@ -196,18 +196,40 @@ public function setStickers($stickers) /** * @return PhotoSize|null */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize $thumbnail + * + * @return void + */ + public function setThumbnail($thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null + */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** + * @deprecated use setThumbnail method + * * @param PhotoSize $thumb * * @return void */ public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } } diff --git a/src/Types/Video.php b/src/Types/Video.php index b0ef4a75..abf79e8a 100644 --- a/src/Types/Video.php +++ b/src/Types/Video.php @@ -32,7 +32,7 @@ class Video extends BaseType implements TypeInterface 'width' => true, 'height' => true, 'duration' => true, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, 'mime_type' => true, 'file_size' => true ]; @@ -68,9 +68,9 @@ class Video extends BaseType implements TypeInterface /** * Video thumbnail * - * @var PhotoSize + * @var PhotoSize|null */ - protected $thumb; + protected $thumbnail; /** * Optional. Mime type of a file as defined by sender @@ -202,21 +202,43 @@ public function setMimeType($mimeType) } /** - * @return PhotoSize + * @return PhotoSize|null + */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize|null $thumbnail + * + * @return void + */ + public function setThumbnail($thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** - * @param PhotoSize $thumb + * @deprecated use setThumbnail method + * + * @param PhotoSize|null $thumb * * @return void */ - public function setThumb(PhotoSize $thumb) + public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } /** diff --git a/src/Types/VideoNote.php b/src/Types/VideoNote.php index a10325a3..a33ae9cc 100644 --- a/src/Types/VideoNote.php +++ b/src/Types/VideoNote.php @@ -20,7 +20,7 @@ class VideoNote extends BaseType implements TypeInterface 'file_unique_id' => true, 'length' => true, 'duration' => true, - 'thumb' => PhotoSize::class, + 'thumbnail' => PhotoSize::class, 'file_size' => true, ]; @@ -57,7 +57,7 @@ class VideoNote extends BaseType implements TypeInterface * * @var PhotoSize|null */ - protected $thumb; + protected $thumbnail; /** * Optional. File size in bytes @@ -141,19 +141,41 @@ public function setDuration($duration) /** * @return PhotoSize|null */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * @param PhotoSize $thumbnail + * + * @return void + */ + public function setThumbnail($thumbnail) + { + $this->thumbnail = $thumbnail; + } + + /** + * @deprecated use getThumbnail method + * + * @return PhotoSize|null + */ public function getThumb() { - return $this->thumb; + return $this->getThumbnail(); } /** + * @deprecated use setThumbnail method + * * @param PhotoSize $thumb * * @return void */ public function setThumb($thumb) { - $this->thumb = $thumb; + $this->setThumbnail($thumb); } /** diff --git a/tests/Types/AnimationTest.php b/tests/Types/AnimationTest.php index be885545..9aba5b58 100644 --- a/tests/Types/AnimationTest.php +++ b/tests/Types/AnimationTest.php @@ -32,7 +32,7 @@ public static function getFullResponse() 'width' => 10, 'height' => 20, 'duration' => 30, - 'thumb' => PhotoSizeTest::getMinResponse(), + 'thumbnail' => PhotoSizeTest::getMinResponse(), 'file_name' => 'file_name', 'mime_type' => 'mime_type', 'file_size' => 100 @@ -50,7 +50,7 @@ protected function assertMinItem($item) $this->assertEquals(10, $item->getWidth()); $this->assertEquals(20, $item->getHeight()); $this->assertEquals(30, $item->getDuration()); - $this->assertNull($item->getThumb()); + $this->assertNull($item->getThumbnail()); $this->assertNull($item->getFileName()); $this->assertNull($item->getMimeType()); $this->assertNull($item->getFileSize()); @@ -67,7 +67,7 @@ protected function assertFullItem($item) $this->assertEquals(10, $item->getWidth()); $this->assertEquals(20, $item->getHeight()); $this->assertEquals(30, $item->getDuration()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); $this->assertEquals('file_name', $item->getFileName()); $this->assertEquals('mime_type', $item->getMimeType()); $this->assertEquals(100, $item->getFileSize()); diff --git a/tests/Types/DocumentTest.php b/tests/Types/DocumentTest.php index f482c4a9..a0734669 100644 --- a/tests/Types/DocumentTest.php +++ b/tests/Types/DocumentTest.php @@ -29,7 +29,7 @@ public static function getFullResponse() 'file_name' => 'testFileName', 'mime_type' => 'audio/mp3', 'file_size' => 3, - 'thumb' => PhotoSizeTest::getMinResponse(), + 'thumbnail' => PhotoSizeTest::getMinResponse(), ]; } @@ -44,7 +44,7 @@ protected function assertMinItem($item) $this->assertNull($item->getFileName()); $this->assertNull($item->getMimeType()); $this->assertNull($item->getFileSize()); - $this->assertNull($item->getThumb()); + $this->assertNull($item->getThumbnail()); } /** @@ -58,7 +58,7 @@ protected function assertFullItem($item) $this->assertEquals('testFileName', $item->getFileName()); $this->assertEquals('audio/mp3', $item->getMimeType()); $this->assertEquals(3, $item->getFileSize()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); } public function testSetFileSizeException() @@ -80,7 +80,7 @@ public function testFromResponseException1() 'file_name' => 'testFileName', 'mime_type' => 'audio/mp3', 'file_size' => 3, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'file_unique_id' => 'testFileUniqueId1', 'width' => 5, diff --git a/tests/Types/StickerSetTest.php b/tests/Types/StickerSetTest.php index e5867ba8..b15ab212 100644 --- a/tests/Types/StickerSetTest.php +++ b/tests/Types/StickerSetTest.php @@ -37,7 +37,7 @@ public static function getFullResponse() 'stickers' => [ StickerTest::getMinResponse(), ], - 'thumb' => PhotoSizeTest::getMinResponse(), + 'thumbnail' => PhotoSizeTest::getMinResponse(), ]; } @@ -53,7 +53,7 @@ protected function assertMinItem($item) $this->assertEquals(true, $item->getIsAnimated()); $this->assertEquals(true, $item->getIsVideo()); $this->assertEquals([StickerTest::createMinInstance()], $item->getStickers()); - $this->assertNull($item->getThumb()); + $this->assertNull($item->getThumbnail()); } /** @@ -68,6 +68,6 @@ protected function assertFullItem($item) $this->assertEquals(true, $item->getIsAnimated()); $this->assertEquals(true, $item->getIsVideo()); $this->assertEquals([StickerTest::createMinInstance()], $item->getStickers()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); } } diff --git a/tests/Types/StickerTest.php b/tests/Types/StickerTest.php index e9a614e3..cd880d50 100644 --- a/tests/Types/StickerTest.php +++ b/tests/Types/StickerTest.php @@ -39,7 +39,7 @@ public static function getFullResponse() 'file_size' => 3, 'premium_animation' => FileTest::getMinResponse(), 'emoji' => '🎉', - 'thumb' => PhotoSizeTest::getMinResponse(), + 'thumbnail' => PhotoSizeTest::getMinResponse(), 'set_name' => 'set', 'custom_emoji_id' => 'custom_emoji_id', 'mask_position' => MaskPositionTest::getMinResponse(), @@ -80,7 +80,7 @@ protected function assertFullItem($item) $this->assertEquals('set', $item->getSetName()); $this->assertEquals('custom_emoji_id', $item->getCustomEmojiId()); $this->assertEquals(MaskPositionTest::createMinInstance(), $item->getMaskPosition()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); } public function testSetFileSizeException() diff --git a/tests/Types/VideoNoteTest.php b/tests/Types/VideoNoteTest.php index c4f2d471..b0197075 100644 --- a/tests/Types/VideoNoteTest.php +++ b/tests/Types/VideoNoteTest.php @@ -29,7 +29,7 @@ public static function getFullResponse() 'file_unique_id' => 'file_unique_id', 'length' => 1, 'duration' => 2, - 'thumb' => PhotoSizeTest::getMinResponse(), + 'thumbnail' => PhotoSizeTest::getMinResponse(), 'file_size' => 3, ]; } @@ -45,7 +45,7 @@ protected function assertMinItem($item) $this->assertEquals(1, $item->getLength()); $this->assertEquals(2, $item->getDuration()); $this->assertNull($item->getFileSize()); - $this->assertNull($item->getThumb()); + $this->assertNull($item->getThumbnail()); } /** @@ -59,6 +59,6 @@ protected function assertFullItem($item) $this->assertEquals(1, $item->getLength()); $this->assertEquals(2, $item->getDuration()); $this->assertEquals(3, $item->getFileSize()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); } } diff --git a/tests/Types/VideoTest.php b/tests/Types/VideoTest.php index a90955f3..d74a5489 100644 --- a/tests/Types/VideoTest.php +++ b/tests/Types/VideoTest.php @@ -34,7 +34,7 @@ public static function getFullResponse() 'duration' => 3, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => PhotoSizeTest::getMinResponse() + 'thumbnail' => PhotoSizeTest::getMinResponse() ]; } @@ -51,7 +51,7 @@ protected function assertMinItem($item) $this->assertEquals(3, $item->getDuration()); $this->assertNull($item->getMimeType()); $this->assertNull($item->getFileSize()); - $this->assertNull($item->getThumb()); + $this->assertNull($item->getThumbnail()); } /** @@ -67,7 +67,7 @@ protected function assertFullItem($item) $this->assertEquals(3, $item->getDuration()); $this->assertEquals('video/mp4', $item->getMimeType()); $this->assertEquals(4, $item->getFileSize()); - $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumb()); + $this->assertEquals(PhotoSizeTest::createMinInstance(), $item->getThumbnail()); } public function testSetHeightException() @@ -116,7 +116,7 @@ public function testFromResponseException1() 'duration' => 3, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'width' => 5, 'height' => 6, @@ -138,7 +138,7 @@ public function testFromResponseException2() 'duration' => 3, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'file_unique_id' => 'testFileUniqueId1', 'width' => 5, @@ -162,7 +162,7 @@ public function testFromResponseException3() 'duration' => 3, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'file_unique_id' => 'testFileUniqueId1', 'width' => 5, @@ -186,7 +186,7 @@ public function testFromResponseException4() 'height' => 2, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'file_unique_id' => 'testFileUniqueId1', 'width' => 5, @@ -210,7 +210,7 @@ public function testFromResponseException5() 'duration' => 1, 'mime_type' => 'video/mp4', 'file_size' => 4, - 'thumb' => [ + 'thumbnail' => [ 'file_id' => 'testFileId1', 'file_unique_id' => 'testFileUniqueId1', 'width' => 5,