Skip to content

Commit 7d8bf3f

Browse files
committed
add documentation for calendar api
Signed-off-by: Dieter Coopman <dieter@deltasolutions.be>
1 parent 62ad1f4 commit 7d8bf3f

1 file changed

Lines changed: 40 additions & 7 deletions

File tree

src/Calendar.php

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,45 @@
1111
use Microsoft\Graph\Model\Location;
1212
use Microsoft\Graph\Model\PhysicalAddress;
1313

14+
/**
15+
* Calendar class for interacting with Microsoft Graph Calendar API
16+
*
17+
* This class provides methods to interact with Microsoft Calendar including:
18+
* - Getting calendars and events
19+
* - Creating and saving calendar events
20+
* - Managing event details like attendees, location, and online meeting status
21+
*/
1422
class Calendar
1523
{
1624
use Connect,
1725
Authenticate;
1826

1927
/**
20-
* Get all calendars
28+
* Get all calendars for the authenticated user
29+
*
30+
* @return array Array of Calendar objects
2131
*/
2232
public function getCalendars(): array
2333
{
2434
return $this->get('/me/calendars', returns: \Microsoft\Graph\Model\Calendar::class);
2535
}
2636

2737
/**
28-
* Get single calendars
38+
* Get a single calendar by ID
39+
*
40+
* @param string $calendar_id The ID of the calendar to retrieve
41+
* @return \Microsoft\Graph\Model\Calendar The requested calendar
2942
*/
3043
public function getCalendar($calendar_id)
3144
{
3245
return $this->get('/me/calendars/'.$calendar_id, returns: \Microsoft\Graph\Model\Calendar::class);
3346
}
3447

3548
/**
36-
* Get all events in a calendar
49+
* Get all events from a specific calendar
50+
*
51+
* @param \Microsoft\Graph\Model\Calendar $calendar The calendar to get events from
52+
* @return array Array of Event objects
3753
*/
3854
public function getCalendarEvents(\Microsoft\Graph\Model\Calendar $calendar): array
3955
{
@@ -42,17 +58,34 @@ public function getCalendarEvents(\Microsoft\Graph\Model\Calendar $calendar): ar
4258

4359
/**
4460
* Save an event to a calendar
45-
*
46-
* @return \Microsoft\Graph\Http\GraphResponse|mixed
61+
*
62+
* @param \Microsoft\Graph\Model\Calendar $calendar The calendar to save the event to
63+
* @param \Microsoft\Graph\Model\Event $event The event to save
64+
* @return \Microsoft\Graph\Http\GraphResponse|mixed Response from the API
4765
*/
4866
public function saveEventToCalendar(\Microsoft\Graph\Model\Calendar $calendar, \Microsoft\Graph\Model\Event $event)
4967
{
5068
return $this->post('/me/events', $event);
5169
}
5270

5371
/**
54-
* Make an event and return an event object of the type \Microsoft\Graph\Model\Event
55-
* this is a shortcut for creating an event object and setting all the bases properties.
72+
* Create a new calendar event with all necessary properties
73+
*
74+
* @param string $starttime Start time of the event in ISO 8601 format
75+
* @param string $endtime End time of the event in ISO 8601 format
76+
* @param string $timezone Timezone for the event (e.g. 'Europe/Brussels')
77+
* @param string $subject Subject/title of the event
78+
* @param string $body Body/description of the event (HTML supported)
79+
* @param object $location_address Location object containing address details:
80+
* - address_street: Street name
81+
* - address_house_nr: House number
82+
* - suffix: Address suffix
83+
* - address_zip_code: Postal code
84+
* - address_city: City
85+
* - address_country: Country
86+
* @param array $attendees Array of email addresses for attendees
87+
* @param bool $isOnlineMeeting Whether this is an online meeting
88+
* @return \Microsoft\Graph\Model\Event The created event object
5689
*/
5790
public function makeEvent(string $starttime, string $endtime, string $timezone, string $subject, string $body, object $location_address, array $attendees = [], bool $isOnlineMeeting = false): \Microsoft\Graph\Model\Event
5891
{

0 commit comments

Comments
 (0)