Added attachment LinkButton

This commit is contained in:
Alex
2025-07-16 08:47:16 +03:00
parent a7c948dd95
commit 3e93f14784
7 changed files with 75 additions and 13 deletions
-5
View File
@@ -65,7 +65,6 @@ class Api
* Information about the current bot, identified by an access token.
*
* @return BotInfo
*
* @throws ClientApiException
* @throws NetworkException
* @throws SerializationException
@@ -82,7 +81,6 @@ class Api
* List of all active webhook subscriptions.
*
* @return Subscription[]
*
* @throws ClientApiException
* @throws NetworkException
* @throws SerializationException
@@ -103,7 +101,6 @@ class Api
* @param UpdateType[]|null $updateTypes List of update types.
*
* @return Result
*
* @throws ClientApiException
* @throws NetworkException
* @throws SerializationException
@@ -134,7 +131,6 @@ class Api
* @param string $url URL webhook.
*
* @return Result
*
* @throws ClientApiException
* @throws NetworkException
* @throws SerializationException
@@ -163,7 +159,6 @@ class Api
* @param bool $disableLinkPreview If false, server will not generate media preview for links in text.
*
* @return Message
*
* @throws ReflectionException
*/
public function sendMessage(
-1
View File
@@ -19,7 +19,6 @@ interface ClientApiInterface
* @param array<string, mixed> $body The request body.
*
* @return array<string, mixed> The decoded JSON response as an associative array.
*
* @throws ClientApiException for API-level errors (4xx, 5xx).
* @throws NetworkException for network-related issues.
* @throws SerializationException for JSON encoding/decoding failures.
-4
View File
@@ -21,7 +21,6 @@ class ModelFactory
* @param array<string, mixed> $data
*
* @return Result
*
* @throws ReflectionException
*/
public function createResult(array $data): Result
@@ -35,7 +34,6 @@ class ModelFactory
* @param array<string, mixed> $data
*
* @return BotInfo
*
* @throws ReflectionException
*/
public function createBotInfo(array $data): BotInfo
@@ -49,7 +47,6 @@ class ModelFactory
* @param array<string, mixed> $data
*
* @return Subscription
*
* @throws ReflectionException
*/
public function createSubscription(array $data): Subscription
@@ -78,7 +75,6 @@ class ModelFactory
* @param array<string, mixed> $data
*
* @return Message
*
* @throws ReflectionException
*/
public function createMessage(array $data): Message
@@ -12,6 +12,11 @@ final readonly class CallbackButton extends AbstractButton
public string $payload;
public ?Intent $intent;
/**
* @param string $text Visible button text (1 to 128 characters).
* @param string $payload Button token (up to 1024 characters).
* @param Intent|null $intent The intent of the button. Affects how it is displayed by the client.
*/
public function __construct(string $text, string $payload, ?Intent $intent = null)
{
parent::__construct(ButtonType::Callback, $text);
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
final readonly class LinkButton extends AbstractButton
{
public string $url;
/**
* @param string $text Visible button text (1 to 128 characters).
* @param string $url Button URL (1 to 2048 characters).
*/
public function __construct(string $text, string $url)
{
parent::__construct(ButtonType::Link, $text);
$this->url = $url;
}
}