/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { MoovError } from "./mooverror.js"; export type ScheduleValidationErrorData = { occurrences?: { [k: string]: string } | undefined; recur?: string | undefined; description?: string | undefined; }; export class ScheduleValidationError extends MoovError { occurrences?: { [k: string]: string } | undefined; recur?: string | undefined; description?: string | undefined; /** The original data that was passed to this error instance. */ data$: ScheduleValidationErrorData; constructor( err: ScheduleValidationErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.occurrences != null) this.occurrences = err.occurrences; if (err.recur != null) this.recur = err.recur; if (err.description != null) this.description = err.description; this.name = "ScheduleValidationError"; } } /** @internal */ export const ScheduleValidationError$inboundSchema: z.ZodType< ScheduleValidationError, z.ZodTypeDef, unknown > = z.object({ occurrences: z.record(z.string()).optional(), recur: z.string().optional(), description: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new ScheduleValidationError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type ScheduleValidationError$Outbound = { occurrences?: { [k: string]: string } | undefined; recur?: string | undefined; description?: string | undefined; }; /** @internal */ export const ScheduleValidationError$outboundSchema: z.ZodType< ScheduleValidationError$Outbound, z.ZodTypeDef, ScheduleValidationError > = z.instanceof(ScheduleValidationError) .transform(v => v.data$) .pipe(z.object({ occurrences: z.record(z.string()).optional(), recur: z.string().optional(), description: z.string().optional(), }));