/* * 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 { PushOptionChoice, PushOptionChoice$inboundSchema, } from "./pushoptionchoice.js"; import { PushOptionProperty, PushOptionProperty$inboundSchema, } from "./pushoptionproperty.js"; import { PushOptionType, PushOptionType$inboundSchema, } from "./pushoptiontype.js"; import { PushValidationInfo, PushValidationInfo$inboundSchema, } from "./pushvalidationinfo.js"; export type PushOption = { /** * The option type. */ type: PushOptionType; /** * The property's display name. */ displayName: string; /** * A description of the property. */ description?: string | undefined; /** * The property is required if `True`. */ required: boolean; properties?: { [k: string]: PushOptionProperty } | null | undefined; options?: Array | null | undefined; validation?: PushValidationInfo | undefined; }; /** @internal */ export const PushOption$inboundSchema: z.ZodType< PushOption, z.ZodTypeDef, unknown > = z.object({ type: PushOptionType$inboundSchema, displayName: z.string(), description: z.string().optional(), required: z.boolean(), properties: z.nullable(z.record(PushOptionProperty$inboundSchema)).optional(), options: z.nullable(z.array(PushOptionChoice$inboundSchema)).optional(), validation: PushValidationInfo$inboundSchema.optional(), }); export function pushOptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PushOption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PushOption' from JSON`, ); }