Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(sdk): manage booking links, bookings and settings through macro.calendar.booking (#9945)
Wolf Mermelstein24abdd248c4b
diff --git a/Cargo.lock b/Cargo.lockindex 383cec6058..097758eb09 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3981,6 +3981,7 @@ dependencies = ["thiserror 2.0.18","tokio","tracing",+ "utoipa","uuid","wiremock","workspace-hack",diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/client.ts b/apps/web/src/lib/service-clients/service-calendar/generated/client.tsindex 318a7dd61e..54c4166c48 100644--- a/apps/web/src/lib/service-clients/service-calendar/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-calendar/generated/client.ts@@ -7,6 +7,13 @@import type {AvailabilityCalendarBody,AvailabilityCalendarsResponse,+ BookingChange,+ BookingInsights,+ BookingLink,+ BookingLinkListing,+ BookingProfile,+ BookingResponse,+ BookingsResponse,CalendarEvent,CalendarEventProviderUrl,CalendarEventProviderUrlParams,@@ -14,13 +21,27 @@ import type {CalendarMutationApiError,CalendarReplacementView,CopyCalendarEventRequest,+ CreateBookingLinkParams,+ CreateBookingLinkRequest,CreateCalendarEventRequest,DeleteCalendarEventParams,+ EditBookingLinkParams,+ EditBookingLinkRequest,+ GetBookingInsightsParams,+ GetBookingSettingsParams,+ InsightQuery,InviteCalendarEventGuestsRequest,+ ListBookingLinksParams,+ ListBookingRescheduleSlotsParams,+ ListBookingsParams,ListCalendarsResponse,PrepareCalendarReplacementRequest,+ ProfileResponse,+ ReceiptResponse,RespondToJoinRequestRequest,RsvpCalendarEventRequest,+ SaveBookingSettingsParams,+ SlotsResponse,TeamCalendarSharingBody,UpdateCalendarEventRequest,} from './schemas';@@ -1060,6 +1081,713 @@ export const confirmCalendarReplacement = async (} as confirmCalendarReplacementResponse;};+/**+ * @summary List the profile's bookings, optionally those starting in a half-open range.+ */+export type listBookingsResponse200 = {+ data: BookingsResponse;+ status: 200;+};++export type listBookingsResponse400 = {+ data: void;+ status: 400;+};++export type listBookingsResponse403 = {+ data: void;+ status: 403;+};++export type listBookingsResponseSuccess = listBookingsResponse200 & {+ headers: Headers;+};+export type listBookingsResponseError = (+ | listBookingsResponse400+ | listBookingsResponse403+) & {+ headers: Headers;+};++export type listBookingsResponse =+ | listBookingsResponseSuccess+ | listBookingsResponseError;++export const getListBookingsUrl = (params?: ListBookingsParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/bookings?${stringifiedParams}`+ : `/scheduling/bookings`;+};++export const listBookings = async (+ params?: ListBookingsParams,+ options?: RequestInit+): Promise<listBookingsResponse> => {+ const res = await fetch(getListBookingsUrl(params), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: listBookingsResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as listBookingsResponse;+};++/**+ * @summary Approve, cancel, record attendance for, or reschedule one booking.+ */+export type changeBookingResponse200 = {+ data: BookingResponse;+ status: 200;+};++export type changeBookingResponse400 = {+ data: void;+ status: 400;+};++export type changeBookingResponse403 = {+ data: void;+ status: 403;+};++export type changeBookingResponse404 = {+ data: void;+ status: 404;+};++export type changeBookingResponse409 = {+ data: void;+ status: 409;+};++export type changeBookingResponseSuccess = changeBookingResponse200 & {+ headers: Headers;+};+export type changeBookingResponseError = (+ | changeBookingResponse400+ | changeBookingResponse403+ | changeBookingResponse404+ | changeBookingResponse409+) & {+ headers: Headers;+};++export type changeBookingResponse =+ | changeBookingResponseSuccess+ | changeBookingResponseError;++export const getChangeBookingUrl = (id: string) => {+ return `/scheduling/bookings/${id}/change`;+};++export const changeBooking = async (+ id: string,+ bookingChange: BookingChange,+ options?: RequestInit+): Promise<changeBookingResponse> => {+ const res = await fetch(getChangeBookingUrl(id), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(bookingChange),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: changeBookingResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as changeBookingResponse;+};++/**+ * @summary Read one booking as its personal owner, a host, or a team administrator.+ */+export type getManagedBookingResponse200 = {+ data: ReceiptResponse;+ status: 200;+};++export type getManagedBookingResponse403 = {+ data: void;+ status: 403;+};++export type getManagedBookingResponse404 = {+ data: void;+ status: 404;+};++export type getManagedBookingResponseSuccess = getManagedBookingResponse200 & {+ headers: Headers;+};+export type getManagedBookingResponseError = (+ | getManagedBookingResponse403+ | getManagedBookingResponse404+) & {+ headers: Headers;+};++export type getManagedBookingResponse =+ | getManagedBookingResponseSuccess+ | getManagedBookingResponseError;++export const getGetManagedBookingUrl = (id: string) => {+ return `/scheduling/bookings/${id}/manage`;+};++export const getManagedBooking = async (+ id: string,+ options?: RequestInit+): Promise<getManagedBookingResponse> => {+ const res = await fetch(getGetManagedBookingUrl(id), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getManagedBookingResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as getManagedBookingResponse;+};++/**+ * @summary Replacement start times for one booking on a schedule-local date.+ */+export type listBookingRescheduleSlotsResponse200 = {+ data: SlotsResponse;+ status: 200;+};++export type listBookingRescheduleSlotsResponse403 = {+ data: void;+ status: 403;+};++export type listBookingRescheduleSlotsResponse404 = {+ data: void;+ status: 404;+};++export type listBookingRescheduleSlotsResponseSuccess =+ listBookingRescheduleSlotsResponse200 & {+ headers: Headers;+ };+export type listBookingRescheduleSlotsResponseError = (+ | listBookingRescheduleSlotsResponse403+ | listBookingRescheduleSlotsResponse404+) & {+ headers: Headers;+};++export type listBookingRescheduleSlotsResponse =+ | listBookingRescheduleSlotsResponseSuccess+ | listBookingRescheduleSlotsResponseError;++export const getListBookingRescheduleSlotsUrl = (+ id: string,+ params: ListBookingRescheduleSlotsParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/bookings/${id}/slots?${stringifiedParams}`+ : `/scheduling/bookings/${id}/slots`;+};++export const listBookingRescheduleSlots = async (+ id: string,+ params: ListBookingRescheduleSlotsParams,+ options?: RequestInit+): Promise<listBookingRescheduleSlotsResponse> => {+ const res = await fetch(getListBookingRescheduleSlotsUrl(id, params), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: listBookingRescheduleSlotsResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as listBookingRescheduleSlotsResponse;+};++/**+ * @summary Booking statistics for a local date range and the equally long period before it.+ */+export type getBookingInsightsResponse200 = {+ data: BookingInsights;+ status: 200;+};++export type getBookingInsightsResponse400 = {+ data: void;+ status: 400;+};++export type getBookingInsightsResponse403 = {+ data: void;+ status: 403;+};++export type getBookingInsightsResponseSuccess =+ getBookingInsightsResponse200 & {+ headers: Headers;+ };+export type getBookingInsightsResponseError = (+ | getBookingInsightsResponse400+ | getBookingInsightsResponse403+) & {+ headers: Headers;+};++export type getBookingInsightsResponse =+ | getBookingInsightsResponseSuccess+ | getBookingInsightsResponseError;++export const getGetBookingInsightsUrl = (params?: GetBookingInsightsParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/insights?${stringifiedParams}`+ : `/scheduling/insights`;+};++export const getBookingInsights = async (+ insightQuery: InsightQuery,+ params?: GetBookingInsightsParams,+ options?: RequestInit+): Promise<getBookingInsightsResponse> => {+ const res = await fetch(getGetBookingInsightsUrl(params), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(insightQuery),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getBookingInsightsResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as getBookingInsightsResponse;+};++/**+ * @summary List and search booking links with their full drafts and reusable schedules.+ */+export type listBookingLinksResponse200 = {+ data: BookingLinkListing;+ status: 200;+};++export type listBookingLinksResponse403 = {+ data: void;+ status: 403;+};++export type listBookingLinksResponseSuccess = listBookingLinksResponse200 & {+ headers: Headers;+};+export type listBookingLinksResponseError = listBookingLinksResponse403 & {+ headers: Headers;+};++export type listBookingLinksResponse =+ | listBookingLinksResponseSuccess+ | listBookingLinksResponseError;++export const getListBookingLinksUrl = (params?: ListBookingLinksParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/links?${stringifiedParams}`+ : `/scheduling/links`;+};++export const listBookingLinks = async (+ params?: ListBookingLinksParams,+ options?: RequestInit+): Promise<listBookingLinksResponse> => {+ const res = await fetch(getListBookingLinksUrl(params), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: listBookingLinksResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as listBookingLinksResponse;+};++/**+ * @summary Create a booking link; an identical replay at the same slug returns the saved link.+ */+export type createBookingLinkResponse200 = {+ data: BookingLink;+ status: 200;+};++export type createBookingLinkResponse400 = {+ data: void;+ status: 400;+};++export type createBookingLinkResponse403 = {+ data: void;+ status: 403;+};++export type createBookingLinkResponse409 = {+ data: void;+ status: 409;+};++export type createBookingLinkResponseSuccess = createBookingLinkResponse200 & {+ headers: Headers;+};+export type createBookingLinkResponseError = (+ | createBookingLinkResponse400+ | createBookingLinkResponse403+ | createBookingLinkResponse409+) & {+ headers: Headers;+};++export type createBookingLinkResponse =+ | createBookingLinkResponseSuccess+ | createBookingLinkResponseError;++export const getCreateBookingLinkUrl = (params?: CreateBookingLinkParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/links?${stringifiedParams}`+ : `/scheduling/links`;+};++export const createBookingLink = async (+ createBookingLinkRequest: CreateBookingLinkRequest,+ params?: CreateBookingLinkParams,+ options?: RequestInit+): Promise<createBookingLinkResponse> => {+ const res = await fetch(getCreateBookingLinkUrl(params), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(createBookingLinkRequest),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: createBookingLinkResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as createBookingLinkResponse;+};++/**+ * @summary Replace one booking link's configuration at the profile revision it was read with.+ */+export type editBookingLinkResponse200 = {+ data: BookingLink;+ status: 200;+};++export type editBookingLinkResponse400 = {+ data: void;+ status: 400;+};++export type editBookingLinkResponse403 = {+ data: void;+ status: 403;+};++export type editBookingLinkResponse404 = {+ data: void;+ status: 404;+};++export type editBookingLinkResponse409 = {+ data: void;+ status: 409;+};++export type editBookingLinkResponseSuccess = editBookingLinkResponse200 & {+ headers: Headers;+};+export type editBookingLinkResponseError = (+ | editBookingLinkResponse400+ | editBookingLinkResponse403+ | editBookingLinkResponse404+ | editBookingLinkResponse409+) & {+ headers: Headers;+};++export type editBookingLinkResponse =+ | editBookingLinkResponseSuccess+ | editBookingLinkResponseError;++export const getEditBookingLinkUrl = (+ id: string,+ params?: EditBookingLinkParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/links/${id}?${stringifiedParams}`+ : `/scheduling/links/${id}`;+};++export const editBookingLink = async (+ id: string,+ editBookingLinkRequest: EditBookingLinkRequest,+ params?: EditBookingLinkParams,+ options?: RequestInit+): Promise<editBookingLinkResponse> => {+ const res = await fetch(getEditBookingLinkUrl(id, params), {+ ...options,+ method: 'PUT',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(editBookingLinkRequest),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: editBookingLinkResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as editBookingLinkResponse;+};++/**+ * @summary Read personal or team booking settings without creating them.+ */+export type getBookingSettingsResponse200 = {+ data: ProfileResponse;+ status: 200;+};++export type getBookingSettingsResponse403 = {+ data: void;+ status: 403;+};++export type getBookingSettingsResponse404 = {+ data: void;+ status: 404;+};++export type getBookingSettingsResponseSuccess =+ getBookingSettingsResponse200 & {+ headers: Headers;+ };+export type getBookingSettingsResponseError = (+ | getBookingSettingsResponse403+ | getBookingSettingsResponse404+) & {+ headers: Headers;+};++export type getBookingSettingsResponse =+ | getBookingSettingsResponseSuccess+ | getBookingSettingsResponseError;++export const getGetBookingSettingsUrl = (params?: GetBookingSettingsParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/settings?${stringifiedParams}`+ : `/scheduling/settings`;+};++export const getBookingSettings = async (+ params?: GetBookingSettingsParams,+ options?: RequestInit+): Promise<getBookingSettingsResponse> => {+ const res = await fetch(getGetBookingSettingsUrl(params), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: getBookingSettingsResponse['data'] = body ? JSON.parse(body) : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as getBookingSettingsResponse;+};++/**+ * @summary Save booking settings at the revision they were read with.+ */+export type saveBookingSettingsResponse200 = {+ data: ProfileResponse;+ status: 200;+};++export type saveBookingSettingsResponse400 = {+ data: void;+ status: 400;+};++export type saveBookingSettingsResponse403 = {+ data: void;+ status: 403;+};++export type saveBookingSettingsResponse409 = {+ data: void;+ status: 409;+};++export type saveBookingSettingsResponseSuccess =+ saveBookingSettingsResponse200 & {+ headers: Headers;+ };+export type saveBookingSettingsResponseError = (+ | saveBookingSettingsResponse400+ | saveBookingSettingsResponse403+ | saveBookingSettingsResponse409+) & {+ headers: Headers;+};++export type saveBookingSettingsResponse =+ | saveBookingSettingsResponseSuccess+ | saveBookingSettingsResponseError;++export const getSaveBookingSettingsUrl = (+ params?: SaveBookingSettingsParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/scheduling/settings?${stringifiedParams}`+ : `/scheduling/settings`;+};++export const saveBookingSettings = async (+ bookingProfile: BookingProfile,+ params?: SaveBookingSettingsParams,+ options?: RequestInit+): Promise<saveBookingSettingsResponse> => {+ const res = await fetch(getSaveBookingSettingsUrl(params), {+ ...options,+ method: 'PUT',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(bookingProfile),+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: saveBookingSettingsResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as saveBookingSettingsResponse;+};+/*** @summary Read the authenticated user's sharing choice.*/diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/booking.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/booking.tsnew file mode 100644index 0000000000..048a9dced3--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/booking.ts@@ -0,0 +1,52 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingAnswers } from './bookingAnswers';+import type { BookingAttendance } from './bookingAttendance';+import type { BookingQuestionLabels } from './bookingQuestionLabels';+import type { BookingRescheduledAt } from './bookingRescheduledAt';+import type { BookingStatus } from './bookingStatus';++/**+ * Public booking details, also visible to authorized profile members.+ */+export interface Booking {+ /** Answers keyed by question identity. */+ answers: BookingAnswers;+ /** Explicit attendance outcome; existing booking records default to unknown. */+ attendance?: BookingAttendance;+ /** Booker's email. */+ email: string;+ /** Absolute meeting end. */+ endsAt: string;+ /** Booking link identity. */+ eventTypeId: string;+ /** Assigned hosts. */+ hosts: string[];+ /** Booking identity. */+ id: string;+ /** Final location or conference URL. */+ location: string;+ /** Booker's name. */+ name: string;+ /** Original labels for answers, independent of later event-type edits. */+ questionLabels?: BookingQuestionLabels;+ /**+ * Number of successfully completed moves to a different start time.+ * @minimum 0+ */+ rescheduleCount?: number;+ /** When the most recent successful reschedule completed. */+ rescheduledAt?: BookingRescheduledAt;+ /** Absolute meeting start. */+ startsAt: string;+ /** Current lifecycle state. */+ status: BookingStatus;+ /** Booker's display time zone. */+ timeZone: string;+ /** Snapshot of the meeting title. */+ title: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAnswers.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAnswers.tsnew file mode 100644index 0000000000..9c84211fb2--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAnswers.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Answers keyed by question identity.+ */+export type BookingAnswers = { [key: string]: string };diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAttendance.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAttendance.tsnew file mode 100644index 0000000000..561d15999e--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingAttendance.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Attendance recorded by an assigned host or profile administrator after a meeting.+ */+export type BookingAttendance =+ (typeof BookingAttendance)[keyof typeof BookingAttendance];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingAttendance = {+ unknown: 'unknown',+ attended: 'attended',+ guestNoShow: 'guestNoShow',+ hostNoShow: 'hostNoShow',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChange.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChange.tsnew file mode 100644index 0000000000..bfa63a8a6c--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChange.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingChangeOneOf } from './bookingChangeOneOf';+import type { BookingChangeOneOfFive } from './bookingChangeOneOfFive';+import type { BookingChangeOneOfSeven } from './bookingChangeOneOfSeven';+import type { BookingChangeOneOfThree } from './bookingChangeOneOfThree';++/**+ * A host's requested change to a booked meeting.+ */+export type BookingChange =+ | BookingChangeOneOf+ | BookingChangeOneOfThree+ | BookingChangeOneOfFive+ | BookingChangeOneOfSeven;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOf.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOf.tsnew file mode 100644index 0000000000..29c5a4b1b3--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOf.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingChangeOneOfAction } from './bookingChangeOneOfAction';++/**+ * Approve a legacy pending booking and send its calendar invitations.+ */+export type BookingChangeOneOf = {+ action: BookingChangeOneOfAction;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfAction.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfAction.tsnew file mode 100644index 0000000000..d1c0914974--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfAction.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type BookingChangeOneOfAction =+ (typeof BookingChangeOneOfAction)[keyof typeof BookingChangeOneOfAction];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingChangeOneOfAction = {+ approve: 'approve',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFive.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFive.tsnew file mode 100644index 0000000000..369fa998d7--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFive.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++import type { BookingAttendance } from './bookingAttendance';+import type { BookingChangeOneOfFiveAction } from './bookingChangeOneOfFiveAction';++/**+ * Record or clear attendance after the meeting ends.+ */+export type BookingChangeOneOfFive = {+ action: BookingChangeOneOfFiveAction;+ /** Recorded outcome. */+ attendance: BookingAttendance;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFiveAction.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFiveAction.tsnew file mode 100644index 0000000000..a2e5a28c9f--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfFiveAction.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type BookingChangeOneOfFiveAction =+ (typeof BookingChangeOneOfFiveAction)[keyof typeof BookingChangeOneOfFiveAction];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingChangeOneOfFiveAction = {+ attendance: 'attendance',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSeven.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSeven.tsnew file mode 100644index 0000000000..a4d9842221--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSeven.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingChangeOneOfSevenAction } from './bookingChangeOneOfSevenAction';++/**+ * Move the existing meeting to an available time; notify attendees.+ */+export type BookingChangeOneOfSeven = {+ action: BookingChangeOneOfSevenAction;+ /** Absolute start chosen from available replacement slots. */+ startsAt: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSevenAction.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSevenAction.tsnew file mode 100644index 0000000000..6c3283d930--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfSevenAction.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type BookingChangeOneOfSevenAction =+ (typeof BookingChangeOneOfSevenAction)[keyof typeof BookingChangeOneOfSevenAction];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingChangeOneOfSevenAction = {+ reschedule: 'reschedule',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThree.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThree.tsnew file mode 100644index 0000000000..77de3e0eee--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThree.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingChangeOneOfThreeAction } from './bookingChangeOneOfThreeAction';++/**+ * Cancel a booking and notify its attendees.+ */+export type BookingChangeOneOfThree = {+ action: BookingChangeOneOfThreeAction;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThreeAction.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThreeAction.tsnew file mode 100644index 0000000000..b4debb7da5--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingChangeOneOfThreeAction.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type BookingChangeOneOfThreeAction =+ (typeof BookingChangeOneOfThreeAction)[keyof typeof BookingChangeOneOfThreeAction];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingChangeOneOfThreeAction = {+ cancel: 'cancel',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingDateOverride.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingDateOverride.tsnew file mode 100644index 0000000000..41358edb33--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingDateOverride.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingTimeWindow } from './bookingTimeWindow';++/**+ * Replacement availability for one date.+ */+export interface BookingDateOverride {+ /** Local date in the schedule zone. */+ date: string;+ /** Empty means unavailable all day. */+ windows: BookingTimeWindow[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventType.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventType.tsnew file mode 100644index 0000000000..883b7f39bc--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventType.ts@@ -0,0 +1,78 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingEventTypeDailyLimit } from './bookingEventTypeDailyLimit';+import type { BookingQuestion } from './bookingQuestion';+import type { SchedulingMode } from './schedulingMode';++/**+ * A reusable booking link.+ */+export interface BookingEventType {+ /**+ * Protected time after a meeting.+ * @minimum 0+ */+ afterMinutes: number;+ /**+ * Protected time before a meeting.+ * @minimum 0+ */+ beforeMinutes: number;+ /**+ * Maximum bookings for this event on one schedule-local day.+ * @minimum 0+ */+ dailyLimit?: BookingEventTypeDailyLimit;+ /** Public description. */+ description: string;+ /**+ * Meeting duration.+ * @minimum 0+ */+ durationMinutes: number;+ /** Whether new bookings are accepted. */+ enabled: boolean;+ /** Generate a Google Meet conference. Mutually exclusive with a Macro call. */+ googleMeet: boolean;+ /**+ * Maximum days ahead.+ * @minimum 0+ */+ horizonDays: number;+ /** Current Macro user identities selected as hosts. */+ hosts: string[];+ /** Stable identity. */+ id: string;+ /**+ * Spacing of offered start times.+ * @minimum 0+ */+ intervalMinutes: number;+ /** Meeting location. */+ location: string;+ /** Generate a Macro call and attach its join link when someone books.+Mutually exclusive with Google Meet. Omitted on links saved before+Macro calls were a booking option, which keep their previous conference. */+ macroCall?: boolean;+ /** Host assignment policy. */+ mode: SchedulingMode;+ /**+ * Minimum notice in minutes.+ * @minimum 0+ */+ noticeMinutes: number;+ /** Additional form fields. */+ questions: BookingQuestion[];+ /** Hold bookings for host approval. */+ requiresConfirmation: boolean;+ /** Referenced availability schedule. */+ scheduleId: string;+ /** Unique link segment within a profile. */+ slug: string;+ /** Public title. */+ title: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventTypeDailyLimit.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventTypeDailyLimit.tsnew file mode 100644index 0000000000..8bc644ae59--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingEventTypeDailyLimit.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Maximum bookings for this event on one schedule-local day.+ * @minimum 0+ */+export type BookingEventTypeDailyLimit = number | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingInsights.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingInsights.tsnew file mode 100644index 0000000000..d4acdf3cf6--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingInsights.ts@@ -0,0 +1,23 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { InsightPeriod } from './insightPeriod';++/**+ * Current and equally long preceding local-calendar periods.+ */+export interface BookingInsights {+ /** Time at which completion was evaluated. */+ asOf: string;+ /** Requested period. */+ current: InsightPeriod;+ /** Comparison period, using identical filters and definitions. */+ previous: InsightPeriod;+ /** Preceding period's first local date. */+ previousFrom: string;+ /** Preceding period's last local date. */+ previousTo: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLink.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLink.tsnew file mode 100644index 0000000000..523eebdad7--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLink.ts@@ -0,0 +1,21 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLinkDraft } from './bookingLinkDraft';++/**+ * Saved link with actual identities and revision for subsequent edits.+ */+export interface BookingLink {+ /** Full editable configuration. */+ draft: BookingLinkDraft;+ /** Stable link identity. */+ eventTypeId: string;+ /** Owning profile. */+ profileId: string;+ /** Profile revision to supply when editing. */+ revision: number;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkDraft.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkDraft.tsnew file mode 100644index 0000000000..b28a73d02f--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkDraft.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLinkEvent } from './bookingLinkEvent';+import type { BookingLinkSchedule } from './bookingLinkSchedule';++/**+ * Complete proposal reviewed and validated before saving.+ */+export interface BookingLinkDraft {+ /** Public details, hosts, booking rules and questions. */+ event: BookingLinkEvent;+ /** Weekly hours, IANA time zone, and date overrides for this link. */+ schedule: BookingLinkSchedule;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEvent.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEvent.tsnew file mode 100644index 0000000000..842a04ed0b--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEvent.ts@@ -0,0 +1,76 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLinkEventDailyLimit } from './bookingLinkEventDailyLimit';+import type { BookingQuestion } from './bookingQuestion';+import type { SchedulingMode } from './schedulingMode';++/**+ * All editable rules for one link. Personal links must use the authenticated user as host.+ */+export interface BookingLinkEvent {+ /**+ * Protected time after a meeting.+ * @minimum 0+ */+ afterMinutes: number;+ /**+ * Protected time before a meeting.+ * @minimum 0+ */+ beforeMinutes: number;+ /**+ * Maximum bookings for this event on one schedule-local day.+ * @minimum 0+ */+ dailyLimit?: BookingLinkEventDailyLimit;+ /** Public description. */+ description: string;+ /**+ * Meeting duration.+ * @minimum 0+ */+ durationMinutes: number;+ /** Whether new bookings are accepted. */+ enabled: boolean;+ /** Generate a Google Meet conference. Mutually exclusive with `macroCall`. */+ googleMeet: boolean;+ /**+ * Maximum days ahead.+ * @minimum 0+ */+ horizonDays: number;+ /** Current Macro user identities selected as hosts. */+ hosts: string[];+ /**+ * Spacing of offered start times.+ * @minimum 0+ */+ intervalMinutes: number;+ /** Meeting location. */+ location: string;+ /** Attach a Macro call when someone books. A join link is created for that+booking and written onto the calendar invitation. Mutually exclusive+with `googleMeet`. Prefer this for a Macro booking; omit or false when+the link should use Google Meet or no video. False is omitted so drafts+saved before this field still round-trip unchanged. */+ macroCall?: boolean;+ /** Host assignment policy. */+ mode: SchedulingMode;+ /**+ * Minimum notice in minutes.+ * @minimum 0+ */+ noticeMinutes: number;+ /** Additional form fields. */+ questions: BookingQuestion[];+ /** Hold bookings for host approval. */+ requiresConfirmation: boolean;+ /** Unique link segment within a profile. */+ slug: string;+ /** Public title. */+ title: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEventDailyLimit.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEventDailyLimit.tsnew file mode 100644index 0000000000..9e2dcd38cc--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkEventDailyLimit.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Maximum bookings for this event on one schedule-local day.+ * @minimum 0+ */+export type BookingLinkEventDailyLimit = number | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkListing.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkListing.tsnew file mode 100644index 0000000000..325e758cfa--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkListing.ts@@ -0,0 +1,26 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLink } from './bookingLink';+import type { BookingSchedule } from './bookingSchedule';++/**+ * Authorized discovery results including reusable availability.+ */+export interface BookingLinkListing {+ /** Links whose title, slug or description matches the search, including paused links. */+ links: BookingLink[];+ /** Owning profile identity, including unsaved new profiles. */+ profileId: string;+ /** Current revision. */+ revision: number;+ /** Reusable schedules, even when no links match. */+ schedules: BookingSchedule[];+ /** Current team identities that can be used to discover team links. */+ teamIds: string[];+ /** Current authenticated host identity for personal drafts. */+ userId: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkSchedule.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkSchedule.tsnew file mode 100644index 0000000000..2e1ffeebca--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingLinkSchedule.ts@@ -0,0 +1,22 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingDateOverride } from './bookingDateOverride';+import type { BookingWeeklyDay } from './bookingWeeklyDay';++/**+ * Availability copied into a dedicated schedule when it changes; other links retain their hours.+ */+export interface BookingLinkSchedule {+ /** Display name. */+ name: string;+ /** Date-specific replacements. */+ overrides: BookingDateOverride[];+ /** IANA time zone. */+ timeZone: string;+ /** Weekly windows. */+ weekly: BookingWeeklyDay[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfile.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfile.tsnew file mode 100644index 0000000000..05dc8893f3--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfile.ts@@ -0,0 +1,30 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++import type { BookingEventType } from './bookingEventType';+import type { BookingProfileDefaultScheduleId } from './bookingProfileDefaultScheduleId';+import type { BookingSchedule } from './bookingSchedule';++/**+ * Editable configuration for a person or team.+ */+export interface BookingProfile {+ /** Personal hours used by team events; absent legacy profiles use their first schedule. */+ defaultScheduleId?: BookingProfileDefaultScheduleId;+ /** Public introduction. */+ description: string;+ /** Booking links. */+ eventTypes: BookingEventType[];+ /** Public, opaque profile identity. */+ id: string;+ /** Display name on the public page. */+ name: string;+ /** Optimistic concurrency version. */+ revision: number;+ /** Reusable schedules. */+ schedules: BookingSchedule[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfileDefaultScheduleId.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfileDefaultScheduleId.tsnew file mode 100644index 0000000000..43652c43ca--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingProfileDefaultScheduleId.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Personal hours used by team events; absent legacy profiles use their first schedule.+ */+export type BookingProfileDefaultScheduleId = string | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestion.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestion.tsnew file mode 100644index 0000000000..ea9f9c8bb7--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestion.ts@@ -0,0 +1,18 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * A question on the booking form.+ */+export interface BookingQuestion {+ /** Stable identity. */+ id: string;+ /** Public question label. */+ label: string;+ /** Whether an answer is mandatory. */+ required: boolean;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestionLabels.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestionLabels.tsnew file mode 100644index 0000000000..a7b49388fe--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingQuestionLabels.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Original labels for answers, independent of later event-type edits.+ */+export type BookingQuestionLabels = { [key: string]: string };diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingRescheduledAt.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingRescheduledAt.tsnew file mode 100644index 0000000000..4ac8bfb46c--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingRescheduledAt.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * When the most recent successful reschedule completed.+ */+export type BookingRescheduledAt = string | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingResponse.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingResponse.tsnew file mode 100644index 0000000000..2b0c844e49--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingResponse.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { Booking } from './booking';++/**+ * One booking after a change.+ */+export interface BookingResponse {+ /** The saved booking. */+ booking: Booking;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSchedule.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSchedule.tsnew file mode 100644index 0000000000..ccfd7ed89e--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSchedule.ts@@ -0,0 +1,24 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingDateOverride } from './bookingDateOverride';+import type { BookingWeeklyDay } from './bookingWeeklyDay';++/**+ * Reusable hours, with DST interpreted in an IANA zone.+ */+export interface BookingSchedule {+ /** Stable schedule identity. */+ id: string;+ /** Display name. */+ name: string;+ /** Date-specific replacements. */+ overrides: BookingDateOverride[];+ /** IANA time zone. */+ timeZone: string;+ /** Weekly windows. */+ weekly: BookingWeeklyDay[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSlot.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSlot.tsnew file mode 100644index 0000000000..26bb1fada5--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingSlot.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Available slot and the hosts who can satisfy it.+ */+export interface BookingSlot {+ /** Absolute end. */+ endsAt: string;+ /** Absolute start. */+ startsAt: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingStatus.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingStatus.tsnew file mode 100644index 0000000000..0d6782180a--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingStatus.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Booking lifecycle state.+ */+export type BookingStatus = (typeof BookingStatus)[keyof typeof BookingStatus];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const BookingStatus = {+ pending: 'pending',+ confirmed: 'confirmed',+ cancelled: 'cancelled',+ processing: 'processing',+ failed: 'failed',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingTimeWindow.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingTimeWindow.tsnew file mode 100644index 0000000000..5d5199de9e--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingTimeWindow.ts@@ -0,0 +1,16 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * A wall-clock window in an availability schedule.+ */+export interface BookingTimeWindow {+ /** Exclusive HH:MM end. */+ end: string;+ /** Inclusive HH:MM start. */+ start: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingWeeklyDay.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingWeeklyDay.tsnew file mode 100644index 0000000000..1906fc9da0--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingWeeklyDay.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingTimeWindow } from './bookingTimeWindow';++/**+ * Availability for one weekday.+ */+export interface BookingWeeklyDay {+ /**+ * Sunday is zero.+ * @minimum 0+ */+ day: number;+ /** Non-overlapping local windows. */+ windows: BookingTimeWindow[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingsResponse.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingsResponse.tsnew file mode 100644index 0000000000..89b2696510--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/bookingsResponse.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { Booking } from './booking';++/**+ * Bookings of one profile.+ */+export interface BookingsResponse {+ /** Every matching booking. */+ bookings: Booking[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkParams.tsnew file mode 100644index 0000000000..c2e0fb20e4--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type CreateBookingLinkParams = {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkRequest.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkRequest.tsnew file mode 100644index 0000000000..e04c960eeb--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/createBookingLinkRequest.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLinkDraft } from './bookingLinkDraft';++/**+ * A new booking link, saved after the user approved it.+ */+export interface CreateBookingLinkRequest {+ /** Full booking rules and availability the user approved. */+ draft: BookingLinkDraft;+ /** The user's reply approving this proposal, quoted verbatim. */+ userConfirmation: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkParams.tsnew file mode 100644index 0000000000..b1601074f2--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type EditBookingLinkParams = {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkRequest.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkRequest.tsnew file mode 100644index 0000000000..b0399c20b8--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/editBookingLinkRequest.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingLinkDraft } from './bookingLinkDraft';++/**+ * Replacement configuration for one booking link, saved after the user approved it.+ */+export interface EditBookingLinkRequest {+ /** Full edited booking rules and availability the user approved. */+ draft: BookingLinkDraft;+ /** Profile revision the edit was prepared from; a newer revision conflicts. */+ expectedRevision: number;+ /** The user's reply approving this proposal, quoted verbatim. */+ userConfirmation: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingInsightsParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingInsightsParams.tsnew file mode 100644index 0000000000..dab469c55c--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingInsightsParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type GetBookingInsightsParams = {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingSettingsParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingSettingsParams.tsnew file mode 100644index 0000000000..8c4cc76866--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/getBookingSettingsParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type GetBookingSettingsParams = {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/index.tsindex f752cfcad1..e82375a37b 100644--- a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/index.ts+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/index.ts@@ -9,6 +9,40 @@ export * from './attendeeResponseStatus';export * from './availabilityCalendar';export * from './availabilityCalendarBody';export * from './availabilityCalendarsResponse';+export * from './booking';+export * from './bookingAnswers';+export * from './bookingAttendance';+export * from './bookingChange';+export * from './bookingChangeOneOf';+export * from './bookingChangeOneOfAction';+export * from './bookingChangeOneOfFive';+export * from './bookingChangeOneOfFiveAction';+export * from './bookingChangeOneOfSeven';+export * from './bookingChangeOneOfSevenAction';+export * from './bookingChangeOneOfThree';+export * from './bookingChangeOneOfThreeAction';+export * from './bookingDateOverride';+export * from './bookingEventType';+export * from './bookingEventTypeDailyLimit';+export * from './bookingInsights';+export * from './bookingLink';+export * from './bookingLinkDraft';+export * from './bookingLinkEvent';+export * from './bookingLinkEventDailyLimit';+export * from './bookingLinkListing';+export * from './bookingLinkSchedule';+export * from './bookingProfile';+export * from './bookingProfileDefaultScheduleId';+export * from './bookingQuestion';+export * from './bookingQuestionLabels';+export * from './bookingRescheduledAt';+export * from './bookingResponse';+export * from './bookingSchedule';+export * from './bookingSlot';+export * from './bookingStatus';+export * from './bookingsResponse';+export * from './bookingTimeWindow';+export * from './bookingWeeklyDay';export * from './calendarAttendee';export * from './calendarAttendeeComment';export * from './calendarAttendeeDisplayName';@@ -51,6 +85,8 @@ export * from './conferenceChange';export * from './conferenceProvider';export * from './copyCalendarEventRequest';export * from './copyCalendarEventRequestCalendarId';+export * from './createBookingLinkParams';+export * from './createBookingLinkRequest';export * from './createCalendarEventRequest';export * from './createCalendarEventRequestCalendarId';export * from './createCalendarEventRequestConference';@@ -64,6 +100,8 @@ export * from './createCalendarEventRequestReminders';export * from './createCalendarEventRequestTransparency';export * from './createCalendarEventRequestVisibility';export * from './deleteCalendarEventParams';+export * from './editBookingLinkParams';+export * from './editBookingLinkRequest';export * from './eventReminderOverride';export * from './eventReminders';export * from './eventStatus';@@ -76,12 +114,25 @@ export * from './eventTimeOneOfTimeZone';export * from './eventTransparency';export * from './eventType';export * from './eventVisibility';+export * from './getBookingInsightsParams';+export * from './getBookingSettingsParams';export * from './guestPolicy';+export * from './insightCounts';+export * from './insightPeriod';+export * from './insightPeriodDays';+export * from './insightPeriodEventCounts';+export * from './insightPeriodHostCounts';+export * from './insightQuery';+export * from './insightQueryEventTypeId';+export * from './insightQueryHostId';export * from './inviteCalendarEventGuestsRequest';export * from './inviteCalendarEventGuestsRequestCalendarId';export * from './inviteCalendarEventGuestsRequestInbox';export * from './inviteCalendarEventGuestsRequestRecurrenceId';export * from './inviteCalendarEventGuestsRequestScope';+export * from './listBookingLinksParams';+export * from './listBookingRescheduleSlotsParams';+export * from './listBookingsParams';export * from './listCalendarsResponse';export * from './outOfOfficeAutoDeclineMode';export * from './outOfOfficeProperties';@@ -89,6 +140,8 @@ export * from './outOfOfficePropertiesDeclineMessage';export * from './prepareCalendarReplacementRequest';export * from './prepareCalendarReplacementRequestCalendarId';export * from './prepareCalendarReplacementRequestRecurrenceId';+export * from './profileResponse';+export * from './receiptResponse';export * from './refreshCalendarEvent';export * from './refreshCalendarEventOneOf';export * from './refreshCalendarEventOneOfEvent';@@ -103,6 +156,9 @@ export * from './rsvpCalendarEventRequestCalendarId';export * from './rsvpCalendarEventRequestRecurrenceId';export * from './rsvpCalendarEventRequestRespondingEmail';export * from './rsvpCalendarEventRequestScope';+export * from './saveBookingSettingsParams';+export * from './schedulingMode';+export * from './slotsResponse';export * from './teamCalendarSharing';export * from './teamCalendarSharingBody';export * from './updateCalendarEventRequest';diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightCounts.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightCounts.tsnew file mode 100644index 0000000000..fadeab0958--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightCounts.ts@@ -0,0 +1,42 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Counts can overlap: a rescheduled event can also be completed or cancelled.+ */+export interface InsightCounts {+ /**+ * Cancelled bookings, grouped by their scheduled start.+ * @minimum 0+ */+ cancelled: number;+ /**+ * Confirmed, ended bookings excluding explicit no-shows.+ * @minimum 0+ */+ completed: number;+ /**+ * Explicit guest no-shows only.+ * @minimum 0+ */+ guestNoShow: number;+ /**+ * Explicit host no-shows only.+ * @minimum 0+ */+ hostNoShow: number;+ /**+ * Bookings with at least one completed reschedule, counted once.+ * @minimum 0+ */+ rescheduled: number;+ /**+ * All bookings except failed and processing requests.+ * @minimum 0+ */+ total: number;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriod.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriod.tsnew file mode 100644index 0000000000..e6d35c197e--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriod.ts@@ -0,0 +1,30 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { InsightCounts } from './insightCounts';+import type { InsightPeriodDays } from './insightPeriodDays';+import type { InsightPeriodEventCounts } from './insightPeriodEventCounts';+import type { InsightPeriodHostCounts } from './insightPeriodHostCounts';++/**+ * One complete period of metrics and chart data, with no guest contact information.+ */+export interface InsightPeriod {+ /** Average scheduled duration of all confirmed bookings, including future ones. */+ averageMinutes: number;+ /** Summary event counts. */+ counts: InsightCounts;+ /** Local-date counts, including dates with zero bookings. */+ days: InsightPeriodDays;+ /** Booking counts by link identity. */+ eventCounts: InsightPeriodEventCounts;+ /** Booking counts by host; collective bookings count once for each host. */+ hostCounts: InsightPeriodHostCounts;+ /** Booking counts by local hour, indexed from 0 to 23. */+ hours: number[];+ /** Scheduled minutes of completed meetings, not actual call duration. */+ meetingMinutes: number;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodDays.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodDays.tsnew file mode 100644index 0000000000..98ce2b9011--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodDays.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { InsightCounts } from './insightCounts';++/**+ * Local-date counts, including dates with zero bookings.+ */+export type InsightPeriodDays = { [key: string]: InsightCounts };diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodEventCounts.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodEventCounts.tsnew file mode 100644index 0000000000..f713de42e5--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodEventCounts.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Booking counts by link identity.+ */+export type InsightPeriodEventCounts = { [key: string]: number };diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodHostCounts.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodHostCounts.tsnew file mode 100644index 0000000000..217a2d8469--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightPeriodHostCounts.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Booking counts by host; collective bookings count once for each host.+ */+export type InsightPeriodHostCounts = { [key: string]: number };diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQuery.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQuery.tsnew file mode 100644index 0000000000..0d7cf9e58b--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQuery.ts@@ -0,0 +1,24 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { InsightQueryEventTypeId } from './insightQueryEventTypeId';+import type { InsightQueryHostId } from './insightQueryHostId';++/**+ * Inclusive local dates and optional booking/host filters.+ */+export interface InsightQuery {+ /** Restrict to one booking link; omit for all links. */+ eventTypeId?: InsightQueryEventTypeId;+ /** First local date, inclusive. */+ from: string;+ /** Restrict to one assigned host; omit for all hosts. */+ hostId?: InsightQueryHostId;+ /** IANA zone used for dates and hour-of-day grouping. */+ timeZone: string;+ /** Last local date, inclusive; maximum 366 days. */+ to: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryEventTypeId.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryEventTypeId.tsnew file mode 100644index 0000000000..b959af3ab2--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryEventTypeId.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Restrict to one booking link; omit for all links.+ */+export type InsightQueryEventTypeId = string | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryHostId.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryHostId.tsnew file mode 100644index 0000000000..ad5ce724e7--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/insightQueryHostId.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Restrict to one assigned host; omit for all hosts.+ */+export type InsightQueryHostId = string | null;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingLinksParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingLinksParams.tsnew file mode 100644index 0000000000..0054515b7a--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingLinksParams.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type ListBookingLinksParams = {+ /**+ * Existing Macro team; omit for personal links.+ */+ teamId?: string;+ /**+ * Text matched against link title, slug and description; omit for all links.+ */+ query?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingRescheduleSlotsParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingRescheduleSlotsParams.tsnew file mode 100644index 0000000000..b3b478a420--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingRescheduleSlotsParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type ListBookingRescheduleSlotsParams = {+ /**+ * Date in the booking's schedule time zone.+ */+ date: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingsParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingsParams.tsnew file mode 100644index 0000000000..5304d9865d--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/listBookingsParams.ts@@ -0,0 +1,21 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type ListBookingsParams = {+ /**+ * Existing Macro team; omit for personal bookings.+ */+ teamId?: string;+ /**+ * Inclusive start; supply together with `to`, at most 733 days apart.+ */+ from?: string;+ /**+ * Exclusive end; supply together with `from`.+ */+ to?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/profileResponse.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/profileResponse.tsnew file mode 100644index 0000000000..77594bd2c4--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/profileResponse.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingProfile } from './bookingProfile';++/**+ * Booking settings of one profile.+ */+export interface ProfileResponse {+ /** Full settings, including the revision to save against. */+ profile: BookingProfile;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/receiptResponse.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/receiptResponse.tsnew file mode 100644index 0000000000..40ba7f88b5--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/receiptResponse.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { Booking } from './booking';++/**+ * A booking with its booker management capability.+ */+export interface ReceiptResponse {+ /** The booking. */+ booking: Booking;+ /** IANA time zone of the booking's availability schedule. */+ scheduleTimeZone: string;+ /** Bearer capability for the booker's receipt, reschedule and cancel pages. */+ token: string;+}diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/saveBookingSettingsParams.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/saveBookingSettingsParams.tsnew file mode 100644index 0000000000..d4432a4a2f--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/saveBookingSettingsParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++export type SaveBookingSettingsParams = {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+};diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/schedulingMode.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/schedulingMode.tsnew file mode 100644index 0000000000..7d3302e194--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/schedulingMode.ts@@ -0,0 +1,19 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Team host assignment policy.+ */+export type SchedulingMode =+ (typeof SchedulingMode)[keyof typeof SchedulingMode];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const SchedulingMode = {+ individual: 'individual',+ collective: 'collective',+ roundRobin: 'roundRobin',+} as const;diff --git a/apps/web/src/lib/service-clients/service-calendar/generated/schemas/slotsResponse.ts b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/slotsResponse.tsnew file mode 100644index 0000000000..6b87e4be11--- /dev/null+++ b/apps/web/src/lib/service-clients/service-calendar/generated/schemas/slotsResponse.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * calendar_service+ * OpenAPI spec version: 0.1.0+ */+import type { BookingSlot } from './bookingSlot';++/**+ * Available start times.+ */+export interface SlotsResponse {+ /** Every available slot. */+ slots: BookingSlot[];+}diff --git a/apps/web/src/lib/service-clients/service-calendar/openapi.json b/apps/web/src/lib/service-clients/service-calendar/openapi.jsonindex e3d6b3f0c8..ac3d06e39a 100644--- a/apps/web/src/lib/service-clients/service-calendar/openapi.json+++ b/apps/web/src/lib/service-clients/service-calendar/openapi.json@@ -956,111 +956,1373 @@}}},- "/team-sharing": {+ "/scheduling/bookings": {"get": {- "tags": ["calendar_events"],- "summary": "Read the authenticated user's sharing choice.",- "operationId": "get_team_sharing",+ "tags": ["scheduling"],+ "summary": "List the profile's bookings, optionally those starting in a half-open range.",+ "operationId": "list_bookings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for personal bookings.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "from",+ "in": "query",+ "description": "Inclusive start; supply together with `to`, at most 733 days apart.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "date-time"+ }+ },+ {+ "name": "to",+ "in": "query",+ "description": "Exclusive end; supply together with `from`.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "date-time"+ }+ }+ ],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"+ "$ref": "#/components/schemas/BookingsResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/change": {+ "post": {+ "tags": ["scheduling"],+ "summary": "Approve, cancel, record attendance for, or reschedule one booking.",+ "operationId": "change_booking",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingChange"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/manage": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Read one booking as its personal owner, a host, or a team administrator.",+ "operationId": "get_managed_booking",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ReceiptResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/slots": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Replacement start times for one booking on a schedule-local date.",+ "operationId": "list_booking_reschedule_slots",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "date",+ "in": "query",+ "description": "Date in the booking's schedule time zone.",+ "required": true,+ "schema": {+ "type": "string",+ "format": "date"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SlotsResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/insights": {+ "post": {+ "tags": ["scheduling"],+ "summary": "Booking statistics for a local date range and the equally long period before it.",+ "operationId": "get_booking_insights",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/InsightQuery"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingInsights"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/links": {+ "get": {+ "tags": ["scheduling"],+ "summary": "List and search booking links with their full drafts and reusable schedules.",+ "operationId": "list_booking_links",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for personal links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "query",+ "in": "query",+ "description": "Text matched against link title, slug and description; omit for all links.",+ "required": false,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLinkListing"}}}+ },+ "403": {+ "description": ""}}},- "put": {- "tags": ["calendar_events"],- "summary": "Set the authenticated user's sharing choice.",- "operationId": "set_team_sharing",+ "post": {+ "tags": ["scheduling"],+ "summary": "Create a booking link; an identical replay at the same slug returns the saved link.",+ "operationId": "create_booking_link",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],"requestBody": {"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"+ "$ref": "#/components/schemas/CreateBookingLinkRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLink"+ }}}},- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"- }- }- }+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/links/{id}": {+ "put": {+ "tags": ["scheduling"],+ "summary": "Replace one booking link's configuration at the profile revision it was read with.",+ "operationId": "edit_booking_link",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking link (event type) identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/EditBookingLinkRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLink"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/settings": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Read personal or team booking settings without creating them.",+ "operationId": "get_booking_settings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ProfileResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ },+ "put": {+ "tags": ["scheduling"],+ "summary": "Save booking settings at the revision they were read with.",+ "operationId": "save_booking_settings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingProfile"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ProfileResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/team-sharing": {+ "get": {+ "tags": ["calendar_events"],+ "summary": "Read the authenticated user's sharing choice.",+ "operationId": "get_team_sharing",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ }+ }+ }+ },+ "put": {+ "tags": ["calendar_events"],+ "summary": "Set the authenticated user's sharing choice.",+ "operationId": "set_team_sharing",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ }+ }+ }+ }+ }+ },+ "components": {+ "schemas": {+ "AttendeeResponseStatus": {+ "type": "string",+ "description": "RSVP state for an attendee.",+ "enum": ["needs_action", "accepted", "declined", "tentative"]+ },+ "AvailabilityCalendar": {+ "type": "object",+ "description": "Per-user inclusion of a source calendar in personal availability.",+ "required": [+ "calendarId",+ "name",+ "contributesToAvailability",+ "isPrimary"+ ],+ "properties": {+ "calendarId": {+ "type": "string",+ "format": "uuid",+ "description": "Visible source calendar."+ },+ "contributesToAvailability": {+ "type": "boolean",+ "description": "Whether its events normally block the user's time."+ },+ "isPrimary": {+ "type": "boolean",+ "description": "Whether this is the connected account's primary calendar."+ },+ "name": {+ "type": "string",+ "description": "Source name."+ }+ }+ },+ "AvailabilityCalendarBody": {+ "type": "object",+ "description": "Own-user source inclusion preference.",+ "required": ["contributesToAvailability"],+ "properties": {+ "contributesToAvailability": {+ "type": "boolean",+ "description": "Whether this calendar contributes to personal availability."+ }+ }+ },+ "AvailabilityCalendarsResponse": {+ "type": "object",+ "description": "Source calendar settings returned to their viewer.",+ "required": ["calendars"],+ "properties": {+ "calendars": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/AvailabilityCalendar"+ },+ "description": "Directly visible source calendars."+ }+ }+ },+ "Booking": {+ "type": "object",+ "description": "Public booking details, also visible to authorized profile members.",+ "required": [+ "id",+ "eventTypeId",+ "title",+ "name",+ "email",+ "startsAt",+ "endsAt",+ "timeZone",+ "hosts",+ "status",+ "location",+ "answers"+ ],+ "properties": {+ "answers": {+ "type": "object",+ "description": "Answers keyed by question identity.",+ "additionalProperties": {+ "type": "string"+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "attendance": {+ "$ref": "#/components/schemas/BookingAttendance",+ "description": "Explicit attendance outcome; existing booking records default to unknown."+ },+ "email": {+ "type": "string",+ "description": "Booker's email."+ },+ "endsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute meeting end."+ },+ "eventTypeId": {+ "type": "string",+ "format": "uuid",+ "description": "Booking link identity."+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Assigned hosts."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Booking identity."+ },+ "location": {+ "type": "string",+ "description": "Final location or conference URL."+ },+ "name": {+ "type": "string",+ "description": "Booker's name."+ },+ "questionLabels": {+ "type": "object",+ "description": "Original labels for answers, independent of later event-type edits.",+ "additionalProperties": {+ "type": "string"+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "rescheduleCount": {+ "type": "integer",+ "format": "int32",+ "description": "Number of successfully completed moves to a different start time.",+ "minimum": 0+ },+ "rescheduledAt": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "When the most recent successful reschedule completed."+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute meeting start."+ },+ "status": {+ "$ref": "#/components/schemas/BookingStatus",+ "description": "Current lifecycle state."+ },+ "timeZone": {+ "type": "string",+ "description": "Booker's display time zone."+ },+ "title": {+ "type": "string",+ "description": "Snapshot of the meeting title."+ }+ }+ },+ "BookingAttendance": {+ "type": "string",+ "description": "Attendance recorded by an assigned host or profile administrator after a meeting.",+ "enum": ["unknown", "attended", "guestNoShow", "hostNoShow"]+ },+ "BookingChange": {+ "oneOf": [+ {+ "type": "object",+ "description": "Approve a legacy pending booking and send its calendar invitations.",+ "required": ["action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["approve"]+ }+ }+ },+ {+ "type": "object",+ "description": "Cancel a booking and notify its attendees.",+ "required": ["action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["cancel"]+ }+ }+ },+ {+ "type": "object",+ "description": "Record or clear attendance after the meeting ends.",+ "required": ["attendance", "action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["attendance"]+ },+ "attendance": {+ "$ref": "#/components/schemas/BookingAttendance",+ "description": "Recorded outcome."+ }+ }+ },+ {+ "type": "object",+ "description": "Move the existing meeting to an available time; notify attendees.",+ "required": ["startsAt", "action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["reschedule"]+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute start chosen from available replacement slots."+ }+ }+ }+ ],+ "description": "A host's requested change to a booked meeting."+ },+ "BookingDateOverride": {+ "type": "object",+ "description": "Replacement availability for one date.",+ "required": ["date", "windows"],+ "properties": {+ "date": {+ "type": "string",+ "format": "date",+ "description": "Local date in the schedule zone."+ },+ "windows": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingTimeWindow"+ },+ "description": "Empty means unavailable all day."+ }+ }+ },+ "BookingEventType": {+ "type": "object",+ "description": "A reusable booking link.",+ "required": [+ "id",+ "title",+ "slug",+ "description",+ "durationMinutes",+ "location",+ "googleMeet",+ "enabled",+ "scheduleId",+ "mode",+ "hosts",+ "beforeMinutes",+ "afterMinutes",+ "noticeMinutes",+ "horizonDays",+ "intervalMinutes",+ "requiresConfirmation",+ "questions"+ ],+ "properties": {+ "afterMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time after a meeting.",+ "minimum": 0+ },+ "beforeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time before a meeting.",+ "minimum": 0+ },+ "dailyLimit": {+ "type": ["integer", "null"],+ "format": "int32",+ "description": "Maximum bookings for this event on one schedule-local day.",+ "minimum": 0+ },+ "description": {+ "type": "string",+ "description": "Public description."+ },+ "durationMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Meeting duration.",+ "minimum": 0+ },+ "enabled": {+ "type": "boolean",+ "description": "Whether new bookings are accepted."+ },+ "googleMeet": {+ "type": "boolean",+ "description": "Generate a Google Meet conference. Mutually exclusive with a Macro call."+ },+ "horizonDays": {+ "type": "integer",+ "format": "int32",+ "description": "Maximum days ahead.",+ "minimum": 0+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Current Macro user identities selected as hosts."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable identity."+ },+ "intervalMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Spacing of offered start times.",+ "minimum": 0+ },+ "location": {+ "type": "string",+ "description": "Meeting location."+ },+ "macroCall": {+ "type": "boolean",+ "description": "Generate a Macro call and attach its join link when someone books.\nMutually exclusive with Google Meet. Omitted on links saved before\nMacro calls were a booking option, which keep their previous conference."+ },+ "mode": {+ "$ref": "#/components/schemas/SchedulingMode",+ "description": "Host assignment policy."+ },+ "noticeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Minimum notice in minutes.",+ "minimum": 0+ },+ "questions": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingQuestion"+ },+ "description": "Additional form fields."+ },+ "requiresConfirmation": {+ "type": "boolean",+ "description": "Hold bookings for host approval."+ },+ "scheduleId": {+ "type": "string",+ "format": "uuid",+ "description": "Referenced availability schedule."+ },+ "slug": {+ "type": "string",+ "description": "Unique link segment within a profile."+ },+ "title": {+ "type": "string",+ "description": "Public title."+ }+ }+ },+ "BookingInsights": {+ "type": "object",+ "description": "Current and equally long preceding local-calendar periods.",+ "required": [+ "asOf",+ "previousFrom",+ "previousTo",+ "current",+ "previous"+ ],+ "properties": {+ "asOf": {+ "type": "string",+ "format": "date-time",+ "description": "Time at which completion was evaluated."+ },+ "current": {+ "$ref": "#/components/schemas/InsightPeriod",+ "description": "Requested period."+ },+ "previous": {+ "$ref": "#/components/schemas/InsightPeriod",+ "description": "Comparison period, using identical filters and definitions."+ },+ "previousFrom": {+ "type": "string",+ "format": "date",+ "description": "Preceding period's first local date."+ },+ "previousTo": {+ "type": "string",+ "format": "date",+ "description": "Preceding period's last local date."+ }+ }+ },+ "BookingLink": {+ "type": "object",+ "description": "Saved link with actual identities and revision for subsequent edits.",+ "required": ["profileId", "eventTypeId", "revision", "draft"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full editable configuration."+ },+ "eventTypeId": {+ "type": "string",+ "format": "uuid",+ "description": "Stable link identity."+ },+ "profileId": {+ "type": "string",+ "format": "uuid",+ "description": "Owning profile."+ },+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Profile revision to supply when editing."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkDraft": {+ "type": "object",+ "description": "Complete proposal reviewed and validated before saving.",+ "required": ["event", "schedule"],+ "properties": {+ "event": {+ "$ref": "#/components/schemas/BookingLinkEvent",+ "description": "Public details, hosts, booking rules and questions."+ },+ "schedule": {+ "$ref": "#/components/schemas/BookingLinkSchedule",+ "description": "Weekly hours, IANA time zone, and date overrides for this link."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkEvent": {+ "type": "object",+ "description": "All editable rules for one link. Personal links must use the authenticated user as host.",+ "required": [+ "title",+ "slug",+ "description",+ "durationMinutes",+ "location",+ "googleMeet",+ "enabled",+ "mode",+ "hosts",+ "beforeMinutes",+ "afterMinutes",+ "noticeMinutes",+ "horizonDays",+ "intervalMinutes",+ "requiresConfirmation",+ "questions"+ ],+ "properties": {+ "afterMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time after a meeting.",+ "minimum": 0+ },+ "beforeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time before a meeting.",+ "minimum": 0+ },+ "dailyLimit": {+ "type": ["integer", "null"],+ "format": "int32",+ "description": "Maximum bookings for this event on one schedule-local day.",+ "minimum": 0+ },+ "description": {+ "type": "string",+ "description": "Public description."+ },+ "durationMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Meeting duration.",+ "minimum": 0+ },+ "enabled": {+ "type": "boolean",+ "description": "Whether new bookings are accepted."+ },+ "googleMeet": {+ "type": "boolean",+ "description": "Generate a Google Meet conference. Mutually exclusive with `macroCall`."+ },+ "horizonDays": {+ "type": "integer",+ "format": "int32",+ "description": "Maximum days ahead.",+ "minimum": 0+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Current Macro user identities selected as hosts."+ },+ "intervalMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Spacing of offered start times.",+ "minimum": 0+ },+ "location": {+ "type": "string",+ "description": "Meeting location."+ },+ "macroCall": {+ "type": "boolean",+ "description": "Attach a Macro call when someone books. A join link is created for that\nbooking and written onto the calendar invitation. Mutually exclusive\nwith `googleMeet`. Prefer this for a Macro booking; omit or false when\nthe link should use Google Meet or no video. False is omitted so drafts\nsaved before this field still round-trip unchanged."+ },+ "mode": {+ "$ref": "#/components/schemas/SchedulingMode",+ "description": "Host assignment policy."+ },+ "noticeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Minimum notice in minutes.",+ "minimum": 0+ },+ "questions": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingQuestion"+ },+ "description": "Additional form fields."+ },+ "requiresConfirmation": {+ "type": "boolean",+ "description": "Hold bookings for host approval."+ },+ "slug": {+ "type": "string",+ "description": "Unique link segment within a profile."+ },+ "title": {+ "type": "string",+ "description": "Public title."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkListing": {+ "type": "object",+ "description": "Authorized discovery results including reusable availability.",+ "required": [+ "teamIds",+ "userId",+ "profileId",+ "revision",+ "schedules",+ "links"+ ],+ "properties": {+ "links": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingLink"+ },+ "description": "Links whose title, slug or description matches the search, including paused links."+ },+ "profileId": {+ "type": "string",+ "format": "uuid",+ "description": "Owning profile identity, including unsaved new profiles."+ },+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Current revision."+ },+ "schedules": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSchedule"+ },+ "description": "Reusable schedules, even when no links match."+ },+ "teamIds": {+ "type": "array",+ "items": {+ "type": "string",+ "format": "uuid"+ },+ "description": "Current team identities that can be used to discover team links."+ },+ "userId": {+ "type": "string",+ "description": "Current authenticated host identity for personal drafts."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkSchedule": {+ "type": "object",+ "description": "Availability copied into a dedicated schedule when it changes; other links retain their hours.",+ "required": ["name", "timeZone", "weekly", "overrides"],+ "properties": {+ "name": {+ "type": "string",+ "description": "Display name."+ },+ "overrides": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingDateOverride"+ },+ "description": "Date-specific replacements."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA time zone."+ },+ "weekly": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingWeeklyDay"+ },+ "description": "Weekly windows."}- }- }- }- },- "components": {- "schemas": {- "AttendeeResponseStatus": {- "type": "string",- "description": "RSVP state for an attendee.",- "enum": ["needs_action", "accepted", "declined", "tentative"]+ },+ "additionalProperties": false},- "AvailabilityCalendar": {+ "BookingProfile": {"type": "object",- "description": "Per-user inclusion of a source calendar in personal availability.",+ "description": "Editable configuration for a person or team.","required": [- "calendarId",+ "id","name",- "contributesToAvailability",- "isPrimary"+ "description",+ "schedules",+ "eventTypes",+ "revision"],"properties": {- "calendarId": {+ "defaultScheduleId": {+ "type": ["string", "null"],+ "format": "uuid",+ "description": "Personal hours used by team events; absent legacy profiles use their first schedule."+ },+ "description": {+ "type": "string",+ "description": "Public introduction."+ },+ "eventTypes": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingEventType"+ },+ "description": "Booking links."+ },+ "id": {"type": "string","format": "uuid",- "description": "Visible source calendar."+ "description": "Public, opaque profile identity."},- "contributesToAvailability": {- "type": "boolean",- "description": "Whether its events normally block the user's time."+ "name": {+ "type": "string",+ "description": "Display name on the public page."},- "isPrimary": {+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Optimistic concurrency version."+ },+ "schedules": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSchedule"+ },+ "description": "Reusable schedules."+ }+ }+ },+ "BookingQuestion": {+ "type": "object",+ "description": "A question on the booking form.",+ "required": ["id", "label", "required"],+ "properties": {+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable identity."+ },+ "label": {+ "type": "string",+ "description": "Public question label."+ },+ "required": {"type": "boolean",- "description": "Whether this is the connected account's primary calendar."+ "description": "Whether an answer is mandatory."+ }+ }+ },+ "BookingResponse": {+ "type": "object",+ "description": "One booking after a change.",+ "required": ["booking"],+ "properties": {+ "booking": {+ "$ref": "#/components/schemas/Booking",+ "description": "The saved booking."+ }+ }+ },+ "BookingSchedule": {+ "type": "object",+ "description": "Reusable hours, with DST interpreted in an IANA zone.",+ "required": ["id", "name", "timeZone", "weekly", "overrides"],+ "properties": {+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable schedule identity."},"name": {"type": "string",- "description": "Source name."+ "description": "Display name."+ },+ "overrides": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingDateOverride"+ },+ "description": "Date-specific replacements."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA time zone."+ },+ "weekly": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingWeeklyDay"+ },+ "description": "Weekly windows."}}},- "AvailabilityCalendarBody": {+ "BookingSlot": {"type": "object",- "description": "Own-user source inclusion preference.",- "required": ["contributesToAvailability"],+ "description": "Available slot and the hosts who can satisfy it.",+ "required": ["startsAt", "endsAt"],"properties": {- "contributesToAvailability": {- "type": "boolean",- "description": "Whether this calendar contributes to personal availability."+ "endsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute end."+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute start."}}},- "AvailabilityCalendarsResponse": {+ "BookingStatus": {+ "type": "string",+ "description": "Booking lifecycle state.",+ "enum": ["pending", "confirmed", "cancelled", "processing", "failed"]+ },+ "BookingTimeWindow": {"type": "object",- "description": "Source calendar settings returned to their viewer.",- "required": ["calendars"],+ "description": "A wall-clock window in an availability schedule.",+ "required": ["start", "end"],"properties": {- "calendars": {+ "end": {+ "type": "string",+ "description": "Exclusive HH:MM end."+ },+ "start": {+ "type": "string",+ "description": "Inclusive HH:MM start."+ }+ }+ },+ "BookingWeeklyDay": {+ "type": "object",+ "description": "Availability for one weekday.",+ "required": ["day", "windows"],+ "properties": {+ "day": {+ "type": "integer",+ "format": "int32",+ "description": "Sunday is zero.",+ "minimum": 0+ },+ "windows": {"type": "array","items": {- "$ref": "#/components/schemas/AvailabilityCalendar"+ "$ref": "#/components/schemas/BookingTimeWindow"},- "description": "Directly visible source calendars."+ "description": "Non-overlapping local windows."+ }+ }+ },+ "BookingsResponse": {+ "type": "object",+ "description": "Bookings of one profile.",+ "required": ["bookings"],+ "properties": {+ "bookings": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Booking"+ },+ "description": "Every matching booking."}}},@@ -1627,6 +2889,22 @@}}},+ "CreateBookingLinkRequest": {+ "type": "object",+ "description": "A new booking link, saved after the user approved it.",+ "required": ["draft", "userConfirmation"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full booking rules and availability the user approved."+ },+ "userConfirmation": {+ "type": "string",+ "description": "The user's reply approving this proposal, quoted verbatim."+ }+ },+ "additionalProperties": false+ },"CreateCalendarEventRequest": {"type": "object","description": "Request body creating a calendar event on the requester's calendar.",@@ -1749,6 +3027,27 @@}}},+ "EditBookingLinkRequest": {+ "type": "object",+ "description": "Replacement configuration for one booking link, saved after the user approved it.",+ "required": ["expectedRevision", "draft", "userConfirmation"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full edited booking rules and availability the user approved."+ },+ "expectedRevision": {+ "type": "integer",+ "format": "int64",+ "description": "Profile revision the edit was prepared from; a newer revision conflicts."+ },+ "userConfirmation": {+ "type": "string",+ "description": "The user's reply approving this proposal, quoted verbatim."+ }+ },+ "additionalProperties": false+ },"EventReminderOverride": {"type": "object","description": "One reminder: how it alerts and how many minutes before the event start\n(before midnight in the calendar's zone for all-day events) it fires.",@@ -1881,6 +3180,161 @@}}},+ "InsightCounts": {+ "type": "object",+ "description": "Counts can overlap: a rescheduled event can also be completed or cancelled.",+ "required": [+ "total",+ "completed",+ "rescheduled",+ "cancelled",+ "guestNoShow",+ "hostNoShow"+ ],+ "properties": {+ "cancelled": {+ "type": "integer",+ "format": "int32",+ "description": "Cancelled bookings, grouped by their scheduled start.",+ "minimum": 0+ },+ "completed": {+ "type": "integer",+ "format": "int32",+ "description": "Confirmed, ended bookings excluding explicit no-shows.",+ "minimum": 0+ },+ "guestNoShow": {+ "type": "integer",+ "format": "int32",+ "description": "Explicit guest no-shows only.",+ "minimum": 0+ },+ "hostNoShow": {+ "type": "integer",+ "format": "int32",+ "description": "Explicit host no-shows only.",+ "minimum": 0+ },+ "rescheduled": {+ "type": "integer",+ "format": "int32",+ "description": "Bookings with at least one completed reschedule, counted once.",+ "minimum": 0+ },+ "total": {+ "type": "integer",+ "format": "int32",+ "description": "All bookings except failed and processing requests.",+ "minimum": 0+ }+ }+ },+ "InsightPeriod": {+ "type": "object",+ "description": "One complete period of metrics and chart data, with no guest contact information.",+ "required": [+ "counts",+ "meetingMinutes",+ "averageMinutes",+ "days",+ "hours",+ "eventCounts",+ "hostCounts"+ ],+ "properties": {+ "averageMinutes": {+ "type": "number",+ "format": "double",+ "description": "Average scheduled duration of all confirmed bookings, including future ones."+ },+ "counts": {+ "$ref": "#/components/schemas/InsightCounts",+ "description": "Summary event counts."+ },+ "days": {+ "type": "object",+ "description": "Local-date counts, including dates with zero bookings.",+ "additionalProperties": {+ "$ref": "#/components/schemas/InsightCounts"+ },+ "propertyNames": {+ "type": "string",+ "format": "date"+ }+ },+ "eventCounts": {+ "type": "object",+ "description": "Booking counts by link identity.",+ "additionalProperties": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "hostCounts": {+ "type": "object",+ "description": "Booking counts by host; collective bookings count once for each host.",+ "additionalProperties": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "propertyNames": {+ "type": "string"+ }+ },+ "hours": {+ "type": "array",+ "items": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "description": "Booking counts by local hour, indexed from 0 to 23."+ },+ "meetingMinutes": {+ "type": "number",+ "format": "double",+ "description": "Scheduled minutes of completed meetings, not actual call duration."+ }+ }+ },+ "InsightQuery": {+ "type": "object",+ "description": "Inclusive local dates and optional booking/host filters.",+ "required": ["from", "to", "timeZone"],+ "properties": {+ "eventTypeId": {+ "type": ["string", "null"],+ "format": "uuid",+ "description": "Restrict to one booking link; omit for all links."+ },+ "from": {+ "type": "string",+ "format": "date",+ "description": "First local date, inclusive."+ },+ "hostId": {+ "type": ["string", "null"],+ "description": "Restrict to one assigned host; omit for all hosts."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA zone used for dates and hour-of-day grouping."+ },+ "to": {+ "type": "string",+ "format": "date",+ "description": "Last local date, inclusive; maximum 366 days."+ }+ },+ "additionalProperties": false+ },"InviteCalendarEventGuestsRequest": {"type": "object","description": "Request body adding guests to an event without touching anyone already\ninvited.",@@ -1976,6 +3430,37 @@}}},+ "ProfileResponse": {+ "type": "object",+ "description": "Booking settings of one profile.",+ "required": ["profile"],+ "properties": {+ "profile": {+ "$ref": "#/components/schemas/BookingProfile",+ "description": "Full settings, including the revision to save against."+ }+ }+ },+ "ReceiptResponse": {+ "type": "object",+ "description": "A booking with its booker management capability.",+ "required": ["booking", "token", "scheduleTimeZone"],+ "properties": {+ "booking": {+ "$ref": "#/components/schemas/Booking",+ "description": "The booking."+ },+ "scheduleTimeZone": {+ "type": "string",+ "description": "IANA time zone of the booking's availability schedule."+ },+ "token": {+ "type": "string",+ "format": "uuid",+ "description": "Bearer capability for the booker's receipt, reschedule and cancel pages."+ }+ }+ },"RefreshCalendarEvent": {"oneOf": [{@@ -2083,6 +3568,25 @@}}},+ "SchedulingMode": {+ "type": "string",+ "description": "Team host assignment policy.",+ "enum": ["individual", "collective", "roundRobin"]+ },+ "SlotsResponse": {+ "type": "object",+ "description": "Available start times.",+ "required": ["slots"],+ "properties": {+ "slots": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSlot"+ },+ "description": "Every available slot."+ }+ }+ },"TeamCalendarSharing": {"type": "string","description": "What a user exposes through their team membership.",@@ -2351,6 +3855,10 @@{"name": "calendar_events","description": "Macro Calendar Service"+ },+ {+ "name": "scheduling",+ "description": "Booking links, bookings and booking settings"}]}diff --git a/crates/agent_code_mode/src/domain/service.rs b/crates/agent_code_mode/src/domain/service.rsindex ab8e953b72..394aa8d117 100644--- a/crates/agent_code_mode/src/domain/service.rs+++ b/crates/agent_code_mode/src/domain/service.rs@@ -246,6 +246,16 @@ pub fn covered_by_code_sdk(name: &str, user_tool: bool) -> bool {| "CreateConfirmedCalendarEvent"| "UpdateCalendarEvent"| "DeleteCalendarEvent"+ // macro.calendar.booking.+ | "ReadBookingSettings"+ | "UpdateBookingSettings"+ | "ListBookings"+ | "GetBookingInsights"+ | "GetBookingRescheduleSlots"+ | "ChangeBooking"+ | "ListBookingLinks"+ | "CreateBookingLink"+ | "EditBookingLink"| "ListNotifications"| "MarkNotificationsDone"| "MarkNotificationsSeen"diff --git a/crates/ai_tools/src/test.rs b/crates/ai_tools/src/test.rsindex e5ebdf0ae5..6949e3f23b 100644--- a/crates/ai_tools/src/test.rs+++ b/crates/ai_tools/src/test.rs@@ -712,6 +712,30 @@ fn booking_management_has_mcp_and_chat_parity() {}}+#[test]+fn code_mode_manages_booking_links_through_the_sdk_instead_of_the_tools() {+ let standard = tools_for(AiHost::AgentSession);+ let direct = tools_for_agent_code_mode();+ for name in [+ "ReadBookingSettings",+ "UpdateBookingSettings",+ "ListBookings",+ "GetBookingInsights",+ "GetBookingRescheduleSlots",+ "ChangeBooking",+ "ListBookingLinks",+ "CreateBookingLink",+ "EditBookingLink",+ ] {+ assert!(standard.toolset.tools.contains_key(name), "{name}");+ assert!(!direct.toolset.tools.contains_key(name), "{name}");+ assert!(+ !direct.deferred.iter().any(|tool| tool.name == name),+ "{name}"+ );+ }+}+#[test]fn code_mode_retains_direct_lifecycles_and_hides_sdk_methods_from_lazy_discovery() {let standard = tools_for(AiHost::AgentSession);diff --git a/crates/calendar_scheduling/AGENTS.md b/crates/calendar_scheduling/AGENTS.mdindex 329cb9f068..40cff635d6 100644--- a/crates/calendar_scheduling/AGENTS.md+++ b/crates/calendar_scheduling/AGENTS.md@@ -31,7 +31,14 @@ MacroDB migrations.- Depends on: `calendar_events`, `teams`, `email_validator`; optionally `call`via `calendar_events` (meeting links).-- Used by: `forms`, `ai_tools`.+- Used by: `forms`, `ai_tools`, `calendar_service` (router, mounted at `/scheduling`).++## Interfaces++- Host routes in `src/inbound/router.rs` carry `utoipa::path` annotations and are+ listed in `services/calendar_service/src/api/swagger.rs`; the SDK's+ `macro.calendar.booking` wraps them. Domain models derive `ToSchema` under the+ `schema` feature (part of `inbound`); keep `ToSchema` beside every `JsonSchema`.## Recipesdiff --git a/crates/calendar_scheduling/Cargo.toml b/crates/calendar_scheduling/Cargo.tomlindex 35f983e71c..87987dbb52 100644--- a/crates/calendar_scheduling/Cargo.toml+++ b/crates/calendar_scheduling/Cargo.toml@@ -9,7 +9,8 @@ client = ["dep:reqwest"]default = []ai_tools = ["dep:ai_toolset", "dep:async-trait", "dep:schemars", "dep:anyhow"]postgres = ["dep:sqlx"]-inbound = ["dep:axum", "dep:macro_authorization"]+inbound = ["dep:axum", "dep:macro_authorization", "schema"]+schema = ["dep:utoipa"]calendar = ["dep:calendar_events", "dep:teams", "dep:macro_user_id", "dep:reqwest"][dependencies]@@ -30,6 +31,7 @@ rootcause = { workspace = true }tracing = { workspace = true }axum = { workspace = true, optional = true }sqlx = { workspace = true, optional = true }+utoipa = { workspace = true, optional = true }macro_authorization = { path = "../macro_authorization", default-features = false, features = ["axum"], optional = true }calendar_events = { path = "../calendar_events", optional = true }teams = { path = "../teams", default-features = false, features = ["ports"], optional = true }diff --git a/crates/calendar_scheduling/README.md b/crates/calendar_scheduling/README.mdindex 989bf28ebf..2849751cf7 100644--- a/crates/calendar_scheduling/README.md+++ b/crates/calendar_scheduling/README.md@@ -91,6 +91,9 @@ Missing or blank confirmation is rejected before calling the scheduling service.As with confirmed email/calendar tools, the quote is not verified against conversationhistory. There is no booking review card, elicitation, or deferred user-tool result.The agent discovers internal identities through tools instead of asking users for IDs.+Code mode reaches the same workflows through `macro.calendar.booking` in the SDK, over+`GET/POST /scheduling/links` and `PUT /scheduling/links/{id}`; the HTTP writes take the+same required `userConfirmation`.The scheduling service owns authorization and validates the complete draft. Editsreplace only the chosen event type; changed hours use a separate schedule todiff --git a/crates/calendar_scheduling/src/domain/booking_link_models.rs b/crates/calendar_scheduling/src/domain/booking_link_models.rsindex 0ce818ecad..cbbf41e9d6 100644--- a/crates/calendar_scheduling/src/domain/booking_link_models.rs+++ b/crates/calendar_scheduling/src/domain/booking_link_models.rs@@ -6,6 +6,7 @@ use uuid::Uuid;/// All editable rules for one link. Personal links must use the authenticated user as host.#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct BookingLinkEvent {/// Public title.@@ -54,12 +55,14 @@ pub struct BookingLinkEvent {/// Availability copied into a dedicated schedule when it changes; other links retain their hours.#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct BookingLinkSchedule {/// Display name.pub name: String,/// IANA time zone.#[cfg_attr(feature = "ai_tools", schemars(with = "String"))]+ #[cfg_attr(feature = "schema", schema(value_type = String))]pub time_zone: chrono_tz::Tz,/// Weekly windows.pub weekly: Vec<WeeklyDay>,@@ -70,6 +73,7 @@ pub struct BookingLinkSchedule {/// Complete proposal reviewed and validated before saving.#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct BookingLinkDraft {/// Public details, hosts, booking rules and questions.@@ -81,6 +85,7 @@ pub struct BookingLinkDraft {/// Saved link with actual identities and revision for subsequent edits.#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct BookingLink {/// Owning profile.@@ -96,6 +101,7 @@ pub struct BookingLink {/// Authorized discovery results including reusable availability.#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct BookingLinkListing {/// Current team identities that can be used to discover team links.diff --git a/crates/calendar_scheduling/src/domain/insights.rs b/crates/calendar_scheduling/src/domain/insights.rsindex e68c457333..42ef5fea9e 100644--- a/crates/calendar_scheduling/src/domain/insights.rs+++ b/crates/calendar_scheduling/src/domain/insights.rs@@ -8,6 +8,7 @@ use uuid::Uuid;/// Inclusive local dates and optional booking/host filters.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(rename_all = "camelCase", deny_unknown_fields)]pub struct InsightQuery {@@ -17,6 +18,7 @@ pub struct InsightQuery {pub to: NaiveDate,/// IANA zone used for dates and hour-of-day grouping.#[cfg_attr(feature = "ai_tools", schemars(with = "String"))]+ #[cfg_attr(feature = "schema", schema(value_type = String))]pub time_zone: Tz,/// Restrict to one booking link; omit for all links.pub event_type_id: Option<Uuid>,@@ -25,6 +27,7 @@ pub struct InsightQuery {}/// Counts can overlap: a rescheduled event can also be completed or cancelled.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Debug, Default, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct InsightCounts {@@ -60,6 +63,7 @@ impl InsightCounts {}/// One complete period of metrics and chart data, with no guest contact information.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Debug, Default, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct InsightPeriod {@@ -80,6 +84,7 @@ pub struct InsightPeriod {}/// Current and equally long preceding local-calendar periods.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Debug, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct BookingInsights {diff --git a/crates/calendar_scheduling/src/domain/management.rs b/crates/calendar_scheduling/src/domain/management.rsindex 4247ee89a9..40af117c6e 100644--- a/crates/calendar_scheduling/src/domain/management.rs+++ b/crates/calendar_scheduling/src/domain/management.rs@@ -6,6 +6,7 @@ use uuid::Uuid;/// A host's requested change to a booked meeting.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Debug, Deserialize, Serialize)]#[serde(tag = "action", rename_all = "camelCase", deny_unknown_fields)]pub enum BookingChange {diff --git a/crates/calendar_scheduling/src/domain/models.rs b/crates/calendar_scheduling/src/domain/models.rsindex 496ccaa2b4..5fe2a2ec8b 100644--- a/crates/calendar_scheduling/src/domain/models.rs+++ b/crates/calendar_scheduling/src/domain/models.rs@@ -6,6 +6,7 @@ use uuid::Uuid;/// A wall-clock window in an availability schedule.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingTimeWindow))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]#[serde(rename_all = "camelCase")]pub struct TimeWindow {@@ -16,6 +17,7 @@ pub struct TimeWindow {}/// Availability for one weekday.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingWeeklyDay))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]pub struct WeeklyDay {/// Sunday is zero.@@ -25,6 +27,7 @@ pub struct WeeklyDay {}/// Replacement availability for one date.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingDateOverride))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]pub struct DateOverride {/// Local date in the schedule zone.@@ -34,6 +37,7 @@ pub struct DateOverride {}/// Reusable hours, with DST interpreted in an IANA zone.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingSchedule))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]#[serde(rename_all = "camelCase")]pub struct Schedule {@@ -43,6 +47,7 @@ pub struct Schedule {pub name: String,/// IANA time zone.#[cfg_attr(feature = "ai_tools", schemars(with = "String"))]+ #[cfg_attr(feature = "schema", schema(value_type = String))]pub time_zone: chrono_tz::Tz,/// Weekly windows.pub weekly: Vec<WeeklyDay>,@@ -51,6 +56,7 @@ pub struct Schedule {}/// Team host assignment policy.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub enum SchedulingMode {@@ -63,6 +69,7 @@ pub enum SchedulingMode {}/// A question on the booking form.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingQuestion))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]pub struct Question {/// Stable identity.@@ -74,6 +81,7 @@ pub struct Question {}/// A reusable booking link.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingEventType))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]#[serde(rename_all = "camelCase")]pub struct EventType {@@ -123,6 +131,7 @@ pub struct EventType {}/// Editable configuration for a person or team.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingProfile))]#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]#[serde(rename_all = "camelCase")]pub struct Profile {@@ -154,6 +163,7 @@ pub struct OwnedProfile {}/// Booking lifecycle state.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub enum BookingStatus {@@ -170,6 +180,7 @@ pub enum BookingStatus {}/// Attendance recorded by an assigned host or profile administrator after a meeting.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub enum BookingAttendance {@@ -185,6 +196,7 @@ pub enum BookingAttendance {}/// Public booking details, also visible to authorized profile members.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]#[derive(Clone, Debug, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct Booking {@@ -204,6 +216,7 @@ pub struct Booking {pub ends_at: DateTime<Utc>,/// Booker's display time zone.#[cfg_attr(feature = "ai_tools", schemars(with = "String"))]+ #[cfg_attr(feature = "schema", schema(value_type = String))]pub time_zone: chrono_tz::Tz,/// Assigned hosts.pub hosts: Vec<String>,@@ -287,6 +300,7 @@ pub struct BusyRange {}/// Available slot and the hosts who can satisfy it.#[cfg_attr(feature = "ai_tools", derive(schemars::JsonSchema))]+#[cfg_attr(feature = "schema", derive(utoipa::ToSchema), schema(as = BookingSlot))]#[derive(Clone, Debug, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct Slot {diff --git a/crates/calendar_scheduling/src/inbound/router.rs b/crates/calendar_scheduling/src/inbound/router.rsindex 3b23497463..374e4f9c91 100644--- a/crates/calendar_scheduling/src/inbound/router.rs+++ b/crates/calendar_scheduling/src/inbound/router.rs@@ -1,5 +1,6 @@//! Thin HTTP routes; membership, availability, and write policy live in the service.use crate::domain::{+ booking_links::{BookingLink, BookingLinkDraft, BookingLinkListing, BookingLinks},insights::{BookingInsights, InsightQuery},management::BookingChange,models::*,@@ -11,7 +12,7 @@ use axum::{extract::{DefaultBodyLimit, FromRef, Path, Query, State},http::{HeaderMap, StatusCode},response::{IntoResponse, Response},- routing::{get, post},+ routing::{get, post, put},};use macro_authorization::{MacroAuthorizationExtractor, MacroAuthorizationService, MacroAuthorizationState, UserOrInternal,@@ -61,6 +62,11 @@ pub fn router<).route("/bookings", get(bookings::<R, C, D, A>)).route("/insights", post(insights::<R, C, D, A>))+ .route(+ "/links",+ get(list_links::<R, C, D, A>).post(create_link::<R, C, D, A>),+ )+ .route("/links/{id}", put(edit_link::<R, C, D, A>)).route("/bookings/{id}/change", post(change::<R, C, D, A>)).route("/bookings/{id}/slots", get(host_slots::<R, C, D, A>)).route("/bookings/{id}/manage", get(manage::<R, C, D, A>))@@ -87,18 +93,56 @@ pub fn router<.layer(axum::middleware::from_fn(no_store)).with_state(state)}-#[derive(Deserialize)]+/// Personal settings when `teamId` is omitted, otherwise that team's.+#[derive(Deserialize, utoipa::IntoParams)]#[serde(rename_all = "camelCase")]-struct Scope {+#[into_params(parameter_in = Query)]+pub struct Scope {+ /// Existing Macro team; omit for the caller's personal booking links.team_id: Option<Uuid>,}-#[derive(Deserialize)]+/// Bookings of one profile, optionally limited to a half-open start range.+#[derive(Deserialize, utoipa::IntoParams)]#[serde(rename_all = "camelCase")]-struct BookingRange {+#[into_params(parameter_in = Query)]+pub struct BookingRange {+ /// Existing Macro team; omit for personal bookings.team_id: Option<Uuid>,+ /// Inclusive start; supply together with `to`, at most 733 days apart.from: Option<chrono::DateTime<chrono::Utc>>,+ /// Exclusive end; supply together with `from`.to: Option<chrono::DateTime<chrono::Utc>>,}+/// Booking links of one profile, optionally searched.+#[derive(Deserialize, utoipa::IntoParams)]+#[serde(rename_all = "camelCase")]+#[into_params(parameter_in = Query)]+pub struct LinkSearch {+ /// Existing Macro team; omit for personal links.+ team_id: Option<Uuid>,+ /// Text matched against link title, slug and description; omit for all links.+ query: Option<String>,+}+/// A new booking link, saved after the user approved it.+#[derive(Deserialize, utoipa::ToSchema)]+#[serde(rename_all = "camelCase", deny_unknown_fields)]+pub struct CreateBookingLinkRequest {+ /// Full booking rules and availability the user approved.+ draft: BookingLinkDraft,+ /// The user's reply approving this proposal, quoted verbatim.+ user_confirmation: String,+}+/// Replacement configuration for one booking link, saved after the user approved it.+#[derive(Deserialize, utoipa::ToSchema)]+#[serde(rename_all = "camelCase", deny_unknown_fields)]+pub struct EditBookingLinkRequest {+ /// Profile revision the edit was prepared from; a newer revision conflicts.+ expected_revision: i64,+ /// Full edited booking rules and availability the user approved.+ draft: BookingLinkDraft,+ /// The user's reply approving this proposal, quoted verbatim.+ user_confirmation: String,+}#[derive(Deserialize)]struct AttendanceRequest {attendance: BookingAttendance,@@ -109,8 +153,11 @@ struct SlotQuery {date: chrono::NaiveDate,time_zone: Option<chrono_tz::Tz>,}-#[derive(Deserialize)]-struct ReplacementQuery {+/// One local date of replacement times.+#[derive(Deserialize, utoipa::IntoParams)]+#[into_params(parameter_in = Query)]+pub struct ReplacementQuery {+ /// Date in the booking's schedule time zone.date: chrono::NaiveDate,}#[derive(Deserialize)]@@ -123,34 +170,48 @@ struct RescheduleRequest {struct Token {token: Uuid,}-#[derive(Serialize)]-struct ProfileResponse {+/// Booking settings of one profile.+#[derive(Serialize, utoipa::ToSchema)]+pub struct ProfileResponse {+ /// Full settings, including the revision to save against.profile: Profile,}-#[derive(Serialize)]-struct BookingsResponse {+/// Bookings of one profile.+#[derive(Serialize, utoipa::ToSchema)]+pub struct BookingsResponse {+ /// Every matching booking.bookings: Vec<Booking>,}-#[derive(Serialize)]-struct BookingResponse {+/// One booking after a change.+#[derive(Serialize, utoipa::ToSchema)]+pub struct BookingResponse {+ /// The saved booking.booking: Booking,}-#[derive(Serialize)]+/// A booking with its booker management capability.+#[derive(Serialize, utoipa::ToSchema)]#[serde(rename_all = "camelCase")]-struct ReceiptResponse {+pub struct ReceiptResponse {+ /// The booking.booking: Booking,+ /// Bearer capability for the booker's receipt, reschedule and cancel pages.token: Uuid,+ /// IANA time zone of the booking's availability schedule.+ #[schema(value_type = String)]schedule_time_zone: chrono_tz::Tz,}-#[derive(Serialize)]-struct SlotsResponse {+/// Available start times.+#[derive(Serialize, utoipa::ToSchema)]+pub struct SlotsResponse {+ /// Every available slot.slots: Vec<Slot>,}#[derive(Serialize)]struct PublicResponse {profile: PublicProfile,}-struct ApiError(Error);+/// Scheduling error rendered as its HTTP status and a `message`.+pub struct ApiError(Error);impl From<Error> for ApiError {fn from(e: Error) -> Self {Self(e)@@ -180,7 +241,9 @@ impl IntoResponse for ApiError {response}}-async fn settings<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Read personal or team booking settings without creating them.+#[utoipa::path(get, path = "/scheduling/settings", operation_id = "get_booking_settings", params(Scope), responses((status = 200, body = ProfileResponse), (status = 403), (status = 404)), tag = "scheduling")]+pub async fn settings<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Query(q): Query<Scope>,@@ -192,7 +255,9 @@ async fn settings<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizati.await?,}))}-async fn save<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Save booking settings at the revision they were read with.+#[utoipa::path(put, path = "/scheduling/settings", operation_id = "save_booking_settings", params(Scope), request_body = Profile, responses((status = 200, body = ProfileResponse), (status = 400), (status = 403), (status = 409)), tag = "scheduling")]+pub async fn save<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Query(q): Query<Scope>,@@ -209,7 +274,9 @@ async fn save<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationSe.await?,}))}-async fn bookings<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// List the profile's bookings, optionally those starting in a half-open range.+#[utoipa::path(get, path = "/scheduling/bookings", operation_id = "list_bookings", params(BookingRange), responses((status = 200, body = BookingsResponse), (status = 400), (status = 403)), tag = "scheduling")]+pub async fn bookings<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Query(q): Query<BookingRange>,@@ -361,7 +428,9 @@ async fn reschedule<R: Repository, C: Calendars, D: Directory, A: MacroAuthoriza}))}-async fn manage<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Read one booking as its personal owner, a host, or a team administrator.+#[utoipa::path(get, path = "/scheduling/bookings/{id}/manage", operation_id = "get_managed_booking", params(("id" = Uuid, Path, description = "Booking identity")), responses((status = 200, body = ReceiptResponse), (status = 403), (status = 404)), tag = "scheduling")]+pub async fn manage<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Path(id): Path<Uuid>,@@ -377,7 +446,9 @@ async fn manage<R: Repository, C: Calendars, D: Directory, A: MacroAuthorization}))}-async fn insights<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Booking statistics for a local date range and the equally long period before it.+#[utoipa::path(post, path = "/scheduling/insights", operation_id = "get_booking_insights", params(Scope), request_body = InsightQuery, responses((status = 200, body = BookingInsights), (status = 400), (status = 403)), tag = "scheduling")]+pub async fn insights<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Query(scope): Query<Scope>,@@ -393,7 +464,9 @@ async fn insights<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizati.await?,))}-async fn change<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Approve, cancel, record attendance for, or reschedule one booking.+#[utoipa::path(post, path = "/scheduling/bookings/{id}/change", operation_id = "change_booking", params(("id" = Uuid, Path, description = "Booking identity")), request_body = BookingChange, responses((status = 200, body = BookingResponse), (status = 400), (status = 403), (status = 404), (status = 409)), tag = "scheduling")]+pub async fn change<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Path(id): Path<Uuid>,@@ -406,7 +479,9 @@ async fn change<R: Repository, C: Calendars, D: Directory, A: MacroAuthorization.await?,}))}-async fn host_slots<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+/// Replacement start times for one booking on a schedule-local date.+#[utoipa::path(get, path = "/scheduling/bookings/{id}/slots", operation_id = "list_booking_reschedule_slots", params(("id" = Uuid, Path, description = "Booking identity"), ReplacementQuery), responses((status = 200, body = SlotsResponse), (status = 403), (status = 404)), tag = "scheduling")]+pub async fn host_slots<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(State(s): State<RouterState<R, C, D, A>>,user: MacroAuthorizationExtractor<A, UserOrInternal>,Path(id): Path<Uuid>,@@ -424,6 +499,82 @@ async fn host_slots<R: Repository, C: Calendars, D: Directory, A: MacroAuthoriza}))}+/// List and search booking links with their full drafts and reusable schedules.+#[utoipa::path(get, path = "/scheduling/links", operation_id = "list_booking_links", params(LinkSearch), responses((status = 200, body = BookingLinkListing), (status = 403)), tag = "scheduling")]+pub async fn list_links<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+ State(s): State<RouterState<R, C, D, A>>,+ user: MacroAuthorizationExtractor<A, UserOrInternal>,+ Query(q): Query<LinkSearch>,+) -> Result<Json<BookingLinkListing>, ApiError> {+ Ok(Json(+ s.service+ .list_links(+ user.authorization.user.macro_user_id.as_ref(),+ q.team_id,+ q.query.as_deref(),+ )+ .await?,+ ))+}++/// Create a booking link; an identical replay at the same slug returns the saved link.+#[utoipa::path(post, path = "/scheduling/links", operation_id = "create_booking_link", params(Scope), request_body = CreateBookingLinkRequest, responses((status = 200, body = BookingLink), (status = 400), (status = 403), (status = 409)), tag = "scheduling")]+pub async fn create_link<+ R: Repository,+ C: Calendars,+ D: Directory,+ A: MacroAuthorizationService,+>(+ State(s): State<RouterState<R, C, D, A>>,+ user: MacroAuthorizationExtractor<A, UserOrInternal>,+ Query(q): Query<Scope>,+ Json(request): Json<CreateBookingLinkRequest>,+) -> Result<Json<BookingLink>, ApiError> {+ require_confirmation(&request.user_confirmation)?;+ Ok(Json(+ s.service+ .create_link(+ user.authorization.user.macro_user_id.as_ref(),+ q.team_id,+ request.draft,+ )+ .await?,+ ))+}++/// Replace one booking link's configuration at the profile revision it was read with.+#[utoipa::path(put, path = "/scheduling/links/{id}", operation_id = "edit_booking_link", params(("id" = Uuid, Path, description = "Booking link (event type) identity"), Scope), request_body = EditBookingLinkRequest, responses((status = 200, body = BookingLink), (status = 400), (status = 403), (status = 404), (status = 409)), tag = "scheduling")]+pub async fn edit_link<R: Repository, C: Calendars, D: Directory, A: MacroAuthorizationService>(+ State(s): State<RouterState<R, C, D, A>>,+ user: MacroAuthorizationExtractor<A, UserOrInternal>,+ Path(id): Path<Uuid>,+ Query(q): Query<Scope>,+ Json(request): Json<EditBookingLinkRequest>,+) -> Result<Json<BookingLink>, ApiError> {+ require_confirmation(&request.user_confirmation)?;+ Ok(Json(+ s.service+ .edit_link(+ user.authorization.user.macro_user_id.as_ref(),+ q.team_id,+ id,+ request.expected_revision,+ request.draft,+ )+ .await?,+ ))+}++/// Booking-link writes save immediately, so they carry the user's approving reply.+fn require_confirmation(confirmation: &str) -> Result<(), ApiError> {+ if confirmation.trim().is_empty() {+ return Err(ApiError(Error::Invalid(+ "Quote the user's reply approving the booking link in userConfirmation".into(),+ )));+ }+ Ok(())+}+fn booking_token(headers: &HeaderMap) -> Result<Uuid, ApiError> {headers.get(axum::http::header::AUTHORIZATION)diff --git a/crates/calendar_scheduling/src/inbound/router/test.rs b/crates/calendar_scheduling/src/inbound/router/test.rsindex c282d8f84f..f21c36975a 100644--- a/crates/calendar_scheduling/src/inbound/router/test.rs+++ b/crates/calendar_scheduling/src/inbound/router/test.rs@@ -278,3 +278,129 @@ async fn http_booking_receipt_recovery_reschedule_cancel_and_team_auth(pool: sql);task.abort();}++#[sqlx::test(migrations = false)]+async fn http_booking_links_require_confirmation_and_revision(pool: sqlx::PgPool) {+ sqlx::raw_sql(EMPTY_PUBLIC_SCHEMA)+ .execute(&pool)+ .await+ .unwrap();+ sqlx::raw_sql("CREATE TABLE \"User\" (id text PRIMARY KEY); CREATE TABLE team (id uuid PRIMARY KEY); INSERT INTO \"User\" VALUES ('macro|[email protected]');").execute(&pool).await.unwrap();+ sqlx::raw_sql(include_str!(+ "../../../../macro_db_client/migrations/20260918164303_calendar_scheduling.sql"+ ))+ .execute(&pool)+ .await+ .unwrap();+ sqlx::raw_sql(include_str!(+ "../../../../macro_db_client/migrations/20260918175703_scheduling_recovery.sql"+ ))+ .execute(&pool)+ .await+ .unwrap();+ let app: Router = router(RouterState::new(+ Arc::new(Service::new(+ PostgresRepository::new(pool.clone()),+ Calendar(AtomicBool::new(false)),+ People,+ )),+ MacroAuthorizationState::new(Arc::new(Identity)),+ ));+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();+ let base = format!("http://{}", listener.local_addr().unwrap());+ let task = tokio::spawn(async move {+ axum::serve(listener, app).await.unwrap();+ });+ let client = reqwest::Client::new();+ let draft = serde_json::json!({+ "event": {"title":"Intro","slug":"intro","description":"","durationMinutes":30,"location":"Office","googleMeet":false,"enabled":true,"mode":"individual","hosts":["macro|[email protected]"],"beforeMinutes":0,"afterMinutes":0,"noticeMinutes":60,"horizonDays":30,"intervalMinutes":30,"dailyLimit":null,"requiresConfirmation":false,"questions":[]},+ "schedule": {"name":"Working hours","timeZone":"UTC","weekly":(0..7).map(|day| serde_json::json!({"day":day,"windows":[{"start":"09:00","end":"17:00"}]})).collect::<Vec<_>>(),"overrides":[]}+ });++ let empty: serde_json::Value = client+ .get(format!("{base}/links"))+ .bearer_auth("host")+ .send()+ .await+ .unwrap()+ .json()+ .await+ .unwrap();+ assert_eq!(empty["links"], serde_json::json!([]));+ assert_eq!(empty["userId"], "macro|[email protected]");++ let unconfirmed = client+ .post(format!("{base}/links"))+ .bearer_auth("host")+ .json(&serde_json::json!({"draft": draft, "userConfirmation": " \n"}))+ .send()+ .await+ .unwrap();+ assert_eq!(unconfirmed.status(), 400);++ let created = client+ .post(format!("{base}/links"))+ .bearer_auth("host")+ .json(&serde_json::json!({"draft": draft, "userConfirmation": "Yes, create it."}))+ .send()+ .await+ .unwrap();+ assert_eq!(created.status(), 200);+ let created: serde_json::Value = created.json().await.unwrap();+ assert_eq!(created["draft"], draft);+ let link = created["eventTypeId"].as_str().unwrap().to_owned();+ let revision = created["revision"].as_i64().unwrap();++ let listed: serde_json::Value = client+ .get(format!("{base}/links?query=intro"))+ .bearer_auth("host")+ .send()+ .await+ .unwrap()+ .json()+ .await+ .unwrap();+ assert_eq!(listed["links"][0]["eventTypeId"], link.as_str());+ assert_eq!(listed["revision"], revision);++ let mut edited = draft.clone();+ edited["event"]["title"] = serde_json::json!("Intro call");+ let saved = client+ .put(format!("{base}/links/{link}"))+ .bearer_auth("host")+ .json(&serde_json::json!({"expectedRevision": revision, "draft": edited, "userConfirmation": "Yes, rename it."}))+ .send()+ .await+ .unwrap();+ assert_eq!(saved.status(), 200);+ let saved: serde_json::Value = saved.json().await.unwrap();+ assert_eq!(saved["draft"]["event"]["title"], "Intro call");+ assert!(saved["revision"].as_i64().unwrap() > revision);++ let mut stale = draft.clone();+ stale["event"]["title"] = serde_json::json!("Stale title");+ assert_eq!(+ client+ .put(format!("{base}/links/{link}"))+ .bearer_auth("host")+ .json(&serde_json::json!({"expectedRevision": revision, "draft": stale, "userConfirmation": "Yes."}))+ .send()+ .await+ .unwrap()+ .status(),+ 409+ );++ let team = Uuid::now_v7();+ assert_eq!(+ client+ .get(format!("{base}/links?teamId={team}"))+ .bearer_auth("stranger")+ .send()+ .await+ .unwrap()+ .status(),+ 403+ );+ task.abort();+}diff --git a/packages/sdk/AGENTS.md b/packages/sdk/AGENTS.mdindex 8b3b6b6876..5003ec61bb 100644--- a/packages/sdk/AGENTS.md+++ b/packages/sdk/AGENTS.md@@ -21,6 +21,10 @@ enforced by the ordinary backend APIs.- `src/entities/search/namespace.ts`: `macro.search`, one unified search acrossevery kind of item with the direct search tools' filters (types, exact match,tags, inbox, agent session transcripts), returning typed handles.+- `src/entities/calendar/booking-namespace.ts`: `macro.calendar.booking`, booking links+ (`BookingLink`), settings, booked meetings (`Booking`) and insights over calendar+ `/scheduling`. Link writes carry the user's quoted `userConfirmation`, which the+ route rejects when blank; `BookingLink` handles keep their `team` for edits.- `src/entities/routines/`, `agents/`, `harnesses/`: automation and agent hosts.- `users.search(nameOrEmail)` searches existing Macro contacts with batched authnames and returns seeded User handles; it is not a global directory. Emptydiff --git a/packages/sdk/generated/calendar/index.ts b/packages/sdk/generated/calendar/index.tsindex 7fbb761cb6..2c153c555d 100644--- a/packages/sdk/generated/calendar/index.ts+++ b/packages/sdk/generated/calendar/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { AttendeeResponseStatus, AvailabilityCalendar, AvailabilityCalendarBody, AvailabilityCalendarsResponse, CalendarAttendee, CalendarAttendeeInputBody, CalendarCapabilities, CalendarDeletionScopeParam, CalendarEvent, CalendarEventProviderUrl, CalendarEventProviderUrlData, CalendarEventProviderUrlError, CalendarEventProviderUrlErrors, CalendarEventProviderUrlResponse, CalendarEventProviderUrlResponses, CalendarEventSourceContent, CalendarGuestInputBody, CalendarJoinRequest, CalendarJoinRequestDecision, CalendarJoinRequestStatus, CalendarMutationApiError, CalendarMutationErrorCode, CalendarProvider, CalendarReplacementStatusData, CalendarReplacementStatusError, CalendarReplacementStatusErrors, CalendarReplacementStatusResponse, CalendarReplacementStatusResponses, CalendarReplacementView, CalendarRsvpScopeParam, CalendarUpdateScopeParam, ClientOptions, ConferenceChange, ConferenceProvider, ConfirmCalendarReplacementData, ConfirmCalendarReplacementError, ConfirmCalendarReplacementErrors, ConfirmCalendarReplacementResponse, ConfirmCalendarReplacementResponses, CopyCalendarEventData, CopyCalendarEventError, CopyCalendarEventErrors, CopyCalendarEventRequest, CopyCalendarEventResponse, CopyCalendarEventResponses, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DiscardCalendarReplacementData, DiscardCalendarReplacementError, DiscardCalendarReplacementErrors, DiscardCalendarReplacementResponse, DiscardCalendarReplacementResponses, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetAvailabilityCalendarsData, GetAvailabilityCalendarsResponse, GetAvailabilityCalendarsResponses, GetTeamSharingData, GetTeamSharingResponse, GetTeamSharingResponses, GuestPolicy, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InviteCalendarEventGuestsData, InviteCalendarEventGuestsError, InviteCalendarEventGuestsErrors, InviteCalendarEventGuestsRequest, InviteCalendarEventGuestsResponse, InviteCalendarEventGuestsResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, OutOfOfficeAutoDeclineMode, OutOfOfficeProperties, PrepareCalendarReplacementData, PrepareCalendarReplacementError, PrepareCalendarReplacementErrors, PrepareCalendarReplacementRequest, PrepareCalendarReplacementResponse, PrepareCalendarReplacementResponses, RefreshCalendarEvent, ReplacementStatus, RespondToJoinRequestData, RespondToJoinRequestError, RespondToJoinRequestErrors, RespondToJoinRequestRequest, RespondToJoinRequestResponse, RespondToJoinRequestResponses, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SetAvailabilityCalendarData, SetAvailabilityCalendarResponse, SetAvailabilityCalendarResponses, SetTeamSharingData, SetTeamSharingResponse, SetTeamSharingResponses, TeamCalendarSharing, TeamCalendarSharingBody, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, ViewerCapabilities, VisibleCalendar } from './types.gen';+export type { AttendeeResponseStatus, AvailabilityCalendar, AvailabilityCalendarBody, AvailabilityCalendarsResponse, Booking, BookingAttendance, BookingChange, BookingDateOverride, BookingEventType, BookingInsights, BookingLink, BookingLinkDraft, BookingLinkEvent, BookingLinkListing, BookingLinkSchedule, BookingProfile, BookingQuestion, BookingResponse, BookingSchedule, BookingSlot, BookingsResponse, BookingStatus, BookingTimeWindow, BookingWeeklyDay, CalendarAttendee, CalendarAttendeeInputBody, CalendarCapabilities, CalendarDeletionScopeParam, CalendarEvent, CalendarEventProviderUrl, CalendarEventProviderUrlData, CalendarEventProviderUrlError, CalendarEventProviderUrlErrors, CalendarEventProviderUrlResponse, CalendarEventProviderUrlResponses, CalendarEventSourceContent, CalendarGuestInputBody, CalendarJoinRequest, CalendarJoinRequestDecision, CalendarJoinRequestStatus, CalendarMutationApiError, CalendarMutationErrorCode, CalendarProvider, CalendarReplacementStatusData, CalendarReplacementStatusError, CalendarReplacementStatusErrors, CalendarReplacementStatusResponse, CalendarReplacementStatusResponses, CalendarReplacementView, CalendarRsvpScopeParam, CalendarUpdateScopeParam, ChangeBookingData, ChangeBookingErrors, ChangeBookingResponse, ChangeBookingResponses, ClientOptions, ConferenceChange, ConferenceProvider, ConfirmCalendarReplacementData, ConfirmCalendarReplacementError, ConfirmCalendarReplacementErrors, ConfirmCalendarReplacementResponse, ConfirmCalendarReplacementResponses, CopyCalendarEventData, CopyCalendarEventError, CopyCalendarEventErrors, CopyCalendarEventRequest, CopyCalendarEventResponse, CopyCalendarEventResponses, CreateBookingLinkData, CreateBookingLinkErrors, CreateBookingLinkRequest, CreateBookingLinkResponse, CreateBookingLinkResponses, CreateCalendarEventData, CreateCalendarEventError, CreateCalendarEventErrors, CreateCalendarEventRequest, CreateCalendarEventResponse, CreateCalendarEventResponses, DeleteCalendarEventData, DeleteCalendarEventError, DeleteCalendarEventErrors, DeleteCalendarEventResponse, DeleteCalendarEventResponses, DiscardCalendarReplacementData, DiscardCalendarReplacementError, DiscardCalendarReplacementErrors, DiscardCalendarReplacementResponse, DiscardCalendarReplacementResponses, EditBookingLinkData, EditBookingLinkErrors, EditBookingLinkRequest, EditBookingLinkResponse, EditBookingLinkResponses, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetAvailabilityCalendarsData, GetAvailabilityCalendarsResponse, GetAvailabilityCalendarsResponses, GetBookingInsightsData, GetBookingInsightsErrors, GetBookingInsightsResponse, GetBookingInsightsResponses, GetBookingSettingsData, GetBookingSettingsErrors, GetBookingSettingsResponse, GetBookingSettingsResponses, GetManagedBookingData, GetManagedBookingErrors, GetManagedBookingResponse, GetManagedBookingResponses, GetTeamSharingData, GetTeamSharingResponse, GetTeamSharingResponses, GuestPolicy, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InsightCounts, InsightPeriod, InsightQuery, InviteCalendarEventGuestsData, InviteCalendarEventGuestsError, InviteCalendarEventGuestsErrors, InviteCalendarEventGuestsRequest, InviteCalendarEventGuestsResponse, InviteCalendarEventGuestsResponses, ListBookingLinksData, ListBookingLinksErrors, ListBookingLinksResponse, ListBookingLinksResponses, ListBookingRescheduleSlotsData, ListBookingRescheduleSlotsErrors, ListBookingRescheduleSlotsResponse, ListBookingRescheduleSlotsResponses, ListBookingsData, ListBookingsErrors, ListBookingsResponse, ListBookingsResponses, ListCalendarsData, ListCalendarsError, ListCalendarsErrors, ListCalendarsResponse, ListCalendarsResponse2, ListCalendarsResponses, OutOfOfficeAutoDeclineMode, OutOfOfficeProperties, PrepareCalendarReplacementData, PrepareCalendarReplacementError, PrepareCalendarReplacementErrors, PrepareCalendarReplacementRequest, PrepareCalendarReplacementResponse, PrepareCalendarReplacementResponses, ProfileResponse, ReceiptResponse, RefreshCalendarEvent, ReplacementStatus, RespondToJoinRequestData, RespondToJoinRequestError, RespondToJoinRequestErrors, RespondToJoinRequestRequest, RespondToJoinRequestResponse, RespondToJoinRequestResponses, RsvpCalendarEventData, RsvpCalendarEventError, RsvpCalendarEventErrors, RsvpCalendarEventRequest, RsvpCalendarEventResponse, RsvpCalendarEventResponses, SaveBookingSettingsData, SaveBookingSettingsErrors, SaveBookingSettingsResponse, SaveBookingSettingsResponses, SchedulingMode, SetAvailabilityCalendarData, SetAvailabilityCalendarResponse, SetAvailabilityCalendarResponses, SetTeamSharingData, SetTeamSharingResponse, SetTeamSharingResponses, SlotsResponse, TeamCalendarSharing, TeamCalendarSharingBody, UpdateCalendarEventData, UpdateCalendarEventError, UpdateCalendarEventErrors, UpdateCalendarEventRequest, UpdateCalendarEventResponse, UpdateCalendarEventResponses, ViewerCapabilities, VisibleCalendar } from './types.gen';diff --git a/packages/sdk/generated/calendar/sdk.gen.ts b/packages/sdk/generated/calendar/sdk.gen.tsindex 2a21d37954..4ec887e7ba 100644--- a/packages/sdk/generated/calendar/sdk.gen.ts+++ b/packages/sdk/generated/calendar/sdk.gen.ts@@ -2,7 +2,7 @@import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';import { client } from './client.gen';-import type { CalendarEventProviderUrlData, CalendarEventProviderUrlErrors, CalendarEventProviderUrlResponses, CalendarReplacementStatusData, CalendarReplacementStatusErrors, CalendarReplacementStatusResponses, ConfirmCalendarReplacementData, ConfirmCalendarReplacementErrors, ConfirmCalendarReplacementResponses, CopyCalendarEventData, CopyCalendarEventErrors, CopyCalendarEventResponses, CreateCalendarEventData, CreateCalendarEventErrors, CreateCalendarEventResponses, DeleteCalendarEventData, DeleteCalendarEventErrors, DeleteCalendarEventResponses, DiscardCalendarReplacementData, DiscardCalendarReplacementErrors, DiscardCalendarReplacementResponses, GetAvailabilityCalendarsData, GetAvailabilityCalendarsResponses, GetTeamSharingData, GetTeamSharingResponses, HealthHandlerData, HealthHandlerResponses, InviteCalendarEventGuestsData, InviteCalendarEventGuestsErrors, InviteCalendarEventGuestsResponses, ListCalendarsData, ListCalendarsErrors, ListCalendarsResponses, PrepareCalendarReplacementData, PrepareCalendarReplacementErrors, PrepareCalendarReplacementResponses, RespondToJoinRequestData, RespondToJoinRequestErrors, RespondToJoinRequestResponses, RsvpCalendarEventData, RsvpCalendarEventErrors, RsvpCalendarEventResponses, SetAvailabilityCalendarData, SetAvailabilityCalendarResponses, SetTeamSharingData, SetTeamSharingResponses, UpdateCalendarEventData, UpdateCalendarEventErrors, UpdateCalendarEventResponses } from './types.gen';+import type { CalendarEventProviderUrlData, CalendarEventProviderUrlErrors, CalendarEventProviderUrlResponses, CalendarReplacementStatusData, CalendarReplacementStatusErrors, CalendarReplacementStatusResponses, ChangeBookingData, ChangeBookingErrors, ChangeBookingResponses, ConfirmCalendarReplacementData, ConfirmCalendarReplacementErrors, ConfirmCalendarReplacementResponses, CopyCalendarEventData, CopyCalendarEventErrors, CopyCalendarEventResponses, CreateBookingLinkData, CreateBookingLinkErrors, CreateBookingLinkResponses, CreateCalendarEventData, CreateCalendarEventErrors, CreateCalendarEventResponses, DeleteCalendarEventData, DeleteCalendarEventErrors, DeleteCalendarEventResponses, DiscardCalendarReplacementData, DiscardCalendarReplacementErrors, DiscardCalendarReplacementResponses, EditBookingLinkData, EditBookingLinkErrors, EditBookingLinkResponses, GetAvailabilityCalendarsData, GetAvailabilityCalendarsResponses, GetBookingInsightsData, GetBookingInsightsErrors, GetBookingInsightsResponses, GetBookingSettingsData, GetBookingSettingsErrors, GetBookingSettingsResponses, GetManagedBookingData, GetManagedBookingErrors, GetManagedBookingResponses, GetTeamSharingData, GetTeamSharingResponses, HealthHandlerData, HealthHandlerResponses, InviteCalendarEventGuestsData, InviteCalendarEventGuestsErrors, InviteCalendarEventGuestsResponses, ListBookingLinksData, ListBookingLinksErrors, ListBookingLinksResponses, ListBookingRescheduleSlotsData, ListBookingRescheduleSlotsErrors, ListBookingRescheduleSlotsResponses, ListBookingsData, ListBookingsErrors, ListBookingsResponses, ListCalendarsData, ListCalendarsErrors, ListCalendarsResponses, PrepareCalendarReplacementData, PrepareCalendarReplacementErrors, PrepareCalendarReplacementResponses, RespondToJoinRequestData, RespondToJoinRequestErrors, RespondToJoinRequestResponses, RsvpCalendarEventData, RsvpCalendarEventErrors, RsvpCalendarEventResponses, SaveBookingSettingsData, SaveBookingSettingsErrors, SaveBookingSettingsResponses, SetAvailabilityCalendarData, SetAvailabilityCalendarResponses, SetTeamSharingData, SetTeamSharingResponses, UpdateCalendarEventData, UpdateCalendarEventErrors, UpdateCalendarEventResponses } from './types.gen';export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {/**@@ -235,6 +235,111 @@ export class Sdk extends HeyApiClient {return (options.client ?? this.client).post<ConfirmCalendarReplacementResponses, ConfirmCalendarReplacementErrors, ThrowOnError>({ url: '/replacements/{operation_id}/confirm', ...options });}+ /**+ * List the profile's bookings, optionally those starting in a half-open range.+ */+ public listBookings<ThrowOnError extends boolean = false>(options?: Options<ListBookingsData, ThrowOnError>): RequestResult<ListBookingsResponses, ListBookingsErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<ListBookingsResponses, ListBookingsErrors, ThrowOnError>({ url: '/scheduling/bookings', ...options });+ }++ /**+ * Approve, cancel, record attendance for, or reschedule one booking.+ */+ public changeBooking<ThrowOnError extends boolean = false>(options: Options<ChangeBookingData, ThrowOnError>): RequestResult<ChangeBookingResponses, ChangeBookingErrors, ThrowOnError> {+ return (options.client ?? this.client).post<ChangeBookingResponses, ChangeBookingErrors, ThrowOnError>({+ url: '/scheduling/bookings/{id}/change',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }++ /**+ * Read one booking as its personal owner, a host, or a team administrator.+ */+ public getManagedBooking<ThrowOnError extends boolean = false>(options: Options<GetManagedBookingData, ThrowOnError>): RequestResult<GetManagedBookingResponses, GetManagedBookingErrors, ThrowOnError> {+ return (options.client ?? this.client).get<GetManagedBookingResponses, GetManagedBookingErrors, ThrowOnError>({ url: '/scheduling/bookings/{id}/manage', ...options });+ }++ /**+ * Replacement start times for one booking on a schedule-local date.+ */+ public listBookingRescheduleSlots<ThrowOnError extends boolean = false>(options: Options<ListBookingRescheduleSlotsData, ThrowOnError>): RequestResult<ListBookingRescheduleSlotsResponses, ListBookingRescheduleSlotsErrors, ThrowOnError> {+ return (options.client ?? this.client).get<ListBookingRescheduleSlotsResponses, ListBookingRescheduleSlotsErrors, ThrowOnError>({ url: '/scheduling/bookings/{id}/slots', ...options });+ }++ /**+ * Booking statistics for a local date range and the equally long period before it.+ */+ public getBookingInsights<ThrowOnError extends boolean = false>(options: Options<GetBookingInsightsData, ThrowOnError>): RequestResult<GetBookingInsightsResponses, GetBookingInsightsErrors, ThrowOnError> {+ return (options.client ?? this.client).post<GetBookingInsightsResponses, GetBookingInsightsErrors, ThrowOnError>({+ url: '/scheduling/insights',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }++ /**+ * List and search booking links with their full drafts and reusable schedules.+ */+ public listBookingLinks<ThrowOnError extends boolean = false>(options?: Options<ListBookingLinksData, ThrowOnError>): RequestResult<ListBookingLinksResponses, ListBookingLinksErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<ListBookingLinksResponses, ListBookingLinksErrors, ThrowOnError>({ url: '/scheduling/links', ...options });+ }++ /**+ * Create a booking link; an identical replay at the same slug returns the saved link.+ */+ public createBookingLink<ThrowOnError extends boolean = false>(options: Options<CreateBookingLinkData, ThrowOnError>): RequestResult<CreateBookingLinkResponses, CreateBookingLinkErrors, ThrowOnError> {+ return (options.client ?? this.client).post<CreateBookingLinkResponses, CreateBookingLinkErrors, ThrowOnError>({+ url: '/scheduling/links',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }++ /**+ * Replace one booking link's configuration at the profile revision it was read with.+ */+ public editBookingLink<ThrowOnError extends boolean = false>(options: Options<EditBookingLinkData, ThrowOnError>): RequestResult<EditBookingLinkResponses, EditBookingLinkErrors, ThrowOnError> {+ return (options.client ?? this.client).put<EditBookingLinkResponses, EditBookingLinkErrors, ThrowOnError>({+ url: '/scheduling/links/{id}',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }++ /**+ * Read personal or team booking settings without creating them.+ */+ public getBookingSettings<ThrowOnError extends boolean = false>(options?: Options<GetBookingSettingsData, ThrowOnError>): RequestResult<GetBookingSettingsResponses, GetBookingSettingsErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<GetBookingSettingsResponses, GetBookingSettingsErrors, ThrowOnError>({ url: '/scheduling/settings', ...options });+ }++ /**+ * Save booking settings at the revision they were read with.+ */+ public saveBookingSettings<ThrowOnError extends boolean = false>(options: Options<SaveBookingSettingsData, ThrowOnError>): RequestResult<SaveBookingSettingsResponses, SaveBookingSettingsErrors, ThrowOnError> {+ return (options.client ?? this.client).put<SaveBookingSettingsResponses, SaveBookingSettingsErrors, ThrowOnError>({+ url: '/scheduling/settings',+ ...options,+ headers: {+ 'Content-Type': 'application/json',+ ...options.headers+ }+ });+ }+/*** Read the authenticated user's sharing choice.*/diff --git a/packages/sdk/generated/calendar/types.gen.ts b/packages/sdk/generated/calendar/types.gen.tsindex 4bb7141a2c..b4f0331fce 100644--- a/packages/sdk/generated/calendar/types.gen.ts+++ b/packages/sdk/generated/calendar/types.gen.ts@@ -51,6 +51,549 @@ export type AvailabilityCalendarsResponse = {calendars: Array<AvailabilityCalendar>;};+/**+ * Public booking details, also visible to authorized profile members.+ */+export type Booking = {+ /**+ * Answers keyed by question identity.+ */+ answers: {+ [key: string]: string;+ };+ /**+ * Explicit attendance outcome; existing booking records default to unknown.+ */+ attendance?: BookingAttendance;+ /**+ * Booker's email.+ */+ email: string;+ /**+ * Absolute meeting end.+ */+ endsAt: string;+ /**+ * Booking link identity.+ */+ eventTypeId: string;+ /**+ * Assigned hosts.+ */+ hosts: Array<string>;+ /**+ * Booking identity.+ */+ id: string;+ /**+ * Final location or conference URL.+ */+ location: string;+ /**+ * Booker's name.+ */+ name: string;+ /**+ * Original labels for answers, independent of later event-type edits.+ */+ questionLabels?: {+ [key: string]: string;+ };+ /**+ * Number of successfully completed moves to a different start time.+ */+ rescheduleCount?: number;+ /**+ * When the most recent successful reschedule completed.+ */+ rescheduledAt?: string | null;+ /**+ * Absolute meeting start.+ */+ startsAt: string;+ /**+ * Current lifecycle state.+ */+ status: BookingStatus;+ /**+ * Booker's display time zone.+ */+ timeZone: string;+ /**+ * Snapshot of the meeting title.+ */+ title: string;+};++/**+ * Attendance recorded by an assigned host or profile administrator after a meeting.+ */+export type BookingAttendance = 'unknown' | 'attended' | 'guestNoShow' | 'hostNoShow';++/**+ * A host's requested change to a booked meeting.+ */+export type BookingChange = {+ action: 'approve';+} | {+ action: 'cancel';+} | {+ action: 'attendance';+ /**+ * Recorded outcome.+ */+ attendance: BookingAttendance;+} | {+ action: 'reschedule';+ /**+ * Absolute start chosen from available replacement slots.+ */+ startsAt: string;+};++/**+ * Replacement availability for one date.+ */+export type BookingDateOverride = {+ /**+ * Local date in the schedule zone.+ */+ date: string;+ /**+ * Empty means unavailable all day.+ */+ windows: Array<BookingTimeWindow>;+};++/**+ * A reusable booking link.+ */+export type BookingEventType = {+ /**+ * Protected time after a meeting.+ */+ afterMinutes: number;+ /**+ * Protected time before a meeting.+ */+ beforeMinutes: number;+ /**+ * Maximum bookings for this event on one schedule-local day.+ */+ dailyLimit?: number | null;+ /**+ * Public description.+ */+ description: string;+ /**+ * Meeting duration.+ */+ durationMinutes: number;+ /**+ * Whether new bookings are accepted.+ */+ enabled: boolean;+ /**+ * Generate a Google Meet conference. Mutually exclusive with a Macro call.+ */+ googleMeet: boolean;+ /**+ * Maximum days ahead.+ */+ horizonDays: number;+ /**+ * Current Macro user identities selected as hosts.+ */+ hosts: Array<string>;+ /**+ * Stable identity.+ */+ id: string;+ /**+ * Spacing of offered start times.+ */+ intervalMinutes: number;+ /**+ * Meeting location.+ */+ location: string;+ /**+ * Generate a Macro call and attach its join link when someone books.+ * Mutually exclusive with Google Meet. Omitted on links saved before+ * Macro calls were a booking option, which keep their previous conference.+ */+ macroCall?: boolean;+ /**+ * Host assignment policy.+ */+ mode: SchedulingMode;+ /**+ * Minimum notice in minutes.+ */+ noticeMinutes: number;+ /**+ * Additional form fields.+ */+ questions: Array<BookingQuestion>;+ /**+ * Hold bookings for host approval.+ */+ requiresConfirmation: boolean;+ /**+ * Referenced availability schedule.+ */+ scheduleId: string;+ /**+ * Unique link segment within a profile.+ */+ slug: string;+ /**+ * Public title.+ */+ title: string;+};++/**+ * Current and equally long preceding local-calendar periods.+ */+export type BookingInsights = {+ /**+ * Time at which completion was evaluated.+ */+ asOf: string;+ /**+ * Requested period.+ */+ current: InsightPeriod;+ /**+ * Comparison period, using identical filters and definitions.+ */+ previous: InsightPeriod;+ /**+ * Preceding period's first local date.+ */+ previousFrom: string;+ /**+ * Preceding period's last local date.+ */+ previousTo: string;+};++/**+ * Saved link with actual identities and revision for subsequent edits.+ */+export type BookingLink = {+ /**+ * Full editable configuration.+ */+ draft: BookingLinkDraft;+ /**+ * Stable link identity.+ */+ eventTypeId: string;+ /**+ * Owning profile.+ */+ profileId: string;+ /**+ * Profile revision to supply when editing.+ */+ revision: number;+};++/**+ * Complete proposal reviewed and validated before saving.+ */+export type BookingLinkDraft = {+ /**+ * Public details, hosts, booking rules and questions.+ */+ event: BookingLinkEvent;+ /**+ * Weekly hours, IANA time zone, and date overrides for this link.+ */+ schedule: BookingLinkSchedule;+};++/**+ * All editable rules for one link. Personal links must use the authenticated user as host.+ */+export type BookingLinkEvent = {+ /**+ * Protected time after a meeting.+ */+ afterMinutes: number;+ /**+ * Protected time before a meeting.+ */+ beforeMinutes: number;+ /**+ * Maximum bookings for this event on one schedule-local day.+ */+ dailyLimit?: number | null;+ /**+ * Public description.+ */+ description: string;+ /**+ * Meeting duration.+ */+ durationMinutes: number;+ /**+ * Whether new bookings are accepted.+ */+ enabled: boolean;+ /**+ * Generate a Google Meet conference. Mutually exclusive with `macroCall`.+ */+ googleMeet: boolean;+ /**+ * Maximum days ahead.+ */+ horizonDays: number;+ /**+ * Current Macro user identities selected as hosts.+ */+ hosts: Array<string>;+ /**+ * Spacing of offered start times.+ */+ intervalMinutes: number;+ /**+ * Meeting location.+ */+ location: string;+ /**+ * Attach a Macro call when someone books. A join link is created for that+ * booking and written onto the calendar invitation. Mutually exclusive+ * with `googleMeet`. Prefer this for a Macro booking; omit or false when+ * the link should use Google Meet or no video. False is omitted so drafts+ * saved before this field still round-trip unchanged.+ */+ macroCall?: boolean;+ /**+ * Host assignment policy.+ */+ mode: SchedulingMode;+ /**+ * Minimum notice in minutes.+ */+ noticeMinutes: number;+ /**+ * Additional form fields.+ */+ questions: Array<BookingQuestion>;+ /**+ * Hold bookings for host approval.+ */+ requiresConfirmation: boolean;+ /**+ * Unique link segment within a profile.+ */+ slug: string;+ /**+ * Public title.+ */+ title: string;+};++/**+ * Authorized discovery results including reusable availability.+ */+export type BookingLinkListing = {+ /**+ * Links whose title, slug or description matches the search, including paused links.+ */+ links: Array<BookingLink>;+ /**+ * Owning profile identity, including unsaved new profiles.+ */+ profileId: string;+ /**+ * Current revision.+ */+ revision: number;+ /**+ * Reusable schedules, even when no links match.+ */+ schedules: Array<BookingSchedule>;+ /**+ * Current team identities that can be used to discover team links.+ */+ teamIds: Array<string>;+ /**+ * Current authenticated host identity for personal drafts.+ */+ userId: string;+};++/**+ * Availability copied into a dedicated schedule when it changes; other links retain their hours.+ */+export type BookingLinkSchedule = {+ /**+ * Display name.+ */+ name: string;+ /**+ * Date-specific replacements.+ */+ overrides: Array<BookingDateOverride>;+ /**+ * IANA time zone.+ */+ timeZone: string;+ /**+ * Weekly windows.+ */+ weekly: Array<BookingWeeklyDay>;+};++/**+ * Editable configuration for a person or team.+ */+export type BookingProfile = {+ /**+ * Personal hours used by team events; absent legacy profiles use their first schedule.+ */+ defaultScheduleId?: string | null;+ /**+ * Public introduction.+ */+ description: string;+ /**+ * Booking links.+ */+ eventTypes: Array<BookingEventType>;+ /**+ * Public, opaque profile identity.+ */+ id: string;+ /**+ * Display name on the public page.+ */+ name: string;+ /**+ * Optimistic concurrency version.+ */+ revision: number;+ /**+ * Reusable schedules.+ */+ schedules: Array<BookingSchedule>;+};++/**+ * A question on the booking form.+ */+export type BookingQuestion = {+ /**+ * Stable identity.+ */+ id: string;+ /**+ * Public question label.+ */+ label: string;+ /**+ * Whether an answer is mandatory.+ */+ required: boolean;+};++/**+ * One booking after a change.+ */+export type BookingResponse = {+ /**+ * The saved booking.+ */+ booking: Booking;+};++/**+ * Reusable hours, with DST interpreted in an IANA zone.+ */+export type BookingSchedule = {+ /**+ * Stable schedule identity.+ */+ id: string;+ /**+ * Display name.+ */+ name: string;+ /**+ * Date-specific replacements.+ */+ overrides: Array<BookingDateOverride>;+ /**+ * IANA time zone.+ */+ timeZone: string;+ /**+ * Weekly windows.+ */+ weekly: Array<BookingWeeklyDay>;+};++/**+ * Available slot and the hosts who can satisfy it.+ */+export type BookingSlot = {+ /**+ * Absolute end.+ */+ endsAt: string;+ /**+ * Absolute start.+ */+ startsAt: string;+};++/**+ * Booking lifecycle state.+ */+export type BookingStatus = 'pending' | 'confirmed' | 'cancelled' | 'processing' | 'failed';++/**+ * A wall-clock window in an availability schedule.+ */+export type BookingTimeWindow = {+ /**+ * Exclusive HH:MM end.+ */+ end: string;+ /**+ * Inclusive HH:MM start.+ */+ start: string;+};++/**+ * Availability for one weekday.+ */+export type BookingWeeklyDay = {+ /**+ * Sunday is zero.+ */+ day: number;+ /**+ * Non-overlapping local windows.+ */+ windows: Array<BookingTimeWindow>;+};++/**+ * Bookings of one profile.+ */+export type BookingsResponse = {+ /**+ * Every matching booking.+ */+ bookings: Array<Booking>;+};+/*** An attendee on a calendar event.*/@@ -516,6 +1059,20 @@ export type CopyCalendarEventRequest = {calendarId?: string | null;};+/**+ * A new booking link, saved after the user approved it.+ */+export type CreateBookingLinkRequest = {+ /**+ * Full booking rules and availability the user approved.+ */+ draft: BookingLinkDraft;+ /**+ * The user's reply approving this proposal, quoted verbatim.+ */+ userConfirmation: string;+};+/*** Request body creating a calendar event on the requester's calendar.*/@@ -572,6 +1129,24 @@ export type CreateCalendarEventRequest = {visibility?: null | EventVisibility;};+/**+ * Replacement configuration for one booking link, saved after the user approved it.+ */+export type EditBookingLinkRequest = {+ /**+ * Full edited booking rules and availability the user approved.+ */+ draft: BookingLinkDraft;+ /**+ * Profile revision the edit was prepared from; a newer revision conflicts.+ */+ expectedRevision: number;+ /**+ * The user's reply approving this proposal, quoted verbatim.+ */+ userConfirmation: string;+};+/*** One reminder: how it alerts and how many minutes before the event start* (before midnight in the calendar's zone for all-day events) it fires.@@ -678,6 +1253,102 @@ export type GuestPolicy = {canSeeOtherGuests: boolean;};+/**+ * Counts can overlap: a rescheduled event can also be completed or cancelled.+ */+export type InsightCounts = {+ /**+ * Cancelled bookings, grouped by their scheduled start.+ */+ cancelled: number;+ /**+ * Confirmed, ended bookings excluding explicit no-shows.+ */+ completed: number;+ /**+ * Explicit guest no-shows only.+ */+ guestNoShow: number;+ /**+ * Explicit host no-shows only.+ */+ hostNoShow: number;+ /**+ * Bookings with at least one completed reschedule, counted once.+ */+ rescheduled: number;+ /**+ * All bookings except failed and processing requests.+ */+ total: number;+};++/**+ * One complete period of metrics and chart data, with no guest contact information.+ */+export type InsightPeriod = {+ /**+ * Average scheduled duration of all confirmed bookings, including future ones.+ */+ averageMinutes: number;+ /**+ * Summary event counts.+ */+ counts: InsightCounts;+ /**+ * Local-date counts, including dates with zero bookings.+ */+ days: {+ [key: string]: InsightCounts;+ };+ /**+ * Booking counts by link identity.+ */+ eventCounts: {+ [key: string]: number;+ };+ /**+ * Booking counts by host; collective bookings count once for each host.+ */+ hostCounts: {+ [key: string]: number;+ };+ /**+ * Booking counts by local hour, indexed from 0 to 23.+ */+ hours: Array<number>;+ /**+ * Scheduled minutes of completed meetings, not actual call duration.+ */+ meetingMinutes: number;+};++/**+ * Inclusive local dates and optional booking/host filters.+ */+export type InsightQuery = {+ /**+ * Restrict to one booking link; omit for all links.+ */+ eventTypeId?: string | null;+ /**+ * First local date, inclusive.+ */+ from: string;+ /**+ * Restrict to one assigned host; omit for all hosts.+ */+ hostId?: string | null;+ /**+ * IANA zone used for dates and hour-of-day grouping.+ */+ timeZone: string;+ /**+ * Last local date, inclusive; maximum 366 days.+ */+ to: string;+};+/*** Request body adding guests to an event without touching anyone already* invited.@@ -756,6 +1427,34 @@ export type PrepareCalendarReplacementRequest = {removeConference: boolean;};+/**+ * Booking settings of one profile.+ */+export type ProfileResponse = {+ /**+ * Full settings, including the revision to save against.+ */+ profile: BookingProfile;+};++/**+ * A booking with its booker management capability.+ */+export type ReceiptResponse = {+ /**+ * The booking.+ */+ booking: Booking;+ /**+ * IANA time zone of the booking's availability schedule.+ */+ scheduleTimeZone: string;+ /**+ * Bearer capability for the booker's receipt, reschedule and cancel pages.+ */+ token: string;+};+/*** Realtime signal that a connected inbox's calendar projection changed.*/@@ -823,6 +1522,21 @@ export type RsvpCalendarEventRequest = {scope?: null | CalendarRsvpScopeParam;};+/**+ * Team host assignment policy.+ */+export type SchedulingMode = 'individual' | 'collective' | 'roundRobin';++/**+ * Available start times.+ */+export type SlotsResponse = {+ /**+ * Every available slot.+ */+ slots: Array<BookingSlot>;+};+/*** What a user exposes through their team membership.*/@@ -1520,6 +2234,263 @@ export type ConfirmCalendarReplacementResponses = {export type ConfirmCalendarReplacementResponse = ConfirmCalendarReplacementResponses[keyof ConfirmCalendarReplacementResponses];+export type ListBookingsData = {+ body?: never;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for personal bookings.+ */+ teamId?: string;+ /**+ * Inclusive start; supply together with `to`, at most 733 days apart.+ */+ from?: string;+ /**+ * Exclusive end; supply together with `from`.+ */+ to?: string;+ };+ url: '/scheduling/bookings';+};++export type ListBookingsErrors = {+ 400: unknown;+ 403: unknown;+};++export type ListBookingsResponses = {+ 200: BookingsResponse;+};++export type ListBookingsResponse = ListBookingsResponses[keyof ListBookingsResponses];++export type ChangeBookingData = {+ body: BookingChange;+ path: {+ /**+ * Booking identity+ */+ id: string;+ };+ query?: never;+ url: '/scheduling/bookings/{id}/change';+};++export type ChangeBookingErrors = {+ 400: unknown;+ 403: unknown;+ 404: unknown;+ 409: unknown;+};++export type ChangeBookingResponses = {+ 200: BookingResponse;+};++export type ChangeBookingResponse = ChangeBookingResponses[keyof ChangeBookingResponses];++export type GetManagedBookingData = {+ body?: never;+ path: {+ /**+ * Booking identity+ */+ id: string;+ };+ query?: never;+ url: '/scheduling/bookings/{id}/manage';+};++export type GetManagedBookingErrors = {+ 403: unknown;+ 404: unknown;+};++export type GetManagedBookingResponses = {+ 200: ReceiptResponse;+};++export type GetManagedBookingResponse = GetManagedBookingResponses[keyof GetManagedBookingResponses];++export type ListBookingRescheduleSlotsData = {+ body?: never;+ path: {+ /**+ * Booking identity+ */+ id: string;+ };+ query: {+ /**+ * Date in the booking's schedule time zone.+ */+ date: string;+ };+ url: '/scheduling/bookings/{id}/slots';+};++export type ListBookingRescheduleSlotsErrors = {+ 403: unknown;+ 404: unknown;+};++export type ListBookingRescheduleSlotsResponses = {+ 200: SlotsResponse;+};++export type ListBookingRescheduleSlotsResponse = ListBookingRescheduleSlotsResponses[keyof ListBookingRescheduleSlotsResponses];++export type GetBookingInsightsData = {+ body: InsightQuery;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+ };+ url: '/scheduling/insights';+};++export type GetBookingInsightsErrors = {+ 400: unknown;+ 403: unknown;+};++export type GetBookingInsightsResponses = {+ 200: BookingInsights;+};++export type GetBookingInsightsResponse = GetBookingInsightsResponses[keyof GetBookingInsightsResponses];++export type ListBookingLinksData = {+ body?: never;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for personal links.+ */+ teamId?: string;+ /**+ * Text matched against link title, slug and description; omit for all links.+ */+ query?: string;+ };+ url: '/scheduling/links';+};++export type ListBookingLinksErrors = {+ 403: unknown;+};++export type ListBookingLinksResponses = {+ 200: BookingLinkListing;+};++export type ListBookingLinksResponse = ListBookingLinksResponses[keyof ListBookingLinksResponses];++export type CreateBookingLinkData = {+ body: CreateBookingLinkRequest;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+ };+ url: '/scheduling/links';+};++export type CreateBookingLinkErrors = {+ 400: unknown;+ 403: unknown;+ 409: unknown;+};++export type CreateBookingLinkResponses = {+ 200: BookingLink;+};++export type CreateBookingLinkResponse = CreateBookingLinkResponses[keyof CreateBookingLinkResponses];++export type EditBookingLinkData = {+ body: EditBookingLinkRequest;+ path: {+ /**+ * Booking link (event type) identity+ */+ id: string;+ };+ query?: {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+ };+ url: '/scheduling/links/{id}';+};++export type EditBookingLinkErrors = {+ 400: unknown;+ 403: unknown;+ 404: unknown;+ 409: unknown;+};++export type EditBookingLinkResponses = {+ 200: BookingLink;+};++export type EditBookingLinkResponse = EditBookingLinkResponses[keyof EditBookingLinkResponses];++export type GetBookingSettingsData = {+ body?: never;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+ };+ url: '/scheduling/settings';+};++export type GetBookingSettingsErrors = {+ 403: unknown;+ 404: unknown;+};++export type GetBookingSettingsResponses = {+ 200: ProfileResponse;+};++export type GetBookingSettingsResponse = GetBookingSettingsResponses[keyof GetBookingSettingsResponses];++export type SaveBookingSettingsData = {+ body: BookingProfile;+ path?: never;+ query?: {+ /**+ * Existing Macro team; omit for the caller's personal booking links.+ */+ teamId?: string;+ };+ url: '/scheduling/settings';+};++export type SaveBookingSettingsErrors = {+ 400: unknown;+ 403: unknown;+ 409: unknown;+};++export type SaveBookingSettingsResponses = {+ 200: ProfileResponse;+};++export type SaveBookingSettingsResponse = SaveBookingSettingsResponses[keyof SaveBookingSettingsResponses];+export type GetTeamSharingData = {body?: never;path?: never;diff --git a/packages/sdk/specs/calendar.json b/packages/sdk/specs/calendar.jsonindex e3d6b3f0c8..ac3d06e39a 100644--- a/packages/sdk/specs/calendar.json+++ b/packages/sdk/specs/calendar.json@@ -956,111 +956,1373 @@}}},- "/team-sharing": {+ "/scheduling/bookings": {"get": {- "tags": ["calendar_events"],- "summary": "Read the authenticated user's sharing choice.",- "operationId": "get_team_sharing",+ "tags": ["scheduling"],+ "summary": "List the profile's bookings, optionally those starting in a half-open range.",+ "operationId": "list_bookings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for personal bookings.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "from",+ "in": "query",+ "description": "Inclusive start; supply together with `to`, at most 733 days apart.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "date-time"+ }+ },+ {+ "name": "to",+ "in": "query",+ "description": "Exclusive end; supply together with `from`.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "date-time"+ }+ }+ ],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"+ "$ref": "#/components/schemas/BookingsResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/change": {+ "post": {+ "tags": ["scheduling"],+ "summary": "Approve, cancel, record attendance for, or reschedule one booking.",+ "operationId": "change_booking",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingChange"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/manage": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Read one booking as its personal owner, a host, or a team administrator.",+ "operationId": "get_managed_booking",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ReceiptResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/bookings/{id}/slots": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Replacement start times for one booking on a schedule-local date.",+ "operationId": "list_booking_reschedule_slots",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "date",+ "in": "query",+ "description": "Date in the booking's schedule time zone.",+ "required": true,+ "schema": {+ "type": "string",+ "format": "date"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/SlotsResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/insights": {+ "post": {+ "tags": ["scheduling"],+ "summary": "Booking statistics for a local date range and the equally long period before it.",+ "operationId": "get_booking_insights",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/InsightQuery"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingInsights"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/links": {+ "get": {+ "tags": ["scheduling"],+ "summary": "List and search booking links with their full drafts and reusable schedules.",+ "operationId": "list_booking_links",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for personal links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "query",+ "in": "query",+ "description": "Text matched against link title, slug and description; omit for all links.",+ "required": false,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLinkListing"}}}+ },+ "403": {+ "description": ""}}},- "put": {- "tags": ["calendar_events"],- "summary": "Set the authenticated user's sharing choice.",- "operationId": "set_team_sharing",+ "post": {+ "tags": ["scheduling"],+ "summary": "Create a booking link; an identical replay at the same slug returns the saved link.",+ "operationId": "create_booking_link",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],"requestBody": {"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"+ "$ref": "#/components/schemas/CreateBookingLinkRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLink"+ }}}},- "required": true- },- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/TeamCalendarSharingBody"- }- }- }+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/links/{id}": {+ "put": {+ "tags": ["scheduling"],+ "summary": "Replace one booking link's configuration at the profile revision it was read with.",+ "operationId": "edit_booking_link",+ "parameters": [+ {+ "name": "id",+ "in": "path",+ "description": "Booking link (event type) identity",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/EditBookingLinkRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingLink"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/scheduling/settings": {+ "get": {+ "tags": ["scheduling"],+ "summary": "Read personal or team booking settings without creating them.",+ "operationId": "get_booking_settings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ProfileResponse"+ }+ }+ }+ },+ "403": {+ "description": ""+ },+ "404": {+ "description": ""+ }+ }+ },+ "put": {+ "tags": ["scheduling"],+ "summary": "Save booking settings at the revision they were read with.",+ "operationId": "save_booking_settings",+ "parameters": [+ {+ "name": "teamId",+ "in": "query",+ "description": "Existing Macro team; omit for the caller's personal booking links.",+ "required": false,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BookingProfile"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ProfileResponse"+ }+ }+ }+ },+ "400": {+ "description": ""+ },+ "403": {+ "description": ""+ },+ "409": {+ "description": ""+ }+ }+ }+ },+ "/team-sharing": {+ "get": {+ "tags": ["calendar_events"],+ "summary": "Read the authenticated user's sharing choice.",+ "operationId": "get_team_sharing",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ }+ }+ }+ },+ "put": {+ "tags": ["calendar_events"],+ "summary": "Set the authenticated user's sharing choice.",+ "operationId": "set_team_sharing",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TeamCalendarSharingBody"+ }+ }+ }+ }+ }+ }+ }+ },+ "components": {+ "schemas": {+ "AttendeeResponseStatus": {+ "type": "string",+ "description": "RSVP state for an attendee.",+ "enum": ["needs_action", "accepted", "declined", "tentative"]+ },+ "AvailabilityCalendar": {+ "type": "object",+ "description": "Per-user inclusion of a source calendar in personal availability.",+ "required": [+ "calendarId",+ "name",+ "contributesToAvailability",+ "isPrimary"+ ],+ "properties": {+ "calendarId": {+ "type": "string",+ "format": "uuid",+ "description": "Visible source calendar."+ },+ "contributesToAvailability": {+ "type": "boolean",+ "description": "Whether its events normally block the user's time."+ },+ "isPrimary": {+ "type": "boolean",+ "description": "Whether this is the connected account's primary calendar."+ },+ "name": {+ "type": "string",+ "description": "Source name."+ }+ }+ },+ "AvailabilityCalendarBody": {+ "type": "object",+ "description": "Own-user source inclusion preference.",+ "required": ["contributesToAvailability"],+ "properties": {+ "contributesToAvailability": {+ "type": "boolean",+ "description": "Whether this calendar contributes to personal availability."+ }+ }+ },+ "AvailabilityCalendarsResponse": {+ "type": "object",+ "description": "Source calendar settings returned to their viewer.",+ "required": ["calendars"],+ "properties": {+ "calendars": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/AvailabilityCalendar"+ },+ "description": "Directly visible source calendars."+ }+ }+ },+ "Booking": {+ "type": "object",+ "description": "Public booking details, also visible to authorized profile members.",+ "required": [+ "id",+ "eventTypeId",+ "title",+ "name",+ "email",+ "startsAt",+ "endsAt",+ "timeZone",+ "hosts",+ "status",+ "location",+ "answers"+ ],+ "properties": {+ "answers": {+ "type": "object",+ "description": "Answers keyed by question identity.",+ "additionalProperties": {+ "type": "string"+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "attendance": {+ "$ref": "#/components/schemas/BookingAttendance",+ "description": "Explicit attendance outcome; existing booking records default to unknown."+ },+ "email": {+ "type": "string",+ "description": "Booker's email."+ },+ "endsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute meeting end."+ },+ "eventTypeId": {+ "type": "string",+ "format": "uuid",+ "description": "Booking link identity."+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Assigned hosts."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Booking identity."+ },+ "location": {+ "type": "string",+ "description": "Final location or conference URL."+ },+ "name": {+ "type": "string",+ "description": "Booker's name."+ },+ "questionLabels": {+ "type": "object",+ "description": "Original labels for answers, independent of later event-type edits.",+ "additionalProperties": {+ "type": "string"+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "rescheduleCount": {+ "type": "integer",+ "format": "int32",+ "description": "Number of successfully completed moves to a different start time.",+ "minimum": 0+ },+ "rescheduledAt": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "When the most recent successful reschedule completed."+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute meeting start."+ },+ "status": {+ "$ref": "#/components/schemas/BookingStatus",+ "description": "Current lifecycle state."+ },+ "timeZone": {+ "type": "string",+ "description": "Booker's display time zone."+ },+ "title": {+ "type": "string",+ "description": "Snapshot of the meeting title."+ }+ }+ },+ "BookingAttendance": {+ "type": "string",+ "description": "Attendance recorded by an assigned host or profile administrator after a meeting.",+ "enum": ["unknown", "attended", "guestNoShow", "hostNoShow"]+ },+ "BookingChange": {+ "oneOf": [+ {+ "type": "object",+ "description": "Approve a legacy pending booking and send its calendar invitations.",+ "required": ["action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["approve"]+ }+ }+ },+ {+ "type": "object",+ "description": "Cancel a booking and notify its attendees.",+ "required": ["action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["cancel"]+ }+ }+ },+ {+ "type": "object",+ "description": "Record or clear attendance after the meeting ends.",+ "required": ["attendance", "action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["attendance"]+ },+ "attendance": {+ "$ref": "#/components/schemas/BookingAttendance",+ "description": "Recorded outcome."+ }+ }+ },+ {+ "type": "object",+ "description": "Move the existing meeting to an available time; notify attendees.",+ "required": ["startsAt", "action"],+ "properties": {+ "action": {+ "type": "string",+ "enum": ["reschedule"]+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute start chosen from available replacement slots."+ }+ }+ }+ ],+ "description": "A host's requested change to a booked meeting."+ },+ "BookingDateOverride": {+ "type": "object",+ "description": "Replacement availability for one date.",+ "required": ["date", "windows"],+ "properties": {+ "date": {+ "type": "string",+ "format": "date",+ "description": "Local date in the schedule zone."+ },+ "windows": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingTimeWindow"+ },+ "description": "Empty means unavailable all day."+ }+ }+ },+ "BookingEventType": {+ "type": "object",+ "description": "A reusable booking link.",+ "required": [+ "id",+ "title",+ "slug",+ "description",+ "durationMinutes",+ "location",+ "googleMeet",+ "enabled",+ "scheduleId",+ "mode",+ "hosts",+ "beforeMinutes",+ "afterMinutes",+ "noticeMinutes",+ "horizonDays",+ "intervalMinutes",+ "requiresConfirmation",+ "questions"+ ],+ "properties": {+ "afterMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time after a meeting.",+ "minimum": 0+ },+ "beforeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time before a meeting.",+ "minimum": 0+ },+ "dailyLimit": {+ "type": ["integer", "null"],+ "format": "int32",+ "description": "Maximum bookings for this event on one schedule-local day.",+ "minimum": 0+ },+ "description": {+ "type": "string",+ "description": "Public description."+ },+ "durationMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Meeting duration.",+ "minimum": 0+ },+ "enabled": {+ "type": "boolean",+ "description": "Whether new bookings are accepted."+ },+ "googleMeet": {+ "type": "boolean",+ "description": "Generate a Google Meet conference. Mutually exclusive with a Macro call."+ },+ "horizonDays": {+ "type": "integer",+ "format": "int32",+ "description": "Maximum days ahead.",+ "minimum": 0+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Current Macro user identities selected as hosts."+ },+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable identity."+ },+ "intervalMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Spacing of offered start times.",+ "minimum": 0+ },+ "location": {+ "type": "string",+ "description": "Meeting location."+ },+ "macroCall": {+ "type": "boolean",+ "description": "Generate a Macro call and attach its join link when someone books.\nMutually exclusive with Google Meet. Omitted on links saved before\nMacro calls were a booking option, which keep their previous conference."+ },+ "mode": {+ "$ref": "#/components/schemas/SchedulingMode",+ "description": "Host assignment policy."+ },+ "noticeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Minimum notice in minutes.",+ "minimum": 0+ },+ "questions": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingQuestion"+ },+ "description": "Additional form fields."+ },+ "requiresConfirmation": {+ "type": "boolean",+ "description": "Hold bookings for host approval."+ },+ "scheduleId": {+ "type": "string",+ "format": "uuid",+ "description": "Referenced availability schedule."+ },+ "slug": {+ "type": "string",+ "description": "Unique link segment within a profile."+ },+ "title": {+ "type": "string",+ "description": "Public title."+ }+ }+ },+ "BookingInsights": {+ "type": "object",+ "description": "Current and equally long preceding local-calendar periods.",+ "required": [+ "asOf",+ "previousFrom",+ "previousTo",+ "current",+ "previous"+ ],+ "properties": {+ "asOf": {+ "type": "string",+ "format": "date-time",+ "description": "Time at which completion was evaluated."+ },+ "current": {+ "$ref": "#/components/schemas/InsightPeriod",+ "description": "Requested period."+ },+ "previous": {+ "$ref": "#/components/schemas/InsightPeriod",+ "description": "Comparison period, using identical filters and definitions."+ },+ "previousFrom": {+ "type": "string",+ "format": "date",+ "description": "Preceding period's first local date."+ },+ "previousTo": {+ "type": "string",+ "format": "date",+ "description": "Preceding period's last local date."+ }+ }+ },+ "BookingLink": {+ "type": "object",+ "description": "Saved link with actual identities and revision for subsequent edits.",+ "required": ["profileId", "eventTypeId", "revision", "draft"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full editable configuration."+ },+ "eventTypeId": {+ "type": "string",+ "format": "uuid",+ "description": "Stable link identity."+ },+ "profileId": {+ "type": "string",+ "format": "uuid",+ "description": "Owning profile."+ },+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Profile revision to supply when editing."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkDraft": {+ "type": "object",+ "description": "Complete proposal reviewed and validated before saving.",+ "required": ["event", "schedule"],+ "properties": {+ "event": {+ "$ref": "#/components/schemas/BookingLinkEvent",+ "description": "Public details, hosts, booking rules and questions."+ },+ "schedule": {+ "$ref": "#/components/schemas/BookingLinkSchedule",+ "description": "Weekly hours, IANA time zone, and date overrides for this link."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkEvent": {+ "type": "object",+ "description": "All editable rules for one link. Personal links must use the authenticated user as host.",+ "required": [+ "title",+ "slug",+ "description",+ "durationMinutes",+ "location",+ "googleMeet",+ "enabled",+ "mode",+ "hosts",+ "beforeMinutes",+ "afterMinutes",+ "noticeMinutes",+ "horizonDays",+ "intervalMinutes",+ "requiresConfirmation",+ "questions"+ ],+ "properties": {+ "afterMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time after a meeting.",+ "minimum": 0+ },+ "beforeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Protected time before a meeting.",+ "minimum": 0+ },+ "dailyLimit": {+ "type": ["integer", "null"],+ "format": "int32",+ "description": "Maximum bookings for this event on one schedule-local day.",+ "minimum": 0+ },+ "description": {+ "type": "string",+ "description": "Public description."+ },+ "durationMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Meeting duration.",+ "minimum": 0+ },+ "enabled": {+ "type": "boolean",+ "description": "Whether new bookings are accepted."+ },+ "googleMeet": {+ "type": "boolean",+ "description": "Generate a Google Meet conference. Mutually exclusive with `macroCall`."+ },+ "horizonDays": {+ "type": "integer",+ "format": "int32",+ "description": "Maximum days ahead.",+ "minimum": 0+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Current Macro user identities selected as hosts."+ },+ "intervalMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Spacing of offered start times.",+ "minimum": 0+ },+ "location": {+ "type": "string",+ "description": "Meeting location."+ },+ "macroCall": {+ "type": "boolean",+ "description": "Attach a Macro call when someone books. A join link is created for that\nbooking and written onto the calendar invitation. Mutually exclusive\nwith `googleMeet`. Prefer this for a Macro booking; omit or false when\nthe link should use Google Meet or no video. False is omitted so drafts\nsaved before this field still round-trip unchanged."+ },+ "mode": {+ "$ref": "#/components/schemas/SchedulingMode",+ "description": "Host assignment policy."+ },+ "noticeMinutes": {+ "type": "integer",+ "format": "int32",+ "description": "Minimum notice in minutes.",+ "minimum": 0+ },+ "questions": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingQuestion"+ },+ "description": "Additional form fields."+ },+ "requiresConfirmation": {+ "type": "boolean",+ "description": "Hold bookings for host approval."+ },+ "slug": {+ "type": "string",+ "description": "Unique link segment within a profile."+ },+ "title": {+ "type": "string",+ "description": "Public title."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkListing": {+ "type": "object",+ "description": "Authorized discovery results including reusable availability.",+ "required": [+ "teamIds",+ "userId",+ "profileId",+ "revision",+ "schedules",+ "links"+ ],+ "properties": {+ "links": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingLink"+ },+ "description": "Links whose title, slug or description matches the search, including paused links."+ },+ "profileId": {+ "type": "string",+ "format": "uuid",+ "description": "Owning profile identity, including unsaved new profiles."+ },+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Current revision."+ },+ "schedules": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSchedule"+ },+ "description": "Reusable schedules, even when no links match."+ },+ "teamIds": {+ "type": "array",+ "items": {+ "type": "string",+ "format": "uuid"+ },+ "description": "Current team identities that can be used to discover team links."+ },+ "userId": {+ "type": "string",+ "description": "Current authenticated host identity for personal drafts."+ }+ },+ "additionalProperties": false+ },+ "BookingLinkSchedule": {+ "type": "object",+ "description": "Availability copied into a dedicated schedule when it changes; other links retain their hours.",+ "required": ["name", "timeZone", "weekly", "overrides"],+ "properties": {+ "name": {+ "type": "string",+ "description": "Display name."+ },+ "overrides": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingDateOverride"+ },+ "description": "Date-specific replacements."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA time zone."+ },+ "weekly": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingWeeklyDay"+ },+ "description": "Weekly windows."}- }- }- }- },- "components": {- "schemas": {- "AttendeeResponseStatus": {- "type": "string",- "description": "RSVP state for an attendee.",- "enum": ["needs_action", "accepted", "declined", "tentative"]+ },+ "additionalProperties": false},- "AvailabilityCalendar": {+ "BookingProfile": {"type": "object",- "description": "Per-user inclusion of a source calendar in personal availability.",+ "description": "Editable configuration for a person or team.","required": [- "calendarId",+ "id","name",- "contributesToAvailability",- "isPrimary"+ "description",+ "schedules",+ "eventTypes",+ "revision"],"properties": {- "calendarId": {+ "defaultScheduleId": {+ "type": ["string", "null"],+ "format": "uuid",+ "description": "Personal hours used by team events; absent legacy profiles use their first schedule."+ },+ "description": {+ "type": "string",+ "description": "Public introduction."+ },+ "eventTypes": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingEventType"+ },+ "description": "Booking links."+ },+ "id": {"type": "string","format": "uuid",- "description": "Visible source calendar."+ "description": "Public, opaque profile identity."},- "contributesToAvailability": {- "type": "boolean",- "description": "Whether its events normally block the user's time."+ "name": {+ "type": "string",+ "description": "Display name on the public page."},- "isPrimary": {+ "revision": {+ "type": "integer",+ "format": "int64",+ "description": "Optimistic concurrency version."+ },+ "schedules": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSchedule"+ },+ "description": "Reusable schedules."+ }+ }+ },+ "BookingQuestion": {+ "type": "object",+ "description": "A question on the booking form.",+ "required": ["id", "label", "required"],+ "properties": {+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable identity."+ },+ "label": {+ "type": "string",+ "description": "Public question label."+ },+ "required": {"type": "boolean",- "description": "Whether this is the connected account's primary calendar."+ "description": "Whether an answer is mandatory."+ }+ }+ },+ "BookingResponse": {+ "type": "object",+ "description": "One booking after a change.",+ "required": ["booking"],+ "properties": {+ "booking": {+ "$ref": "#/components/schemas/Booking",+ "description": "The saved booking."+ }+ }+ },+ "BookingSchedule": {+ "type": "object",+ "description": "Reusable hours, with DST interpreted in an IANA zone.",+ "required": ["id", "name", "timeZone", "weekly", "overrides"],+ "properties": {+ "id": {+ "type": "string",+ "format": "uuid",+ "description": "Stable schedule identity."},"name": {"type": "string",- "description": "Source name."+ "description": "Display name."+ },+ "overrides": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingDateOverride"+ },+ "description": "Date-specific replacements."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA time zone."+ },+ "weekly": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingWeeklyDay"+ },+ "description": "Weekly windows."}}},- "AvailabilityCalendarBody": {+ "BookingSlot": {"type": "object",- "description": "Own-user source inclusion preference.",- "required": ["contributesToAvailability"],+ "description": "Available slot and the hosts who can satisfy it.",+ "required": ["startsAt", "endsAt"],"properties": {- "contributesToAvailability": {- "type": "boolean",- "description": "Whether this calendar contributes to personal availability."+ "endsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute end."+ },+ "startsAt": {+ "type": "string",+ "format": "date-time",+ "description": "Absolute start."}}},- "AvailabilityCalendarsResponse": {+ "BookingStatus": {+ "type": "string",+ "description": "Booking lifecycle state.",+ "enum": ["pending", "confirmed", "cancelled", "processing", "failed"]+ },+ "BookingTimeWindow": {"type": "object",- "description": "Source calendar settings returned to their viewer.",- "required": ["calendars"],+ "description": "A wall-clock window in an availability schedule.",+ "required": ["start", "end"],"properties": {- "calendars": {+ "end": {+ "type": "string",+ "description": "Exclusive HH:MM end."+ },+ "start": {+ "type": "string",+ "description": "Inclusive HH:MM start."+ }+ }+ },+ "BookingWeeklyDay": {+ "type": "object",+ "description": "Availability for one weekday.",+ "required": ["day", "windows"],+ "properties": {+ "day": {+ "type": "integer",+ "format": "int32",+ "description": "Sunday is zero.",+ "minimum": 0+ },+ "windows": {"type": "array","items": {- "$ref": "#/components/schemas/AvailabilityCalendar"+ "$ref": "#/components/schemas/BookingTimeWindow"},- "description": "Directly visible source calendars."+ "description": "Non-overlapping local windows."+ }+ }+ },+ "BookingsResponse": {+ "type": "object",+ "description": "Bookings of one profile.",+ "required": ["bookings"],+ "properties": {+ "bookings": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Booking"+ },+ "description": "Every matching booking."}}},@@ -1627,6 +2889,22 @@}}},+ "CreateBookingLinkRequest": {+ "type": "object",+ "description": "A new booking link, saved after the user approved it.",+ "required": ["draft", "userConfirmation"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full booking rules and availability the user approved."+ },+ "userConfirmation": {+ "type": "string",+ "description": "The user's reply approving this proposal, quoted verbatim."+ }+ },+ "additionalProperties": false+ },"CreateCalendarEventRequest": {"type": "object","description": "Request body creating a calendar event on the requester's calendar.",@@ -1749,6 +3027,27 @@}}},+ "EditBookingLinkRequest": {+ "type": "object",+ "description": "Replacement configuration for one booking link, saved after the user approved it.",+ "required": ["expectedRevision", "draft", "userConfirmation"],+ "properties": {+ "draft": {+ "$ref": "#/components/schemas/BookingLinkDraft",+ "description": "Full edited booking rules and availability the user approved."+ },+ "expectedRevision": {+ "type": "integer",+ "format": "int64",+ "description": "Profile revision the edit was prepared from; a newer revision conflicts."+ },+ "userConfirmation": {+ "type": "string",+ "description": "The user's reply approving this proposal, quoted verbatim."+ }+ },+ "additionalProperties": false+ },"EventReminderOverride": {"type": "object","description": "One reminder: how it alerts and how many minutes before the event start\n(before midnight in the calendar's zone for all-day events) it fires.",@@ -1881,6 +3180,161 @@}}},+ "InsightCounts": {+ "type": "object",+ "description": "Counts can overlap: a rescheduled event can also be completed or cancelled.",+ "required": [+ "total",+ "completed",+ "rescheduled",+ "cancelled",+ "guestNoShow",+ "hostNoShow"+ ],+ "properties": {+ "cancelled": {+ "type": "integer",+ "format": "int32",+ "description": "Cancelled bookings, grouped by their scheduled start.",+ "minimum": 0+ },+ "completed": {+ "type": "integer",+ "format": "int32",+ "description": "Confirmed, ended bookings excluding explicit no-shows.",+ "minimum": 0+ },+ "guestNoShow": {+ "type": "integer",+ "format": "int32",+ "description": "Explicit guest no-shows only.",+ "minimum": 0+ },+ "hostNoShow": {+ "type": "integer",+ "format": "int32",+ "description": "Explicit host no-shows only.",+ "minimum": 0+ },+ "rescheduled": {+ "type": "integer",+ "format": "int32",+ "description": "Bookings with at least one completed reschedule, counted once.",+ "minimum": 0+ },+ "total": {+ "type": "integer",+ "format": "int32",+ "description": "All bookings except failed and processing requests.",+ "minimum": 0+ }+ }+ },+ "InsightPeriod": {+ "type": "object",+ "description": "One complete period of metrics and chart data, with no guest contact information.",+ "required": [+ "counts",+ "meetingMinutes",+ "averageMinutes",+ "days",+ "hours",+ "eventCounts",+ "hostCounts"+ ],+ "properties": {+ "averageMinutes": {+ "type": "number",+ "format": "double",+ "description": "Average scheduled duration of all confirmed bookings, including future ones."+ },+ "counts": {+ "$ref": "#/components/schemas/InsightCounts",+ "description": "Summary event counts."+ },+ "days": {+ "type": "object",+ "description": "Local-date counts, including dates with zero bookings.",+ "additionalProperties": {+ "$ref": "#/components/schemas/InsightCounts"+ },+ "propertyNames": {+ "type": "string",+ "format": "date"+ }+ },+ "eventCounts": {+ "type": "object",+ "description": "Booking counts by link identity.",+ "additionalProperties": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "propertyNames": {+ "type": "string",+ "format": "uuid"+ }+ },+ "hostCounts": {+ "type": "object",+ "description": "Booking counts by host; collective bookings count once for each host.",+ "additionalProperties": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "propertyNames": {+ "type": "string"+ }+ },+ "hours": {+ "type": "array",+ "items": {+ "type": "integer",+ "format": "int32",+ "minimum": 0+ },+ "description": "Booking counts by local hour, indexed from 0 to 23."+ },+ "meetingMinutes": {+ "type": "number",+ "format": "double",+ "description": "Scheduled minutes of completed meetings, not actual call duration."+ }+ }+ },+ "InsightQuery": {+ "type": "object",+ "description": "Inclusive local dates and optional booking/host filters.",+ "required": ["from", "to", "timeZone"],+ "properties": {+ "eventTypeId": {+ "type": ["string", "null"],+ "format": "uuid",+ "description": "Restrict to one booking link; omit for all links."+ },+ "from": {+ "type": "string",+ "format": "date",+ "description": "First local date, inclusive."+ },+ "hostId": {+ "type": ["string", "null"],+ "description": "Restrict to one assigned host; omit for all hosts."+ },+ "timeZone": {+ "type": "string",+ "description": "IANA zone used for dates and hour-of-day grouping."+ },+ "to": {+ "type": "string",+ "format": "date",+ "description": "Last local date, inclusive; maximum 366 days."+ }+ },+ "additionalProperties": false+ },"InviteCalendarEventGuestsRequest": {"type": "object","description": "Request body adding guests to an event without touching anyone already\ninvited.",@@ -1976,6 +3430,37 @@}}},+ "ProfileResponse": {+ "type": "object",+ "description": "Booking settings of one profile.",+ "required": ["profile"],+ "properties": {+ "profile": {+ "$ref": "#/components/schemas/BookingProfile",+ "description": "Full settings, including the revision to save against."+ }+ }+ },+ "ReceiptResponse": {+ "type": "object",+ "description": "A booking with its booker management capability.",+ "required": ["booking", "token", "scheduleTimeZone"],+ "properties": {+ "booking": {+ "$ref": "#/components/schemas/Booking",+ "description": "The booking."+ },+ "scheduleTimeZone": {+ "type": "string",+ "description": "IANA time zone of the booking's availability schedule."+ },+ "token": {+ "type": "string",+ "format": "uuid",+ "description": "Bearer capability for the booker's receipt, reschedule and cancel pages."+ }+ }+ },"RefreshCalendarEvent": {"oneOf": [{@@ -2083,6 +3568,25 @@}}},+ "SchedulingMode": {+ "type": "string",+ "description": "Team host assignment policy.",+ "enum": ["individual", "collective", "roundRobin"]+ },+ "SlotsResponse": {+ "type": "object",+ "description": "Available start times.",+ "required": ["slots"],+ "properties": {+ "slots": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BookingSlot"+ },+ "description": "Every available slot."+ }+ }+ },"TeamCalendarSharing": {"type": "string","description": "What a user exposes through their team membership.",@@ -2351,6 +3855,10 @@{"name": "calendar_events","description": "Macro Calendar Service"+ },+ {+ "name": "scheduling",+ "description": "Booking links, bookings and booking settings"}]}diff --git a/packages/sdk/src/entities/calendar/booking-link.ts b/packages/sdk/src/entities/calendar/booking-link.tsnew file mode 100644index 0000000000..8ca4a06feb--- /dev/null+++ b/packages/sdk/src/entities/calendar/booking-link.ts@@ -0,0 +1,113 @@+import type {+ BookingLinkDraft,+ BookingLink as BookingLinkRecord,+} from '../../../generated/calendar/types.gen';+import { MacroNotFoundError, unwrap } from '../../utils';+import type { MacroClient } from '../../utils/client';+import { MacroEntity } from '../entity';+import type { Team } from '../teams/team';++/**+ * A reusable booking page (not a calendar meeting) on the user's or a team's+ * profile: its full draft, the profile revision to edit it at, and the URL+ * guests book through. Paused links (`enabled: false`) stay listed but accept+ * no bookings.+ */+export class BookingLink extends MacroEntity<BookingLinkRecord> {+ private constructor(+ client: MacroClient,+ id: string,+ /** The team owning the link; undefined for a personal link. */+ readonly team: Team | undefined,+ seed?: BookingLinkRecord,+ ) {+ super(client, id, seed);+ }++ protected async fetch(): Promise<BookingLinkRecord> {+ const { links } = unwrap(+ await this.client.calendar.listBookingLinks({+ query: { teamId: this.team?.id },+ }),+ );+ const found = links.find((link) => link.eventTypeId === this.id);+ if (!found)+ throw new MacroNotFoundError(`booking link ${this.id} not found`);+ return found;+ }++ /** A handle to a personal link, or a team's when `team` is given. Detail loads on first access. */+ static byId(client: MacroClient, id: string, team?: Team): BookingLink {+ return new BookingLink(client, id, team);+ }++ /** A handle seeded with a link record the service returned. */+ static fromRecord(+ client: MacroClient,+ record: BookingLinkRecord,+ team?: Team,+ ): BookingLink {+ return new BookingLink(client, record.eventTypeId, team, record);+ }++ /** The full editable configuration: event details, hosts, rules, questions and schedule. */+ readonly draft = this.field('draft');++ /** The profile revision this link was read at; {@link edit} saves against it. */+ readonly revision = this.field('revision');++ /** The shareable URL guests book through. */+ async webUrl(): Promise<string> {+ return linkUrl(this.client, await this.detail.get());+ }++ /**+ * Replace this link's whole configuration, only after the user replied+ * approving the edited proposal, quoting that reply in `userConfirmation`.+ *+ * Start from {@link draft} and change only what the user asked for. Other+ * links and the personal default hours keep their settings. The edit saves+ * against {@link revision}; when someone saved in between it is refused+ * (409): read the link again and confirm the updated proposal instead of+ * overwriting their change. Returns the saved link.+ */+ async edit(+ draft: BookingLinkDraft,+ options: { userConfirmation: string },+ ): Promise<BookingLink> {+ const expectedRevision = await this.revision();+ const saved = await this.mutate((client) =>+ client.calendar.editBookingLink({+ path: { id: this.id },+ query: { teamId: this.team?.id },+ body: {+ expectedRevision,+ draft,+ userConfirmation: options.userConfirmation,+ },+ }),+ );+ return BookingLink.fromRecord(this.client, saved, this.team);+ }++ override toJSON() {+ const detail = this.detail.peek();+ return detail === undefined+ ? super.toJSON()+ : { ...super.toJSON(), url: linkUrl(this.client, detail) };+ }+}++/** The public booking page of a profile, or of one link on it. */+export function bookingPageUrl(+ client: MacroClient,+ profileId: string,+ slug?: string,+): string {+ const page = `${client.webAppUrl}/app/book/${profileId}`;+ return slug === undefined ? page : `${page}/${slug}`;+}++function linkUrl(client: MacroClient, record: BookingLinkRecord): string {+ return bookingPageUrl(client, record.profileId, record.draft.event.slug);+}diff --git a/packages/sdk/src/entities/calendar/booking-namespace.test.ts b/packages/sdk/src/entities/calendar/booking-namespace.test.tsnew file mode 100644index 0000000000..c65761b584--- /dev/null+++ b/packages/sdk/src/entities/calendar/booking-namespace.test.ts@@ -0,0 +1,236 @@+import { describe, expect, test } from 'bun:test';+import type {+ BookingLinkDraft,+ BookingLink as BookingLinkRecord,+ Booking as BookingRecord,+} from '../../../generated/calendar/types.gen';+import type { MacroClient } from '../../utils/client';+import { Team } from '../teams/team';+import { BookingNamespace } from './booking-namespace';++const draft: BookingLinkDraft = {+ event: {+ title: 'Intro',+ slug: 'intro',+ description: '',+ durationMinutes: 30,+ location: 'Office',+ googleMeet: false,+ enabled: true,+ mode: 'individual',+ hosts: ['macro|[email protected]'],+ beforeMinutes: 0,+ afterMinutes: 0,+ noticeMinutes: 60,+ horizonDays: 30,+ intervalMinutes: 30,+ requiresConfirmation: false,+ questions: [],+ },+ schedule: {+ name: 'Working hours',+ timeZone: 'UTC',+ weekly: [0, 1, 2, 3, 4, 5, 6].map((day) => ({+ day,+ windows: [{ start: '09:00', end: '17:00' }],+ })),+ overrides: [],+ },+};++const saved: BookingLinkRecord = {+ profileId: 'profile-1',+ eventTypeId: 'link-1',+ revision: 3,+ draft,+};++const booking: BookingRecord = {+ id: 'booking-1',+ eventTypeId: 'link-1',+ title: 'Intro',+ name: 'Guest',+ email: '[email protected]',+ startsAt: '2026-01-05T09:00:00Z',+ endsAt: '2026-01-05T09:30:00Z',+ timeZone: 'UTC',+ hosts: ['macro|[email protected]'],+ status: 'confirmed',+ attendance: 'unknown',+ rescheduleCount: 0,+ location: 'Office',+ answers: {},+ questionLabels: {},+};++describe('calendar.booking', () => {+ test('lists a team’s links as handles with their booking URLs', async () => {+ const queries: unknown[] = [];+ const client = {+ webAppUrl: 'https://macro.com',+ calendar: {+ listBookingLinks: async (options: unknown) => {+ queries.push(options);+ return {+ data: {+ teamIds: ['team-1'],+ userId: 'macro|[email protected]',+ profileId: 'profile-1',+ revision: 3,+ schedules: [],+ links: [saved],+ },+ };+ },+ },+ } as unknown as MacroClient;+ const team = Team.byId(client, 'team-1');++ const listing = await new BookingNamespace(client).links({+ team,+ query: 'intro',+ });++ expect(queries).toEqual([{ query: { teamId: 'team-1', query: 'intro' } }]);+ expect(listing.host.id).toBe('macro|[email protected]');+ expect(listing.teams.map((t) => t.id)).toEqual(['team-1']);+ expect(listing.pageUrl).toBe('https://macro.com/app/book/profile-1');+ const [link] = listing.links;+ expect(link?.id).toBe('link-1');+ expect(link?.team).toBe(team);+ expect(await link?.webUrl()).toBe(+ 'https://macro.com/app/book/profile-1/intro',+ );+ expect(JSON.parse(JSON.stringify(link))).toMatchObject({+ id: 'link-1',+ url: 'https://macro.com/app/book/profile-1/intro',+ });+ });++ test('creates and edits a link with the quoted approval and the read revision', async () => {+ const calls: { method: string; options: unknown }[] = [];+ const client = {+ webAppUrl: 'https://macro.com',+ calendar: {+ createBookingLink: async (options: unknown) => {+ calls.push({ method: 'create', options });+ return { data: saved };+ },+ editBookingLink: async (options: unknown) => {+ calls.push({ method: 'edit', options });+ return { data: { ...saved, revision: 4 } };+ },+ },+ } as unknown as MacroClient;++ const link = await new BookingNamespace(client).createLink(draft, {+ userConfirmation: 'Yes, create it.',+ });+ const renamed = {+ ...draft,+ event: { ...draft.event, title: 'Intro call' },+ };+ const edited = await link.edit(renamed, {+ userConfirmation: 'Yes, rename it.',+ });++ expect(calls).toEqual([+ {+ method: 'create',+ options: {+ query: { teamId: undefined },+ body: { draft, userConfirmation: 'Yes, create it.' },+ },+ },+ {+ method: 'edit',+ options: {+ path: { id: 'link-1' },+ query: { teamId: undefined },+ body: {+ expectedRevision: 3,+ draft: renamed,+ userConfirmation: 'Yes, rename it.',+ },+ },+ },+ ]);+ expect(await edited.revision()).toBe(4);+ });++ test('lists bookings in a range and reschedules one to an offered slot', async () => {+ const calls: { method: string; options: unknown }[] = [];+ const client = {+ webAppUrl: 'https://macro.com',+ calendar: {+ listBookings: async (options: unknown) => {+ calls.push({ method: 'list', options });+ return { data: { bookings: [booking] } };+ },+ listBookingRescheduleSlots: async (options: unknown) => {+ calls.push({ method: 'slots', options });+ return {+ data: {+ slots: [+ {+ startsAt: '2026-01-06T10:00:00Z',+ endsAt: '2026-01-06T10:30:00Z',+ },+ ],+ },+ };+ },+ changeBooking: async (options: unknown) => {+ calls.push({ method: 'change', options });+ return {+ data: {+ booking: {+ ...booking,+ startsAt: '2026-01-06T10:00:00Z',+ endsAt: '2026-01-06T10:30:00Z',+ rescheduleCount: 1,+ },+ },+ };+ },+ },+ } as unknown as MacroClient;++ const [found] = await new BookingNamespace(client).bookings({+ from: '2026-01-01T00:00:00Z',+ to: '2026-02-01T00:00:00Z',+ });+ if (!found) throw new Error('expected a booking');+ expect((await found.hosts()).map((host) => host.id)).toEqual([+ 'macro|[email protected]',+ ]);+ const [slot] = await found.rescheduleSlots('2026-01-06');+ if (!slot) throw new Error('expected a slot');+ const moved = await found.reschedule(slot.startsAt);++ expect(await moved.rescheduleCount()).toBe(1);+ expect(calls).toEqual([+ {+ method: 'list',+ options: {+ query: {+ teamId: undefined,+ from: '2026-01-01T00:00:00Z',+ to: '2026-02-01T00:00:00Z',+ },+ },+ },+ {+ method: 'slots',+ options: { path: { id: 'booking-1' }, query: { date: '2026-01-06' } },+ },+ {+ method: 'change',+ options: {+ path: { id: 'booking-1' },+ body: { action: 'reschedule', startsAt: '2026-01-06T10:00:00Z' },+ },+ },+ ]);+ });+});diff --git a/packages/sdk/src/entities/calendar/booking-namespace.ts b/packages/sdk/src/entities/calendar/booking-namespace.tsnew file mode 100644index 0000000000..a7f926f328--- /dev/null+++ b/packages/sdk/src/entities/calendar/booking-namespace.ts@@ -0,0 +1,207 @@+import type {+ BookingInsights,+ BookingLinkDraft,+ BookingProfile,+ BookingSchedule,+} from '../../../generated/calendar/types.gen';+import { unwrap } from '../../utils';+import type { MacroClient } from '../../utils/client';+import { Team } from '../teams/team';+import { User } from '../users/user';+import { Booking } from './booking';+import { BookingLink, bookingPageUrl } from './booking-link';++/** Whose booking links: the user's own when `team` is omitted, otherwise that team's. */+export interface BookingScope {+ /** A team the user belongs to; omit for the user's personal booking links. */+ team?: Team;+}++/** A profile's booking settings and its public booking page. */+export interface BookingSettings {+ /** Every setting, with the revision {@link BookingNamespace.saveSettings} saves against. */+ profile: BookingProfile;+ /** The public page listing the profile's links; a revision-0 profile must be saved before sharing it. */+ pageUrl: string;+}++/** The user's or a team's booking links, and what a new link can reuse. */+export interface BookingLinkListing {+ /** Matching links, paused ones included. */+ links: BookingLink[];+ /** Reusable availability schedules to copy into a new draft. */+ schedules: BookingSchedule[];+ /** The user, as the host to name in a personal draft's `hosts`. */+ host: User;+ /** The user's teams, whose links {@link BookingNamespace.links} lists with `team`. */+ teams: Team[];+ /** The profile's public booking page. */+ pageUrl: string;+}++/** A local date range for {@link BookingNamespace.insights}. */+export interface BookingInsightsQuery extends BookingScope {+ /** First local date (`YYYY-MM-DD`), inclusive. */+ from: string;+ /** Last local date (`YYYY-MM-DD`), inclusive; at most 366 days after `from`. */+ to: string;+ /** IANA zone for dates and hour-of-day grouping. */+ timeZone: string;+ /** Only bookings of this link. */+ link?: BookingLink;+ /** Only bookings this user hosts. */+ host?: User;+}++/**+ * Booking links (`macro.calendar.booking`): reusable booking pages, the+ * settings behind them, the meetings guests book through them, and their+ * statistics. Personal unless a `team` is given; any team member can read and+ * edit a team's.+ */+export class BookingNamespace {+ constructor(private readonly client: MacroClient) {}++ /**+ * List and search the user's booking links (or a team's), with their full+ * drafts, the reusable schedules and the user as host; call this before+ * creating a link. Reading never creates settings.+ *+ * `query` matches link title, slug and description; omit it for every link+ * (at most 100).+ */+ async links(+ options: BookingScope & { query?: string } = {},+ ): Promise<BookingLinkListing> {+ const listing = unwrap(+ await this.client.calendar.listBookingLinks({+ query: { teamId: options.team?.id, query: options.query },+ }),+ );+ return {+ links: listing.links.map((link) =>+ BookingLink.fromRecord(this.client, link, options.team),+ ),+ schedules: listing.schedules,+ host: User.byId(this.client, listing.userId),+ teams: listing.teamIds.map((id) => Team.byId(this.client, id)),+ pageUrl: bookingPageUrl(this.client, listing.profileId),+ };+ }++ /**+ * Create a booking link only after the user replied approving the full+ * proposal, quoting that reply in `userConfirmation`; never on the request+ * that asked for the link.+ *+ * List {@link links} first and reuse what fits. Before creating, write the+ * whole proposal out for the user: personal or team ownership, the named+ * hosts and who attends, meeting name and description, duration, location,+ * Macro call or Google Meet, time zone, weekly hours and date exceptions,+ * link name, buffers, minimum notice, booking window, slot interval, daily+ * limit, guest questions and whether bookings are enabled. Ask whether to+ * proceed and stop. Never ask the user for ids, revisions or JSON.+ *+ * The draft needs all seven weekdays (Sunday is 0), an IANA time zone and+ * real hosts: a personal link names {@link BookingLinkListing.host} with+ * mode `individual`; a team link uses `collective` or `roundRobin`.+ * `requiresConfirmation` must be false. For video set `macroCall`+ * (preferred) or `googleMeet`, never both. Creating sends no invitations.+ * Replaying an identical draft at the same slug returns the saved link; a+ * different draft at that slug conflicts (409). Share the link's+ * {@link BookingLink.webUrl} as an `<m-booking-link-mention>` chip.+ */+ async createLink(+ draft: BookingLinkDraft,+ options: BookingScope & { userConfirmation: string },+ ): Promise<BookingLink> {+ const link = unwrap(+ await this.client.calendar.createBookingLink({+ query: { teamId: options.team?.id },+ body: { draft, userConfirmation: options.userConfirmation },+ }),+ );+ return BookingLink.fromRecord(this.client, link, options.team);+ }++ /**+ * Read every booking setting of the user (or a team): booking-page name and+ * introduction, reusable schedules, default hours and every link. Reading+ * never creates settings.+ */+ async settings(options: BookingScope = {}): Promise<BookingSettings> {+ const { profile } = unwrap(+ await this.client.calendar.getBookingSettings({+ query: { teamId: options.team?.id },+ }),+ );+ return { profile, pageUrl: bookingPageUrl(this.client, profile.id) };+ }++ /**+ * Save the full settings read with {@link settings}, only after the user+ * replied approving the changes; use {@link createLink} and+ * {@link BookingLink.edit} for a single link.+ *+ * Change only what the user asked for and keep every id; generate new+ * UUIDs for new schedules, links and questions. A shared schedule's hours+ * apply to every link using it, and personal default hours apply to team+ * hosting, so name the affected links before changing them. Deleting a link+ * cancels none of its bookings. Saving at a stale revision is refused (409):+ * read again and reconcile instead of overwriting.+ */+ async saveSettings(+ profile: BookingProfile,+ options: BookingScope = {},+ ): Promise<BookingSettings> {+ const saved = unwrap(+ await this.client.calendar.saveBookingSettings({+ query: { teamId: options.team?.id },+ body: profile,+ }),+ ).profile;+ return { profile: saved, pageUrl: bookingPageUrl(this.client, saved.id) };+ }++ /**+ * Every booking starting in a half-open range (`from` inclusive, `to`+ * exclusive, ISO timestamps with an offset, at most 733 days apart), with+ * guests, answers, attendance and reschedule history. An oversized result+ * fails rather than truncating: narrow the range. Use {@link insights} for+ * statistics.+ */+ async bookings(+ options: BookingScope & { from: string; to: string },+ ): Promise<Booking[]> {+ const { bookings } = unwrap(+ await this.client.calendar.listBookings({+ query: { teamId: options.team?.id, from: options.from, to: options.to },+ }),+ );+ return bookings.map((record) => Booking.fromRecord(this.client, record));+ }++ /**+ * Booking statistics for local dates, and the equally long period before:+ * totals, completed, rescheduled, cancelled, no-shows, scheduled minutes,+ * daily trends, popular hours and counts by link and host.+ *+ * Failed and processing requests are excluded. Completed means confirmed+ * and ended without a recorded no-show, not verified attendance; minutes+ * are scheduled duration, not call length. No guest contact details.+ */+ async insights(query: BookingInsightsQuery): Promise<BookingInsights> {+ return unwrap(+ await this.client.calendar.getBookingInsights({+ query: { teamId: query.team?.id },+ body: {+ from: query.from,+ to: query.to,+ timeZone: query.timeZone,+ eventTypeId: query.link?.id,+ hostId: query.host?.id,+ },+ }),+ );+ }+}diff --git a/packages/sdk/src/entities/calendar/booking.ts b/packages/sdk/src/entities/calendar/booking.tsnew file mode 100644index 0000000000..f33a16ca0d--- /dev/null+++ b/packages/sdk/src/entities/calendar/booking.ts@@ -0,0 +1,132 @@+import type {+ BookingAttendance,+ BookingChange,+ Booking as BookingRecord,+ BookingSlot,+} from '../../../generated/calendar/types.gen';+import { unwrap } from '../../utils';+import type { MacroClient } from '../../utils/client';+import { MacroEntity } from '../entity';+import { User } from '../users/user';++/**+ * A meeting someone booked through one of the user's or their team's booking+ * links. Detail loads through the host's management view, so it needs the+ * personal owner, a host of the meeting or a team administrator.+ */+export class Booking extends MacroEntity<BookingRecord> {+ protected async fetch(): Promise<BookingRecord> {+ return unwrap(+ await this.client.calendar.getManagedBooking({ path: { id: this.id } }),+ ).booking;+ }++ /** A handle to a booking by id. Detail loads on first access. */+ static byId(client: MacroClient, id: string): Booking {+ return new Booking(client, id);+ }++ /** A handle seeded with a booking record the service returned. */+ static fromRecord(client: MacroClient, record: BookingRecord): Booking {+ return new Booking(client, record.id, record);+ }++ /** Meeting title, as it was when the meeting was booked. */+ readonly title = this.field('title');++ /** The guest's name. */+ readonly name = this.field('name');++ /** The guest's email. */+ readonly email = this.field('email');++ /** Absolute start. */+ readonly startsAt = this.field('startsAt');++ /** Absolute end. */+ readonly endsAt = this.field('endsAt');++ /** The guest's IANA display time zone. */+ readonly timeZone = this.field('timeZone');++ /** Lifecycle state. `failed` and `processing` need reconciliation, never a blind retry. */+ readonly status = this.field('status');++ /** Recorded attendance; `unknown` until a host records it. */+ readonly attendance = this.field('attendance');++ /** How many times the meeting moved to another start. */+ readonly rescheduleCount = this.field('rescheduleCount');++ /** When the meeting last moved, if it ever did. */+ readonly rescheduledAt = this.field('rescheduledAt');++ /** Final location or conference URL. */+ readonly location = this.field('location');++ /** The guest's answers, keyed by question id; {@link questionLabels} names each question. */+ readonly answers = this.field('answers');++ /** Question labels as they were when the meeting was booked, keyed by question id. */+ readonly questionLabels = this.field('questionLabels');++ /** The hosts assigned to the meeting. */+ readonly hosts = this.mappedField('hosts', (ids) =>+ ids.map((id) => User.byId(this.client, id)),+ );++ /**+ * Available replacement starts on one date (`YYYY-MM-DD`, in the booking+ * schedule's time zone), for {@link reschedule}. Availability is checked+ * again when the meeting moves.+ */+ async rescheduleSlots(date: string): Promise<BookingSlot[]> {+ return unwrap(+ await this.client.calendar.listBookingRescheduleSlots({+ path: { id: this.id },+ query: { date },+ }),+ ).slots;+ }++ /**+ * Move the meeting to a start returned by {@link rescheduleSlots}; only on+ * the user's go-ahead, since the guest and hosts are notified. Returns the+ * saved booking.+ */+ async reschedule(startsAt: string): Promise<Booking> {+ return this.change({ action: 'reschedule', startsAt });+ }++ /**+ * Cancel the meeting; only on the user's go-ahead, since the guest and+ * hosts are notified. The booking link stays as it is. Returns the saved+ * booking.+ */+ async cancel(): Promise<Booking> {+ return this.change({ action: 'cancel' });+ }++ /**+ * Approve a legacy pending booking and send its invitations; only on the+ * user's go-ahead. Returns the saved booking.+ */+ async approve(): Promise<Booking> {+ return this.change({ action: 'approve' });+ }++ /**+ * Record or clear attendance once a confirmed meeting has ended. Returns+ * the saved booking.+ */+ async setAttendance(attendance: BookingAttendance): Promise<Booking> {+ return this.change({ action: 'attendance', attendance });+ }++ private async change(body: BookingChange): Promise<Booking> {+ const { booking } = await this.mutate((client) =>+ client.calendar.changeBooking({ path: { id: this.id }, body }),+ );+ return Booking.fromRecord(this.client, booking);+ }+}diff --git a/packages/sdk/src/entities/calendar/namespace.ts b/packages/sdk/src/entities/calendar/namespace.tsindex 60281a5503..cd331fda27 100644--- a/packages/sdk/src/entities/calendar/namespace.ts+++ b/packages/sdk/src/entities/calendar/namespace.ts@@ -25,6 +25,7 @@ import { paginate, unwrap } from '../../utils';import type { MacroClient } from '../../utils/client';import type { Link } from '../email/link';import { User } from '../users/user';+import { BookingNamespace } from './booking-namespace';import { Calendar } from './calendar';import { CalendarEvent } from './event';import { CalendarReplacement } from './replacement';@@ -115,20 +116,26 @@ export type CalendarEventRole = 'organizer' | 'guest';* @agent* ## Booking links*- * - Booking links use conversational confirmation in every surface. First use `ListBookingLinks`- * to find existing links and reusable availability. Resolve team and host identities with tools;- * never ask for IDs, revisions or JSON. Default to personal ownership unless a team is requested.- * Explain the complete proposal in readable prose: ownership and named hosts, who attends,- * meeting name and description, duration, location or Google Meet, time zone, weekly hours and- * date exceptions, link name, buffers, minimum notice, booking window, slot interval, daily limit,- * guest questions, and whether bookings are enabled. Group related settings so it is easy to- * review. Ask whether to proceed, and end the turn. Only after the user's reply approving that- * proposal, call `CreateBookingLink` or `EditBookingLink`, quoting the reply verbatim in- * `userConfirmation`. Do not quote the original request or invent approval. These tools save- * immediately, with no booking review form. Do not use `AskUser` or an elicitation for booking- * details. For edits preserve unrequested settings, and re-read and reconfirm if the revision- * conflicts. Share the saved URL with an `<m-booking-link-mention>` chip (see Mentions), not a- * bare URL. If the same proposal is already approved, do not ask again.+ * - Booking links live under `macro.calendar.booking`. They are reusable booking pages, not+ * calendar meetings; the meetings guests book through them are `Booking`s.+ * - Booking links use conversational confirmation in every surface. First list+ * `macro.calendar.booking.links()` to find existing links and reusable availability. Resolve+ * teams and hosts from what it returns; never ask for IDs, revisions or JSON. Default to+ * personal ownership unless a team is requested. Explain the complete proposal in readable+ * prose: ownership and named hosts, who attends, meeting name and description, duration,+ * location, Macro call or Google Meet, time zone, weekly hours and date exceptions, link name,+ * buffers, minimum notice, booking window, slot interval, daily limit, guest questions, and+ * whether bookings are enabled. Group related settings so it is easy to review. Ask whether to+ * proceed, and end the turn. Only after the user's reply approving that proposal, call+ * `booking.createLink` or `BookingLink.edit`, quoting the reply verbatim in `userConfirmation`.+ * Do not quote the original request or invent approval. These save immediately, with no+ * review card. For edits preserve unrequested settings, and re-read and reconfirm if the+ * revision conflicts. Share the saved `webUrl()` with an `<m-booking-link-mention>` chip (see+ * Mentions), not a bare URL. If the same proposal is already approved, do not ask again.+ * - `booking.saveSettings` changes shared schedules, page settings and many links at once: explain+ * the changes and the links they affect, and save only on the user's approving reply.+ * - Cancelling, approving or rescheduling a `Booking` notifies its guest and hosts; do it only on+ * the user's go-ahead. Reschedule to a start from `rescheduleSlots`.** ## Creating events*@@ -263,7 +270,12 @@ export class CalendarNamespace {};}- constructor(private readonly client: MacroClient) {}+ /** Booking links, their settings, booked meetings and booking statistics. */+ readonly booking: BookingNamespace;++ constructor(private readonly client: MacroClient) {+ this.booking = new BookingNamespace(client);+ }/** The calendars the caller can see, some possibly not theirs, primaries and writable first. */calendars(): Promise<Calendar[]> {@@ -401,7 +413,7 @@ function onSchedule(: undefined;}-/** The user's role on a copy, read the way ListCalendarEvents reads it: only+/** The user's role on a copy, read the way Rust `EventRole::of` reads it: only* the copy's own inbox row is `isSelf`. That row marked organizer counts only* on a copy the user can change, since Microsoft Graph names the mailbox owner* as organizer on every event of a read-only calendar. `organize` says theydiff --git a/services/calendar_service/src/api/swagger.rs b/services/calendar_service/src/api/swagger.rsindex 6ecf215e20..a2829fde75 100644--- a/services/calendar_service/src/api/swagger.rs+++ b/services/calendar_service/src/api/swagger.rs@@ -26,6 +26,16 @@ use utoipa::OpenApi;calendar_events::inbound::mutation_router::invite_calendar_event_guests,calendar_events::inbound::mutation_router::copy_calendar_event,calendar_events::inbound::mutation_router::respond_to_join_request,+ calendar_scheduling::inbound::router::settings,+ calendar_scheduling::inbound::router::save,+ calendar_scheduling::inbound::router::bookings,+ calendar_scheduling::inbound::router::manage,+ calendar_scheduling::inbound::router::insights,+ calendar_scheduling::inbound::router::change,+ calendar_scheduling::inbound::router::host_slots,+ calendar_scheduling::inbound::router::list_links,+ calendar_scheduling::inbound::router::create_link,+ calendar_scheduling::inbound::router::edit_link,),components(schemas(calendar_events::inbound::team_router::TeamCalendarSharingBody,@@ -59,6 +69,9 @@ use utoipa::OpenApi;calendar_events::domain::models::EventTransparency,calendar_events::domain::models::RefreshCalendarEvent,)),- tags((name = "calendar_events", description = "Macro Calendar Service"))+ tags(+ (name = "calendar_events", description = "Macro Calendar Service"),+ (name = "scheduling", description = "Booking links, bookings and booking settings"),+ ))]pub struct ApiDoc;