Skip to content

Commit fcd5b4a

Browse files
committed
Bot api may update (4.3)
1 parent 76cd8a5 commit fcd5b4a

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2121
### Security
2222
- Nothing
2323

24+
## 1.0.2 - 2019-06-01
25+
Implemented support for Telegram Bot API v4.2
26+
### Added
27+
- #### types
28+
- added LoginUrlType
29+
2430
## 1.0.1 - 2019-04-05
2531

2632
### Fixed
@@ -35,7 +41,6 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
3541

3642

3743
## 0.4.0-beta - 2019-04-15
38-
3944
Implemented support for Telegram Bot API v4.2
4045

4146
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Quality Score][ico-code-quality]][link-code-quality]
99
![Total Downloads][ico-php-v]
1010

11-
#### Supported Telegram Bot API v4.2
11+
#### Supported Telegram Bot API v4.3 (May 31 update)
1212

1313
## Installation
1414

@@ -139,7 +139,7 @@ If you discover any security related issues, please email wformps@gmail.com inst
139139
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
140140

141141
[ico-php-v]: https://img.shields.io/travis/php-v/tg-bot-api/bot-api-base.svg?style=flat-square
142-
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.2-blue.svg?style=flat-square
142+
[ico-bot-api]: https://img.shields.io/badge/Bot%20API-4.3-blue.svg?style=flat-square
143143
[ico-version]: https://img.shields.io/packagist/v/tg-bot-api/bot-api-base.svg?style=flat-square
144144
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
145145
[ico-travis]: https://img.shields.io/travis/tg-bot-api/bot-api-base/master.svg?style=flat-square

src/Type/InlineKeyboardButtonType.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ class InlineKeyboardButtonType
2929
*/
3030
public $url;
3131

32+
/**
33+
* Optional. An HTTP URL used to automatically authorize the user.
34+
* Can be used as a replacement for the Telegram Login Widget.
35+
*
36+
* @var LoginUrlType | null
37+
*/
38+
public $loginUrl;
39+
3240
/**
3341
* Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
3442
*

src/Type/LoginUrlType.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TgBotApi\BotApiBase\Type;
6+
7+
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8+
9+
/**
10+
* Class LoginUrlType
11+
*This object represents a parameter of the inline keyboard button used to automatically authorize a user.
12+
* Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram.
13+
* All the user needs to do is tap/click a button.
14+
*
15+
* @see https://core.telegram.org/bots/api#loginurl
16+
*/
17+
class LoginUrlType
18+
{
19+
use FillFromArrayTrait;
20+
21+
/**
22+
* An HTTP URL to be opened with user authorization data added to the query string when the button is pressed.
23+
* If the user refuses to provide authorization data,
24+
* the original URL without information about the user will be opened.
25+
* The data added is the same as described in Receiving authorization data.
26+
*
27+
* NOTE: You must always check the hash of the received data to verify the authentication
28+
* and the integrity of the data as described in Checking authorization.
29+
*
30+
* @var string
31+
*/
32+
public $url;
33+
34+
/**
35+
* Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details.
36+
* If not specified, the current bot's username will be assumed.
37+
* The url's domain must be the same as the domain linked with the bot.
38+
* See Linking your domain to the bot for more details.
39+
*
40+
* @var string | null
41+
*/
42+
public $forwardText;
43+
44+
/**
45+
* Optional. New text of the button in forwarded messages.
46+
*
47+
* @var string | null
48+
*/
49+
public $botUsername;
50+
51+
/**
52+
* Optional. Pass True to request the permission for your bot to send messages to the user.
53+
*
54+
* @var bool | null
55+
*/
56+
public $requestWriteAccess;
57+
58+
/**
59+
* @param string $url
60+
* @param array|null $data
61+
*
62+
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
63+
*
64+
* @return LoginUrlType
65+
*/
66+
public static function create(string $url, array $data = null): LoginUrlType
67+
{
68+
$instance = new static();
69+
$instance->url = $url;
70+
if ($data) {
71+
$instance->fill($data);
72+
}
73+
74+
return $instance;
75+
}
76+
}

0 commit comments

Comments
 (0)