/* * 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"; export type IndexerStatusResource = { id?: number | undefined; indexerId?: number | undefined; disabledTill?: Date | null | undefined; mostRecentFailure?: Date | null | undefined; initialFailure?: Date | null | undefined; }; /** @internal */ export const IndexerStatusResource$inboundSchema: z.ZodType< IndexerStatusResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), indexerId: z.number().int().optional(), disabledTill: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), mostRecentFailure: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), initialFailure: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }); /** @internal */ export type IndexerStatusResource$Outbound = { id?: number | undefined; indexerId?: number | undefined; disabledTill?: string | null | undefined; mostRecentFailure?: string | null | undefined; initialFailure?: string | null | undefined; }; /** @internal */ export const IndexerStatusResource$outboundSchema: z.ZodType< IndexerStatusResource$Outbound, z.ZodTypeDef, IndexerStatusResource > = z.object({ id: z.number().int().optional(), indexerId: z.number().int().optional(), disabledTill: z.nullable(z.date().transform(v => v.toISOString())).optional(), mostRecentFailure: z.nullable(z.date().transform(v => v.toISOString())) .optional(), initialFailure: z.nullable(z.date().transform(v => v.toISOString())) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IndexerStatusResource$ { /** @deprecated use `IndexerStatusResource$inboundSchema` instead. */ export const inboundSchema = IndexerStatusResource$inboundSchema; /** @deprecated use `IndexerStatusResource$outboundSchema` instead. */ export const outboundSchema = IndexerStatusResource$outboundSchema; /** @deprecated use `IndexerStatusResource$Outbound` instead. */ export type Outbound = IndexerStatusResource$Outbound; } export function indexerStatusResourceToJSON( indexerStatusResource: IndexerStatusResource, ): string { return JSON.stringify( IndexerStatusResource$outboundSchema.parse(indexerStatusResource), ); } export function indexerStatusResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IndexerStatusResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IndexerStatusResource' from JSON`, ); }