/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * A field used in a payment service */ export type Field = { /** * The ID of the configured field. */ key: string; /** * The value of the configured field. */ value: string; }; /** @internal */ export const Field$inboundSchema: z.ZodType = z .object({ key: z.string(), value: z.string(), }); /** @internal */ export type Field$Outbound = { key: string; value: string; }; /** @internal */ export const Field$outboundSchema: z.ZodType< Field$Outbound, z.ZodTypeDef, Field > = z.object({ key: z.string(), value: z.string(), }); export function fieldToJSON(field: Field): string { return JSON.stringify(Field$outboundSchema.parse(field)); } export function fieldFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Field$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Field' from JSON`, ); }