From a1ec9fdb13f1a9849af20c50d5edd006c1122e38 Mon Sep 17 00:00:00 2001 From: Netkas Date: Wed, 9 Aug 2023 18:52:00 -0400 Subject: [PATCH] Code fixes in \TgBotLib\Objects\Telegram\InlineQueryResult > InlineQueryResultMpeg4Gif --- .../InlineQueryResultMpeg4Gif.php | 165 +++++++++++++++++- 1 file changed, 161 insertions(+), 4 deletions(-) diff --git a/src/TgBotLib/Objects/Telegram/InlineQueryResult/InlineQueryResultMpeg4Gif.php b/src/TgBotLib/Objects/Telegram/InlineQueryResult/InlineQueryResultMpeg4Gif.php index 9c383c2..007f181 100644 --- a/src/TgBotLib/Objects/Telegram/InlineQueryResult/InlineQueryResultMpeg4Gif.php +++ b/src/TgBotLib/Objects/Telegram/InlineQueryResult/InlineQueryResultMpeg4Gif.php @@ -1,5 +1,6 @@ id; } + /** + * Sets the value of the 'id' field + * + * @param string $id + * @return $this + */ + public function setId(string $id): InlineQueryResultMpeg4Gif + { + $this->id = $id; + return $this; + } + /** * A valid URL for the MPEG4 file. File size must not exceed 1MB * @@ -123,6 +136,18 @@ return $this->mpeg4_url; } + /** + * + * + * @param string $mpeg4_url + * @return $this + */ + public function setMpeg4Url(string $mpeg4_url): InlineQueryResultMpeg4Gif + { + $this->mpeg4_url = $mpeg4_url; + return $this; + } + /** * Optional. Video width * @@ -133,6 +158,18 @@ return $this->mpeg4_width; } + /** + * Optional. Video width + * + * @param int|null $mpeg4_width + * @return $this + */ + public function setMpeg4Width(?int $mpeg4_width): InlineQueryResultMpeg4Gif + { + $this->mpeg4_width = $mpeg4_width; + return $this; + } + /** * Optional. Video height * @@ -143,6 +180,18 @@ return $this->mpeg4_height; } + /** + * Optional. Video height + * + * @param int|null $mpeg4_height + * @return $this + */ + public function setMpeg4Height(?int $mpeg4_height): InlineQueryResultMpeg4Gif + { + $this->mpeg4_height = $mpeg4_height; + return $this; + } + /** * Optional. Video duration in seconds * @@ -153,6 +202,18 @@ return $this->mpeg4_duration; } + /** + * Optional. Video duration in seconds + * + * @param int|null $mpeg4_duration + * @return $this + */ + public function setMpeg4Duration(?int $mpeg4_duration): InlineQueryResultMpeg4Gif + { + $this->mpeg4_duration = $mpeg4_duration; + return $this; + } + /** * URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result * @@ -164,7 +225,19 @@ } /** - * Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” + * URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result + * + * @param string $thumbnail_url + * @return $this + */ + public function setThumbnailUrl(string $thumbnail_url): InlineQueryResultMpeg4Gif + { + $this->thumbnail_url = $thumbnail_url; + return $this; + } + + /** + * Optional. MIME type of the thumbnail must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” * * @return string|null */ @@ -173,6 +246,18 @@ return $this->thumbnail_mime_type; } + /** + * Optional. MIME type of the thumbnail must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” + * + * @param string|null $thumbnail_mime_type + * @return $this + */ + public function setThumbnailMimeType(?string $thumbnail_mime_type): InlineQueryResultMpeg4Gif + { + $this->thumbnail_mime_type = $thumbnail_mime_type; + return $this; + } + /** * Optional. Title for the result * @@ -183,6 +268,18 @@ return $this->title; } + /** + * Optional. Title for the result + * + * @param string|null $title + * @return $this + */ + public function setTitle(?string $title): InlineQueryResultMpeg4Gif + { + $this->title = $title; + return $this; + } + /** * Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing * @@ -193,6 +290,18 @@ return $this->caption; } + /** + * Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing + * + * @param string|null $caption + * @return $this + */ + public function setCaption(?string $caption): InlineQueryResultMpeg4Gif + { + $this->caption = $caption; + return $this; + } + /** * Optional. Mode for parsing entities in the caption. See formatting options for more details. * @@ -203,6 +312,18 @@ return $this->parse_mode; } + /** + * Optional. Mode for parsing entities in the caption. See formatting options for more details. + * + * @param string|null $parse_mode + * @return $this + */ + public function setParseMode(?string $parse_mode): InlineQueryResultMpeg4Gif + { + $this->parse_mode = $parse_mode; + return $this; + } + /** * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode * @@ -213,6 +334,18 @@ return $this->caption_entities; } + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * + * @param MessageEntity[]|null $caption_entities + * @return $this + */ + public function setCaptionEntities(?array $caption_entities): InlineQueryResultMpeg4Gif + { + $this->caption_entities = $caption_entities; + return $this; + } + /** * Optional. Inline keyboard attached to the message * @@ -223,6 +356,18 @@ return $this->reply_markup; } + /** + * Optional. Inline keyboard attached to the message + * + * @param InlineKeyboardMarkup|null $reply_markup + * @return $this + */ + public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultMpeg4Gif + { + $this->reply_markup = $reply_markup; + return $this; + } + /** * Optional. Content of the message to be sent instead of the video animation * @@ -233,6 +378,18 @@ return $this->input_message_content; } + /** + * Optional. Content of the message to be sent instead of the video animation + * + * @param InputContactMessageContent|InputInvoiceMessageContent|InputLocationMessageContent|InputTextMessageContent|InputVenueMessageContent|null $input_message_content + * @return $this + */ + public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content): InlineQueryResultMpeg4Gif + { + $this->input_message_content = $input_message_content; + return $this; + } + /** * Returns an array representation of the object * @@ -252,7 +409,7 @@ 'title' => $this->title ?? null, 'caption' => $this->caption ?? null, 'parse_mode' => $this->parse_mode ?? null, - 'caption_entities' => ($this->caption_entities ?? null) ? array_map(function (MessageEntity $item) { + 'caption_entities' => ($this->caption_entities ?? null) ? array_map(static function (MessageEntity $item) { return $item->toArray(); }, $this->caption_entities) : null, 'reply_markup' => ($this->reply_markup ?? null) ? $this->reply_markup->toArray() : null, @@ -262,7 +419,7 @@ } /** - * Constructs object from an array representation + * Constructs an object from an array representation * * @param array $data * @return ObjectTypeInterface @@ -283,7 +440,7 @@ $object->title = $data['title'] ?? null; $object->caption = $data['caption'] ?? null; $object->parse_mode = $data['parse_mode'] ?? null; - $object->caption_entities = array_map(function ($item) { + $object->caption_entities = array_map(static function ($item) { return MessageEntity::fromArray($item); }, $data['caption_entities'] ?? []); $object->reply_markup = ($data['reply_markup'] ?? null) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;