/* * 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 { CreateTelegramAgentConnectorRequest, CreateTelegramAgentConnectorRequest$inboundSchema, CreateTelegramAgentConnectorRequest$Outbound, CreateTelegramAgentConnectorRequest$outboundSchema, } from "./createtelegramagentconnectorrequest.js"; import { CreateWhatsAppAgentConnectorRequest, CreateWhatsAppAgentConnectorRequest$inboundSchema, CreateWhatsAppAgentConnectorRequest$Outbound, CreateWhatsAppAgentConnectorRequest$outboundSchema, } from "./createwhatsappagentconnectorrequest.js"; export type CreateAgentConnectorRequest = | CreateTelegramAgentConnectorRequest | CreateWhatsAppAgentConnectorRequest; /** @internal */ export const CreateAgentConnectorRequest$inboundSchema: z.ZodType< CreateAgentConnectorRequest, z.ZodTypeDef, unknown > = z.union([ CreateTelegramAgentConnectorRequest$inboundSchema, CreateWhatsAppAgentConnectorRequest$inboundSchema, ]); /** @internal */ export type CreateAgentConnectorRequest$Outbound = | CreateTelegramAgentConnectorRequest$Outbound | CreateWhatsAppAgentConnectorRequest$Outbound; /** @internal */ export const CreateAgentConnectorRequest$outboundSchema: z.ZodType< CreateAgentConnectorRequest$Outbound, z.ZodTypeDef, CreateAgentConnectorRequest > = z.union([ CreateTelegramAgentConnectorRequest$outboundSchema, CreateWhatsAppAgentConnectorRequest$outboundSchema, ]); export function createAgentConnectorRequestToJSON( createAgentConnectorRequest: CreateAgentConnectorRequest, ): string { return JSON.stringify( CreateAgentConnectorRequest$outboundSchema.parse( createAgentConnectorRequest, ), ); } export function createAgentConnectorRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAgentConnectorRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentConnectorRequest' from JSON`, ); }