/* * 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"; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ export type DecimalCreate = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** @internal */ export const DecimalCreate$inboundSchema: z.ZodType< DecimalCreate, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type DecimalCreate$Outbound = { value?: string | undefined; }; /** @internal */ export const DecimalCreate$outboundSchema: z.ZodType< DecimalCreate$Outbound, z.ZodTypeDef, DecimalCreate > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DecimalCreate$ { /** @deprecated use `DecimalCreate$inboundSchema` instead. */ export const inboundSchema = DecimalCreate$inboundSchema; /** @deprecated use `DecimalCreate$outboundSchema` instead. */ export const outboundSchema = DecimalCreate$outboundSchema; /** @deprecated use `DecimalCreate$Outbound` instead. */ export type Outbound = DecimalCreate$Outbound; } export function decimalCreateToJSON(decimalCreate: DecimalCreate): string { return JSON.stringify(DecimalCreate$outboundSchema.parse(decimalCreate)); } export function decimalCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DecimalCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DecimalCreate' from JSON`, ); }