/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: de738accaf24 */ 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 { HotwordProximity, HotwordProximity$inboundSchema, HotwordProximity$Outbound, HotwordProximity$outboundSchema, } from "./hotwordproximity.js"; export type Hotword = { regex?: string | undefined; proximity?: HotwordProximity | undefined; }; /** @internal */ export const Hotword$inboundSchema: z.ZodType = z.object({ regex: z.string().optional(), proximity: HotwordProximity$inboundSchema.optional(), }); /** @internal */ export type Hotword$Outbound = { regex?: string | undefined; proximity?: HotwordProximity$Outbound | undefined; }; /** @internal */ export const Hotword$outboundSchema: z.ZodType< Hotword$Outbound, z.ZodTypeDef, Hotword > = z.object({ regex: z.string().optional(), proximity: HotwordProximity$outboundSchema.optional(), }); export function hotwordToJSON(hotword: Hotword): string { return JSON.stringify(Hotword$outboundSchema.parse(hotword)); } export function hotwordFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Hotword$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Hotword' from JSON`, ); }