/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 8effbaf4eca6 */ import * as z from "zod/v4"; 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"; import { FilePurpose, FilePurpose$inboundSchema } from "./filepurpose.js"; import { FileVisibility, FileVisibility$inboundSchema, } from "./filevisibility.js"; import { SampleType, SampleType$inboundSchema } from "./sampletype.js"; import { Source, Source$inboundSchema } from "./source.js"; export type GetFileResponse = { /** * The unique identifier of the file. */ id: string; /** * The object type, which is always "file". */ object: string; /** * The size of the file, in bytes. */ sizeBytes: number; /** * The UNIX timestamp (in seconds) of the event. */ createdAt: number; /** * The name of the uploaded file. */ filename: string; purpose: FilePurpose; sampleType: SampleType; numLines?: number | null | undefined; mimetype?: string | null | undefined; source: Source; signature?: string | null | undefined; expiresAt?: number | null | undefined; visibility?: FileVisibility | null | undefined; deleted: boolean; }; /** @internal */ export const GetFileResponse$inboundSchema: z.ZodType< GetFileResponse, unknown > = z.object({ id: z.string(), object: z.string(), bytes: z.int(), created_at: z.int(), filename: z.string(), purpose: FilePurpose$inboundSchema, sample_type: SampleType$inboundSchema, num_lines: z.nullable(z.int()).optional(), mimetype: z.nullable(z.string()).optional(), source: Source$inboundSchema, signature: z.nullable(z.string()).optional(), expires_at: z.nullable(z.int()).optional(), visibility: z.nullable(FileVisibility$inboundSchema).optional(), deleted: z.boolean(), }).transform((v) => { return remap$(v, { "bytes": "sizeBytes", "created_at": "createdAt", "sample_type": "sampleType", "num_lines": "numLines", "expires_at": "expiresAt", }); }); export function getFileResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetFileResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetFileResponse' from JSON`, ); }