Skip to content

Commit 3f60f48

Browse files
useratorvjik
andauthored
Add the missing "certificate" parameter in the "SetWebhook" (#192)
Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
1 parent 97c2a68 commit 3f60f48

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Telegram Bot API for PHP Change Log
22

3+
## 0.18.1 April 5, 2026
4+
5+
- Bug #192: Add missed `certificate` parameter to `SetWebhook` method.
6+
37
## 0.18 April 4, 2026
48

59
- Enh #190: Open file in binary mode in `InputFile::fromLocalFile()` method.

src/Method/Update/SetWebhook.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Phptg\BotApi\Method\Update;
66

7+
use Phptg\BotApi\Type\InputFile;
78
use SensitiveParameter;
89
use Phptg\BotApi\ParseResult\ValueProcessor\TrueValue;
910
use Phptg\BotApi\Transport\HttpMethod;
@@ -24,6 +25,7 @@ public function __construct(
2425
private ?bool $dropPendingUpdates = null,
2526
#[SensitiveParameter]
2627
private ?string $secretToken = null,
28+
private ?InputFile $certificate = null,
2729
) {}
2830

2931
public function getHttpMethod(): HttpMethod
@@ -46,6 +48,7 @@ public function getData(): array
4648
'allowed_updates' => $this->allowUpdates,
4749
'drop_pending_updates' => $this->dropPendingUpdates,
4850
'secret_token' => $this->secretToken,
51+
'certificate' => $this->certificate,
4952
],
5053
static fn(mixed $value): bool => $value !== null,
5154
);

src/TelegramBotApi.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3169,9 +3169,10 @@ public function setWebhook(
31693169
?bool $dropPendingUpdates = null,
31703170
#[SensitiveParameter]
31713171
?string $secretToken = null,
3172+
?InputFile $certificate = null,
31723173
): FailResult|true {
31733174
return $this->call(
3174-
new SetWebhook($url, $ipAddress, $maxConnections, $allowUpdates, $dropPendingUpdates, $secretToken),
3175+
new SetWebhook($url, $ipAddress, $maxConnections, $allowUpdates, $dropPendingUpdates, $secretToken, $certificate),
31753176
);
31763177
}
31773178

tests/Method/Update/SetWebhookTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Phptg\BotApi\Tests\Method\Update;
66

7+
use Phptg\BotApi\Type\InputFile;
78
use PHPUnit\Framework\TestCase;
89
use Phptg\BotApi\Transport\HttpMethod;
910
use Phptg\BotApi\Method\Update\SetWebhook;
@@ -30,13 +31,15 @@ public function testBase(): void
3031

3132
public function testFull(): void
3233
{
34+
$file = new InputFile(null);
3335
$method = new SetWebhook(
3436
'https://example.com/hook',
3537
'127.0.0.1',
3638
12,
3739
['update1', 'update2'],
3840
true,
3941
'asdg23y',
42+
$file,
4043
);
4144

4245
assertSame(HttpMethod::POST, $method->getHttpMethod());
@@ -49,6 +52,7 @@ public function testFull(): void
4952
'allowed_updates' => ['update1', 'update2'],
5053
'drop_pending_updates' => true,
5154
'secret_token' => 'asdg23y',
55+
'certificate' => $file,
5256
],
5357
$method->getData(),
5458
);

0 commit comments

Comments
 (0)