/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type InvoiceResponse = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; }; /** @internal */ export const InvoiceResponse$inboundSchema: z.ZodType< InvoiceResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), downstream_id: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", }); }); /** @internal */ export type InvoiceResponse$Outbound = { id?: string | undefined; downstream_id?: string | null | undefined; }; /** @internal */ export const InvoiceResponse$outboundSchema: z.ZodType< InvoiceResponse$Outbound, z.ZodTypeDef, InvoiceResponse > = z.object({ id: z.string().optional(), downstreamId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { downstreamId: "downstream_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InvoiceResponse$ { /** @deprecated use `InvoiceResponse$inboundSchema` instead. */ export const inboundSchema = InvoiceResponse$inboundSchema; /** @deprecated use `InvoiceResponse$outboundSchema` instead. */ export const outboundSchema = InvoiceResponse$outboundSchema; /** @deprecated use `InvoiceResponse$Outbound` instead. */ export type Outbound = InvoiceResponse$Outbound; } export function invoiceResponseToJSON( invoiceResponse: InvoiceResponse, ): string { return JSON.stringify(InvoiceResponse$outboundSchema.parse(invoiceResponse)); } export function invoiceResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvoiceResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvoiceResponse' from JSON`, ); }