/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const GetApiV3BitcoinMainChainHeightFormat = { Json: "json", Csv: "csv", } as const; export type GetApiV3BitcoinMainChainHeightFormat = ClosedEnum< typeof GetApiV3BitcoinMainChainHeightFormat >; /** * Network */ export const GetApiV3BitcoinMainChainHeightNetwork = { Mainnet: "mainnet", Testnet: "testnet", } as const; /** * Network */ export type GetApiV3BitcoinMainChainHeightNetwork = ClosedEnum< typeof GetApiV3BitcoinMainChainHeightNetwork >; export type GetApiV3BitcoinMainChainHeightRequest = { /** * Start Timestamp */ start?: number | null | undefined; /** * End Timestamp */ end?: number | null | undefined; format?: GetApiV3BitcoinMainChainHeightFormat | undefined; /** * Float Step value */ step?: number | undefined; /** * Network */ network?: GetApiV3BitcoinMainChainHeightNetwork | undefined; }; /** @internal */ export const GetApiV3BitcoinMainChainHeightFormat$inboundSchema: z.ZodNativeEnum = z.nativeEnum( GetApiV3BitcoinMainChainHeightFormat, ); /** @internal */ export const GetApiV3BitcoinMainChainHeightFormat$outboundSchema: z.ZodNativeEnum = GetApiV3BitcoinMainChainHeightFormat$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3BitcoinMainChainHeightFormat$ { /** @deprecated use `GetApiV3BitcoinMainChainHeightFormat$inboundSchema` instead. */ export const inboundSchema = GetApiV3BitcoinMainChainHeightFormat$inboundSchema; /** @deprecated use `GetApiV3BitcoinMainChainHeightFormat$outboundSchema` instead. */ export const outboundSchema = GetApiV3BitcoinMainChainHeightFormat$outboundSchema; } /** @internal */ export const GetApiV3BitcoinMainChainHeightNetwork$inboundSchema: z.ZodNativeEnum = z.nativeEnum( GetApiV3BitcoinMainChainHeightNetwork, ); /** @internal */ export const GetApiV3BitcoinMainChainHeightNetwork$outboundSchema: z.ZodNativeEnum = GetApiV3BitcoinMainChainHeightNetwork$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3BitcoinMainChainHeightNetwork$ { /** @deprecated use `GetApiV3BitcoinMainChainHeightNetwork$inboundSchema` instead. */ export const inboundSchema = GetApiV3BitcoinMainChainHeightNetwork$inboundSchema; /** @deprecated use `GetApiV3BitcoinMainChainHeightNetwork$outboundSchema` instead. */ export const outboundSchema = GetApiV3BitcoinMainChainHeightNetwork$outboundSchema; } /** @internal */ export const GetApiV3BitcoinMainChainHeightRequest$inboundSchema: z.ZodType< GetApiV3BitcoinMainChainHeightRequest, z.ZodTypeDef, unknown > = z.object({ start: z.nullable(z.number()).default(null), end: z.nullable(z.number()).default(null), format: GetApiV3BitcoinMainChainHeightFormat$inboundSchema.default("json"), step: z.number().default(7200), network: GetApiV3BitcoinMainChainHeightNetwork$inboundSchema.default( "mainnet", ), }); /** @internal */ export type GetApiV3BitcoinMainChainHeightRequest$Outbound = { start: number | null; end: number | null; format: string; step: number; network: string; }; /** @internal */ export const GetApiV3BitcoinMainChainHeightRequest$outboundSchema: z.ZodType< GetApiV3BitcoinMainChainHeightRequest$Outbound, z.ZodTypeDef, GetApiV3BitcoinMainChainHeightRequest > = z.object({ start: z.nullable(z.number()).default(null), end: z.nullable(z.number()).default(null), format: GetApiV3BitcoinMainChainHeightFormat$outboundSchema.default("json"), step: z.number().default(7200), network: GetApiV3BitcoinMainChainHeightNetwork$outboundSchema.default( "mainnet", ), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetApiV3BitcoinMainChainHeightRequest$ { /** @deprecated use `GetApiV3BitcoinMainChainHeightRequest$inboundSchema` instead. */ export const inboundSchema = GetApiV3BitcoinMainChainHeightRequest$inboundSchema; /** @deprecated use `GetApiV3BitcoinMainChainHeightRequest$outboundSchema` instead. */ export const outboundSchema = GetApiV3BitcoinMainChainHeightRequest$outboundSchema; /** @deprecated use `GetApiV3BitcoinMainChainHeightRequest$Outbound` instead. */ export type Outbound = GetApiV3BitcoinMainChainHeightRequest$Outbound; } export function getApiV3BitcoinMainChainHeightRequestToJSON( getApiV3BitcoinMainChainHeightRequest: GetApiV3BitcoinMainChainHeightRequest, ): string { return JSON.stringify( GetApiV3BitcoinMainChainHeightRequest$outboundSchema.parse( getApiV3BitcoinMainChainHeightRequest, ), ); } export function getApiV3BitcoinMainChainHeightRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetApiV3BitcoinMainChainHeightRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetApiV3BitcoinMainChainHeightRequest' from JSON`, ); }