diff --git a/README.md b/README.md index 557783d..4674a43 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,12 @@ # Outlook -### Status -[![Build Status](https://travis-ci.org/Symplicity/outlook.svg?branch=master)](https://travis-ci.org/Symplicity/outlook) -[![Latest Stable Version](https://poser.pugx.org/symplicity/outlook/v/stable)](https://packagist.org/packages/symplicity/outlook) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Symplicity/outlook/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Symplicity/outlook/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/Symplicity/outlook/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Symplicity/outlook/?branch=master) -[![License](https://poser.pugx.org/symplicity/outlook/license)](https://packagist.org/packages/symplicity/outlook) - ## Installation Use composer to install Outlook package. ``` -$ composer require symplicity/outlook "^1.0" -``` - -# Usage - -We will be using Monolog Logger to log all info. Logger needs to be passed for all instance creations. - +$ composer require symplicity/outlook "^5.0" ``` -pushHandler($streamHandler, Logger::WARNING); -``` ## Documentations - [Starting](docs/calendar-usage.md) diff --git a/docs/calendar-usage.md b/docs/calendar-usage.md index bc0d554..b35d12d 100644 --- a/docs/calendar-usage.md +++ b/docs/calendar-usage.md @@ -1,10 +1,9 @@ # Starting with Calendar -To start working with calendars simply extend the Calendar class. There are a bunch of methods that needs to be implemented +To start working with calendars simply extend your class to the abstract Calendar class. ``` setId('1') - ->setSubject('testing new outlook events') - ->setInternalEventType('Php Appointments') - ->setLocation(new Location(['DisplayName' => 'Test'])) - ->setBody(new ResponseBody(['ContentType' => 'HTML', 'Content' => 'Testing Calendar'])) - ->setStartDate(new ODateTime(new DateTime('2019-02-20 08:30:00'), 'Eastern Standard Time')) - ->setEndDate(new ODateTime(new DateTime('2019-02-20 09:00:00'), 'Eastern Standard Time')); - - $event2 = new Writer() - ->setId('2') - ->setSubject('testing new outlook events - 2') - ->setInternalEventType('Php Appointments') - ->setLocation(new Location(['DisplayName' => 'Test'])) - ->setBody(new ResponseBody(['ContentType' => 'HTML', 'Content' => 'Testing Calendar'])) - ->setStartDate(new ODateTime(new DateTime('2019-02-21 08:30:00'), 'Eastern Standard Time')) - ->setEndDate(new ODateTime(new DateTime('2019-02-21 09:00:00'), 'Eastern Standard Time')); - - $event3 = new Delete('guid', 'internalEventId') - + + // Post event to outlook + $start = new \Microsoft\Graph\Generated\Models\DateTimeTimeZone(); + $start->setTimeZone('Eastern Standard Time'); + $start->setDateTime('2023-11-28 15:00:00'); + + $end = new \Microsoft\Graph\Generated\Models\DateTimeTimeZone(); + $end->setTimeZone('Eastern Standard Time'); + $end->setDateTime('2023-11-28 16:00:00'); + + $body = new \Microsoft\Graph\Generated\Models\ItemBody(); + $body->setContent('This is a test event'); + + $event1 = new \Symplicity\Outlook\Models\Event(); + $event1->setSubject('Test1'); + $event1->setStart($start); + $event1->setEnd($end); + $event1->setBody($body); + + // Delete event from outlook + $event2 = new \Symplicity\Outlook\Models\Event(); + $event2->setIsDelete(); + $event2->setId('ABC=='); + + // Patch event to outlook + $body = new \Microsoft\Graph\Generated\Models\ItemBody(); + $body->setContent('Update event with extension'); + + $event3 = new \Microsoft\Graph\Generated\Models\Event(); + $event3->setSubject('Update Event'); + $event3->setId('ADB=='); + $event3->setStart($start); + $event3->setEnd($end); + $event3->setBody($body); + + $extension = new \Microsoft\Graph\Generated\Models\OpenTypeExtension(); + $extension->setExtensionName('com.symplicity.test'); + $extension->setAdditionalData([ + 'internalId' => '1232133' + ]); + $event3->setExtensions([$extension]); + return [$event1, $event2, $event3]; } - public function handlePoolResponses(array $responses = []) : void + public function handleBatchResponse(?BatchResponseContent $responses): void { - foreach ($responses as $id => $response) { - $outlookResponse = $response['response'] ?? null; - if ($outlookResponse instanceof BatchResponse && $outlookResponse->getStatus() === Promise::FULFILLED) { - // Handle Fullfilled mappings. - } else { - // Handle Rejected mappings. - } - } + // handle responses from push events request } } - ``` diff --git a/src/Interfaces/CalendarInterface.php b/src/Interfaces/CalendarInterface.php index 347eb1b..fe474ef 100644 --- a/src/Interfaces/CalendarInterface.php +++ b/src/Interfaces/CalendarInterface.php @@ -55,7 +55,8 @@ public function getEventBy(string $id, ?EventItemRequestBuilderGetQueryParameter /** * Method to get all instances of a series master * @param string $id - * @param InstancesRequestBuilderGetQueryParameters $params + * @param InstancesRequestBuilderGetQueryParameters|null $params + * @param array $args */ public function getEventInstances(string $id, ?InstancesRequestBuilderGetQueryParameters $params = null, array $args = []): void;