From eec05911555cf53628c6303738174fb39d18f34b Mon Sep 17 00:00:00 2001 From: martinyde Date: Thu, 4 Jul 2024 13:02:43 +0200 Subject: [PATCH 1/3] Changed /me/events --- CHANGELOG.md | 5 +++++ src/Service/MicrosoftGraphBookingService.php | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf77a3..1c28101 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ See [keep a changelog](https://keepachangelog.com/en/1.0.0/) for information abo ## [Unreleased] +### Changed + +- Changed getBookingIdFromICalUid graph call from /me/events to /users/*/events +- Add test command for getting booking from uid. + ## [1.2.2] - 2023-11-28 ### Changed diff --git a/src/Service/MicrosoftGraphBookingService.php b/src/Service/MicrosoftGraphBookingService.php index aa919a6..9c04635 100644 --- a/src/Service/MicrosoftGraphBookingService.php +++ b/src/Service/MicrosoftGraphBookingService.php @@ -566,8 +566,7 @@ public function createBodyUserId(string $id): string public function getBookingIdFromICalUid(string $iCalUId): ?string { $token = $this->graphHelperService->authenticateAsServiceAccount(); - - $path = "/me/events?\$filter=iCalUId eq '$iCalUId'"; + $path = "/users/$this->serviceAccountUsername/events?\$filter=uid eq '$iCalUId'"; $response = $this->graphHelperService->request($path, $token); From 8e8be7e929434de79ec35c7c79d067f398a6bbac Mon Sep 17 00:00:00 2001 From: martinyde Date: Thu, 4 Jul 2024 13:02:53 +0200 Subject: [PATCH 2/3] Added command --- src/Command/TestGetBookingFromUidCommand.php | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Command/TestGetBookingFromUidCommand.php diff --git a/src/Command/TestGetBookingFromUidCommand.php b/src/Command/TestGetBookingFromUidCommand.php new file mode 100644 index 0000000..37ad65f --- /dev/null +++ b/src/Command/TestGetBookingFromUidCommand.php @@ -0,0 +1,45 @@ +addArgument('uid', InputArgument::REQUIRED, 'Uid to get booking for.'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + + $uid = $input->getArgument('uid'); + $io->note(sprintf('You request bookings for uid: %s', $uid)); + + $data = $this->bookingService->getBookingIdFromIcalUid($uid); + $io->info(json_encode($data)); + + return Command::SUCCESS; + } +} +// @codeCoverageIgnoreEnd From 3eed1ab0050457f19ab1667ed6ccde88af7adf20 Mon Sep 17 00:00:00 2001 From: martinyde Date: Thu, 4 Jul 2024 13:05:15 +0200 Subject: [PATCH 3/3] Changed /me/events --- src/Service/MicrosoftGraphBookingService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/MicrosoftGraphBookingService.php b/src/Service/MicrosoftGraphBookingService.php index 9c04635..9b3271c 100644 --- a/src/Service/MicrosoftGraphBookingService.php +++ b/src/Service/MicrosoftGraphBookingService.php @@ -596,7 +596,7 @@ private function getEventFromResourceByICalUid(string $resourceEmail, string $iC { $token = $this->graphHelperService->authenticateAsServiceAccount(); - $path = "/users/$resourceEmail/events?\$filter=iCalUId eq '$iCalUId'"; + $path = "/users/$resourceEmail/events?\$filter=uid eq '$iCalUId'"; $response = $this->graphHelperService->request($path, $token);