/* * 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 { Block, Block$inboundSchema, Block$Outbound, Block$outboundSchema, } from "./block.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type ListBlocksResponse = { data: Array; maxBlockIndex: number; totalBlocks: number; }; /** @internal */ export const ListBlocksResponse$inboundSchema: z.ZodType< ListBlocksResponse, z.ZodTypeDef, unknown > = z.object({ data: z.array(Block$inboundSchema), max_block_index: z.number().int(), total_blocks: z.number().int(), }).transform((v) => { return remap$(v, { "max_block_index": "maxBlockIndex", "total_blocks": "totalBlocks", }); }); /** @internal */ export type ListBlocksResponse$Outbound = { data: Array; max_block_index: number; total_blocks: number; }; /** @internal */ export const ListBlocksResponse$outboundSchema: z.ZodType< ListBlocksResponse$Outbound, z.ZodTypeDef, ListBlocksResponse > = z.object({ data: z.array(Block$outboundSchema), maxBlockIndex: z.number().int(), totalBlocks: z.number().int(), }).transform((v) => { return remap$(v, { maxBlockIndex: "max_block_index", totalBlocks: "total_blocks", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ListBlocksResponse$ { /** @deprecated use `ListBlocksResponse$inboundSchema` instead. */ export const inboundSchema = ListBlocksResponse$inboundSchema; /** @deprecated use `ListBlocksResponse$outboundSchema` instead. */ export const outboundSchema = ListBlocksResponse$outboundSchema; /** @deprecated use `ListBlocksResponse$Outbound` instead. */ export type Outbound = ListBlocksResponse$Outbound; } export function listBlocksResponseToJSON( listBlocksResponse: ListBlocksResponse, ): string { return JSON.stringify( ListBlocksResponse$outboundSchema.parse(listBlocksResponse), ); } export function listBlocksResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListBlocksResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBlocksResponse' from JSON`, ); }