/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; export type Index = { /** * The unique identifier of the index */ indexId: string; /** * The name of the index */ indexName: string; /** * The number of records in the index */ recordCount: number; /** * The status of the index */ status?: string | undefined; }; /** @internal */ export const Index$inboundSchema: z.ZodType = z .object({ index_id: z.string(), index_name: z.string(), record_count: z.number().int(), status: z.string().optional(), }).transform((v) => { return remap$(v, { "index_id": "indexId", "index_name": "indexName", "record_count": "recordCount", }); }); /** @internal */ export type Index$Outbound = { index_id: string; index_name: string; record_count: number; status?: string | undefined; }; /** @internal */ export const Index$outboundSchema: z.ZodType< Index$Outbound, z.ZodTypeDef, Index > = z.object({ indexId: z.string(), indexName: z.string(), recordCount: z.number().int(), status: z.string().optional(), }).transform((v) => { return remap$(v, { indexId: "index_id", indexName: "index_name", recordCount: "record_count", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Index$ { /** @deprecated use `Index$inboundSchema` instead. */ export const inboundSchema = Index$inboundSchema; /** @deprecated use `Index$outboundSchema` instead. */ export const outboundSchema = Index$outboundSchema; /** @deprecated use `Index$Outbound` instead. */ export type Outbound = Index$Outbound; } export function indexToJSON(index: Index): string { return JSON.stringify(Index$outboundSchema.parse(index)); } export function indexFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Index$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Index' from JSON`, ); }