تخطَّ إلى المستندات
PHP

$client->calendar

كل دالّة في مساحة الأسماء هذه: توقيعها ومعلماتها وما تُرجعه ومثال عليها.

الدوالّ

Calendar events found in mail or put on the calendar here, expanded into occurrences, with invitations, changes, cancellations and answers sent by email.

calendar->listEvents

List one page of event occurrences inside a time window

الصلاحياتcalendar:readيتصفح النتائج صفحةً صفحة
التوقيع
listEvents(    DateTimeInterface|string $from,    DateTimeInterface|string $to,    ?string $timezone = null,    ?int $limit = null,    ?string $cursor = null,    ?string $apiKey = null,): Page

Expands every event in the workspace into its occurrences between from and to and returns one page of them, sorted by start time and then by event id. A recurring series gives one row per instance in the window, with its excluded dates left out, and every row points back to its event through eventId. The window is required because a repeating series has no end to list up to. Follow nextCursor while hasMore is true, with the same from, to and timezone:, to read every occurrence, or let listAllEvents and iterateEvents do that walk.

to must be after from and at most 366 days later. A missing from or to is a 422 invalid_parameter, while a value that does not parse, a reversed or overlong window, or an unknown zone is a 400 invalid_parameter naming the field. Both bounds take a DateTimeInterface or an ISO 8601 string, and the SDK sends a DateTimeInterface as an ISO 8601 instant in UTC.

timezone is an IANA zone and defaults to UTC on the server. It is used to expand any event stored without a zone of its own, which is what decides the day an all day event lands on.

المعلمات

fromstring|DateTimeInterfaceمطلوب

Start of the window.

tostring|DateTimeInterfaceمطلوب

End of the window, after from and at most 366 days later.

timezonestring

IANA zone such as Europe/London, at most 64 characters. Defaults to UTC.

limitint

Occurrences per page, a whole number from 1 to 100. The server defaults to 25.

cursorstring

The nextCursor of the previous page, sent with the same window. It is opaque, so never build one yourself.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

A Page of occurrence arrays with items, hasMore and nextCursor. Each item has eventId, uid, start, end, allDay, summary, location, status, transparency, isOrganizer, organizerEmail, recurring, myPartstat and attendeeCount.

مثال

$page = $client->calendar->listEvents(    new \DateTimeImmutable('today'),    new \DateTimeImmutable('today +7 days'),    timezone: 'Europe/London',    limit: 50,); foreach ($page as $occurrence) {    echo $occurrence['start'], ' ', $occurrence['summary'], ' ', $occurrence['myPartstat'] ?? 'not invited', PHP_EOL;} if ($page->hasMore) {    echo 'More from cursor ', $page->nextCursor, PHP_EOL;}

ملاحظات

  • myPartstat is the response recorded for any address this workspace holds on its own domains, or for the addresses a narrowed key covers, and null when none of them is an attendee. A workspace with no address on its own domains matches no attendee, so every row reads null.

  • A narrowed key only sees occurrences whose organiser is one of the addresses it covers or where one of them is an attendee.

  • Cancelled events are not filtered out. Check status for CANCELLED.

  • Nothing in the window is dropped. A series repeats at most once a day, so one series gives at most one row per day of the window, and every one of them is reachable through the pages.

  • The cursor holds the start time and event id of the last row, so an event deleted or moved between pages never breaks the walk. A cursor this list did not hand out is a 400 invalid_cursor.

متاح أيضًا في

API
GET /calendar/events
TypeScript
calendar.listEvents()
Python
calendar.list_events()
Ruby
calendar.list_events
CLI
openemail calendar list-events

calendar->listAllEvents

Collect every occurrence inside a time window into one array

الصلاحياتcalendar:readيتصفح النتائج صفحةً صفحة
التوقيع
listAllEvents(    DateTimeInterface|string $from,    DateTimeInterface|string $to,    ?string $timezone = null,    ?int $limit = null,    ?string $cursor = null,    ?string $apiKey = null,): array

Walks every page of listEvents for one window and returns all of its occurrences, sorted by start time and then by event id. It follows nextCursor until hasMore is false, sending the same from, to and timezone: with each request.

A window of up to 366 days of a busy calendar can hold thousands of occurrences, so prefer iterateEvents when you can stop early.

المعلمات

fromstring|DateTimeInterfaceمطلوب

Start of the window.

tostring|DateTimeInterfaceمطلوب

End of the window, after from and at most 366 days later.

timezonestring

IANA zone such as Europe/London, at most 64 characters. Defaults to UTC.

limitint

Page size for each request, 1 to 100. The server defaults to 25.

cursorstring

Starts the walk from this cursor instead of the start of the window.

apiKeystring

Overrides the client API key for every page of this walk.

يُرجع

A list of occurrence arrays holding every occurrence in the window, earliest first.

مثال

use OpenEmail\Constants\CalendarTransparencies; $occurrences = $client->calendar->listAllEvents('2026-10-01T00:00:00Z', '2026-11-01T00:00:00Z', limit: 100); foreach ($occurrences as $occurrence) {    if ($occurrence['transparency'] === CalendarTransparencies::OPAQUE) {        echo 'Busy ', $occurrence['start'], ' to ', $occurrence['end'], PHP_EOL;    }}

ملاحظات

  • If any page fails the call throws and the occurrences already fetched are discarded.

متاح أيضًا في

API
GET /calendar/events
TypeScript
calendar.listAllEvents()
Python
calendar.list_all_events()
Ruby
calendar.list_all_events

calendar->iterateEvents

Stream the occurrences inside a time window one at a time

الصلاحياتcalendar:readيتصفح النتائج صفحةً صفحة
التوقيع
iterateEvents(    DateTimeInterface|string $from,    DateTimeInterface|string $to,    ?string $timezone = null,    ?int $limit = null,    ?string $cursor = null,    ?string $apiKey = null,): Generator

Returns a Generator over the occurrences in one window that yields them individually, earliest first, and fetches the next page only when the current one is drained. Nothing is requested until you consume it, and breaking out of the loop stops further requests, which makes it the way to find the next free slot or the next meeting without reading the whole window.

The walk ends when hasMore is false, when a page carries no nextCursor, or when the server repeats a cursor.

المعلمات

fromstring|DateTimeInterfaceمطلوب

Start of the window.

tostring|DateTimeInterfaceمطلوب

End of the window, after from and at most 366 days later.

timezonestring

IANA zone such as Europe/London, at most 64 characters. Defaults to UTC.

limitint

Page size per request, 1 to 100. The server defaults to 25.

cursorstring

Starts the walk from this cursor instead of the start of the window.

apiKeystring

Overrides the client API key for every page of this walk.

يُرجع

A Generator that yields one occurrence array per step.

مثال

$from = new \DateTimeImmutable();$to = new \DateTimeImmutable('+30 days'); foreach ($client->calendar->iterateEvents($from, $to) as $occurrence) {    if ($occurrence['myPartstat'] !== null) {        echo 'Next meeting: ', $occurrence['start'], ' ', $occurrence['summary'], PHP_EOL;         break;    }}

ملاحظات

  • A page request that fails throws out of the foreach loop, after every occurrence of the pages before it has been yielded.

متاح أيضًا في

API
GET /calendar/events
TypeScript
calendar.iterateEvents()
Python
calendar.iterate_events()
Ruby
calendar.iterate_events

calendar->getEvent

Read an event with its attendees

الصلاحياتcalendar:read
التوقيع
getEvent(string $id, ?string $apiKey = null): array

Returns a stored event with its attendees and their responses. What the server understood from the iCalendar data is structured here: recurrence holds the RRULE text, exdates the excluded instances, organizer the organiser and alarms the reminders, each an array with minutesBefore and action. The raw iCalendar source is not included, and getEventIcs serves the event as a document.

id is the event id, the eventId on an occurrence, and not the iCalendar uid. A recurring series is one event however many occurrences it has, so start and end describe its first instance. messageId and threadId link the event to mail in the mailbox when there is any.

Attendees come back in the order they were added, each with partstat, role, rsvp, cutype and respondedAt. A narrowed key gets a 404 unless one of the addresses it covers organises the event or is on the attendee list, and a key that holds a whole domain covers every address on it.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence, such as cal_ followed by 24 hex characters.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array with id, uid, sequence, summary, description, location, url, start, end, allDay, timezone, recurrence, exdates, status, transparency, visibility, organizer, isOrganizer, source, messageId, threadId, alarms, attendees, createdAt and updatedAt.

مثال

$event = $client->calendar->getEvent('cal_3f9a1c7e5b2d48a06c1e9f4b'); echo $event['summary'], ', ', $event['recurrence'] ?? 'one off', PHP_EOL; foreach ($event['attendees'] as $attendee) {    echo $attendee['email'], ': ', $attendee['partstat'], PHP_EOL;}

ملاحظات

  • status, transparency and visibility carry iCalendar values, and default to CONFIRMED, OPAQUE and PUBLIC.

  • An attendee's partstat defaults to NEEDS-ACTION and role to REQ-PARTICIPANT until a response is recorded.

متاح أيضًا في

API
GET /calendar/events/{id}
TypeScript
calendar.getEvent()
Python
calendar.get_event()
Ruby
calendar.get_event
CLI
openemail calendar get-event

calendar->getEventIcs

Download an event as an iCalendar document

الصلاحياتcalendar:read
التوقيع
getEventIcs(string $id, ?string $apiKey = null): string

Returns the event serialised as an .ics document, as a raw string rather than parsed JSON. The server sends it as text/calendar; charset=utf-8 with a download filename built from the event's uid, and the SDK requests that type and returns the body untouched.

The document declares METHOD:PUBLISH, and the content type carries no method parameter. That is deliberate: a REQUEST document makes a calendar client offer accept and decline and reply to the organiser, and this endpoint has no authority to invite anyone. Import it to show what the event currently is, not to send an invitation.

It holds one VEVENT with the attendees and their participation status, the recurrence rule, excluded dates and alarms. Lines end in CRLF and long lines are folded. DTSTAMP is the time of the request, so two downloads of an unchanged event differ on that line.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

A string, the iCalendar text from BEGIN:VCALENDAR to END:VCALENDAR.

مثال

$ics = $client->calendar->getEventIcs('cal_8d3f0a2b9c4e41f7a6b5c2d1'); foreach (explode("\r\n", $ics) as $line) {    if (str_starts_with($line, 'SUMMARY:')) {        echo substr($line, 8), PHP_EOL;    }}

ملاحظات

  • Errors still come back as JSON and throw ApiException, so a failure never comes back as a string.

  • Timed events are written as UTC instants and all day events as DATE values, never as local times with a TZID.

  • A narrowed key gets a 404 on the same terms as getEvent.

متاح أيضًا في

API
GET /calendar/events/{id}/ics
TypeScript
calendar.getEventIcs()
Python
calendar.get_event_ics()
Ruby
calendar.get_event_ics
CLI
openemail calendar get-event-ics

calendar->createEvent

Put an event on the calendar

الصلاحياتcalendar:write
التوقيع
createEvent(array $body, ?string $apiKey = null): array

Creates an event, as New event on the Calendar page of the app does. start and end take a DateTimeInterface or ISO 8601 with a zone, and the SDK sends a DateTimeInterface as a UTC instant. timezone is the IANA zone the event belongs to, which decides what an all-day event means.

With attendees, an invitation goes to each of them by email from from, which has to be an address the key may send as, so the call also needs emails:send. Send 'sendInvites' => false to keep it to your own calendar.

المعلمات

summarystringمطلوب

The title, 1 to 255 characters.

startstring|DateTimeInterfaceمطلوب

When it starts, a DateTimeInterface or ISO 8601 with a zone. A DateTimeInterface is sent as an instant in UTC.

endstring|DateTimeInterfaceمطلوب

When it ends, after start and at most two years later.

descriptionstring

Notes about the event, up to 8,000 characters.

locationstring

Where it is: a room, an address or a link.

urlstring

A link that belongs to the event.

allDaybool

Whether it fills whole days. start and end then mark the days.

timezonestring

The IANA zone the event belongs to, UTC unless you say.

recurrencestring

An RRULE such as FREQ=WEEKLY;BYDAY=MO when it repeats.

attendeesarray

Up to 200 people to invite, each an array with email and, if you like, name and optional.

remindersarray

Up to five reminders, each an array with minutesBefore and, if you like, action (DISPLAY, EMAIL or AUDIO, as in OpenEmail\Constants\CalendarReminderActions).

transparencystring

OPAQUE shows you busy and TRANSPARENT free, as in OpenEmail\Constants\CalendarTransparencies.

visibilitystring

PUBLIC, PRIVATE or CONFIDENTIAL, as in OpenEmail\Constants\CalendarVisibilities.

sendInvitesbool

False keeps the change to your own calendar, and sends nothing.

fromstring

The address the invitations come from. It has to be one the key may send as.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array for the new event, shaped like the one calendar->getEvent returns, with its attendees and their responses.

مثال

$london = new \DateTimeZone('Europe/London'); $event = $client->calendar->createEvent([    'summary' => 'Planning',    'start' => new \DateTimeImmutable('2026-10-12 09:00', $london),    'end' => new \DateTimeImmutable('2026-10-12 09:30', $london),    'timezone' => 'Europe/London',    'attendees' => [['email' => '[email protected]', 'name' => 'Ada Lovelace']],    'reminders' => [['minutesBefore' => 10]],    'from' => '[email protected]',]); echo $event['id'], ' ', $event['start'], PHP_EOL;

ملاحظات

  • The SDK does not retry it, because a second call makes a second event and invites everybody again.

  • A key that may not send as from is refused with 403 from_address_forbidden, and an event with attendees and no from with 422 invalid_parameter. Invitations without emails:send are a 403 insufficient_scope.

متاح أيضًا في

API
POST /calendar/events
TypeScript
calendar.createEvent()
Python
calendar.create_event()
Ruby
calendar.create_event
CLI
openemail calendar create-event

calendar->updateEvent

Change an event

الصلاحياتcalendar:write
التوقيع
updateEvent(string $id, array $patch, ?string $apiKey = null): array

Changes an event you organise. A field you leave out keeps its value, and attendees replaces the whole list. Everyone invited gets the updated invitation by email from from, so a change to an event with attendees needs emails:send too, unless sendInvites is false.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence, such as cal_ followed by 24 hex characters.

summarystring

The title, 1 to 255 characters.

startstring|DateTimeInterface

When it starts, a DateTimeInterface or ISO 8601 with a zone. A DateTimeInterface is sent as an instant in UTC.

endstring|DateTimeInterface

When it ends, after start and at most two years later.

descriptionstring

Notes about the event, up to 8,000 characters.

locationstring

Where it is: a room, an address or a link.

urlstring

A link that belongs to the event.

allDaybool

Whether it fills whole days. start and end then mark the days.

timezonestring

The IANA zone the event belongs to, UTC unless you say.

recurrencestring

An RRULE such as FREQ=WEEKLY;BYDAY=MO when it repeats.

attendeesarray

Up to 200 people to invite, each an array with email and, if you like, name and optional. It replaces the whole list.

remindersarray

Up to five reminders, each an array with minutesBefore and, if you like, action (DISPLAY, EMAIL or AUDIO, as in OpenEmail\Constants\CalendarReminderActions).

transparencystring

OPAQUE shows you busy and TRANSPARENT free, as in OpenEmail\Constants\CalendarTransparencies.

visibilitystring

PUBLIC, PRIVATE or CONFIDENTIAL, as in OpenEmail\Constants\CalendarVisibilities.

sendInvitesbool

False keeps the change to your own calendar, and sends nothing.

fromstring

The address the invitations come from. It has to be one the key may send as.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array for the event as it stands after the change, shaped like the one calendar->getEvent returns, with sequence one higher.

مثال

$event = $client->calendar->updateEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', [    'start' => '2026-10-12T10:00:00Z',    'end' => '2026-10-12T10:30:00Z',    'from' => '[email protected]',]); echo $event['start'], ', sequence ', $event['sequence'], PHP_EOL;

ملاحظات

  • The SDK does not retry it, because a retry after a lost response sends the update to everybody again.

  • An event organised by somebody else is refused with 403 not_organizer: answer it with respondToEvent instead. An event the key does not reach is a 404.

متاح أيضًا في

API
PATCH /calendar/events/{id}
TypeScript
calendar.updateEvent()
Python
calendar.update_event()
Ruby
calendar.update_event
CLI
openemail calendar update-event

calendar->deleteEvent

Remove an event from the calendar

الصلاحياتcalendar:write
التوقيع
deleteEvent(string $id, ?string $apiKey = null): array

Removes an event for good, as Remove does in the app. Nobody else is told, so call off a meeting with others in it with cancelEvent instead.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence, such as cal_ followed by 24 hex characters.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array with object, id and deleted set to true.

مثال

$deleted = $client->calendar->deleteEvent('cal_3f9a1c7e5b2d48a06c1e9f4b'); echo $deleted['id'], ' is off the calendar', PHP_EOL;

ملاحظات

  • An event organised by somebody else is refused with 403 not_organizer, and an event that is gone or that the key does not reach is a 404.

متاح أيضًا في

API
DELETE /calendar/events/{id}
TypeScript
calendar.deleteEvent()
Python
calendar.delete_event()
Ruby
calendar.delete_event
CLI
openemail calendar delete-event

calendar->cancelEvent

Call off a meeting

الصلاحياتcalendar:write
التوقيع
cancelEvent(string $id, ?array $body = null, ?string $apiKey = null): array

Cancels a meeting you organise, as Cancel meeting does in the app. It stays on the calendar with status CANCELLED, and everyone invited is told it is off by email from from, so a meeting with attendees also needs emails:send.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence, such as cal_ followed by 24 hex characters.

fromstring

The address the cancellation comes from. It has to be one the key may send as.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array for the event, shaped like the one calendar->getEvent returns, with status set to CANCELLED.

مثال

$event = $client->calendar->cancelEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', ['from' => '[email protected]']); echo $event['summary'], ' is now ', $event['status'], PHP_EOL;

ملاحظات

  • The SDK does not retry it, because a retry sends the cancellation again.

  • An event organised by somebody else is refused with 403 not_organizer.

متاح أيضًا في

API
POST /calendar/events/{id}/cancel
TypeScript
calendar.cancelEvent()
Python
calendar.cancel_event()
Ruby
calendar.cancel_event
CLI
openemail calendar cancel-event

calendar->respondToEvent

Answer an invitation

الصلاحياتcalendar:writeemails:send
التوقيع
respondToEvent(string $id, array $body, ?string $apiKey = null): array

Accepts, declines or tentatively accepts an invitation, as the buttons of an invitation do in the app. The answer goes to the organiser by email from the invited address the key may send as, or from respondingAs when the invitation went to more than one of yours, so it needs emails:send as well.

المعلمات

idstringمطلوب

Event id, the eventId of an occurrence, such as cal_ followed by 24 hex characters.

responsestringمطلوب

ACCEPTED, DECLINED or TENTATIVE, as in OpenEmail\Constants\CalendarResponses.

respondingAsstring

Which of your invited addresses answers, when there is more than one.

apiKeystring

Overrides the client's API key for this call only.

يُرجع

An array for the event, shaped like the one calendar->getEvent returns, with your answer on your attendee row.

مثال

use OpenEmail\Constants\CalendarResponses; $event = $client->calendar->respondToEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', [    'response' => CalendarResponses::ACCEPTED,]); foreach ($event['attendees'] as $attendee) {    echo $attendee['email'], ': ', $attendee['partstat'], PHP_EOL;}

ملاحظات

  • An event that invited none of the addresses the key may send as is refused with 403 not_invited, and a cancelled meeting with 409 event_cancelled.

  • When the organiser cannot be reached, nothing changes and the call is a 409 reply_not_sent.

متاح أيضًا في

API
POST /calendar/events/{id}/respond
TypeScript
calendar.respondToEvent()
Python
calendar.respond_to_event()
Ruby
calendar.respond_to_event
CLI
openemail calendar respond-to-event