/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { TicketContact, TicketContact$inboundSchema, TicketContact$Outbound, TicketContact$outboundSchema, } from "./ticketcontact.js"; /** * Request to create a new support ticket. */ export type CreateTicket = { title: string; body: string; author?: string | undefined; contact: TicketContact; foreignID?: string | undefined; }; /** @internal */ export const CreateTicket$inboundSchema: z.ZodType< CreateTicket, z.ZodTypeDef, unknown > = z.object({ title: z.string(), body: z.string(), author: z.string().optional(), contact: TicketContact$inboundSchema, foreignID: z.string().optional(), }); /** @internal */ export type CreateTicket$Outbound = { title: string; body: string; author?: string | undefined; contact: TicketContact$Outbound; foreignID?: string | undefined; }; /** @internal */ export const CreateTicket$outboundSchema: z.ZodType< CreateTicket$Outbound, z.ZodTypeDef, CreateTicket > = z.object({ title: z.string(), body: z.string(), author: z.string().optional(), contact: TicketContact$outboundSchema, foreignID: z.string().optional(), }); export function createTicketToJSON(createTicket: CreateTicket): string { return JSON.stringify(CreateTicket$outboundSchema.parse(createTicket)); } export function createTicketFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTicket$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTicket' from JSON`, ); }