/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ClickAction, ClickAction$inboundSchema, ClickAction$Outbound, ClickAction$outboundSchema, } from "./clickaction.js"; import { DoubleClickAction, DoubleClickAction$inboundSchema, DoubleClickAction$Outbound, DoubleClickAction$outboundSchema, } from "./doubleclickaction.js"; import { DragAction, DragAction$inboundSchema, DragAction$Outbound, DragAction$outboundSchema, } from "./dragaction.js"; import { KeyPressAction, KeyPressAction$inboundSchema, KeyPressAction$Outbound, KeyPressAction$outboundSchema, } from "./keypressaction.js"; import { MoveAction, MoveAction$inboundSchema, MoveAction$Outbound, MoveAction$outboundSchema, } from "./moveaction.js"; import { ScreenshotAction, ScreenshotAction$inboundSchema, ScreenshotAction$Outbound, ScreenshotAction$outboundSchema, } from "./screenshotaction.js"; import { ScrollAction, ScrollAction$inboundSchema, ScrollAction$Outbound, ScrollAction$outboundSchema, } from "./scrollaction.js"; import { TypeAction, TypeAction$inboundSchema, TypeAction$Outbound, TypeAction$outboundSchema, } from "./typeaction.js"; import { WaitAction, WaitAction$inboundSchema, WaitAction$Outbound, WaitAction$outboundSchema, } from "./waitaction.js"; export type ComputerAction = | ClickAction | DoubleClickAction | DragAction | KeyPressAction | MoveAction | ScreenshotAction | ScrollAction | TypeAction | WaitAction; /** @internal */ export const ComputerAction$inboundSchema: z.ZodType< ComputerAction, z.ZodTypeDef, unknown > = z.union([ ClickAction$inboundSchema, DoubleClickAction$inboundSchema, DragAction$inboundSchema, KeyPressAction$inboundSchema, MoveAction$inboundSchema, ScreenshotAction$inboundSchema, ScrollAction$inboundSchema, TypeAction$inboundSchema, WaitAction$inboundSchema, ]); /** @internal */ export type ComputerAction$Outbound = | ClickAction$Outbound | DoubleClickAction$Outbound | DragAction$Outbound | KeyPressAction$Outbound | MoveAction$Outbound | ScreenshotAction$Outbound | ScrollAction$Outbound | TypeAction$Outbound | WaitAction$Outbound; /** @internal */ export const ComputerAction$outboundSchema: z.ZodType< ComputerAction$Outbound, z.ZodTypeDef, ComputerAction > = z.union([ ClickAction$outboundSchema, DoubleClickAction$outboundSchema, DragAction$outboundSchema, KeyPressAction$outboundSchema, MoveAction$outboundSchema, ScreenshotAction$outboundSchema, ScrollAction$outboundSchema, TypeAction$outboundSchema, WaitAction$outboundSchema, ]); export function computerActionToJSON(computerAction: ComputerAction): string { return JSON.stringify(ComputerAction$outboundSchema.parse(computerAction)); } export function computerActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputerAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputerAction' from JSON`, ); }