- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/sync/office365/sectionmanager.php
- Класс: Bitrix\Calendar\Sync\Office365\SectionManager
- Вызов: SectionManager::subscribe
public function subscribe(SectionConnection $link): Result
{
$makeDateTime = static function (string $date)
{
$phpDateTime = new \DateTime($date);
return DateTime::createFromPhp($phpDateTime);
};
$result = new Result();
/**
*
*
*/
/** @var array $data
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "6417dbea-4b53-42f1-9312-859ee5a4f614",
"resource": "me/events",
"applicationId": "ee900ae3-2cc9-4615-94b0-683a9bf45dbd",
"changeType": "created,updated,deleted",
"clientState": "special",
"notificationUrl": "https://work24.savecard.ru/bitrix/tools/calendar/push.php",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2022-03-16T18:23:45.9356913Z",
"creatorId": "e65624ee-8b9b-4041-b314-3c1a125b078a",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
*/
$data = $this->context->getVendorSyncService()->subscribeSection($link);
if ($data)
{
$result->setData([
'CHANNEL_ID' => $data['channelId'],
'RESOURCE_ID' => $data['id'],
'EXPIRES' => $makeDateTime($data['expirationDateTime']),
]);
}
else
{
$result->addError(new Error('Error of create subscription.'));
}
return $result;
}