/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 693a387ce21c */ 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 IndexStatus = { /** * When the document was last crawled */ lastCrawledTime?: Date | undefined; /** * When the document was last indexed */ lastIndexedTime?: Date | undefined; }; /** @internal */ export const IndexStatus$inboundSchema: z.ZodType< IndexStatus, z.ZodTypeDef, unknown > = z.object({ lastCrawledTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), lastIndexedTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }); /** @internal */ export type IndexStatus$Outbound = { lastCrawledTime?: string | undefined; lastIndexedTime?: string | undefined; }; /** @internal */ export const IndexStatus$outboundSchema: z.ZodType< IndexStatus$Outbound, z.ZodTypeDef, IndexStatus > = z.object({ lastCrawledTime: z.date().transform(v => v.toISOString()).optional(), lastIndexedTime: z.date().transform(v => v.toISOString()).optional(), }); export function indexStatusToJSON(indexStatus: IndexStatus): string { return JSON.stringify(IndexStatus$outboundSchema.parse(indexStatus)); } export function indexStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IndexStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IndexStatus' from JSON`, ); }