ameliabooking
/
src
/
Infrastructure
/
Services
/
Outlook
/
AbstractOutlookCalendarMiddlewareService.php
AbstractOutlookCalendarMiddlewareService.php
2 months ago
AbstractOutlookCalendarService.php
2 months ago
OutlookCalendarMiddlewareService.php
1 month ago
OutlookCredentialsValidatorService.php
1 month ago
StarterOutlookCalendarMiddlewareService.php
2 months ago
StarterOutlookCalendarService.php
2 months ago
AbstractOutlookCalendarMiddlewareService.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Infrastructure\Services\Outlook; |
| 4 | |
| 5 | use AmeliaBooking\Infrastructure\Common\Container; |
| 6 | |
| 7 | abstract class AbstractOutlookCalendarMiddlewareService |
| 8 | { |
| 9 | /** @var Container $container */ |
| 10 | protected $container; |
| 11 | |
| 12 | /** |
| 13 | * Create a URL to obtain user authorization. |
| 14 | * |
| 15 | * @param int|null $providerId |
| 16 | * @param string|null $returnUrl |
| 17 | * @param bool $isBackend |
| 18 | * @return string|null |
| 19 | */ |
| 20 | abstract public function getAuthUrl(?int $providerId, ?string $returnUrl, bool $isBackend): ?string; |
| 21 | |
| 22 | /** |
| 23 | * Get list of Outlook Calendars |
| 24 | * |
| 25 | * @param array $providerOutlookCalendar |
| 26 | * |
| 27 | * @return array |
| 28 | */ |
| 29 | abstract public function getCalendarList(array $providerOutlookCalendar): array; |
| 30 | |
| 31 | /** |
| 32 | * @param array|null $provider |
| 33 | * @return void |
| 34 | */ |
| 35 | abstract public function authorizeProvider(array $provider = null): void; |
| 36 | |
| 37 | /** |
| 38 | * Get configured Graph client with the appropriate token (provider-specific or global) |
| 39 | * |
| 40 | * @param array|null $providerOutlookCalendar |
| 41 | * @return mixed |
| 42 | */ |
| 43 | abstract public function getGraph(array $providerOutlookCalendar = null); |
| 44 | |
| 45 | /** |
| 46 | * Get Outlook User Info (name, email) |
| 47 | * |
| 48 | * @param string $accessToken |
| 49 | * |
| 50 | * @return array |
| 51 | */ |
| 52 | abstract public function getUserInfo(string $accessToken): array; |
| 53 | |
| 54 | /** @noinspection MoreThanThreeArgumentsInspection */ |
| 55 | /** |
| 56 | * @param string $from |
| 57 | * @param string $fromName |
| 58 | * @param string $replyTo |
| 59 | * @param string $to |
| 60 | * @param string $subject |
| 61 | * @param string $body |
| 62 | * @param array $bccEmails |
| 63 | * @param array $attachments |
| 64 | * |
| 65 | * @return void |
| 66 | */ |
| 67 | abstract public function sendEmail( |
| 68 | string $from, |
| 69 | string $fromName, |
| 70 | string $replyTo, |
| 71 | string $to, |
| 72 | string $subject, |
| 73 | string $body, |
| 74 | array $bccEmails = [], |
| 75 | array $attachments = [] |
| 76 | ); |
| 77 | |
| 78 | /** |
| 79 | * Get calendar lists for multiple Outlook accounts |
| 80 | * |
| 81 | * @param array $accounts |
| 82 | * |
| 83 | * @return array |
| 84 | */ |
| 85 | abstract public function getCalendarListsForAccounts(array $accounts): array; |
| 86 | } |
| 87 |