/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { HostStatistics, HostStatistics$inboundSchema, HostStatistics$Outbound, HostStatistics$outboundSchema, } from "./hoststatistics.js"; import { IndexerStatistics, IndexerStatistics$inboundSchema, IndexerStatistics$Outbound, IndexerStatistics$outboundSchema, } from "./indexerstatistics.js"; import { UserAgentStatistics, UserAgentStatistics$inboundSchema, UserAgentStatistics$Outbound, UserAgentStatistics$outboundSchema, } from "./useragentstatistics.js"; export type IndexerStatsResource = { id?: number | undefined; indexers?: Array | null | undefined; userAgents?: Array | null | undefined; hosts?: Array | null | undefined; }; /** @internal */ export const IndexerStatsResource$inboundSchema: z.ZodType< IndexerStatsResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), indexers: z.nullable(z.array(IndexerStatistics$inboundSchema)).optional(), userAgents: z.nullable(z.array(UserAgentStatistics$inboundSchema)).optional(), hosts: z.nullable(z.array(HostStatistics$inboundSchema)).optional(), }); /** @internal */ export type IndexerStatsResource$Outbound = { id?: number | undefined; indexers?: Array | null | undefined; userAgents?: Array | null | undefined; hosts?: Array | null | undefined; }; /** @internal */ export const IndexerStatsResource$outboundSchema: z.ZodType< IndexerStatsResource$Outbound, z.ZodTypeDef, IndexerStatsResource > = z.object({ id: z.number().int().optional(), indexers: z.nullable(z.array(IndexerStatistics$outboundSchema)).optional(), userAgents: z.nullable(z.array(UserAgentStatistics$outboundSchema)) .optional(), hosts: z.nullable(z.array(HostStatistics$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IndexerStatsResource$ { /** @deprecated use `IndexerStatsResource$inboundSchema` instead. */ export const inboundSchema = IndexerStatsResource$inboundSchema; /** @deprecated use `IndexerStatsResource$outboundSchema` instead. */ export const outboundSchema = IndexerStatsResource$outboundSchema; /** @deprecated use `IndexerStatsResource$Outbound` instead. */ export type Outbound = IndexerStatsResource$Outbound; } export function indexerStatsResourceToJSON( indexerStatsResource: IndexerStatsResource, ): string { return JSON.stringify( IndexerStatsResource$outboundSchema.parse(indexerStatsResource), ); } export function indexerStatsResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IndexerStatsResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IndexerStatsResource' from JSON`, ); }