client.Calendar
Çdo metodë në këtë hapësirë emrash: nënshkrimi, parametrat, çfarë kthen dhe një shembull.
Metodat
Calendar events found in mail, expanded into occurrences.
Calendar.ListEventsCalendar.ListAllEventsCalendar.IterateEventsCalendar.GetEventCalendar.GetEventIcsCalendar.CreateEventCalendar.UpdateEventCalendar.DeleteEventCalendar.CancelEventCalendar.RespondToEventCalendar.DeclineProposalCalendar.ListFeedsCalendar.CreateFeedCalendar.ResetFeedCalendar.DeleteFeedCalendar.ListSubscriptionsCalendar.CreateSubscriptionCalendar.UpdateSubscriptionCalendar.RefreshSubscriptionCalendar.DeleteSubscriptionCalendar.ImportIcsCalendar.ListImportsCalendar.ListAllImportsCalendar.IterateImportsCalendar.GetImportCalendar.UndoImport
Calendar.ListEvents
List one page of event occurrences inside a time window
ListEvents(ctx context.Context, from time.Time, to time.Time, opts ...openemail.RequestOption) (*openemail.Page, error)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 time.Time or an ISO 8601 string.
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.
Parametrat
fromtime.TimeE detyrueshmeStart of the window.
totime.TimeE detyrueshmeEnd of the window, after
fromand at most 366 days later.openemail.WithTimezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.openemail.WithLimitintOccurrences per page, a whole number from 1 to 100. The server defaults to 25.
openemail.WithCursorstringThe
NextCursorof the previous page, sent with the same window. It is opaque, so never build one yourself.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
A *openemail.Page with Items, HasMore and NextCursor. Each item has eventId, uid, start, end, allDay, summary, location, status, transparency, isOrganizer, organizerEmail, recurring, myPartstat and attendeeCount.
Shembull
page, err := client.Calendar.ListEvents( ctx, time.Now().Add(24*time.Hour), time.Now().Add(24*time.Hour), openemail.WithTimezone("Europe/London"), openemail.WithLimit(50),)if err != nil { return err} for _, occurrence := range page.Items { fmt.Println(occurrence.String("start"), occurrence.String("summary"), occurrence.String("myPartstat"))} fmt.Println(page.HasMore, page.NextCursor)Shënime
myPartstatis 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
statusforCANCELLED.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.
E disponueshme edhe në
Calendar.ListAllEvents
Collect every occurrence inside a time window into one slice
ListAllEvents(ctx context.Context, from time.Time, to time.Time, opts ...openemail.RequestOption) ([]openemail.Object, error)Walks every page of ListEvents for one window and returns 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.
Parametrat
fromtime.TimeE detyrueshmeStart of the window.
totime.TimeE detyrueshmeEnd of the window, after
fromand at most 366 days later.openemail.WithTimezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.openemail.WithLimitintPage size for each request, 1 to 100. The server defaults to 25.
openemail.WithCursorstringStarts the walk from this cursor instead of the start of the window.
openemail.WithAPIKeystringOverrides the client API key for every page of this walk.
Kthen
A []openemail.Object holding every occurrence in the window, earliest first.
Shembull
occurrences, err := client.Calendar.ListAllEvents( ctx, time.Date(2026, time.October, 1, 0, 0, 0, 0, time.UTC), time.Date(2026, time.November, 1, 0, 0, 0, 0, time.UTC), openemail.WithLimit(100),)if err != nil { return err} for _, occurrence := range occurrences { fmt.Println(occurrence.String("transparency"))}Shënime
If any page fails the call fails and the occurrences already fetched are discarded.
E disponueshme edhe në
Calendar.IterateEvents
Stream the occurrences inside a time window one at a time
IterateEvents(ctx context.Context, from time.Time, to time.Time, opts ...openemail.RequestOption) *openemail.IteratorReturns an iterator 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 the server stops offering a cursor, or when it repeats one.
Parametrat
fromtime.TimeE detyrueshmeStart of the window.
totime.TimeE detyrueshmeEnd of the window, after
fromand at most 366 days later.openemail.WithTimezonestringIANA zone such as
Europe/London, at most 64 characters. Defaults toUTC.openemail.WithLimitintPage size per request, 1 to 100. The server defaults to 25.
openemail.WithCursorstringStarts the walk from this cursor instead of the start of the window.
openemail.WithAPIKeystringOverrides the client API key for every page of this walk.
Kthen
An *openemail.Iterator yielding one occurrence per step.
Shembull
for occurrence, err := range client.Calendar.IterateEvents(ctx, time.Now().Add(24*time.Hour), time.Now().Add(24*time.Hour)).All() { if err != nil { return err } fmt.Println(occurrence.String("myPartstat"), occurrence.String("start"), occurrence.String("summary"))}Shënime
A cancelled context fails the pending page request, and the loop ends with that error.
E disponueshme edhe në
Calendar.GetEvent
Read an event with its attendees
GetEvent(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)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 a map 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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object 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.
Shembull
event, err := client.Calendar.GetEvent(ctx, "cal_8d3f0a2b9c4e41f7a6b5c2d1")if err != nil { return err} fmt.Println(event.String("summary"), event.String("recurrence"))Shënime
status,transparencyandvisibilitycarry iCalendar values, and default toCONFIRMED,OPAQUEandPUBLIC.An attendee's
partstatdefaults toNEEDS-ACTIONandroletoREQ-PARTICIPANTuntil a response is recorded.
E disponueshme edhe në
Calendar.GetEventIcs
Download an event as an iCalendar document
GetEventIcs(ctx context.Context, id string, opts ...openemail.RequestOption) (string, error)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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
A string, the iCalendar text from BEGIN:VCALENDAR to END:VCALENDAR.
Shembull
text, err := client.Calendar.GetEventIcs(ctx, "cal_8d3f0a2b9c4e41f7a6b5c2d1")if err != nil { return err} fmt.Println(text)Shënime
Errors still come back as JSON and return an
*openemail.Error, so a failure is never returned as text.Timed events are written in the zone they were created in, as local times with a
TZIDand aVTIMEZONEthat carries the rules of that zone, and all day events asDATEvalues.A narrowed key gets a 404 on the same terms as
GetEvent.
E disponueshme edhe në
Calendar.CreateEvent
Put an event on the calendar
CreateEvent(ctx context.Context, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)Creates an event, as New event on the Calendar page of the app does. start and end take a time.Time 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.
Parametrat
summarystringE detyrueshmeThe title, 1 to 255 characters.
starttime.Time | stringE detyrueshmeWhen it starts, a
time.Timeor ISO 8601 with a zone.endtime.Time | stringE detyrueshmeWhen it ends, after
startand at most two years later.descriptionstringNotes about the event, up to 8,000 characters.
locationstringWhere it is: a room, an address or a link.
urlstringA link that belongs to the event.
allDayboolWhether it fills whole days.
startandendthen mark the days.timezonestringThe IANA zone the event belongs to,
UTCunless you say.recurrencestringAn RRULE such as
FREQ=WEEKLY;BYDAY=MOwhen it repeats.attendees[]openemail.BodyUp to 200 people to invite, each a map with
emailand optionallynameandoptional.reminders[]openemail.BodyUp to five reminders, each a map with
minutesBeforeand optionallyaction.transparencystringOPAQUEshows you busy andTRANSPARENTfree.visibilitystringPUBLIC,PRIVATEorCONFIDENTIAL.sendInvitesboolFalse keeps the change to your own calendar, and sends nothing.
fromstringThe address the invitations come from. It has to be one the key may send as.
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object for the new event, with its attendees and their responses.
Shembull
event, err := client.Calendar.CreateEvent(ctx, openemail.Body{ "summary": "Planning", "start": "2026-10-12T09:00:00Z", "end": "2026-10-12T09:30:00Z", "attendees": []openemail.Body{ {"email": "[email protected]"}, }, "from": "[email protected]",})if err != nil { return err} fmt.Println(event.String("id"))Shënime
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
fromis refused with 403from_address_forbidden, and an event with attendees and nofromwith 422invalid_parameter. Invitations withoutemails:sendare a 403insufficient_scope.
E disponueshme edhe në
Calendar.UpdateEvent
Change an event
UpdateEvent(ctx context.Context, id string, patch openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.summarystringThe title, 1 to 255 characters.
starttime.Time | stringWhen it starts, a
time.Timeor ISO 8601 with a zone.endtime.Time | stringWhen it ends, after
startand at most two years later.descriptionstringNotes about the event, up to 8,000 characters.
locationstringWhere it is: a room, an address or a link.
urlstringA link that belongs to the event.
allDayboolWhether it fills whole days.
startandendthen mark the days.timezonestringThe IANA zone the event belongs to,
UTCunless you say.recurrencestringAn RRULE such as
FREQ=WEEKLY;BYDAY=MOwhen it repeats.attendees[]openemail.BodyUp to 200 people to invite, each a map with
emailand optionallynameandoptional. It replaces the whole list.reminders[]openemail.BodyUp to five reminders, each a map with
minutesBeforeand optionallyaction.transparencystringOPAQUEshows you busy andTRANSPARENTfree.visibilitystringPUBLIC,PRIVATEorCONFIDENTIAL.sendInvitesboolFalse keeps the change to your own calendar, and sends nothing.
fromstringThe address the invitations come from. It has to be one the key may send as.
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object as it stands after the change, with sequence one higher.
Shembull
event, err := client.Calendar.UpdateEvent( ctx, "cal_3f9a1c7e5b2d48a06c1e9f4b", openemail.Body{"start": "2026-10-12T10:00:00Z", "end": "2026-10-12T10:30:00Z"},)if err != nil { return err} fmt.Println(event.String("start"), event.Int("sequence"))Shënime
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 withRespondToEventinstead. An event the key does not reach is a 404.
E disponueshme edhe në
Calendar.DeleteEvent
Remove an event from the calendar
DeleteEvent(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with object, id and deleted set to true.
Shembull
event, err := client.Calendar.DeleteEvent(ctx, "cal_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} fmt.Println(event.String("id"), event.String("object"))Shënime
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.
E disponueshme edhe në
Calendar.CancelEvent
Call off a meeting
CancelEvent(ctx context.Context, id string, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.fromstringThe address the cancellation comes from. It has to be one the key may send as.
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with status CANCELLED.
Shembull
event, err := client.Calendar.CancelEvent(ctx, "cal_3f9a1c7e5b2d48a06c1e9f4b", openemail.Body{"from": "[email protected]"})if err != nil { return err} fmt.Println(event.String("status"))Shënime
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.
E disponueshme edhe në
Calendar.RespondToEvent
Answer an invitation
RespondToEvent(ctx context.Context, id string, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)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.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.responsestringE detyrueshmeACCEPTED,DECLINEDorTENTATIVE.respondingAsstringWhich of your invited addresses answers, when there is more than one.
proposedStarttime.Time | stringA new start to propose with your answer, sent together with
proposedEnd.proposedEndtime.Time | stringThe end of the proposed time.
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with your answer on your attendee row.
Shembull
event, err := client.Calendar.RespondToEvent(ctx, "cal_3f9a1c7e5b2d48a06c1e9f4b", openemail.Body{"response": "ACCEPTED"})if err != nil { return err} fmt.Println(event.String("id"), event.String("status"))Shënime
An event that invited none of the addresses the key may send as is refused with 403
not_invited, and a cancelled meeting with 409event_cancelled.When the organiser cannot be reached, nothing changes and the call is a 409
reply_not_sent.With
proposedStartandproposedEndthe organiser gets a counter-proposal, as Propose a new time sends from Google Calendar and Outlook, and decides whether to move the meeting.
E disponueshme edhe në
Calendar.DeclineProposal
Decline a proposed time
DeclineProposal(ctx context.Context, id string, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)Keeps the original time of a meeting you organise after a guest proposed another one, as Decline in the proposal on the event does in the app. The guest is told by email from from, or from the organising address, so it needs emails:send as well. To take the proposed time instead, change the event with UpdateEvent.
Parametrat
idstringE detyrueshmeEvent id, the
eventIdof an occurrence, such ascal_followed by 24 hex characters.attendeestringE detyrueshmeThe guest whose proposal you decline, by email address.
fromstringThe address the answer is sent from, when it is not the organising address.
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with the guest's proposedStart and proposedEnd cleared.
Shembull
event, err := client.Calendar.GetEvent(ctx, "cal_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} for _, attendee := range event.Objects("attendees") { if !attendee.Has("proposedStart") { continue } if _, err := client.Calendar.DeclineProposal(ctx, event.ID(), openemail.Body{"attendee": attendee.String("email")}); err != nil { return err } break}Shënime
A guest who has not proposed a new time is refused with 404
proposal_not_found, and an event somebody else organises with 403not_organizer.
E disponueshme edhe në
Calendar.ListFeeds
List calendar links
ListFeeds(ctx context.Context, opts ...openemail.RequestOption) ([]openemail.Object, error)Returns the secret links that publish your calendar to other calendar apps, as Share in the calendar settings of the app lists them. Anyone with a link can read what it shows, so treat url and webcalUrl like passwords.
Parametrat
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
A []openemail.Object, each with id, name, mode, url, webcalUrl and when calendar apps last read it.
Shembull
feeds, err := client.Calendar.ListFeeds(ctx)if err != nil { return err} for _, feed := range feeds { fmt.Println(feed.String("name"), feed.String("mode"), feed.String("url"))}Shënime
A key limited to particular addresses or domains is refused with 422
capability_unsupported, because a link covers the whole calendar.
E disponueshme edhe në
Calendar.CreateFeed
Create a calendar link
CreateFeed(ctx context.Context, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)Makes a secret link that publishes your calendar as an iCalendar feed, for Google Calendar (From URL), Outlook (Subscribe from web) or Apple Calendar (New subscription). full shows every detail, busy only the times you are busy. The calendar app reads the link again on its own schedule, usually every few hours.
Parametrat
namestringE detyrueshmeThe name calendar apps show for the calendar, up to 100 characters.
modestringE detyrueshmefullfor every detail,busyfor busy times only.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with the new url and webcalUrl.
Shembull
feed, err := client.Calendar.CreateFeed(ctx, openemail.Body{"name": "Work (busy)", "mode": "busy"})if err != nil { return err} fmt.Println(feed.String("url"))Shënime
One person may keep 10 links. One more is refused with 409
calendar_feed_limit.
E disponueshme edhe në
Calendar.ResetFeed
Reset a calendar link
ResetFeed(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Replaces the secret in a calendar link, so the old address stops working everywhere it was shared. Paste the new address into the calendar apps you still want to update.
Parametrat
idstringE detyrueshmeCalendar link id,
cfd_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with its new url and webcalUrl.
Shembull
feed, err := client.Calendar.ResetFeed(ctx, "cfd_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} fmt.Println(feed.String("url"))Shënime
A link that is not yours is a 404
calendar_feed_not_found.
E disponueshme edhe në
Calendar.DeleteFeed
Delete a calendar link
DeleteFeed(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Turns a calendar link off for good. Calendar apps that subscribed to it stop getting updates.
Parametrat
idstringE detyrueshmeCalendar link id,
cfd_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with deleted: true.
Shembull
feed, err := client.Calendar.DeleteFeed(ctx, "cfd_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} fmt.Println(feed.String("id"), feed.String("object"))Shënime
A link that is not yours is a 404
calendar_feed_not_found.
E disponueshme edhe në
Calendar.ListSubscriptions
List calendar subscriptions
ListSubscriptions(ctx context.Context, opts ...openemail.RequestOption) ([]openemail.Object, error)Returns the other calendars you subscribe to by link, such as a Google or Outlook calendar address, a team rota or public holidays, as Other calendars in the app lists them. Their events show on your calendar, read-only.
Parametrat
openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
A []openemail.Object, each with name, url, color, status, lastError and how many events it holds.
Shembull
subscriptions, err := client.Calendar.ListSubscriptions(ctx)if err != nil { return err} for _, subscription := range subscriptions { fmt.Println(subscription.String("name"), subscription.String("status"), subscription.Int("eventCount"))}Shënime
statusisfailingwhile reads fail and are retried, andstoppedafter ten failures in a row until you refresh it.
E disponueshme edhe në
Calendar.CreateSubscription
Subscribe to a calendar
CreateSubscription(ctx context.Context, body openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)Adds a calendar by its iCalendar link: an https, http or webcal address, such as the secret address of a Google calendar or a published Outlook calendar. It is read at once, then again about every half hour. name defaults to the name the calendar gives itself.
Parametrat
urlstringE detyrueshmeThe calendar link,
https,httporwebcal.namestringThe name to show, up to 100 characters.
colorstringThe colour of its events, from
CALENDAR_COLORS.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with its first events read.
Shembull
holidays, err := client.Calendar.CreateSubscription(ctx, openemail.Body{"url": "webcal://example.com/holidays.ics", "color": "green"})if err != nil { return err} fmt.Println(holidays.String("name"), holidays.Int("eventCount"))Shënime
An address that does not answer with a calendar is refused with 422
calendar_subscription_unreadable, and one you already subscribe to with 409calendar_subscription_exists.One person may subscribe to 20 calendars.
E disponueshme edhe në
Calendar.UpdateSubscription
Change a calendar subscription
UpdateSubscription(ctx context.Context, id string, patch openemail.Body, opts ...openemail.RequestOption) (openemail.Object, error)Renames a subscription or gives it another colour.
Parametrat
idstringE detyrueshmeSubscription id,
csb_followed by 24 hex characters.namestringThe new name, up to 100 characters.
colorstringThe new colour, from
CALENDAR_COLORS.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object as it stands now.
Shembull
subscription, err := client.Calendar.UpdateSubscription(ctx, "csb_3f9a1c7e5b2d48a06c1e9f4b", openemail.Body{"name": "Team rota", "color": "purple"})if err != nil { return err} fmt.Println(subscription.String("id"), subscription.String("status"))Shënime
A subscription that is not yours is a 404
calendar_subscription_not_found.
E disponueshme edhe në
Calendar.RefreshSubscription
Refresh a calendar subscription
RefreshSubscription(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Reads a subscribed calendar again now instead of waiting for the next half-hourly read, and restarts one that stopped after repeated failures.
Parametrat
idstringE detyrueshmeSubscription id,
csb_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object after the read, with status and lastError.
Shembull
subscription, err := client.Calendar.RefreshSubscription(ctx, "csb_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} fmt.Println(subscription.String("lastError"))Shënime
A calendar read less than a minute ago is refused with 429
calendar_subscription_refresh_too_soon.
E disponueshme edhe në
Calendar.DeleteSubscription
Unsubscribe from a calendar
DeleteSubscription(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Removes a subscription and every event it brought onto your calendar.
Parametrat
idstringE detyrueshmeSubscription id,
csb_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client's API key for this call only.
Kthen
An openemail.Object with deleted: true.
Shembull
subscription, err := client.Calendar.DeleteSubscription(ctx, "csb_3f9a1c7e5b2d48a06c1e9f4b")if err != nil { return err} fmt.Println(subscription.String("id"), subscription.String("object"))Shënime
A subscription that is not yours is a 404
calendar_subscription_not_found.
E disponueshme edhe në
Calendar.ImportIcs
Import a calendar file
ImportIcs(ctx context.Context, data io.Reader, opts ...openemail.RequestOption) (openemail.Object, error)Sends an iCalendar (.ics) file as the request body and queues it. Its events become events of your own that you can edit, and nobody on them is sent anything, now or when you change them later, unless you ask for that on the change. Poll GetImport until status is completed.
The file may be 10 MB and hold 25,000 events. Several calendars in one file are merged, and the report keeps their names. An event whose UID is already in the workspace is skipped and counted, never overwritten, so sending the same file twice adds nothing.
data is an io.Reader, and it goes out as text/calendar.
Parametrat
dataio.ReaderE detyrueshmeThe .ics file: an
io.Reader.openemail.WithFilenamestringThe name to show for the file in the list of imports, at most 255 characters.
openemail.WithAPIKeystringOverrides the client API key for this call only.
Kthen
An openemail.Object with status: queued.
Shembull
source, err := os.Open("work.ics")if err != nil { return err} defer source.Close() queued, err := client.Calendar.ImportIcs(ctx, source, openemail.WithFilename("work.ics"))if err != nil { return err} fmt.Println(queued.ID(), queued.String("status"))Shënime
A body that is not an iCalendar file is a 400
not_a_calendar_file, an empty one a 400item_import_empty, and one holding more than 25,000 events a 400too_many_events.A file over 10 MB is a 413
item_import_too_large.To send text you already hold, such as what
GetEventIcsreturns, wrap it instrings.NewReader(text).An upload that outlasts the client timeout fails as a network error, so raise it on the client for a large file on a slow connection.
Not retried automatically.
E disponueshme edhe në
Calendar.ListImports
List calendar imports
ListImports(ctx context.Context, opts ...openemail.RequestOption) (*openemail.Page, error)Returns one page of the calendar files and calendars brought in, newest first, each with what it added and what it left out. Beside the files sent with ImportIcs it lists the calendars that came with a mailbox import, and those carry the id of that import in parentImportId.
Paging is keyset. openemail.WithLimit takes 1 to 100 and defaults to 25, and NextCursor goes back as openemail.WithCursor while HasMore is true. ListAllImports and IterateImports do that walk for you.
Parametrat
openemail.WithLimitintImports per page, a whole number from 1 to 100. The server defaults to 25.
openemail.WithCursorstringThe
NextCursorfrom the previous page. Never build one yourself.openemail.WithAPIKeystringOverrides the client API key for this call only.
Kthen
A *openemail.Page with Items, HasMore and NextCursor.
Shembull
page, err := client.Calendar.ListImports(ctx, openemail.WithLimit(50))if err != nil { return err} for _, job := range page.Items { fmt.Println(job.String("fileName"), job.String("status"), job.Object("counts").Int("imported"), job.Object("counts").Int("skipped"))} fmt.Println(page.HasMore, page.NextCursor)Shënime
sourceisfilefor an upload.takeout,caldavandmicrosoftcame with a mailbox import.A cursor that names no import is a 400
invalid_cursor.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's
openemail.WithMaxRetries, and on a 429 only when it carries aRetry-Afterof a minute or less.
E disponueshme edhe në
Calendar.ListAllImports
Collect every calendar import into one slice
ListAllImports(ctx context.Context, opts ...openemail.RequestOption) ([]openemail.Object, error)Follows NextCursor from page to page and returns with every calendar import, newest first.
Everything is held in memory before the call returns. Prefer IterateImports when you can stop early. limit sets the page size of each request, not the total.
Parametrat
openemail.WithLimitintPage size per request, from 1 to 100, defaulting to 25 on the server.
openemail.WithCursorstringA cursor from an earlier page to start after.
openemail.WithAPIKeystringOverrides the client API key for every page of this walk.
Kthen
A []openemail.Object holding every import across all pages.
Shembull
imports, err := client.Calendar.ListAllImports(ctx)if err != nil { return err} added := 0 for _, job := range imports { added += job.Object("counts").Int("imported")} fmt.Println(added, "events came from", len(imports), "imports")Shënime
A failure on any page fails the whole call, and the imports already fetched are discarded.
E disponueshme edhe në
Calendar.IterateImports
Stream calendar imports one at a time
IterateImports(ctx context.Context, opts ...openemail.RequestOption) *openemail.IteratorReturns an iterator that yields calendar imports one by one, newest first, and requests the next page only once the current one is drained. Nothing is fetched until you consume it, and breaking out of the loop stops the requests.
Parametrat
openemail.WithLimitintPage size per request, from 1 to 100, defaulting to 25 on the server.
openemail.WithCursorstringA cursor from an earlier page to start after.
openemail.WithAPIKeystringOverrides the client API key for every page of this walk.
Kthen
An *openemail.Iterator yielding one import per step.
Shembull
for job, err := range client.Calendar.IterateImports(ctx).All() { if err != nil { return err } if job.String("status") != "running" { continue } fmt.Println("still running", job.ID(), job.Object("counts").Int("total")) break}Shënime
The iterator is lazy, so an abandoned loop costs only the pages you consumed.
E disponueshme edhe në
Calendar.GetImport
Get a calendar import
GetImport(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Returns one calendar import with its counts and its report: the calendars it read, how many events it left out and why, and up to 20 of the events it left out. Poll it after ImportIcs until status is completed or failed.
counts.imported is what was added and counts.skipped what was left out, which report.skipped breaks down by reason: uid-taken for an event that was already here, no-start for one with no start time, invalid for one that could not be read and empty for a file or calendar that held no events.
Parametrat
idstringE detyrueshmeCalendar import id,
iimp_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client API key for this call only.
Kthen
An openemail.Object with status, counts, report, undoable and when it started, finished and was undone.
Shembull
item, err := client.Calendar.GetImport(ctx, "iimp_3f9c2a7b1e4d8f60a5c7b92d")if err != nil { return err} counts := item.Object("counts") fmt.Println(item.String("status"), counts.Int("imported"), counts.Int("skipped")) for _, sample := range item.Object("report").Objects("samples") { fmt.Println(sample.String("name"), sample.String("reason"))}Shënime
An id that names no calendar import is a 404
item_import_not_found.A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's
openemail.WithMaxRetries, and on a 429 only when it carries aRetry-Afterof a minute or less.
E disponueshme edhe në
Calendar.UndoImport
Remove what a calendar import added
UndoImport(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)Deletes every event the import added, changed since or not, and marks the import undone. Nobody is told. Events that were skipped because they were already here are not touched.
Parametrat
idstringE detyrueshmeCalendar import id,
iimp_followed by 24 hex characters.openemail.WithAPIKeystringOverrides the client API key for this call only.
Kthen
An openemail.Object with status: undone and undoneAt set.
Shembull
undone, err := client.Calendar.UndoImport(ctx, "iimp_3f9c2a7b1e4d8f60a5c7b92d")if err != nil { return err} fmt.Println(undone.String("status"), undone.String("undoneAt"), undone.Object("counts").Int("imported"))Shënime
An import that is still running, or was already removed, is a 409
item_import_not_undoable.undoableon the import says whether the call would remove anything.An id that names no calendar import is a 404
item_import_not_found.Not retried automatically.