/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { StunBindingErrorResponse, StunBindingErrorResponse$inboundSchema, } from "./stunbindingerrorresponse.js"; import { StunBindingSuccessResponse, StunBindingSuccessResponse$inboundSchema, } from "./stunbindingsuccessresponse.js"; import { StunTurn, StunTurn$inboundSchema } from "./stunturn.js"; export type Stun = { bindingErrorResponse?: StunBindingErrorResponse | undefined; bindingSuccessResponse?: StunBindingSuccessResponse | undefined; responseType?: number | undefined; responseTypeName?: string | undefined; turn?: StunTurn | undefined; }; /** @internal */ export const Stun$inboundSchema: z.ZodType = z .object({ binding_error_response: StunBindingErrorResponse$inboundSchema.optional(), binding_success_response: StunBindingSuccessResponse$inboundSchema .optional(), response_type: z.number().int().optional(), response_type_name: z.string().optional(), turn: StunTurn$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "binding_error_response": "bindingErrorResponse", "binding_success_response": "bindingSuccessResponse", "response_type": "responseType", "response_type_name": "responseTypeName", }); }); export function stunFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Stun$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Stun' from JSON`, ); }