Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user(s) shared setter/getter && add type user shared #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/Types/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class Message extends BaseType implements TypeInterface
'invoice' => Invoice::class,
'successful_payment' => SuccessfulPayment::class,
'users_shared' => UsersShared::class,
'user_shared' => UserShared::class,
'chat_shared' => ChatShared::class,
'connected_website' => true,
'write_access_allowed' => WriteAccessAllowed::class,
Expand Down Expand Up @@ -556,6 +557,13 @@ class Message extends BaseType implements TypeInterface
*/
protected $usersShared;

/**
* Optional. Service message: user were shared with the bot
*
* @var UserShared|null
*/
protected $userShared;

/**
* Optional. Service message: a chat was shared with the bot
*
Expand Down Expand Up @@ -1767,4 +1775,38 @@ public function setForumTopicReopened($forumTopicReopened)
{
$this->forumTopicReopened = $forumTopicReopened;
}

/**
* @param UserShared $data
* @return void
*/
public function setUserShared(UserShared $data)
{
$this->userShared = $data;
}

/**
* @return UserShared
*/
public function getUserShared()
{
return $this->userShared;
}

/**
* @param UsersShared $data
* @return void
*/
public function setUsersShared(UsersShared $data)
{
$this->usersShared = $data;
}

/**
* @return UsersShared
*/
public function getUsersShared()
{
return $this->usersShared;
}
}
80 changes: 80 additions & 0 deletions src/Types/UserShared.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace TelegramBot\Api\Types;

use TelegramBot\Api\BaseType;
use TelegramBot\Api\TypeInterface;

/**
* Class UserShared
* This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.
*
* @package TelegramBot\Api\Types
*/
class UserShared extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
protected static $requiredParams = ['request_id', 'user_id'];

/**
* {@inheritdoc}
*
* @var array
*/
protected static $map = [
'user_id' => true,
'request_id' => true
];

/**
* Identifier of the request
*
* @var int
*/
protected $requestId;

/**
* Identifier of the shared user
*
* @var int
*/
protected $userId;

/**
* @return int
*/
public function getRequestId()
{
return $this->requestId;
}

/**
* @param int $requestId
* @return void
*/
public function setRequestId($requestId)
{
$this->requestId = $requestId;
}

/**
* @return int
*/
public function getUserId()
{
return $this->userId;
}

/**
* @param int $userId
* @return void
*/
public function setUserId($userId)
{
$this->userId = $userId;
}
}