/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * File to be associated with the downloadables benefit. */ export type DownloadableFileRead = { /** * The ID of the object. */ id: string; organizationId: string; name: string; path: string; mimeType: string; size: number; storageVersion: string | null; checksumEtag: string | null; checksumSha256Base64: string | null; checksumSha256Hex: string | null; lastModifiedAt: Date | null; version: string | null; service: "downloadable"; isUploaded: boolean; createdAt: Date; sizeReadable: string; }; /** @internal */ export const DownloadableFileRead$inboundSchema: z.ZodMiniType< DownloadableFileRead, unknown > = z.pipe( z.object({ id: z.string(), organization_id: z.string(), name: z.string(), path: z.string(), mime_type: z.string(), size: z.int(), storage_version: z.nullable(z.string()), checksum_etag: z.nullable(z.string()), checksum_sha256_base64: z.nullable(z.string()), checksum_sha256_hex: z.nullable(z.string()), last_modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), version: z.nullable(z.string()), service: z.literal("downloadable"), is_uploaded: z.boolean(), created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), size_readable: z.string(), }), z.transform((v) => { return remap$(v, { "organization_id": "organizationId", "mime_type": "mimeType", "storage_version": "storageVersion", "checksum_etag": "checksumEtag", "checksum_sha256_base64": "checksumSha256Base64", "checksum_sha256_hex": "checksumSha256Hex", "last_modified_at": "lastModifiedAt", "is_uploaded": "isUploaded", "created_at": "createdAt", "size_readable": "sizeReadable", }); }), ); export function downloadableFileReadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DownloadableFileRead$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DownloadableFileRead' from JSON`, ); }