mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\CalendarBundle\Synchro\Connector\MSGraph;
|
|
|
|
use DateTimeImmutable;
|
|
use TheNetworg\OAuth2\Client\Provider\Azure;
|
|
|
|
class MSGraphClient
|
|
{
|
|
private MachineTokenStorage $machineTokenStorage;
|
|
|
|
private Azure $provider;
|
|
|
|
private MSGraphTokenStorage $tokenStorage;
|
|
|
|
/**
|
|
* @param mixed $calendar
|
|
*
|
|
* @return array as a json response
|
|
*/
|
|
public function listEventsForUserCalendar($calendar, DateTimeImmutable $startDate, DateTimeImmutable $endDate, ?int $start = null, ?int $limit = null): array
|
|
{
|
|
$from = $startDate->format(DateTimeImmutable::ATOM);
|
|
$to = $endDate->format(DateTimeImmutable::ATOM);
|
|
|
|
$response = $this->provider->getObjects("{$calendar}/calendar/calendarView?startDateTime={$from}&endDateTime={$end}");
|
|
|
|
dump($response);
|
|
|
|
return $response;
|
|
}
|
|
}
|