import * as z from "zod" import { defineAction } from "../../../automation/actions" import { getGoogleCalendarApi, normalizeColors, } from "@automate.ax/integration-contracts/google-calendar" import { GOOGLE_CALENDAR_COLORS_READ_REQUIREMENT } from "../lib/scopes" import { COLOR_PALETTE_SCHEMA } from "@automate.ax/integration-contracts/google-calendar" /** Gets the authenticated user's calendar and event color palettes. */ export const getGoogleCalendarColors = defineAction( "Get Google Calendar colors", ) .describe( "Gets calendar and event color IDs with foreground/background values.", ) .account("google", GOOGLE_CALENDAR_COLORS_READ_REQUIREMENT) .input(z.object({})) .output(COLOR_PALETTE_SCHEMA) .retry({ replaySafety: "safe" }) .handler(async ({ account }) => { const { data } = await getGoogleCalendarApi(account.secret).colors.get() return normalizeColors(data) })