/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The error code. */ export const Code = { BadRequest: "bad_request", Unauthorized: "unauthorized", Forbidden: "forbidden", ExceededLimit: "exceeded_limit", NotFound: "not_found", Conflict: "conflict", InvitePending: "invite_pending", InviteExpired: "invite_expired", UnprocessableEntity: "unprocessable_entity", RateLimitExceeded: "rate_limit_exceeded", InternalServerError: "internal_server_error", } as const; /** * The error code. */ export type Code = ClosedEnum; export type LinkErrorSchema = { /** * The link that caused the error. */ link?: any | undefined; /** * The error message. */ error: string; /** * The error code. */ code: Code; }; /** @internal */ export const Code$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Code, ); /** @internal */ export const LinkErrorSchema$inboundSchema: z.ZodType< LinkErrorSchema, z.ZodTypeDef, unknown > = z.object({ link: z.any().optional(), error: z.string(), code: Code$inboundSchema, }); export function linkErrorSchemaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkErrorSchema$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkErrorSchema' from JSON`, ); }