/* * 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 { RedirectDto, RedirectDto$inboundSchema, RedirectDto$Outbound, RedirectDto$outboundSchema, } from "./redirectdto.js"; export type ActionDto = { /** * Label for the action button. */ label?: string | undefined; /** * Redirect configuration for the action. */ redirect?: RedirectDto | undefined; }; /** @internal */ export const ActionDto$inboundSchema: z.ZodType< ActionDto, z.ZodTypeDef, unknown > = z.object({ label: z.string().optional(), redirect: RedirectDto$inboundSchema.optional(), }); /** @internal */ export type ActionDto$Outbound = { label?: string | undefined; redirect?: RedirectDto$Outbound | undefined; }; /** @internal */ export const ActionDto$outboundSchema: z.ZodType< ActionDto$Outbound, z.ZodTypeDef, ActionDto > = z.object({ label: z.string().optional(), redirect: RedirectDto$outboundSchema.optional(), }); export function actionDtoToJSON(actionDto: ActionDto): string { return JSON.stringify(ActionDto$outboundSchema.parse(actionDto)); } export function actionDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ActionDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionDto' from JSON`, ); }