/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AttachmentReferenceType, AttachmentReferenceType$inboundSchema, AttachmentReferenceType$outboundSchema, } from "./attachmentreferencetype.js"; export type AttachmentReference = { type?: AttachmentReferenceType | undefined; /** * A unique identifier for an object. */ id?: string | undefined; }; /** @internal */ export const AttachmentReference$inboundSchema: z.ZodType< AttachmentReference, z.ZodTypeDef, unknown > = z.object({ type: AttachmentReferenceType$inboundSchema.optional(), id: z.string().optional(), }); /** @internal */ export type AttachmentReference$Outbound = { type?: string | undefined; id?: string | undefined; }; /** @internal */ export const AttachmentReference$outboundSchema: z.ZodType< AttachmentReference$Outbound, z.ZodTypeDef, AttachmentReference > = z.object({ type: AttachmentReferenceType$outboundSchema.optional(), id: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AttachmentReference$ { /** @deprecated use `AttachmentReference$inboundSchema` instead. */ export const inboundSchema = AttachmentReference$inboundSchema; /** @deprecated use `AttachmentReference$outboundSchema` instead. */ export const outboundSchema = AttachmentReference$outboundSchema; /** @deprecated use `AttachmentReference$Outbound` instead. */ export type Outbound = AttachmentReference$Outbound; } export function attachmentReferenceToJSON( attachmentReference: AttachmentReference, ): string { return JSON.stringify( AttachmentReference$outboundSchema.parse(attachmentReference), ); } export function attachmentReferenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AttachmentReference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AttachmentReference' from JSON`, ); }