Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(calendar_events): create out-of-office events via event type (#6183)

gbirman39682fdd2a5f
diff --git a/.sqlx/query-71f1fb0b913806bbbf860c15c17471049675b45f8227bc4601b4a469ff5676c9.json b/.sqlx/query-daef8a092f75b7c1fd4c611eecc843c347658d24d344e1e66f5508191974f138.json
similarity index 50%
rename from .sqlx/query-71f1fb0b913806bbbf860c15c17471049675b45f8227bc4601b4a469ff5676c9.json
rename to .sqlx/query-daef8a092f75b7c1fd4c611eecc843c347658d24d344e1e66f5508191974f138.json
index 96471e2ed7..15417af3cc 100644
--- a/.sqlx/query-71f1fb0b913806bbbf860c15c17471049675b45f8227bc4601b4a469ff5676c9.json
+++ b/.sqlx/query-daef8a092f75b7c1fd4c611eecc843c347658d24d344e1e66f5508191974f138.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n link.macro_id AS owner_id,\n link.id AS email_link_id,\n account.id AS account_id,\n calendar.id AS calendar_id,\n calendar.provider_calendar_id,\n calendar.access_role,\n link.fusionauth_user_id,\n link.email_address,\n link.provider::text AS \"provider!\"\n FROM email_links link\n JOIN calendar_accounts account ON account.email_link_id = link.id\n JOIN calendars calendar ON calendar.account_id = account.id\n WHERE NOT calendar.is_deleted\n AND account.sync_status <> 'disabled'\n AND (\n ($3::uuid IS NOT NULL AND calendar.id = $3)\n OR ($3::uuid IS NULL AND calendar.is_primary)\n )\n AND ($2::uuid IS NULL OR link.id = $2)\n AND (\n link.macro_id = $1\n OR EXISTS (\n SELECT 1\n FROM macro_user_links delegation\n WHERE delegation.link_id = link.id\n AND delegation.primary_macro_id = $1\n )\n )\n ORDER BY\n (link.macro_id = $1) DESC,\n link.is_primary DESC,\n link.created_at ASC\n LIMIT 1\n ",
+ "query": "\n SELECT\n link.macro_id AS owner_id,\n link.id AS email_link_id,\n account.id AS account_id,\n calendar.id AS calendar_id,\n calendar.provider_calendar_id,\n calendar.access_role,\n calendar.is_primary,\n link.fusionauth_user_id,\n link.email_address,\n link.provider::text AS \"provider!\"\n FROM email_links link\n JOIN calendar_accounts account ON account.email_link_id = link.id\n JOIN calendars calendar ON calendar.account_id = account.id\n WHERE NOT calendar.is_deleted\n AND account.sync_status <> 'disabled'\n AND (\n ($3::uuid IS NOT NULL AND calendar.id = $3)\n OR ($3::uuid IS NULL AND calendar.is_primary)\n )\n AND ($2::uuid IS NULL OR link.id = $2)\n AND (\n link.macro_id = $1\n OR EXISTS (\n SELECT 1\n FROM macro_user_links delegation\n WHERE delegation.link_id = link.id\n AND delegation.primary_macro_id = $1\n )\n )\n ORDER BY\n (link.macro_id = $1) DESC,\n link.is_primary DESC,\n link.created_at ASC\n LIMIT 1\n ",
"describe": {
"columns": [
{
@@ -35,16 +35,21 @@
},
{
"ordinal": 6,
+ "name": "is_primary",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 7,
"name": "fusionauth_user_id",
"type_info": "Text"
},
{
- "ordinal": 7,
+ "ordinal": 8,
"name": "email_address",
"type_info": "Varchar"
},
{
- "ordinal": 8,
+ "ordinal": 9,
"name": "provider!",
"type_info": "Text"
}
@@ -65,8 +70,9 @@
true,
false,
false,
+ false,
null
]
},
- "hash": "71f1fb0b913806bbbf860c15c17471049675b45f8227bc4601b4a469ff5676c9"
+ "hash": "daef8a092f75b7c1fd4c611eecc843c347658d24d344e1e66f5508191974f138"
}
diff --git a/apps/docs/AI/mcp/tools/create-calendar-event.mdx b/apps/docs/AI/mcp/tools/create-calendar-event.mdx
index 6c777a116e..4f830bd89b 100644
--- a/apps/docs/AI/mcp/tools/create-calendar-event.mdx
+++ b/apps/docs/AI/mcp/tools/create-calendar-event.mdx
@@ -1,6 +1,6 @@
---
title: CreateCalendarEvent
-description: "Prepare an event on the user's calendar, inviting any listed attendees through Google Calendar. In Macro chat this tool opens an inline composer so the user can review, edit, and confirm the event; use the tool to present the proposal instead of asking for a redundant confirmation in prose. When the pending call is executed, the event is written to Google immediately and attendees receive invitations. Other clients should confirm attendee events before executing the call. The event lands on the user's primary calendar unless `calendarId` (from ListCalendars) targets another one. For recurring events pass RFC 5545 lines in `recurrenceLines`, e.g. [\"RRULE:FREQ=WEEKLY;BYDAY=MO\"]. Returns the created event with its `eventId` for later updates or deletion. Fails if the user has no writable calendar connected."
+description: "Prepare an event on the user's calendar, inviting any listed attendees through Google Calendar. In Macro chat this tool opens an inline composer so the user can review, edit, and confirm the event; use the tool to present the proposal instead of asking for a redundant confirmation in prose. When the pending call is executed, the event is written to Google immediately and attendees receive invitations. Other clients should confirm attendee events before executing the call. The event lands on the user's primary calendar unless `calendarId` (from ListCalendars) targets another one. For recurring events pass RFC 5545 lines in `recurrenceLines`, e.g. [\"RRULE:FREQ=WEEKLY;BYDAY=MO\"]. Returns the created event with its `eventId` for later updates or deletion. Fails if the user has no writable calendar connected. Set `eventType` to \"out_of_office\" to mark the user as out of office (e.g. \"mark me out of office Thursday\"). Out-of-office events must land on the user's primary calendar (omit `calendarId`), must be timed rather than all-day, and take no attendees or Google Meet (leave `addGoogleMeet` false); use `outOfOffice` to control whether conflicting meetings are auto-declined. The type cannot be changed afterward."
---
# CreateCalendarEvent
@@ -9,6 +9,8 @@ Prepare an event on the user's calendar, inviting any listed attendees through G
The event lands on the user's primary calendar unless `calendarId` (from ListCalendars) targets another one. For recurring events pass RFC 5545 lines in `recurrenceLines`, e.g. ["RRULE:FREQ=WEEKLY;BYDAY=MO"]. Returns the created event with its `eventId` for later updates or deletion. Fails if the user has no writable calendar connected.
+Set `eventType` to "out_of_office" to mark the user as out of office (e.g. "mark me out of office Thursday"). Out-of-office events must land on the user's primary calendar (omit `calendarId`), must be timed rather than all-day, and take no attendees or Google Meet (leave `addGoogleMeet` false); use `outOfOffice` to control whether conflicting meetings are auto-declined. The type cannot be changed afterward.
+
## Parameters
| Parameter | Type | Required | Description |
@@ -22,3 +24,5 @@ The event lands on the user's primary calendar unless `calendarId` (from ListCal
| `calendarId` | string | No | Calendar to create the event on, from ListCalendars. Omit to use the user's primary calendar. |
| `reminders` | EventRemindersInput | No | Reminder configuration for the event. Omit to use the selected calendar's defaults. |
| `addGoogleMeet` | boolean | No | Attach a freshly generated Google Meet video conference to the event. |
+| `eventType` | `"default"` \| `"out_of_office"` | No | The kind of event a create tool call makes. |
+| `outOfOffice` | OutOfOfficeInput | No | Out-of-office decline behavior, used only when eventType is "out_of_office". Omit to just block the time; set `autoDeclineMode` to "decline_all" or "decline_new_only" to have Google decline conflicting meetings, optionally with a `declineMessage`. |
diff --git a/apps/docs/AI/mcp/tools/update-calendar-event.mdx b/apps/docs/AI/mcp/tools/update-calendar-event.mdx
index 273fe60120..f21df23220 100644
--- a/apps/docs/AI/mcp/tools/update-calendar-event.mdx
+++ b/apps/docs/AI/mcp/tools/update-calendar-event.mdx
@@ -29,3 +29,4 @@ Passing `attendees` replaces the full attendee list — include everyone who sho
| `conference` | `"google_meet"` \| `"remove"` | No | Change the event's video conference: "google_meet" attaches a fresh Google Meet, "remove" detaches the current conference. Omit to leave it untouched. |
| `reminders` | EventRemindersInput | No | Replacement notification reminders. `useDefault: true` follows the calendar's own defaults; otherwise `overrides` replaces the whole list with entries of `method` "popup" (a Macro notification) or "email" and `minutes` before the start — an empty list silences the event. Omit to keep the current reminders. |
| `rsvp` | `"accepted"` \| `"declined"` \| `"tentative"` | No | Set the user's own response to the invitation: "accepted", "declined", or "tentative". Omit to leave their response alone. |
+| `outOfOffice` | OutOfOfficeInput | No | Adjust out-of-office decline behavior; only valid on an event that is already out of office (its event type cannot be changed). Replaces the whole block: set `autoDeclineMode` ("decline_none", "decline_all", or "decline_new_only") and optionally `declineMessage`. Omit to leave it untouched. |
diff --git a/apps/web/src/lib/core/component/AI/component/tool/calendar/ChatCompose.tsx b/apps/web/src/lib/core/component/AI/component/tool/calendar/ChatCompose.tsx
index 818580e541..b937421877 100644
--- a/apps/web/src/lib/core/component/AI/component/tool/calendar/ChatCompose.tsx
+++ b/apps/web/src/lib/core/component/AI/component/tool/calendar/ChatCompose.tsx
@@ -10,6 +10,7 @@ import { useChatContext } from '@core/component/AI/context';
import type { AssistantMessagePart } from '@core/component/AI/types';
import { toast } from '@core/component/Toast/Toast';
import { recipientEntityMapper, useContacts } from '@core/user';
+import AirplaneTiltIcon from '@phosphor/airplane-tilt.svg';
import { useVisibleCalendarsQuery } from '@queries/calendar/calendars';
import { invalidateCalendarOccurrences } from '@queries/calendar/occurrences';
import { useChatQuery } from '@queries/chat';
@@ -30,6 +31,7 @@ import { CalendarToolEventPreview } from './EventPreview';
import {
createCalendarEventToEditorInitialValues,
editorSubmitValuesToCreateCalendarEvent,
+ outOfOfficeNotice,
} from './event-form-adapter';
import { openToolCalendarEvent } from './open-tool-event';
@@ -339,6 +341,28 @@ function CalendarChatComposeContent(props: CalendarChatComposeProps) {
edited.
</p>
</Show>
+ <Show when={outOfOfficeNotice(props.initialData)}>
+ {(notice) => (
+ <div
+ role="note"
+ aria-label="Out-of-office event"
+ class="flex items-start gap-2 rounded-lg border border-warning/40 bg-warning-bg p-3 text-xs text-warning-ink"
+ >
+ <AirplaneTiltIcon class="mt-px size-4 shrink-0" />
+ <div class="flex min-w-0 flex-col gap-1">
+ <span class="font-medium">Out-of-office event</span>
+ <span>{notice().effect}</span>
+ <Show when={notice().declineMessage}>
+ {(message) => (
+ <span class="italic">
+ Auto-decline reply: “{message()}”
+ </span>
+ )}
+ </Show>
+ </div>
+ </div>
+ )}
+ </Show>
<EventForm
controller={controller}
class="min-w-0"
diff --git a/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.test.ts b/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.test.ts
new file mode 100644
index 0000000000..ae00fc346a
--- /dev/null
+++ b/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.test.ts
@@ -0,0 +1,69 @@
+import type { CreateCalendarEvent } from '@service-cognition/generated/tools/types';
+import { describe, expect, it } from 'vitest';
+import { outOfOfficeNotice } from './event-form-adapter';
+
+function event(overrides: Partial<CreateCalendarEvent>): CreateCalendarEvent {
+ return {
+ title: 'Focus',
+ time: {
+ kind: 'timed',
+ startsAt: '2026-08-20T17:00:00Z',
+ endsAt: '2026-08-20T18:00:00Z',
+ },
+ ...overrides,
+ } as CreateCalendarEvent;
+}
+
+describe('outOfOfficeNotice', () => {
+ it('returns nothing for a regular event', () => {
+ expect(outOfOfficeNotice(event({}))).toBeUndefined();
+ expect(outOfOfficeNotice(event({ eventType: 'default' }))).toBeUndefined();
+ });
+
+ it('discloses the auto-decline behavior for each mode', () => {
+ expect(
+ outOfOfficeNotice(
+ event({
+ eventType: 'out_of_office',
+ outOfOffice: { autoDeclineMode: 'decline_all' },
+ })
+ )?.effect
+ ).toContain('decline all conflicting invitations');
+
+ expect(
+ outOfOfficeNotice(
+ event({
+ eventType: 'out_of_office',
+ outOfOffice: { autoDeclineMode: 'decline_new_only' },
+ })
+ )?.effect
+ ).toContain('newly received conflicting invitations');
+
+ // No decline mode still discloses the away status, without promising declines.
+ const none = outOfOfficeNotice(
+ event({ eventType: 'out_of_office', outOfOffice: {} })
+ );
+ expect(none?.effect).toContain('away');
+ expect(none?.effect).not.toContain('decline all');
+ });
+
+ it('surfaces a decline message and drops a blank one', () => {
+ expect(
+ outOfOfficeNotice(
+ event({
+ eventType: 'out_of_office',
+ outOfOffice: { declineMessage: 'On vacation' },
+ })
+ )?.declineMessage
+ ).toBe('On vacation');
+
+ expect(
+ outOfOfficeNotice(
+ event({
+ eventType: 'out_of_office',
+ outOfOffice: { declineMessage: ' ' },
+ })
+ )?.declineMessage
+ ).toBeUndefined();
+ });
+});
diff --git a/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.ts b/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.ts
index 02a3c61138..31003ba141 100644
--- a/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.ts
+++ b/apps/web/src/lib/core/component/AI/component/tool/calendar/event-form-adapter.ts
@@ -7,6 +7,44 @@ import type {
EventTimeInput,
} from '@service-cognition/generated/tools/types';
import { format, isValid, parseISO, subDays } from 'date-fns';
+import { match } from 'ts-pattern';
+
+/**
+ * The consequential side effects of a deferred out-of-office create, so the
+ * confirmation composer can disclose them before the user confirms. EventForm
+ * does not surface `eventType`/`outOfOffice`, so without this an event that
+ * looks ordinary would silently write an away block and auto-decline meetings.
+ */
+export type OutOfOfficeNotice = {
+ /** Plain-language description of the away status and auto-decline behavior. */
+ effect: string;
+ /** The reply sent to auto-declined organizers, when one is set. */
+ declineMessage?: string;
+};
+
+/** Describe a deferred create's out-of-office effects, or `undefined` when it is a regular event. */
+export function outOfOfficeNotice(
+ event: CreateCalendarEvent
+): OutOfOfficeNotice | undefined {
+ if (event.eventType !== 'out_of_office') return undefined;
+ const effect = match(event.outOfOffice?.autoDeclineMode ?? 'decline_none')
+ .with(
+ 'decline_all',
+ () =>
+ 'Google will show you as away and automatically decline all conflicting invitations.'
+ )
+ .with(
+ 'decline_new_only',
+ () =>
+ 'Google will show you as away and automatically decline newly received conflicting invitations.'
+ )
+ .otherwise(
+ () =>
+ 'Google will show you as away for this time; conflicting invitations are left untouched.'
+ );
+ const declineMessage = event.outOfOffice?.declineMessage?.trim() || undefined;
+ return { effect, declineMessage };
+}
const DATE_VALUE = 'yyyy-MM-dd';
const DATETIME_VALUE = "yyyy-MM-dd'T'HH:mm";
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/tools/schemas.ts b/apps/web/src/lib/service-clients/service-cognition/generated/tools/schemas.ts
index 5aa3bbd00a..bb00fb5938 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/tools/schemas.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/tools/schemas.ts
@@ -933,6 +933,63 @@ export const CreateCalendarEvent = z.object({
])
.optional(),
addGoogleMeet: z.boolean().optional(),
+ eventType: z
+ .any()
+ .superRefine((x, ctx) => {
+ const schemas = [z.literal('default'), z.literal('out_of_office')];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) => (result.error ? [...errors, result.error] : errors))(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ })
+ .optional(),
+ outOfOffice: z
+ .union([
+ z.object({
+ autoDeclineMode: z
+ .union([
+ z.any().superRefine((x, ctx) => {
+ const schemas = [
+ z.literal('decline_none'),
+ z.literal('decline_all'),
+ z.literal('decline_new_only'),
+ ];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) =>
+ result.error ? [...errors, result.error] : errors)(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ }),
+ z.null(),
+ ])
+ .optional(),
+ declineMessage: z.union([z.string(), z.null()]).optional(),
+ }),
+ z.null(),
+ ])
+ .optional(),
});
export const UserToolResponseForToolCalendarEvent = z
@@ -4505,6 +4562,42 @@ export const UpdateCalendarEvent = z.object({
z.null(),
])
.optional(),
+ outOfOffice: z
+ .union([
+ z.object({
+ autoDeclineMode: z
+ .union([
+ z.any().superRefine((x, ctx) => {
+ const schemas = [
+ z.literal('decline_none'),
+ z.literal('decline_all'),
+ z.literal('decline_new_only'),
+ ];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) =>
+ result.error ? [...errors, result.error] : errors)(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ }),
+ z.null(),
+ ])
+ .optional(),
+ declineMessage: z.union([z.string(), z.null()]).optional(),
+ }),
+ z.null(),
+ ])
+ .optional(),
});
export const ToolCalendarEvent = z.object({
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
index 39d7cf268a..edd533c436 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
@@ -199,6 +199,17 @@ export type EventTimeInput =
endDate: string;
kind: 'allDay';
};
+/**
+ * The kind of event a create tool call makes.
+ */
+export type CalendarEventTypeInput = 'default' | 'out_of_office';
+/**
+ * How an out-of-office event handles conflicting invitations.
+ */
+export type AutoDeclineModeInput =
+ | 'decline_none'
+ | 'decline_all'
+ | 'decline_new_only';
/**
* User tools are pending until a user executes them
*/
@@ -1799,6 +1810,8 @@ export interface BotWebhook {
* Prepare an event on the user's calendar, inviting any listed attendees through Google Calendar. In Macro chat this tool opens an inline composer so the user can review, edit, and confirm the event; use the tool to present the proposal instead of asking for a redundant confirmation in prose. When the pending call is executed, the event is written to Google immediately and attendees receive invitations. Other clients should confirm attendee events before executing the call.
*
* The event lands on the user's primary calendar unless `calendarId` (from ListCalendars) targets another one. For recurring events pass RFC 5545 lines in `recurrenceLines`, e.g. ["RRULE:FREQ=WEEKLY;BYDAY=MO"]. Returns the created event with its `eventId` for later updates or deletion. Fails if the user has no writable calendar connected.
+ *
+ * Set `eventType` to "out_of_office" to mark the user as out of office (e.g. "mark me out of office Thursday"). Out-of-office events must land on the user's primary calendar (omit `calendarId`), must be timed rather than all-day, and take no attendees or Google Meet (leave `addGoogleMeet` false); use `outOfOffice` to control whether conflicting meetings are auto-declined. The type cannot be changed afterward.
*/
export interface CreateCalendarEvent {
/**
@@ -1834,6 +1847,11 @@ export interface CreateCalendarEvent {
* Attach a freshly generated Google Meet video conference to the event.
*/
addGoogleMeet?: boolean;
+ eventType?: CalendarEventTypeInput;
+ /**
+ * Out-of-office decline behavior, used only when eventType is "out_of_office". Omit to just block the time; set `autoDeclineMode` to "decline_all" or "decline_new_only" to have Google decline conflicting meetings, optionally with a `declineMessage`.
+ */
+ outOfOffice?: OutOfOfficeInput | null;
}
/**
* An attendee supplied to a calendar tool.
@@ -1874,6 +1892,20 @@ export interface EventReminderOverrideInput {
*/
minutes: number;
}
+/**
+ * Out-of-office decline behavior supplied to the calendar tools.
+ */
+export interface OutOfOfficeInput {
+ /**
+ * How conflicting invitations are handled. Defaults to declining nothing,
+ * so the event only blocks time and shows the away status.
+ */
+ autoDeclineMode?: AutoDeclineModeInput | null;
+ /**
+ * Message returned to organizers whose invitations are auto-declined.
+ */
+ declineMessage?: string | null;
+}
/**
* A calendar event as returned by the create and update tools.
*/
@@ -5248,6 +5280,10 @@ export interface UpdateCalendarEvent {
* Set the user's own response to the invitation: "accepted", "declined", or "tentative". Omit to leave their response alone.
*/
rsvp?: RsvpResponseInput | null;
+ /**
+ * Adjust out-of-office decline behavior; only valid on an event that is already out of office (its event type cannot be changed). Replaces the whole block: set `autoDeclineMode` ("decline_none", "decline_all", or "decline_new_only") and optionally `declineMessage`. Omit to leave it untouched.
+ */
+ outOfOffice?: OutOfOfficeInput | null;
}
/**
* Change one of the current user's reminders: reword it, move when it fires, or mark it done. Get the `reminderId` from ListReminders or CreateReminder.
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequest.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequest.ts
index 0ab2bf5ba6..12d3821584 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequest.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequest.ts
@@ -10,6 +10,7 @@ import type { CreateCalendarEventRequestConference } from './createCalendarEvent
import type { CreateCalendarEventRequestDescription } from './createCalendarEventRequestDescription';
import type { CreateCalendarEventRequestEmailLinkId } from './createCalendarEventRequestEmailLinkId';
import type { CreateCalendarEventRequestLocation } from './createCalendarEventRequestLocation';
+import type { CreateCalendarEventRequestOutOfOffice } from './createCalendarEventRequestOutOfOffice';
import type { CreateCalendarEventRequestReminders } from './createCalendarEventRequestReminders';
import type { CreateCalendarEventRequestTransparency } from './createCalendarEventRequestTransparency';
import type { CreateCalendarEventRequestVisibility } from './createCalendarEventRequestVisibility';
@@ -32,6 +33,7 @@ to the requester's primary inbox. */
emailLinkId?: CreateCalendarEventRequestEmailLinkId;
/** Optional location label. */
location?: CreateCalendarEventRequestLocation;
+ outOfOffice?: CreateCalendarEventRequestOutOfOffice;
/** Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`). */
recurrenceLines?: string[];
reminders?: CreateCalendarEventRequestReminders;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequestOutOfOffice.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequestOutOfOffice.ts
new file mode 100644
index 0000000000..d720a761d8
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/createCalendarEventRequestOutOfOffice.ts
@@ -0,0 +1,10 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { OutOfOfficeProperties } from './outOfOfficeProperties';
+
+export type CreateCalendarEventRequestOutOfOffice =
+ null | OutOfOfficeProperties;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
index caf21cc4ae..00b45ceae1 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts
@@ -184,6 +184,7 @@ export * from './createCalendarEventRequestConference';
export * from './createCalendarEventRequestDescription';
export * from './createCalendarEventRequestEmailLinkId';
export * from './createCalendarEventRequestLocation';
+export * from './createCalendarEventRequestOutOfOffice';
export * from './createCalendarEventRequestReminders';
export * from './createCalendarEventRequestTransparency';
export * from './createCalendarEventRequestVisibility';
@@ -260,6 +261,9 @@ export * from './messageSentAt';
export * from './messageSizeEstimate';
export * from './messageSnippet';
export * from './messageSubject';
+export * from './outOfOfficeAutoDeclineMode';
+export * from './outOfOfficeProperties';
+export * from './outOfOfficePropertiesDeclineMessage';
export * from './parsedMessage';
export * from './parsedMessageBodyParsed';
export * from './parsedMessageFrom';
@@ -322,6 +326,7 @@ export * from './updateCalendarEventRequestAttendees';
export * from './updateCalendarEventRequestConference';
export * from './updateCalendarEventRequestDescription';
export * from './updateCalendarEventRequestLocation';
+export * from './updateCalendarEventRequestOutOfOffice';
export * from './updateCalendarEventRequestRecurrenceId';
export * from './updateCalendarEventRequestRecurrenceLines';
export * from './updateCalendarEventRequestReminders';
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeAutoDeclineMode.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeAutoDeclineMode.ts
new file mode 100644
index 0000000000..c61a9e2580
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeAutoDeclineMode.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * How an out-of-office event responds to conflicting invitations, mirroring
+Google's `autoDeclineMode`.
+ */
+export type OutOfOfficeAutoDeclineMode =
+ (typeof OutOfOfficeAutoDeclineMode)[keyof typeof OutOfOfficeAutoDeclineMode];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const OutOfOfficeAutoDeclineMode = {
+ decline_none: 'decline_none',
+ decline_all_conflicting_invitations: 'decline_all_conflicting_invitations',
+ decline_only_new_conflicting_invitations:
+ 'decline_only_new_conflicting_invitations',
+} as const;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeProperties.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeProperties.ts
new file mode 100644
index 0000000000..a14881101a
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficeProperties.ts
@@ -0,0 +1,20 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { OutOfOfficeAutoDeclineMode } from './outOfOfficeAutoDeclineMode';
+import type { OutOfOfficePropertiesDeclineMessage } from './outOfOfficePropertiesDeclineMessage';
+
+/**
+ * The extra properties Google requires on an out-of-office event, mirroring
+its `outOfOfficeProperties` block. Their presence on a draft or patch is
+what marks the mutation as out-of-office.
+ */
+export interface OutOfOfficeProperties {
+ /** How conflicting invitations are handled while the user is out. */
+ autoDeclineMode?: OutOfOfficeAutoDeclineMode;
+ /** Message returned to organizers whose invitations are auto-declined. */
+ declineMessage?: OutOfOfficePropertiesDeclineMessage;
+}
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficePropertiesDeclineMessage.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficePropertiesDeclineMessage.ts
new file mode 100644
index 0000000000..b49e3bc476
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/outOfOfficePropertiesDeclineMessage.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Message returned to organizers whose invitations are auto-declined.
+ */
+export type OutOfOfficePropertiesDeclineMessage = string | null;
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequest.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequest.ts
index d1493d9b24..f0b9dc488d 100644
--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequest.ts
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequest.ts
@@ -8,6 +8,7 @@ import type { UpdateCalendarEventRequestAttendees } from './updateCalendarEventR
import type { UpdateCalendarEventRequestConference } from './updateCalendarEventRequestConference';
import type { UpdateCalendarEventRequestDescription } from './updateCalendarEventRequestDescription';
import type { UpdateCalendarEventRequestLocation } from './updateCalendarEventRequestLocation';
+import type { UpdateCalendarEventRequestOutOfOffice } from './updateCalendarEventRequestOutOfOffice';
import type { UpdateCalendarEventRequestRecurrenceId } from './updateCalendarEventRequestRecurrenceId';
import type { UpdateCalendarEventRequestRecurrenceLines } from './updateCalendarEventRequestRecurrenceLines';
import type { UpdateCalendarEventRequestReminders } from './updateCalendarEventRequestReminders';
@@ -28,6 +29,7 @@ export interface UpdateCalendarEventRequest {
description?: UpdateCalendarEventRequestDescription;
/** Replacement location; an empty string clears it. */
location?: UpdateCalendarEventRequestLocation;
+ outOfOffice?: UpdateCalendarEventRequestOutOfOffice;
/** Original-start key of the occurrence the update targets. */
recurrenceId?: UpdateCalendarEventRequestRecurrenceId;
/** Replacement recurrence properties; an empty list clears them. */
diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequestOutOfOffice.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequestOutOfOffice.ts
new file mode 100644
index 0000000000..d066249f1e
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/updateCalendarEventRequestOutOfOffice.ts
@@ -0,0 +1,10 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * email_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { OutOfOfficeProperties } from './outOfOfficeProperties';
+
+export type UpdateCalendarEventRequestOutOfOffice =
+ null | OutOfOfficeProperties;
diff --git a/apps/web/src/lib/service-clients/service-email/openapi.json b/apps/web/src/lib/service-clients/service-email/openapi.json
index 6c820b6d9a..3e4dd3f746 100644
--- a/apps/web/src/lib/service-clients/service-email/openapi.json
+++ b/apps/web/src/lib/service-clients/service-email/openapi.json
@@ -4822,6 +4822,17 @@
"type": ["string", "null"],
"description": "Optional location label."
},
+ "outOfOffice": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/OutOfOfficeProperties",
+ "description": "Out-of-office properties; present to create the event as a Google\nout-of-office status event (primary calendar only, timed, no\nattendees), omitted for a regular event."
+ }
+ ]
+ },
"recurrenceLines": {
"type": "array",
"items": {
@@ -5595,6 +5606,29 @@
"type": "string",
"enum": ["Show", "Hide"]
},
+ "OutOfOfficeAutoDeclineMode": {
+ "type": "string",
+ "description": "How an out-of-office event responds to conflicting invitations, mirroring\nGoogle's `autoDeclineMode`.",
+ "enum": [
+ "decline_none",
+ "decline_all_conflicting_invitations",
+ "decline_only_new_conflicting_invitations"
+ ]
+ },
+ "OutOfOfficeProperties": {
+ "type": "object",
+ "description": "The extra properties Google requires on an out-of-office event, mirroring\nits `outOfOfficeProperties` block. Their presence on a draft or patch is\nwhat marks the mutation as out-of-office.",
+ "properties": {
+ "autoDeclineMode": {
+ "$ref": "#/components/schemas/OutOfOfficeAutoDeclineMode",
+ "description": "How conflicting invitations are handled while the user is out."
+ },
+ "declineMessage": {
+ "type": ["string", "null"],
+ "description": "Message returned to organizers whose invitations are auto-declined."
+ }
+ }
+ },
"ParsedMessage": {
"type": "object",
"required": [
@@ -6190,6 +6224,17 @@
"type": ["string", "null"],
"description": "Replacement location; an empty string clears it."
},
+ "outOfOffice": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/OutOfOfficeProperties",
+ "description": "Replacement out-of-office properties, applied only to an event that is\nalready out-of-office — the provider event type is immutable. Omit to\nleave them untouched."
+ }
+ ]
+ },
"recurrenceId": {
"type": ["string", "null"],
"description": "Original-start key of the occurrence the update targets."
diff --git a/crates/calendar_events/src/domain/models.rs b/crates/calendar_events/src/domain/models.rs
index 138b39643f..60260f949a 100644
--- a/crates/calendar_events/src/domain/models.rs
+++ b/crates/calendar_events/src/domain/models.rs
@@ -313,6 +313,49 @@ impl EventType {
}
}
+/// How an out-of-office event responds to conflicting invitations, mirroring
+/// Google's `autoDeclineMode`.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
+#[serde(rename_all = "snake_case")]
+pub enum OutOfOfficeAutoDeclineMode {
+ /// Leave conflicting invitations alone. The default, so an out-of-office
+ /// event only blocks time and shows the status until the user asks for
+ /// declines.
+ #[default]
+ DeclineNone,
+ /// Decline every conflicting invitation, existing and new.
+ DeclineAllConflictingInvitations,
+ /// Decline only invitations that arrive after the event is created.
+ DeclineOnlyNewConflictingInvitations,
+}
+
+impl OutOfOfficeAutoDeclineMode {
+ /// The provider representation Google's `autoDeclineMode` field expects.
+ pub fn as_google_str(self) -> &'static str {
+ match self {
+ Self::DeclineNone => "declineNone",
+ Self::DeclineAllConflictingInvitations => "declineAllConflictingInvitations",
+ Self::DeclineOnlyNewConflictingInvitations => "declineOnlyNewConflictingInvitations",
+ }
+ }
+}
+
+/// The extra properties Google requires on an out-of-office event, mirroring
+/// its `outOfOfficeProperties` block. Their presence on a draft or patch is
+/// what marks the mutation as out-of-office.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
+#[serde(rename_all = "camelCase")]
+pub struct OutOfOfficeProperties {
+ /// How conflicting invitations are handled while the user is out.
+ #[serde(default)]
+ pub auto_decline_mode: OutOfOfficeAutoDeclineMode,
+ /// Message returned to organizers whose invitations are auto-declined.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub decline_message: Option<String>,
+}
+
/// The conferencing system backing an event's join URL.
///
/// Macro generates only Google Meet conferences, so this distinguishes one it
@@ -921,6 +964,10 @@ pub struct CalendarEventDraft {
pub reminders: Option<EventReminders>,
/// Conference to attach on creation. `None` creates the event without one.
pub conference: Option<ConferenceChange>,
+ /// Out-of-office properties. `Some` creates the event as a Google
+ /// out-of-office status event (primary calendar only, timed, no
+ /// attendees); `None` creates a regular event.
+ pub out_of_office: Option<OutOfOfficeProperties>,
}
/// User-supplied changes to an existing provider event. `None` fields are
@@ -947,6 +994,10 @@ pub struct CalendarEventPatch {
pub reminders: Option<EventReminders>,
/// Conference change to apply; `None` leaves the conference untouched.
pub conference: Option<ConferenceChange>,
+ /// Replacement out-of-office properties, applied only to an event that is
+ /// already out-of-office — the provider event type is immutable. `None`
+ /// leaves them untouched.
+ pub out_of_office: Option<OutOfOfficeProperties>,
}
impl CalendarEventPatch {
@@ -1058,6 +1109,9 @@ pub struct CalendarCreationTarget {
pub provider_calendar_id: String,
/// Whether the provider role prohibits event creation.
pub is_read_only: bool,
+ /// Whether this is its account's primary calendar. Out-of-office events
+ /// can only be created here.
+ pub is_primary: bool,
/// Grant of the connected inbox this calendar belongs to.
pub token_identity: CalendarLinkTokenIdentity,
/// The clicker's owned inboxes. `None` when they own none.
diff --git a/crates/calendar_events/src/domain/mutations.rs b/crates/calendar_events/src/domain/mutations.rs
index 4799d2ea69..117783fb8e 100644
--- a/crates/calendar_events/src/domain/mutations.rs
+++ b/crates/calendar_events/src/domain/mutations.rs
@@ -14,10 +14,10 @@ use uuid::Uuid;
use super::{
models::{
ActorInboxes, AttendeeResponseStatus, CalendarAttendee, CalendarAttendeeInput,
- CalendarEvent, CalendarEventDraft, CalendarEventMutationTarget, CalendarEventPatch,
- CalendarEventUpsert, DisconnectedGoogleCalendar, EventReminders, EventTime,
- OccurrenceRange, REMINDER_METHOD_EMAIL, REMINDER_METHOD_POPUP, REMINDER_MINUTES_MAX,
- REMINDER_OVERRIDES_MAX,
+ CalendarCreationTarget, CalendarEvent, CalendarEventDraft, CalendarEventMutationTarget,
+ CalendarEventPatch, CalendarEventUpsert, DisconnectedGoogleCalendar, EventReminders,
+ EventTime, OccurrenceRange, REMINDER_METHOD_EMAIL, REMINDER_METHOD_POPUP,
+ REMINDER_MINUTES_MAX, REMINDER_OVERRIDES_MAX,
},
ports::{
CalendarAccessTokenProvider, CalendarDeletionScope, CalendarEventChange,
@@ -184,7 +184,13 @@ where
if target.is_read_only {
return Err(CalendarMutationError::ReadOnly);
}
- ensure_organizer_attendee(&mut draft.attendees, &target.token_identity.email_address);
+ // An out-of-office event carries no attendees and Google auto-declines
+ // on the owner's behalf, so it must not gain an organizer guest.
+ if draft.out_of_office.is_some() {
+ validate_out_of_office_create(&draft, &target)?;
+ } else {
+ ensure_organizer_attendee(&mut draft.attendees, &target.token_identity.email_address);
+ }
let access_token = self.fetch_token(&target.token_identity).await?;
let upsert = self
.provider
@@ -546,6 +552,37 @@ fn validate_time(time: &EventTime) -> Result<(), CalendarMutationError> {
Ok(())
}
+/// Enforce Google's rules for creating an out-of-office event so the provider
+/// never rejects a write we already accepted: primary calendar only, a timed
+/// span rather than whole days, and no attendees.
+fn validate_out_of_office_create(
+ draft: &CalendarEventDraft,
+ target: &CalendarCreationTarget,
+) -> Result<(), CalendarMutationError> {
+ if !target.is_primary {
+ return Err(CalendarMutationError::InvalidInput(
+ "out-of-office events can only be created on your primary calendar".to_string(),
+ ));
+ }
+ if !matches!(draft.time, EventTime::Timed { .. }) {
+ return Err(CalendarMutationError::InvalidInput(
+ "out-of-office events must have specific start and end times, not span whole days"
+ .to_string(),
+ ));
+ }
+ if !draft.attendees.is_empty() {
+ return Err(CalendarMutationError::InvalidInput(
+ "out-of-office events cannot have attendees".to_string(),
+ ));
+ }
+ if draft.conference.is_some() {
+ return Err(CalendarMutationError::InvalidInput(
+ "out-of-office events cannot have a video conference".to_string(),
+ ));
+ }
+ Ok(())
+}
+
/// Enforce Google's own reminder limits so the provider never rejects a
/// write we already accepted: at most five overrides, offsets within four
/// weeks, and only methods Google understands.
diff --git a/crates/calendar_events/src/domain/mutations/test.rs b/crates/calendar_events/src/domain/mutations/test.rs
index b7194f2ad2..67d0ffeb13 100644
--- a/crates/calendar_events/src/domain/mutations/test.rs
+++ b/crates/calendar_events/src/domain/mutations/test.rs
@@ -5,7 +5,8 @@ use crate::domain::models::{
CalendarOccurrence, CalendarOccurrenceCursor, CalendarSyncStatus, CalendarWatchRelease,
ConferenceChange, DisconnectedGoogleCalendar, EventStatus, EventTransparency, EventType,
EventVisibility, GoogleCalendarSyncSnapshot, GoogleCalendarTarget, GoogleEventSource,
- GoogleWatchChannel, ProviderCalendar, StoredGoogleCalendar, VisibleCalendar,
+ GoogleWatchChannel, OutOfOfficeAutoDeclineMode, OutOfOfficeProperties, ProviderCalendar,
+ StoredGoogleCalendar, VisibleCalendar,
};
use crate::domain::ports::RetiredCalendarEvent;
use chrono::{Duration, TimeZone};
@@ -55,6 +56,7 @@ fn creation_target(is_read_only: bool) -> CalendarCreationTarget {
calendar_id: Uuid::now_v7(),
provider_calendar_id: "primary".to_string(),
is_read_only,
+ is_primary: true,
token_identity: token_identity(),
actor: Some(ActorInboxes::sole("[email protected]")),
}
@@ -129,6 +131,7 @@ fn draft() -> CalendarEventDraft {
transparency: None,
reminders: None,
conference: None,
+ out_of_office: None,
}
}
@@ -1149,6 +1152,124 @@ async fn create_rejects_invalid_input_before_reaching_the_provider() {
assert!(calls.lock().unwrap().is_empty());
}
+fn out_of_office_draft() -> CalendarEventDraft {
+ CalendarEventDraft {
+ attendees: Vec::new(),
+ out_of_office: Some(OutOfOfficeProperties {
+ auto_decline_mode: OutOfOfficeAutoDeclineMode::DeclineAllConflictingInvitations,
+ decline_message: Some("Out".to_string()),
+ }),
+ ..draft()
+ }
+}
+
+#[tokio::test]
+async fn create_out_of_office_forwards_the_type_and_adds_no_organizer_guest() {
+ let provider = FakeProvider::new(FakeProviderBehavior::Echo);
+ let drafts = provider.created_drafts.clone();
+ let repo = FakeRepo {
+ creation_target: Some(creation_target(false)),
+ ..FakeRepo::default()
+ };
+
+ service(repo, provider, FakeTokens::ok())
+ .create_event("macro|user", None, None, out_of_office_draft())
+ .await
+ .unwrap();
+
+ let sent = drafts.lock().unwrap();
+ let sent = sent.first().expect("one create call");
+ assert!(sent.out_of_office.is_some());
+ // An out-of-office event carries no attendees, so the organizer is never
+ // injected as a guest the way a regular event's is.
+ assert!(sent.attendees.is_empty());
+}
+
+#[tokio::test]
+async fn create_out_of_office_rejects_a_non_primary_calendar_before_the_provider() {
+ let provider = FakeProvider::new(FakeProviderBehavior::Echo);
+ let calls = provider.calls.clone();
+ let svc = service(
+ FakeRepo {
+ creation_target: Some(CalendarCreationTarget {
+ is_primary: false,
+ ..creation_target(false)
+ }),
+ ..FakeRepo::default()
+ },
+ provider,
+ FakeTokens::ok(),
+ );
+
+ assert!(matches!(
+ svc.create_event("macro|user", None, None, out_of_office_draft())
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+ assert!(calls.lock().unwrap().is_empty());
+}
+
+#[tokio::test]
+async fn create_out_of_office_rejects_all_day_spans_and_attendees() {
+ let all_day = service(
+ FakeRepo {
+ creation_target: Some(creation_target(false)),
+ ..FakeRepo::default()
+ },
+ FakeProvider::new(FakeProviderBehavior::Echo),
+ FakeTokens::ok(),
+ );
+ let mut all_day_draft = out_of_office_draft();
+ all_day_draft.time = EventTime::AllDay {
+ start_date: chrono::NaiveDate::from_ymd_opt(2026, 8, 6).unwrap(),
+ end_date: chrono::NaiveDate::from_ymd_opt(2026, 8, 7).unwrap(),
+ };
+ assert!(matches!(
+ all_day
+ .create_event("macro|user", None, None, all_day_draft)
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+
+ let with_guest = service(
+ FakeRepo {
+ creation_target: Some(creation_target(false)),
+ ..FakeRepo::default()
+ },
+ FakeProvider::new(FakeProviderBehavior::Echo),
+ FakeTokens::ok(),
+ );
+ let mut guest_draft = out_of_office_draft();
+ guest_draft.attendees = vec![CalendarAttendeeInput {
+ email: "[email protected]".to_string(),
+ is_optional: false,
+ response_status: None,
+ }];
+ assert!(matches!(
+ with_guest
+ .create_event("macro|user", None, None, guest_draft)
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+
+ let with_conference = service(
+ FakeRepo {
+ creation_target: Some(creation_target(false)),
+ ..FakeRepo::default()
+ },
+ FakeProvider::new(FakeProviderBehavior::Echo),
+ FakeTokens::ok(),
+ );
+ let mut conference_draft = out_of_office_draft();
+ conference_draft.conference = Some(ConferenceChange::GoogleMeet);
+ assert!(matches!(
+ with_conference
+ .create_event("macro|user", None, None, conference_draft)
+ .await,
+ Err(CalendarMutationError::InvalidInput(_))
+ ));
+}
+
#[tokio::test]
async fn update_validates_lookup_policy_and_addresses_the_series_master() {
let empty_patch = service(
diff --git a/crates/calendar_events/src/inbound/mutation_router.rs b/crates/calendar_events/src/inbound/mutation_router.rs
index 3437aad514..03c90cdf98 100644
--- a/crates/calendar_events/src/inbound/mutation_router.rs
+++ b/crates/calendar_events/src/inbound/mutation_router.rs
@@ -26,7 +26,7 @@ use crate::domain::{
models::{
AttendeeResponseStatus, CalendarAttendeeInput, CalendarEvent, CalendarEventDraft,
CalendarEventPatch, ConferenceChange, EventReminders, EventTime, EventTransparency,
- EventVisibility, VisibleCalendar,
+ EventVisibility, OutOfOfficeProperties, VisibleCalendar,
},
ports::{
CalendarDeletionScope, CalendarMutationError, CalendarMutationService, CalendarRsvpScope,
@@ -142,6 +142,10 @@ pub struct CreateCalendarEventRequest {
pub reminders: Option<EventReminders>,
/// Conference to attach to the new event; omit to create it without one.
pub conference: Option<ConferenceChange>,
+ /// Out-of-office properties; present to create the event as a Google
+ /// out-of-office status event (primary calendar only, timed, no
+ /// attendees), omitted for a regular event.
+ pub out_of_office: Option<OutOfOfficeProperties>,
}
/// Request body patching an event; omitted fields are left untouched.
@@ -173,6 +177,10 @@ pub struct UpdateCalendarEventRequest {
/// A third-party conference is replaced or detached like any other, since
/// the request is explicit. Omit the field to leave it alone.
pub conference: Option<ConferenceChange>,
+ /// Replacement out-of-office properties, applied only to an event that is
+ /// already out-of-office — the provider event type is immutable. Omit to
+ /// leave them untouched.
+ pub out_of_office: Option<OutOfOfficeProperties>,
/// How much of a recurring series the update covers. Omit to let
/// `recurrenceId` decide: the identified occurrence alone when one is
/// supplied, otherwise the whole event or series. An explicit
@@ -412,6 +420,7 @@ where
transparency: request.transparency,
reminders: request.reminders,
conference: request.conference,
+ out_of_office: request.out_of_office,
};
let event = state
.service
@@ -527,6 +536,7 @@ where
transparency: request.transparency,
reminders: request.reminders,
conference: request.conference,
+ out_of_office: request.out_of_office,
};
let event = state
.service
diff --git a/crates/calendar_events/src/inbound/toolset.rs b/crates/calendar_events/src/inbound/toolset.rs
index 7c0a71fd2c..171b7f9bf0 100644
--- a/crates/calendar_events/src/inbound/toolset.rs
+++ b/crates/calendar_events/src/inbound/toolset.rs
@@ -25,6 +25,7 @@ use serde::{Deserialize, Serialize};
use crate::domain::{
models::{
CalendarAttendeeInput, CalendarEvent, EventReminderOverride, EventReminders, EventTime,
+ OutOfOfficeAutoDeclineMode, OutOfOfficeProperties,
},
ports::{CalendarMutationError, CalendarMutationService, CalendarOccurrenceService},
};
@@ -229,6 +230,63 @@ impl From<EventRemindersInput> for EventReminders {
}
}
+/// The kind of event a create tool call makes.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Deserialize, JsonSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum CalendarEventTypeInput {
+ /// A regular calendar event.
+ #[default]
+ Default,
+ /// A Google out-of-office status event: primary calendar only, timed, no
+ /// attendees, and Google shows the user as away and can auto-decline
+ /// conflicting invitations.
+ OutOfOffice,
+}
+
+/// How an out-of-office event handles conflicting invitations.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, JsonSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum AutoDeclineModeInput {
+ /// Leave conflicting invitations alone.
+ DeclineNone,
+ /// Decline every conflicting invitation, existing and new.
+ DeclineAll,
+ /// Decline only invitations that arrive after the event is created.
+ DeclineNewOnly,
+}
+
+impl From<AutoDeclineModeInput> for OutOfOfficeAutoDeclineMode {
+ fn from(input: AutoDeclineModeInput) -> Self {
+ match input {
+ AutoDeclineModeInput::DeclineNone => Self::DeclineNone,
+ AutoDeclineModeInput::DeclineAll => Self::DeclineAllConflictingInvitations,
+ AutoDeclineModeInput::DeclineNewOnly => Self::DeclineOnlyNewConflictingInvitations,
+ }
+ }
+}
+
+/// Out-of-office decline behavior supplied to the calendar tools.
+#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, JsonSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct OutOfOfficeInput {
+ /// How conflicting invitations are handled. Defaults to declining nothing,
+ /// so the event only blocks time and shows the away status.
+ #[serde(default)]
+ pub auto_decline_mode: Option<AutoDeclineModeInput>,
+ /// Message returned to organizers whose invitations are auto-declined.
+ #[serde(default)]
+ pub decline_message: Option<String>,
+}
+
+impl From<OutOfOfficeInput> for OutOfOfficeProperties {
+ fn from(input: OutOfOfficeInput) -> Self {
+ Self {
+ auto_decline_mode: input.auto_decline_mode.map(Into::into).unwrap_or_default(),
+ decline_message: input.decline_message,
+ }
+ }
+}
+
/// An attendee of a calendar event, as returned by calendar tools.
#[derive(Debug, Serialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
diff --git a/crates/calendar_events/src/inbound/toolset/create_calendar_event.rs b/crates/calendar_events/src/inbound/toolset/create_calendar_event.rs
index a8e494e03f..e318114c1d 100644
--- a/crates/calendar_events/src/inbound/toolset/create_calendar_event.rs
+++ b/crates/calendar_events/src/inbound/toolset/create_calendar_event.rs
@@ -1,15 +1,17 @@
//! CreateCalendarEvent tool for adding events to the user's calendar.
use ai_toolset::{
- AsyncTool, RequestContext, ServiceContext, ToolAnnotated, ToolAnnotations, ToolResult,
+ AsyncTool, RequestContext, ServiceContext, ToolAnnotated, ToolAnnotations, ToolCallError,
+ ToolResult,
};
use async_trait::async_trait;
+use rootcause::compat::boxed_error::IntoBoxedError;
use schemars::JsonSchema;
use serde::Deserialize;
use super::{
- AttendeeInput, CalendarToolContext, EventRemindersInput, EventTimeInput, ToolCalendarEvent,
- mutation_tool_error,
+ AttendeeInput, CalendarEventTypeInput, CalendarToolContext, EventRemindersInput,
+ EventTimeInput, OutOfOfficeInput, ToolCalendarEvent, mutation_tool_error,
};
use crate::domain::{
models::{CalendarEventDraft, ConferenceChange},
@@ -32,7 +34,13 @@ before executing the call.\n\
The event lands on the user's primary calendar unless `calendarId` (from ListCalendars) \
targets another one. For recurring events pass RFC 5545 lines in `recurrenceLines`, e.g. \
[\"RRULE:FREQ=WEEKLY;BYDAY=MO\"]. Returns the created event with its `eventId` for later \
-updates or deletion. Fails if the user has no writable calendar connected."
+updates or deletion. Fails if the user has no writable calendar connected.\n\
+\n\
+Set `eventType` to \"out_of_office\" to mark the user as out of office (e.g. \"mark me out \
+of office Thursday\"). Out-of-office events must land on the user's primary calendar (omit \
+`calendarId`), must be timed rather than all-day, and take no attendees or Google Meet \
+(leave `addGoogleMeet` false); use `outOfOffice` to control whether conflicting meetings \
+are auto-declined. The type cannot be changed afterward."
)]
pub struct CreateCalendarEvent {
/// Display title.
@@ -94,6 +102,25 @@ pub struct CreateCalendarEvent {
)]
#[serde(default)]
pub add_google_meet: bool,
+
+ /// Kind of event to create.
+ #[schemars(
+ description = "The kind of event: \"default\" for a regular event (the default), or \
+ \"out_of_office\" to mark the user as out of office. Out-of-office \
+ events must be timed, on the primary calendar, and with no attendees."
+ )]
+ #[serde(default)]
+ pub event_type: CalendarEventTypeInput,
+
+ /// Out-of-office decline behavior.
+ #[schemars(
+ description = "Out-of-office decline behavior, used only when eventType is \
+ \"out_of_office\". Omit to just block the time; set \
+ `autoDeclineMode` to \"decline_all\" or \"decline_new_only\" to have \
+ Google decline conflicting meetings, optionally with a `declineMessage`."
+ )]
+ #[serde(default)]
+ pub out_of_office: Option<OutOfOfficeInput>,
}
impl ToolAnnotated for CreateCalendarEvent {
@@ -123,6 +150,25 @@ where
);
let requester_id = request_context.user_id.to_string();
+ let out_of_office = match self.event_type {
+ CalendarEventTypeInput::Default => {
+ if self.out_of_office.is_some() {
+ return Err(ToolCallError {
+ description: "`outOfOffice` only applies when eventType is \
+ \"out_of_office\"."
+ .to_string(),
+ internal_error: anyhow::Error::from_boxed(
+ rootcause::report!("out-of-office settings without the event type")
+ .into_boxed_error(),
+ ),
+ });
+ }
+ None
+ }
+ CalendarEventTypeInput::OutOfOffice => {
+ Some(self.out_of_office.clone().unwrap_or_default().into())
+ }
+ };
let draft = CalendarEventDraft {
title: self.title.clone(),
description: self.description.clone(),
@@ -134,6 +180,7 @@ where
transparency: None,
reminders: self.reminders.clone().map(Into::into),
conference: self.add_google_meet.then_some(ConferenceChange::GoogleMeet),
+ out_of_office,
};
let event = service_context
diff --git a/crates/calendar_events/src/inbound/toolset/test.rs b/crates/calendar_events/src/inbound/toolset/test.rs
index aa312c285f..5b4cdf2394 100644
--- a/crates/calendar_events/src/inbound/toolset/test.rs
+++ b/crates/calendar_events/src/inbound/toolset/test.rs
@@ -362,6 +362,8 @@ async fn create_converts_input_into_a_domain_draft() {
}],
}),
add_google_meet: true,
+ event_type: CalendarEventTypeInput::Default,
+ out_of_office: None,
};
let response = tool.call(context, request_context()).await.unwrap();
assert_eq!(response.event_id, Uuid::from_u128(7));
@@ -391,6 +393,70 @@ async fn create_converts_input_into_a_domain_draft() {
assert!(matches!(draft.time, EventTime::AllDay { .. }));
}
+#[tokio::test]
+async fn create_maps_out_of_office_input_into_the_draft() {
+ let (mutations, context) = context(MockMutations::default(), empty_occurrences());
+
+ let tool = CreateCalendarEvent {
+ title: "Out".to_string(),
+ time: EventTimeInput::Timed {
+ starts_at: Utc.with_ymd_and_hms(2026, 8, 20, 12, 0, 0).unwrap(),
+ ends_at: Utc.with_ymd_and_hms(2026, 8, 20, 18, 0, 0).unwrap(),
+ time_zone: None,
+ },
+ description: None,
+ location: None,
+ attendees: Vec::new(),
+ recurrence_lines: Vec::new(),
+ calendar_id: None,
+ reminders: None,
+ add_google_meet: false,
+ event_type: CalendarEventTypeInput::OutOfOffice,
+ out_of_office: Some(OutOfOfficeInput {
+ auto_decline_mode: Some(AutoDeclineModeInput::DeclineAll),
+ decline_message: Some("Away".to_string()),
+ }),
+ };
+ tool.call(context, request_context()).await.unwrap();
+
+ let created = mutations.created.lock().unwrap();
+ let (_, _, draft) = created.first().expect("one create call");
+ let out_of_office = draft
+ .out_of_office
+ .as_ref()
+ .expect("out-of-office properties carried into the draft");
+ assert_eq!(
+ out_of_office.auto_decline_mode,
+ crate::domain::models::OutOfOfficeAutoDeclineMode::DeclineAllConflictingInvitations
+ );
+ assert_eq!(out_of_office.decline_message.as_deref(), Some("Away"));
+}
+
+#[tokio::test]
+async fn create_rejects_out_of_office_settings_on_a_default_event() {
+ let (mutations, context) = context(MockMutations::default(), empty_occurrences());
+
+ let tool = CreateCalendarEvent {
+ title: "Regular".to_string(),
+ time: EventTimeInput::Timed {
+ starts_at: Utc.with_ymd_and_hms(2026, 8, 20, 12, 0, 0).unwrap(),
+ ends_at: Utc.with_ymd_and_hms(2026, 8, 20, 13, 0, 0).unwrap(),
+ time_zone: None,
+ },
+ description: None,
+ location: None,
+ attendees: Vec::new(),
+ recurrence_lines: Vec::new(),
+ calendar_id: None,
+ reminders: None,
+ add_google_meet: false,
+ event_type: CalendarEventTypeInput::Default,
+ out_of_office: Some(OutOfOfficeInput::default()),
+ };
+ tool.call(context, request_context()).await.unwrap_err();
+ assert!(mutations.created.lock().unwrap().is_empty());
+}
+
#[tokio::test]
async fn create_surfaces_missing_calendar_as_an_actionable_error() {
let mutations = MockMutations {
@@ -413,6 +479,8 @@ async fn create_surfaces_missing_calendar_as_an_actionable_error() {
calendar_id: None,
reminders: None,
add_google_meet: false,
+ event_type: CalendarEventTypeInput::Default,
+ out_of_office: None,
};
let error = tool.call(context, request_context()).await.unwrap_err();
assert!(
@@ -445,6 +513,7 @@ async fn update_converts_input_into_a_domain_patch() {
conference: Some(ConferenceChangeInput::Remove),
reminders: None,
rsvp: None,
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -460,6 +529,44 @@ async fn update_converts_input_into_a_domain_patch() {
Some(1)
);
assert_eq!(patch.conference, Some(ConferenceChange::Removed));
+ assert!(patch.out_of_office.is_none());
+}
+
+#[tokio::test]
+async fn update_maps_out_of_office_settings_into_the_patch() {
+ let (mutations, context) = context(MockMutations::default(), empty_occurrences());
+ let event_id = Uuid::from_u128(11);
+
+ let tool = UpdateCalendarEvent {
+ event_id,
+ scope: UpdateScopeInput::All,
+ recurrence_id: None,
+ title: None,
+ description: None,
+ location: None,
+ time: None,
+ attendees: None,
+ recurrence_lines: None,
+ conference: None,
+ reminders: None,
+ rsvp: None,
+ out_of_office: Some(OutOfOfficeInput {
+ auto_decline_mode: Some(AutoDeclineModeInput::DeclineNewOnly),
+ decline_message: None,
+ }),
+ };
+ tool.call(context, request_context()).await.unwrap();
+
+ let updated = mutations.updated.lock().unwrap();
+ let (_, patch, _) = updated.first().expect("one update call");
+ let out_of_office = patch
+ .out_of_office
+ .as_ref()
+ .expect("out-of-office settings carried into the patch");
+ assert_eq!(
+ out_of_office.auto_decline_mode,
+ crate::domain::models::OutOfOfficeAutoDeclineMode::DeclineOnlyNewConflictingInvitations
+ );
}
#[tokio::test]
@@ -484,6 +591,7 @@ async fn update_passes_the_selected_occurrence_scope() {
conference: None,
reminders: None,
rsvp: None,
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -514,6 +622,7 @@ async fn scoped_update_requires_a_recurrence_id() {
conference: None,
reminders: None,
rsvp: None,
+ out_of_office: None,
};
let error = tool.call(context, request_context()).await.unwrap_err();
assert!(error.description.contains("recurrenceId"));
@@ -540,6 +649,7 @@ async fn series_update_rejects_a_stray_recurrence_id() {
conference: None,
reminders: None,
rsvp: None,
+ out_of_office: None,
};
let error = tool.call(context, request_context()).await.unwrap_err();
assert!(error.description.contains("this_event"));
@@ -569,6 +679,7 @@ async fn update_carries_reminders_into_the_patch() {
}],
}),
rsvp: None,
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -606,6 +717,7 @@ async fn rsvp_alone_answers_without_patching() {
conference: None,
reminders: None,
rsvp: Some(RsvpResponseInput::Declined),
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -638,6 +750,7 @@ async fn rsvp_follows_the_occurrence_scope_of_the_call() {
conference: None,
reminders: None,
rsvp: Some(RsvpResponseInput::Tentative),
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -674,6 +787,7 @@ async fn update_answers_after_applying_the_patch() {
conference: None,
reminders: None,
rsvp: Some(RsvpResponseInput::Accepted),
+ out_of_office: None,
};
tool.call(context, request_context()).await.unwrap();
@@ -698,6 +812,7 @@ async fn update_without_a_change_or_an_rsvp_is_rejected() {
conference: None,
reminders: None,
rsvp: None,
+ out_of_office: None,
};
let error = tool.call(context, request_context()).await.unwrap_err();
assert!(error.description.contains("changes nothing"));
diff --git a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
index bc874af9cf..47a4c0ba9c 100644
--- a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
+++ b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
@@ -10,8 +10,8 @@ use schemars::JsonSchema;
use serde::Deserialize;
use super::{
- AttendeeInput, CalendarToolContext, EventRemindersInput, EventTimeInput, ToolCalendarEvent,
- mutation_tool_error,
+ AttendeeInput, CalendarToolContext, EventRemindersInput, EventTimeInput, OutOfOfficeInput,
+ ToolCalendarEvent, mutation_tool_error,
};
use crate::domain::{
models::{AttendeeResponseStatus, CalendarEventPatch, ConferenceChange},
@@ -194,6 +194,17 @@ pub struct UpdateCalendarEvent {
)]
#[serde(default)]
pub rsvp: Option<RsvpResponseInput>,
+
+ /// Replacement out-of-office decline behavior.
+ #[schemars(
+ description = "Adjust out-of-office decline behavior; only valid on an event that is \
+ already out of office (its event type cannot be changed). Replaces the \
+ whole block: set `autoDeclineMode` (\"decline_none\", \"decline_all\", \
+ or \"decline_new_only\") and optionally `declineMessage`. Omit to leave \
+ it untouched."
+ )]
+ #[serde(default)]
+ pub out_of_office: Option<OutOfOfficeInput>,
}
impl ToolAnnotated for UpdateCalendarEvent {
@@ -267,6 +278,7 @@ where
transparency: None,
reminders: self.reminders.clone().map(Into::into),
conference: self.conference.map(Into::into),
+ out_of_office: self.out_of_office.clone().map(Into::into),
};
// An RSVP is its own provider call, so a call carrying only one runs
diff --git a/crates/calendar_events/src/outbound/email_service_mutations.rs b/crates/calendar_events/src/outbound/email_service_mutations.rs
index 2d4e250f21..e40ff3296d 100644
--- a/crates/calendar_events/src/outbound/email_service_mutations.rs
+++ b/crates/calendar_events/src/outbound/email_service_mutations.rs
@@ -171,6 +171,7 @@ fn create_body(
"transparency": draft.transparency,
"reminders": draft.reminders,
"conference": draft.conference,
+ "outOfOffice": draft.out_of_office,
})
}
@@ -196,6 +197,7 @@ fn update_body(patch: &CalendarEventPatch, scope: &CalendarUpdateScope) -> serde
"transparency": patch.transparency,
"reminders": patch.reminders,
"conference": patch.conference,
+ "outOfOffice": patch.out_of_office,
"scope": scope_name,
"recurrenceId": recurrence_id,
})
diff --git a/crates/calendar_events/src/outbound/email_service_mutations/test.rs b/crates/calendar_events/src/outbound/email_service_mutations/test.rs
index 665a44f05e..f2d431285d 100644
--- a/crates/calendar_events/src/outbound/email_service_mutations/test.rs
+++ b/crates/calendar_events/src/outbound/email_service_mutations/test.rs
@@ -7,7 +7,10 @@ use reqwest::StatusCode;
use uuid::Uuid;
use super::*;
-use crate::domain::models::{CalendarAttendeeInput, EventReminders, EventTime};
+use crate::domain::models::{
+ CalendarAttendeeInput, EventReminders, EventTime, OutOfOfficeAutoDeclineMode,
+ OutOfOfficeProperties,
+};
use crate::inbound::mutation_router::{
CalendarMutationApiError, CalendarUpdateScopeParam, CreateCalendarEventRequest,
DeleteCalendarEventQuery, RsvpCalendarEventRequest, UpdateCalendarEventRequest,
@@ -33,6 +36,7 @@ fn sample_draft() -> CalendarEventDraft {
transparency: None,
reminders: Some(EventReminders::default()),
conference: Some(crate::domain::models::ConferenceChange::GoogleMeet),
+ out_of_office: None,
}
}
@@ -57,6 +61,47 @@ fn create_body_matches_the_router_request() {
);
}
+#[test]
+fn out_of_office_survives_the_create_wire_contract() {
+ let mut draft = sample_draft();
+ draft.attendees.clear();
+ draft.out_of_office = Some(OutOfOfficeProperties {
+ auto_decline_mode: OutOfOfficeAutoDeclineMode::DeclineAllConflictingInvitations,
+ decline_message: Some("Away".to_string()),
+ });
+ let request: CreateCalendarEventRequest =
+ serde_json::from_value(create_body(None, None, &draft)).unwrap();
+
+ let out_of_office = request
+ .out_of_office
+ .expect("out-of-office survives the wire");
+ assert_eq!(
+ out_of_office.auto_decline_mode,
+ OutOfOfficeAutoDeclineMode::DeclineAllConflictingInvitations
+ );
+ assert_eq!(out_of_office.decline_message.as_deref(), Some("Away"));
+}
+
+#[test]
+fn out_of_office_survives_the_update_wire_contract() {
+ let patch = CalendarEventPatch {
+ out_of_office: Some(OutOfOfficeProperties {
+ auto_decline_mode: OutOfOfficeAutoDeclineMode::DeclineOnlyNewConflictingInvitations,
+ decline_message: None,
+ }),
+ ..Default::default()
+ };
+ let request: UpdateCalendarEventRequest =
+ serde_json::from_value(update_body(&patch, &CalendarUpdateScope::All)).unwrap();
+
+ assert_eq!(
+ request
+ .out_of_office
+ .map(|properties| properties.auto_decline_mode),
+ Some(OutOfOfficeAutoDeclineMode::DeclineOnlyNewConflictingInvitations)
+ );
+}
+
#[test]
fn update_body_matches_the_router_request() {
let patch = CalendarEventPatch {
diff --git a/crates/calendar_events/src/outbound/google.rs b/crates/calendar_events/src/outbound/google.rs
index 0bf0d73de4..5516f20039 100644
--- a/crates/calendar_events/src/outbound/google.rs
+++ b/crates/calendar_events/src/outbound/google.rs
@@ -16,7 +16,7 @@ use crate::domain::{
ConferenceProvider, EventReminderOverride, EventReminders, EventStart, EventStatus,
EventTime, EventTransparency, EventType, EventVisibility, GoogleCalendarTarget,
GoogleEventSource, GoogleEventSyncBatch, GoogleSyncPlan, GoogleWatchChannel,
- GoogleWatchConfig, OccurrenceRange, ProviderCalendar,
+ GoogleWatchConfig, OccurrenceRange, OutOfOfficeProperties, ProviderCalendar,
},
ports::{
CalendarRsvpScope, GoogleCalendarMutationProvider, GoogleCalendarProvider,
@@ -1519,6 +1519,27 @@ fn draft_body(draft: &CalendarEventDraft) -> serde_json::Value {
if let Some(conference) = draft.conference {
body["conferenceData"] = google_conference_body(conference);
}
+ // An out-of-office event must declare its type, block availability, and
+ // carry its decline properties, so this overrides any transparency set
+ // above. The type is immutable, so it is only ever written on creation.
+ if let Some(out_of_office) = &draft.out_of_office {
+ body["eventType"] = serde_json::Value::String("outOfOffice".to_string());
+ body["transparency"] =
+ serde_json::Value::String(EventTransparency::Opaque.as_str().to_string());
+ body["outOfOfficeProperties"] = google_out_of_office_body(out_of_office);
+ }
+ body
+}
+
+/// Serialize the `outOfOfficeProperties` block Google requires on an
+/// out-of-office event.
+fn google_out_of_office_body(properties: &OutOfOfficeProperties) -> serde_json::Value {
+ let mut body = serde_json::json!({
+ "autoDeclineMode": properties.auto_decline_mode.as_google_str(),
+ });
+ if let Some(decline_message) = &properties.decline_message {
+ body["declineMessage"] = serde_json::Value::String(decline_message.clone());
+ }
body
}
@@ -1590,6 +1611,11 @@ fn patch_body(patch: &CalendarEventPatch) -> serde_json::Value {
if let Some(conference) = patch.conference {
body["conferenceData"] = google_conference_body(conference);
}
+ // The event type itself is immutable; only the decline properties of an
+ // already out-of-office event can change.
+ if let Some(out_of_office) = &patch.out_of_office {
+ body["outOfOfficeProperties"] = google_out_of_office_body(out_of_office);
+ }
body
}
diff --git a/crates/calendar_events/src/outbound/google/test.rs b/crates/calendar_events/src/outbound/google/test.rs
index 2f3496b7a8..de186cf963 100644
--- a/crates/calendar_events/src/outbound/google/test.rs
+++ b/crates/calendar_events/src/outbound/google/test.rs
@@ -912,6 +912,7 @@ fn mutation_bodies_serialize_reminders_in_google_shape() {
transparency: None,
reminders: Some(reminders.clone()),
conference: None,
+ out_of_office: None,
};
assert_eq!(draft_body(&draft)["reminders"], expected);
@@ -1047,6 +1048,7 @@ fn drafts_carry_conference_requests_and_their_parameter() {
transparency: None,
reminders: None,
conference: Some(ConferenceChange::GoogleMeet),
+ out_of_office: None,
};
let body = draft_body(&draft);
@@ -1058,6 +1060,100 @@ fn drafts_carry_conference_requests_and_their_parameter() {
assert_eq!(conference_query(&body), Some(CONFERENCE_DATA_VERSION));
}
+fn timed_draft(out_of_office: Option<OutOfOfficeProperties>) -> CalendarEventDraft {
+ CalendarEventDraft {
+ title: "Away".to_string(),
+ description: None,
+ location: None,
+ time: EventTime::Timed {
+ starts_at: DateTime::parse_from_rfc3339("2026-07-24T14:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc),
+ ends_at: DateTime::parse_from_rfc3339("2026-07-24T18:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc),
+ time_zone: None,
+ },
+ attendees: Vec::new(),
+ recurrence_lines: Vec::new(),
+ visibility: None,
+ transparency: None,
+ reminders: None,
+ conference: None,
+ out_of_office,
+ }
+}
+
+#[test]
+fn an_out_of_office_draft_declares_its_type_blocks_time_and_carries_its_properties() {
+ let body = draft_body(&timed_draft(Some(OutOfOfficeProperties {
+ auto_decline_mode:
+ crate::domain::models::OutOfOfficeAutoDeclineMode::DeclineAllConflictingInvitations,
+ decline_message: Some("On vacation".to_string()),
+ })));
+
+ assert_eq!(body["eventType"], "outOfOffice");
+ // Google rejects a transparent out-of-office event: it must block time.
+ assert_eq!(body["transparency"], "opaque");
+ assert_eq!(
+ body["outOfOfficeProperties"]["autoDeclineMode"],
+ "declineAllConflictingInvitations"
+ );
+ assert_eq!(
+ body["outOfOfficeProperties"]["declineMessage"],
+ "On vacation"
+ );
+}
+
+#[test]
+fn an_out_of_office_draft_without_a_message_omits_it_and_defaults_to_declining_nothing() {
+ let body = draft_body(&timed_draft(Some(OutOfOfficeProperties::default())));
+
+ assert_eq!(
+ body["outOfOfficeProperties"]["autoDeclineMode"],
+ "declineNone"
+ );
+ assert!(
+ body["outOfOfficeProperties"]
+ .as_object()
+ .unwrap()
+ .get("declineMessage")
+ .is_none()
+ );
+}
+
+#[test]
+fn a_regular_draft_never_writes_an_event_type_or_out_of_office_block() {
+ let body = draft_body(&timed_draft(None));
+
+ assert!(body.as_object().unwrap().get("eventType").is_none());
+ assert!(
+ body.as_object()
+ .unwrap()
+ .get("outOfOfficeProperties")
+ .is_none()
+ );
+}
+
+#[test]
+fn a_patch_can_replace_out_of_office_properties_without_touching_the_immutable_type() {
+ let body = patch_body(&CalendarEventPatch {
+ out_of_office: Some(OutOfOfficeProperties {
+ auto_decline_mode:
+ crate::domain::models::OutOfOfficeAutoDeclineMode::DeclineOnlyNewConflictingInvitations,
+ decline_message: None,
+ }),
+ ..CalendarEventPatch::default()
+ });
+
+ assert_eq!(
+ body["outOfOfficeProperties"]["autoDeclineMode"],
+ "declineOnlyNewConflictingInvitations"
+ );
+ // The event type is immutable, so a patch never restates it.
+ assert!(body.as_object().unwrap().get("eventType").is_none());
+}
+
#[test]
fn a_meet_conference_is_classified_as_google_meet() {
let data: GoogleConferenceData = serde_json::from_value(serde_json::json!({
diff --git a/crates/calendar_events/src/outbound/pg.rs b/crates/calendar_events/src/outbound/pg.rs
index 4ebd0fad2f..40e96da861 100644
--- a/crates/calendar_events/src/outbound/pg.rs
+++ b/crates/calendar_events/src/outbound/pg.rs
@@ -1747,6 +1747,7 @@ impl CalendarRepository for PgCalendarRepository {
calendar.id AS calendar_id,
calendar.provider_calendar_id,
calendar.access_role,
+ calendar.is_primary,
link.fusionauth_user_id,
link.email_address,
link.provider::text AS "provider!"
@@ -1798,6 +1799,7 @@ impl CalendarRepository for PgCalendarRepository {
calendar_id: row.calendar_id,
provider_calendar_id: row.provider_calendar_id,
is_read_only: !matches!(row.access_role.as_deref(), Some("owner" | "writer")),
+ is_primary: row.is_primary,
token_identity,
actor,
}))
diff --git a/crates/calendar_events/src/outbound/pg/test.rs b/crates/calendar_events/src/outbound/pg/test.rs
index 4e0d0c3024..2844e495e0 100644
--- a/crates/calendar_events/src/outbound/pg/test.rs
+++ b/crates/calendar_events/src/outbound/pg/test.rs
@@ -2608,6 +2608,10 @@ async fn creation_target_prefers_the_requesters_own_primary_inbox(pool: PgPool)
assert_eq!(target.calendar_id, calendar_id);
assert_eq!(target.owner_id, owner_id);
assert!(!target.is_read_only);
+ assert!(
+ target.is_primary,
+ "resolving without a calendar id lands on the primary calendar"
+ );
let explicit = repo
.get_creation_target(owner_id, Some(link_id), None)
diff --git a/packages/sdk/generated/email/index.ts b/packages/sdk/generated/email/index.ts
index 2bbbfbdead..23153613d0 100644
--- a/packages/sdk/generated/email/index.ts
+++ b/packages/sdk/generated/email/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarAttendeeInputBody, CalendarDeletionScopeParam, CalendarEvent, CalendarMutationApiError, CalendarMutationErrorCode, CalendarRsvpScopeParam, CalendarUpdateScopeParam, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, ConferenceChange, ConferenceProvider, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableLinkCalendarData, DisableLinkCalendarError, DisableLinkCalendarErrors, DisableLinkCalendarResponse, DisableLinkCalendarResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, Message, MessageListVisibility, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RefreshCalendarEvent, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadSummary, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, VisibleCalendar } from './types.gen';
+export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarAttendeeInputBody, CalendarDeletionScopeParam, CalendarEvent, CalendarMutationApiError, CalendarMutationErrorCode, CalendarRsvpScopeParam, CalendarUpdateScopeParam, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, ConferenceChange, ConferenceProvider, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableLinkCalendarData, DisableLinkCalendarError, DisableLinkCalendarErrors, DisableLinkCalendarResponse, DisableLinkCalendarResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, Message, MessageListVisibility, OutOfOfficeAutoDeclineMode, OutOfOfficeProperties, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RefreshCalendarEvent, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadSummary, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, VisibleCalendar } from './types.gen';
diff --git a/packages/sdk/generated/email/types.gen.ts b/packages/sdk/generated/email/types.gen.ts
index 95881a5e69..c29cbcf524 100644
--- a/packages/sdk/generated/email/types.gen.ts
+++ b/packages/sdk/generated/email/types.gen.ts
@@ -816,6 +816,7 @@ export type CreateCalendarEventRequest = {
* Optional location label.
*/
location?: string | null;
+ outOfOffice?: null | OutOfOfficeProperties;
/**
* Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`).
*/
@@ -1230,6 +1231,28 @@ export type Message = {
export type MessageListVisibility = 'Show' | 'Hide';
+/**
+ * How an out-of-office event responds to conflicting invitations, mirroring
+ * Google's `autoDeclineMode`.
+ */
+export type OutOfOfficeAutoDeclineMode = 'decline_none' | 'decline_all_conflicting_invitations' | 'decline_only_new_conflicting_invitations';
+
+/**
+ * The extra properties Google requires on an out-of-office event, mirroring
+ * its `outOfOfficeProperties` block. Their presence on a draft or patch is
+ * what marks the mutation as out-of-office.
+ */
+export type OutOfOfficeProperties = {
+ /**
+ * How conflicting invitations are handled while the user is out.
+ */
+ autoDeclineMode?: OutOfOfficeAutoDeclineMode;
+ /**
+ * Message returned to organizers whose invitations are auto-declined.
+ */
+ declineMessage?: string | null;
+};
+
export type ParsedMessage = {
bcc: Array<ContactInfo>;
body_parsed?: string | null;
@@ -1469,6 +1492,7 @@ export type UpdateCalendarEventRequest = {
* Replacement location; an empty string clears it.
*/
location?: string | null;
+ outOfOffice?: null | OutOfOfficeProperties;
/**
* Original-start key of the occurrence the update targets.
*/
diff --git a/packages/sdk/specs/email.json b/packages/sdk/specs/email.json
index 6c820b6d9a..3e4dd3f746 100644
--- a/packages/sdk/specs/email.json
+++ b/packages/sdk/specs/email.json
@@ -4822,6 +4822,17 @@
"type": ["string", "null"],
"description": "Optional location label."
},
+ "outOfOffice": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/OutOfOfficeProperties",
+ "description": "Out-of-office properties; present to create the event as a Google\nout-of-office status event (primary calendar only, timed, no\nattendees), omitted for a regular event."
+ }
+ ]
+ },
"recurrenceLines": {
"type": "array",
"items": {
@@ -5595,6 +5606,29 @@
"type": "string",
"enum": ["Show", "Hide"]
},
+ "OutOfOfficeAutoDeclineMode": {
+ "type": "string",
+ "description": "How an out-of-office event responds to conflicting invitations, mirroring\nGoogle's `autoDeclineMode`.",
+ "enum": [
+ "decline_none",
+ "decline_all_conflicting_invitations",
+ "decline_only_new_conflicting_invitations"
+ ]
+ },
+ "OutOfOfficeProperties": {
+ "type": "object",
+ "description": "The extra properties Google requires on an out-of-office event, mirroring\nits `outOfOfficeProperties` block. Their presence on a draft or patch is\nwhat marks the mutation as out-of-office.",
+ "properties": {
+ "autoDeclineMode": {
+ "$ref": "#/components/schemas/OutOfOfficeAutoDeclineMode",
+ "description": "How conflicting invitations are handled while the user is out."
+ },
+ "declineMessage": {
+ "type": ["string", "null"],
+ "description": "Message returned to organizers whose invitations are auto-declined."
+ }
+ }
+ },
"ParsedMessage": {
"type": "object",
"required": [
@@ -6190,6 +6224,17 @@
"type": ["string", "null"],
"description": "Replacement location; an empty string clears it."
},
+ "outOfOffice": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/OutOfOfficeProperties",
+ "description": "Replacement out-of-office properties, applied only to an event that is\nalready out-of-office — the provider event type is immutable. Omit to\nleave them untouched."
+ }
+ ]
+ },
"recurrenceId": {
"type": ["string", "null"],
"description": "Original-start key of the occurrence the update targets."