/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AttachmentReference, AttachmentReference$inboundSchema, } from "./attachmentreference.js"; import { PassThroughBody, PassThroughBody$inboundSchema, } from "./passthroughbody.js"; export type Attachment = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The display id of the file */ displayId?: string | null | undefined; /** * The name of the file */ name?: string | null | undefined; /** * The MIME type of the file. */ mimeType?: string | null | undefined; /** * The size of the file in bytes */ size?: number | null | undefined; reference?: AttachmentReference | undefined; /** * Optional description of the file */ description?: string | null | undefined; /** * The URL to download or preview the file */ fileUrl?: string | null | undefined; /** * The folder id where this attachment belong to */ parentFolderId?: string | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const Attachment$inboundSchema: z.ZodType< Attachment, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), display_id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), mime_type: z.nullable(types.string()).optional(), size: z.nullable(types.number()).optional(), reference: types.optional(AttachmentReference$inboundSchema), description: z.nullable(types.string()).optional(), file_url: z.nullable(types.string()).optional(), parent_folder_id: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "display_id": "displayId", "mime_type": "mimeType", "file_url": "fileUrl", "parent_folder_id": "parentFolderId", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function attachmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Attachment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Attachment' from JSON`, ); }