• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/office365/pushmanager.php
  • Класс: Bitrix\Calendar\Sync\Office365\PushManager
  • Вызов: PushManager::renewPush
public function renewPush(Push $pushChannel): Result
{
	$result = new Result();
	try
	{
		if ($data = $this->context->getVendorSyncService()->resubscribe($pushChannel->getResourceId()))
		{
			if (empty($data['expirationDateTime']))
			{
				$time = time() + 70 * 60 * 60;
				$data['expirationDateTime'] = date('c', $time);
			}

			$pushChannel->setExpireDate(new Date($this->convertToDateTime($data['expirationDateTime'])));
			$result->setData([
				'CHANNEL_ID'  => $pushChannel->getChannelId(),
				'RESOURCE_ID' => $data['id'],
				'EXPIRES'     => $this->convertToDateTime($data['expirationDateTime']),
			]);
		}
		else
		{
			$result->addError(new Error('Error of renew push channel'));
		}
	}
	catch (ApiException $e)
	{
		$result->addError(new Error('Error of MS Graph API', $e->getCode(), $e->getMessage()));
	}

	return $result;
}