Skip to content

Commit

Permalink
update types
Browse files Browse the repository at this point in the history
  • Loading branch information
madmages committed Mar 27, 2020
1 parent 19d4150 commit 3de93b6
Show file tree
Hide file tree
Showing 44 changed files with 1,221 additions and 91 deletions.
107 changes: 83 additions & 24 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract public function _rawApiCall(string $method, array $parameters);
* should be used for testing purposes only.
*
* @param string[] $allowedUpdates
* List the types of updates you want your bot to receive. For example, specify [“message”,
* A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”,
* “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available
* update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the
* previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getUpdates(
* throughput.
*
* @param string[] $allowedUpdates
* List the types of updates you want your bot to receive. For example, specify [“message”,
* A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”,
* “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available
* update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the
* previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the
Expand Down Expand Up @@ -165,7 +165,7 @@ public function getMe(
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*
* @param string $text
* Text of the message to be sent
* Text of the message to be sent, 1-4096 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your
Expand Down Expand Up @@ -260,7 +260,7 @@ public function forwardMessage(
* More info on Sending Files »
*
* @param string $caption
* Photo caption (may also be used when resending photos by file_id), 0-1024 characters
* Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -305,9 +305,9 @@ public function sendPhoto(
* https://core.telegram.org/bots/api#sendaudio
*
* Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must
* be in the .mp3 format. On success, the sent Message is
* returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice
* messages, use the sendVoice method instead.
* be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For
* sending voice messages, use the sendVoice method
* instead.
*
* @param int|string $chatId
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Expand All @@ -318,7 +318,7 @@ public function sendPhoto(
* multipart/form-data. More info on Sending Files »
*
* @param string $caption
* Audio caption, 0-1024 characters
* Audio caption, 0-1024 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -404,7 +404,8 @@ public function sendAudio(
* multipart/form-data under <file_attach_name>. More info on Sending Files »
*
* @param string $caption
* Document caption (may also be used when resending documents by file_id), 0-1024 characters
* Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities
* parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -478,7 +479,7 @@ public function sendDocument(
* multipart/form-data under <file_attach_name>. More info on Sending Files »
*
* @param string $caption
* Video caption (may also be used when resending videos by file_id), 0-1024 characters
* Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -562,7 +563,8 @@ public function sendVideo(
* multipart/form-data under <file_attach_name>. More info on Sending Files »
*
* @param string $caption
* Animation caption (may also be used when resending animation by file_id), 0-1024 characters
* Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities
* parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -615,7 +617,7 @@ public function sendAnimation(
* https://core.telegram.org/bots/api#sendvoice
*
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For
* this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
* this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
*
* @param int|string $chatId
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Expand All @@ -626,7 +628,7 @@ public function sendAnimation(
* multipart/form-data. More info on Sending Files »
*
* @param string $caption
* Voice message caption, 0-1024 characters
* Voice message caption, 0-1024 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -1039,17 +1041,31 @@ public function sendContact(
/**
* https://core.telegram.org/bots/api#sendpoll
*
* Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned.
* Use this method to send a native poll. On success, the sent Message is returned.
*
* @param int|string $chatId
* Unique identifier for the target chat or username of the target channel (in the format @channelusername). A
* native poll can't be sent to a private chat.
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*
* @param string $question
* Poll question, 1-255 characters
*
* @param string[] $options
* List of answer options, 2-10 strings 1-100 characters each
* A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
*
* @param bool $isAnonymous
* True, if the poll needs to be anonymous, defaults to True
*
* @param string $type
* Poll type, “quiz” or “regular”, defaults to “regular”
*
* @param bool $allowsMultipleAnswers
* True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
*
* @param int $correctOptionId
* 0-based identifier of the correct answer option, required for polls in quiz mode
*
* @param bool $isClosed
* Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
*
* @param bool $disableNotification
* Sends the message silently. Users will receive a notification with no sound.
Expand All @@ -1067,6 +1083,11 @@ public function sendPoll(
$chatId,
string $question,
array $options,
bool $isAnonymous = null,
string $type = null,
bool $allowsMultipleAnswers = null,
int $correctOptionId = null,
bool $isClosed = null,
bool $disableNotification = null,
int $replyToMessageId = null,
$replyMarkup = null
Expand All @@ -1076,6 +1097,11 @@ public function sendPoll(
'chat_id' => $chatId,
'question' => $question,
'options' => $options,
'is_anonymous' => $isAnonymous,
'type' => $type,
'allows_multiple_answers' => $allowsMultipleAnswers,
'correct_option_id' => $correctOptionId,
'is_closed' => $isClosed,
'disable_notification' => $disableNotification,
'reply_to_message_id' => $replyToMessageId,
'reply_markup' => $replyMarkup,
Expand Down Expand Up @@ -1345,6 +1371,39 @@ public function promoteChatMember(
return $this->_rawApiCall('promoteChatMember', $requestParameters);
}

/**
* https://core.telegram.org/bots/api#setchatadministratorcustomtitle
*
* Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True
* on success.
*
* @param int|string $chatId
* Unique identifier for the target chat or username of the target supergroup (in the format
* @supergroupusername)
*
* @param int $userId
* Unique identifier of the target user
*
* @param string $customTitle
* New custom title for the administrator; 0-16 characters, emoji are not allowed
*
* @return mixed
*/
public function setChatAdministratorCustomTitle(
$chatId,
int $userId,
string $customTitle
)
{
$requestParameters = [
'chat_id' => $chatId,
'user_id' => $userId,
'custom_title' => $customTitle,
];

return $this->_rawApiCall('setChatAdministratorCustomTitle', $requestParameters);
}

/**
* https://core.telegram.org/bots/api#setchatpermissions
*
Expand Down Expand Up @@ -1777,7 +1836,7 @@ public function answerCallbackQuery(
* success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
*
* @param string $text
* New text of the message
* New text of the message, 1-4096 characters after entities parsing
*
* @param int|string $chatId
* Required if inline_message_id is not specified. Unique identifier for the target chat or username of the
Expand Down Expand Up @@ -1840,7 +1899,7 @@ public function editMessageText(
* Required if chat_id and message_id are not specified. Identifier of the inline message
*
* @param string $caption
* New caption of the message
* New caption of the message, 0-1024 characters after entities parsing
*
* @param string $parseMode
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the
Expand Down Expand Up @@ -2030,7 +2089,7 @@ public function deleteMessage(
*
* @param Type\AbstractInputFile|string $sticker
* Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass
* an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using
* an HTTP URL as a String for Telegram to get a .WEBP file from the Internet, or upload a new one using
* multipart/form-data. More info on Sending Files »
*
* @param bool $disableNotification
Expand Down Expand Up @@ -2088,7 +2147,7 @@ public function getStickerSet(
/**
* https://core.telegram.org/bots/api#uploadstickerfile
*
* Use this method to upload a .png file with a sticker for later use in createNewStickerSet and
* Use this method to upload a .PNG file with a sticker for later use in createNewStickerSet and
* addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
*
* @param int $userId
Expand Down Expand Up @@ -2217,7 +2276,7 @@ public function addStickerToSet(
/**
* https://core.telegram.org/bots/api#setstickerpositioninset
*
* Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success.
* Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
*
* @param string $sticker
* File identifier of the sticker
Expand Down Expand Up @@ -2350,8 +2409,8 @@ public function answerInlineQuery(
* Three-letter ISO 4217 currency code, see more on currencies
*
* @param Type\LabeledPrice[] $prices
* Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus,
* etc.)
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost,
* delivery tax, bonus, etc.)
*
* @param string $title
* Product name, 1-32 characters
Expand Down
5 changes: 0 additions & 5 deletions src/Type/AbstractPassportElementError.php

This file was deleted.

33 changes: 32 additions & 1 deletion src/Type/Animation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static function _getPropertyNames(): array
{
return [
'file_id',
'file_unique_id',
'width',
'height',
'duration',
Expand All @@ -48,6 +49,7 @@ public function _getRawData(): array
{
$result = [
'file_id' => $this->getFileId(),
'file_unique_id' => $this->getFileUniqueId(),
'width' => $this->getWidth(),
'height' => $this->getHeight(),
'duration' => $this->getDuration(),
Expand All @@ -64,7 +66,7 @@ public function _getRawData(): array
}

/**
* Identifier for this file
* Identifier for this file, which can be used to download or reuse the file
*
* @var string
* @SerializedName("file_id")
Expand All @@ -73,6 +75,16 @@ public function _getRawData(): array
*/
protected $fileId;

/**
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can&#039;t be used to download or reuse the file.
*
* @var string
* @SerializedName("file_unique_id")
* @Accessor(getter="getFileUniqueId",setter="setfileUniqueId")
* @Type("string")
*/
protected $fileUniqueId;

/**
* Video width as defined by sender
*
Expand Down Expand Up @@ -167,6 +179,25 @@ public function getFileId(): string
return $this->fileId;
}

/**
* @param string $fileUniqueId
* @return static
*/
public function setFileUniqueId(string $fileUniqueId): self
{
$this->fileUniqueId = $fileUniqueId;

return $this;
}

/**
* @return string
*/
public function getFileUniqueId(): string
{
return $this->fileUniqueId;
}

/**
* @param int $width
* @return static
Expand Down
Loading

0 comments on commit 3de93b6

Please sign in to comment.