문서로 건너뛰기
SDK

openemail.calendar

이 네임스페이스의 모든 메서드: 시그니처, 매개변수, 반환값과 예시.

메서드

Calendar events found in mail, expanded into occurrences.

calendar.listEvents()

List one page of event occurrences inside a time window

범위calendar:read결과를 페이지 단위로 가져옴
시그니처
listEvents(options: CalendarRangeOptions): Promise<Page<CalendarOccurrenceResource>>

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 Date or an ISO 8601 string, and the SDK converts a Date with toISOString().

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.

매개변수

options.fromDate | string필수

Start of the window.

options.toDate | string필수

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

options.timezonestring

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

options.limitnumber

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

options.cursorstring

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

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

Page<CalendarOccurrenceResource> with items, hasMore and nextCursor. Each item has eventId, uid, start, end, allDay, summary, location, status, transparency, isOrganizer, organizerEmail, recurring, myPartstat and attendeeCount.

예시

const from = new Date()const to = new Date(from.getTime() + 7 * 24 * 60 * 60 * 1000) const page = await openemail.calendar.listEvents({ from, to, timezone: 'Europe/London', limit: 50 }) for (const occurrence of page.items) {    console.log(occurrence.start, occurrence.summary, occurrence.myPartstat ?? 'not invited')} console.log(page.hasMore, page.nextCursor)

참고

  • 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
CLI
openemail calendar list-events

calendar.listAllEvents()

Collect every occurrence inside a time window into one array

범위calendar:read결과를 페이지 단위로 가져옴
시그니처
listAllEvents(options: CalendarRangeOptions): Promise<Array<CalendarOccurrenceResource>>

Walks every page of listEvents for one window and resolves with 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.

매개변수

options.fromDate | string필수

Start of the window.

options.toDate | string필수

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

options.timezonestring

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

options.limitnumber

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

options.cursorstring

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

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

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

반환값

Array<CalendarOccurrenceResource> holding every occurrence in the window, earliest first.

예시

const occurrences = await openemail.calendar.listAllEvents({    from: '2026-10-01T00:00:00Z',    to: '2026-11-01T00:00:00Z',    limit: 100}) const busy = occurrences.filter((occurrence) => occurrence.transparency === 'OPAQUE') console.log(`${busy.length} busy blocks in October`)

참고

  • If any page fails the promise rejects and the occurrences already fetched are discarded.

다른 사용처

API
GET /calendar/events

calendar.iterateEvents()

Stream the occurrences inside a time window one at a time

범위calendar:read결과를 페이지 단위로 가져옴
시그니처
iterateEvents(options: CalendarRangeOptions): AsyncGenerator<CalendarOccurrenceResource, void, undefined>

Returns an async 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 comes back empty, or when the server repeats a cursor.

매개변수

options.fromDate | string필수

Start of the window.

options.toDate | string필수

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

options.timezonestring

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

options.limitnumber

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

options.cursorstring

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

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

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

반환값

AsyncGenerator<CalendarOccurrenceResource, void, undefined> yielding one occurrence per step.

예시

const from = new Date()const to = new Date(from.getTime() + 30 * 24 * 60 * 60 * 1000) for await (const occurrence of openemail.calendar.iterateEvents({ from, to })) {    if (occurrence.myPartstat === null) continue    console.log('next meeting', occurrence.start, occurrence.summary)    break}

참고

  • An aborted options.signal rejects the pending page request, which throws out of the for await loop.

다른 사용처

API
GET /calendar/events

calendar.getEvent()

Read an event with its attendees

범위calendar:read
시그니처
getEvent(id: string, options?: RequestScope): Promise<CalendarEventResource>

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 as { minutesBefore, 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.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

CalendarEventResource 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.

예시

const { items: [first] } = await openemail.calendar.listEvents({ from: '2026-09-14T00:00:00Z', to: '2026-09-21T00:00:00Z' }) if (first) {    const event = await openemail.calendar.getEvent(first.eventId)    console.log(event.summary, event.recurrence ?? 'one off')    console.log(event.attendees.map((attendee) => `${attendee.email}: ${attendee.partstat}`))}

참고

  • 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}
CLI
openemail calendar get-event

calendar.getEventIcs()

Download an event as an iCalendar document

범위calendar:read
시그니처
getEventIcs(id: string, options?: RequestScope): Promise<string>

Resolves with 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.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

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

예시

const ics = await openemail.calendar.getEventIcs('cal_8d3f0a2b9c4e41f7a6b5c2d1')const summary = ics.split('\r\n').find((line) => line.startsWith('SUMMARY:')) console.log(summary)

참고

  • Errors still come back as JSON and throw OpenEmailApiError, so a failure never resolves 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
CLI
openemail calendar get-event-ics

calendar.createEvent()

Put an event on the calendar

범위calendar:write
시그니처
createEvent(body: CalendarEventCreate, options?: RequestScope): Promise<CalendarEventResource>

Creates an event, as New event on the Calendar page of the app does. start and end take a Date or ISO 8601 with a zone, and 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.

매개변수

body.summarystring필수

The title, 1 to 255 characters.

body.startDate | string필수

When it starts, a Date or ISO 8601 with a zone.

body.endDate | string필수

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

body.descriptionstring

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

body.locationstring

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

body.urlstring

A link that belongs to the event.

body.allDayboolean

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

body.timezonestring

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

body.recurrencestring

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

body.attendeesArray<CalendarAttendeeInput>

Up to 200 people to invite, each { email, name?, optional? }.

body.remindersArray<CalendarReminderInput>

Up to five reminders, each { minutesBefore, action? }.

body.transparencyCalendarTransparency

OPAQUE shows you busy and TRANSPARENT free.

body.visibilityCalendarVisibility

PUBLIC, PRIVATE or CONFIDENTIAL.

body.sendInvitesboolean

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

body.fromstring

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

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

CalendarEventResource for the new event, with its attendees and their responses.

예시

const event = await openemail.calendar.createEvent({    summary: 'Planning',    start: '2026-10-12T09:00:00Z',    end: '2026-10-12T09:30:00Z',    attendees: [{ email: '[email protected]' }],    from: '[email protected]'}) console.log(event.id, event.attendees.length)

참고

  • 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
CLI
openemail calendar create-event

calendar.updateEvent()

Change an event

범위calendar:write
시그니처
updateEvent(id: string, patch: CalendarEventPatch, options?: RequestScope): Promise<CalendarEventResource>

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.

patch.summarystring

The title, 1 to 255 characters.

patch.startDate | string

When it starts, a Date or ISO 8601 with a zone.

patch.endDate | string

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

patch.descriptionstring

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

patch.locationstring

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

patch.urlstring

A link that belongs to the event.

patch.allDayboolean

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

patch.timezonestring

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

patch.recurrencestring

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

patch.attendeesArray<CalendarAttendeeInput>

Up to 200 people to invite, each { email, name?, optional? }. It replaces the whole list.

patch.remindersArray<CalendarReminderInput>

Up to five reminders, each { minutesBefore, action? }.

patch.transparencyCalendarTransparency

OPAQUE shows you busy and TRANSPARENT free.

patch.visibilityCalendarVisibility

PUBLIC, PRIVATE or CONFIDENTIAL.

patch.sendInvitesboolean

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

patch.fromstring

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

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

CalendarEventResource as it stands after the change, with sequence one higher.

예시

const event = await openemail.calendar.updateEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', {    start: '2026-10-12T10:00:00Z',    end: '2026-10-12T10:30:00Z'}) console.log(event.start, event.sequence)

참고

  • 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}
CLI
openemail calendar update-event

calendar.deleteEvent()

Remove an event from the calendar

범위calendar:write
시그니처
deleteEvent(id: string, options?: RequestScope): Promise<DeletedCalendarEventResource>

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.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

DeletedCalendarEventResource: { object, id, deleted: true }.

예시

await openemail.calendar.deleteEvent('cal_3f9a1c7e5b2d48a06c1e9f4b')

참고

  • 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}
CLI
openemail calendar delete-event

calendar.cancelEvent()

Call off a meeting

범위calendar:write
시그니처
cancelEvent(id: string, body?: CalendarEventCancel, options?: RequestScope): Promise<CalendarEventResource>

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.

body.fromstring

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

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

CalendarEventResource with status CANCELLED.

예시

const event = await openemail.calendar.cancelEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { from: '[email protected]' }) console.log(event.status)

참고

  • 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
CLI
openemail calendar cancel-event

calendar.respondToEvent()

Answer an invitation

범위calendar:writeemails:send
시그니처
respondToEvent(id: string, body: CalendarEventAnswer, options?: RequestScope): Promise<CalendarEventResource>

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.

body.responseCalendarResponse필수

ACCEPTED, DECLINED or TENTATIVE.

body.respondingAsstring

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

options.signalAbortSignal

Cancels the request.

options.apiKeystring

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

반환값

CalendarEventResource with your answer on your attendee row.

예시

const event = await openemail.calendar.respondToEvent('cal_3f9a1c7e5b2d48a06c1e9f4b', { response: 'ACCEPTED' }) console.log(event.attendees.map((attendee) => `${attendee.email}: ${attendee.partstat}`))

참고

  • 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
CLI
openemail calendar respond-to-event