Updated ChatInviteLink
This commit is contained in:
parent
e894375aae
commit
65845b53de
1 changed files with 41 additions and 53 deletions
|
@ -8,50 +8,17 @@
|
||||||
|
|
||||||
class ChatInviteLink implements ObjectTypeInterface
|
class ChatInviteLink implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $invite_link;
|
||||||
* @var string
|
private User $creator;
|
||||||
*/
|
private bool $creates_join_request;
|
||||||
private $invite_link;
|
private bool $is_primary;
|
||||||
|
private bool $is_revoked;
|
||||||
/**
|
private string $name;
|
||||||
* @var User
|
private ?int $expire_date;
|
||||||
*/
|
private ?int $member_limit;
|
||||||
private $creator;
|
private ?int $pending_join_request_count;
|
||||||
|
private ?int $subscription_period;
|
||||||
/**
|
private ?int $subscription_price;
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $creates_join_request;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $is_primary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $is_revoked;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $expire_date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $member_limit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $pending_join_request_count;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The invite link. If the link was created by another chat administrator, then the second part of the link
|
* The invite link. If the link was created by another chat administrator, then the second part of the link
|
||||||
|
@ -146,31 +113,50 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* Optional. The number of seconds the subscription will be active for before the next payment
|
||||||
*
|
*
|
||||||
* @return array
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public function getSubscriptionPeriod(): ?int
|
||||||
|
{
|
||||||
|
return $this->subscription_period;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription
|
||||||
|
* period to be a member of the chat using the link
|
||||||
|
*
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public function getSubscriptionPrice(): ?int
|
||||||
|
{
|
||||||
|
return $this->subscription_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invite_link' => $this->invite_link,
|
'invite_link' => $this->invite_link,
|
||||||
'creator' => ($this->creator instanceof ObjectTypeInterface) ? $this->creator->toArray() : null,
|
'creator' => $this->creator?->toArray(),
|
||||||
'creates_join_request' => $this->creates_join_request ?? false,
|
'creates_join_request' => $this->creates_join_request ?? false,
|
||||||
'is_primary' => $this->is_primary ?? false,
|
'is_primary' => $this->is_primary ?? false,
|
||||||
'is_revoked' => $this->is_revoked ?? false,
|
'is_revoked' => $this->is_revoked ?? false,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'expire_date' => $this->expire_date,
|
'expire_date' => $this->expire_date,
|
||||||
'member_limit' => $this->member_limit, 'pending_join_request_count' => $this->pending_join_request_count
|
'member_limit' => $this->member_limit,
|
||||||
|
'pending_join_request_count' => $this->pending_join_request_count,
|
||||||
|
'subscription_period' => $this->subscription_period,
|
||||||
|
'subscription_price' => $this->subscription_price
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from an array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return ChatInviteLink
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ChatInviteLink
|
||||||
{
|
{
|
||||||
$object = new self();
|
$object = new self();
|
||||||
|
|
||||||
|
@ -183,6 +169,8 @@
|
||||||
$object->expire_date = $data['expire_date'] ?? null;
|
$object->expire_date = $data['expire_date'] ?? null;
|
||||||
$object->member_limit = $data['member_limit'] ?? null;
|
$object->member_limit = $data['member_limit'] ?? null;
|
||||||
$object->pending_join_request_count = $data['pending_join_request_count'] ?? null;
|
$object->pending_join_request_count = $data['pending_join_request_count'] ?? null;
|
||||||
|
$object->subscription_period = $data['subscription_period'] ?? null;
|
||||||
|
$object->subscription_price = $data['subscription_price'] ?? null;
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue