1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CallToken.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Call;
4
5use Bitrix\Call\JwtCall;
6use Bitrix\Im\V2\Rest\PopupDataItem;
7use Bitrix\Main\Loader;
8
9class CallToken implements PopupDataItem
10{
11 protected ?int $chatId = null;
12 protected ?int $userId = null;
13 protected string $token = '';
14
15 public function __construct(?int $chatId, ?int $userId)
16 {
17 if (isset($chatId) && Loader::includeModule('call'))
18 {
19 $this->token = JwtCall::getCallToken($chatId, $userId);
20 $this->chatId = $chatId;
21 $this->userId = $userId;
22 }
23 }
24
25 public function update(): void
26 {
27 if (Loader::includeModule('call'))
28 {
29 $this->token = \Bitrix\Call\JwtCall::updateCallToken((int)$this->chatId, (int)$this->userId);
30 }
31 }
32
33 public function getToken(): string
34 {
35 return $this->token;
36 }
37
38 public function getChatId(): ?int
39 {
40 return $this->chatId;
41 }
42
43 public static function getRestEntityName(): string
44 {
45 return 'callInfo';
46 }
47
48 public function toRestFormat(array $option = []): ?array
49 {
50 return [
51 'token' => $this->token,
52 'chatId' => $this->chatId,
53 ];
54 }
55
56 public function merge(PopupDataItem $item): PopupDataItem
57 {
58 return $this;
59 }
60}
static getRestEntityName()
Определения CallToken.php:43
toRestFormat(array $option=[])
Определения CallToken.php:48
int $userId
Определения CallToken.php:12
int $chatId
Определения CallToken.php:11
__construct(?int $chatId, ?int $userId)
Определения CallToken.php:15
string $token
Определения CallToken.php:13
merge(PopupDataItem $item)
Определения CallToken.php:56
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$option
Определения options.php:1711