/* * 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"; export type WorkspaceFile = { path: string; size?: number | undefined; etag?: string | null | undefined; }; /** @internal */ export const WorkspaceFile$inboundSchema: z.ZodType< WorkspaceFile, z.ZodTypeDef, unknown > = z.object({ path: z.string(), size: z.number().int().default(0), etag: z.nullable(z.string()).optional(), }); /** @internal */ export type WorkspaceFile$Outbound = { path: string; size: number; etag?: string | null | undefined; }; /** @internal */ export const WorkspaceFile$outboundSchema: z.ZodType< WorkspaceFile$Outbound, z.ZodTypeDef, WorkspaceFile > = z.object({ path: z.string(), size: z.number().int().default(0), etag: z.nullable(z.string()).optional(), }); export function workspaceFileToJSON(workspaceFile: WorkspaceFile): string { return JSON.stringify(WorkspaceFile$outboundSchema.parse(workspaceFile)); } export function workspaceFileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkspaceFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkspaceFile' from JSON`, ); }