/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { MoovError } from "./mooverror.js"; export type CreateTicketErrorData = { title?: string | undefined; body?: string | undefined; author?: string | undefined; contact?: components.CreateTicketContactError | undefined; foreignID?: string | undefined; }; export class CreateTicketError extends MoovError { title?: string | undefined; author?: string | undefined; contact?: components.CreateTicketContactError | undefined; foreignID?: string | undefined; /** The original data that was passed to this error instance. */ data$: CreateTicketErrorData; constructor( err: CreateTicketErrorData, 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.title != null) this.title = err.title; if (err.author != null) this.author = err.author; if (err.contact != null) this.contact = err.contact; if (err.foreignID != null) this.foreignID = err.foreignID; this.name = "CreateTicketError"; } } /** @internal */ export const CreateTicketError$inboundSchema: z.ZodType< CreateTicketError, z.ZodTypeDef, unknown > = z.object({ title: z.string().optional(), body: z.string().optional(), author: z.string().optional(), contact: components.CreateTicketContactError$inboundSchema.optional(), foreignID: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateTicketError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type CreateTicketError$Outbound = { title?: string | undefined; body?: string | undefined; author?: string | undefined; contact?: components.CreateTicketContactError$Outbound | undefined; foreignID?: string | undefined; }; /** @internal */ export const CreateTicketError$outboundSchema: z.ZodType< CreateTicketError$Outbound, z.ZodTypeDef, CreateTicketError > = z.instanceof(CreateTicketError) .transform(v => v.data$) .pipe(z.object({ title: z.string().optional(), body: z.string().optional(), author: z.string().optional(), contact: components.CreateTicketContactError$outboundSchema.optional(), foreignID: z.string().optional(), }));