/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const RejectType = { Unknown: "", WrongVersion: "wrong_version", InvalidUsername: "invalid_username", WrongUserPw: "wrong_user_pw", WrongServerPw: "wrong_server_pw", UsernameInUse: "username_in_use", ServerFull: "server_full", NoCertificate: "no_certificate", AuthenticatorFail: "authenticator_fail", } as const; export type RejectType = OpenEnum; export type Reject = { reason?: string | undefined; type?: RejectType | undefined; }; /** @internal */ export const RejectType$inboundSchema: z.ZodType< RejectType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(RejectType); /** @internal */ export const Reject$inboundSchema: z.ZodType = z .object({ reason: z.string().optional(), type: RejectType$inboundSchema.optional(), }); export function rejectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Reject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Reject' from JSON`, ); }