/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 700b13b663f7 */ import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { ActivityEventParams, ActivityEventParams$Outbound, ActivityEventParams$outboundSchema, } from "./activityeventparams.js"; /** * The type of activity this represents. */ export const ActivityEventAction = { /** * Represents a visit to the given `url`. */ View: "VIEW", /** * Represents an edit of the document represented by the `url`. */ Edit: "EDIT", /** * Represents a search performed at the given `url`. */ Search: "SEARCH", /** * Represents a comment on the document represented by the `url`. */ Comment: "COMMENT", /** * Represents an explicit request to index the given `url` along with associated attributes in this payload. */ Crawl: "CRAWL", /** * Represents a search performed at the given `url` as indicated by the user's history. */ HistoricalSearch: "HISTORICAL_SEARCH", /** * Represents a visit to the given `url` as indicated by the user's history. */ HistoricalView: "HISTORICAL_VIEW", } as const; /** * The type of activity this represents. */ export type ActivityEventAction = ClosedEnum; export type ActivityEvent = { /** * Universally unique identifier of the event. To allow for reliable retransmission, only the earliest received event of a given UUID is considered valid by the server and subsequent are ignored. */ id?: string | undefined; /** * The type of activity this represents. */ action: ActivityEventAction; params?: ActivityEventParams | undefined; /** * The ISO 8601 timestamp when the activity began. */ timestamp: Date; /** * The URL of the activity. */ url: string; }; /** @internal */ export const ActivityEventAction$outboundSchema: z.ZodNativeEnum< typeof ActivityEventAction > = z.nativeEnum(ActivityEventAction); /** @internal */ export type ActivityEvent$Outbound = { id?: string | undefined; action: string; params?: ActivityEventParams$Outbound | undefined; timestamp: string; url: string; }; /** @internal */ export const ActivityEvent$outboundSchema: z.ZodType< ActivityEvent$Outbound, z.ZodTypeDef, ActivityEvent > = z.object({ id: z.string().optional(), action: ActivityEventAction$outboundSchema, params: ActivityEventParams$outboundSchema.optional(), timestamp: z.date().transform(v => v.toISOString()), url: z.string(), }); export function activityEventToJSON(activityEvent: ActivityEvent): string { return JSON.stringify(ActivityEvent$outboundSchema.parse(activityEvent)); }