/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { CheckoutSessionResponse, CheckoutSessionResponse$inboundSchema, } from "./checkout-session-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { WalletResponse, WalletResponse$inboundSchema, } from "./wallet-response.js"; import { WalletTransactionResponse, WalletTransactionResponse$inboundSchema, } from "./wallet-transaction-response.js"; export type TopUpWalletResponse = { checkoutSession?: CheckoutSessionResponse | undefined; /** * Invoice ID if an invoice was created (only for PURCHASED_CREDIT_INVOICED) */ invoiceId?: string | undefined; wallet?: WalletResponse | undefined; walletTransaction?: WalletTransactionResponse | undefined; }; /** @internal */ export const TopUpWalletResponse$inboundSchema: z.ZodMiniType< TopUpWalletResponse, unknown > = z.pipe( z.object({ checkout_session: types.optional(CheckoutSessionResponse$inboundSchema), invoice_id: types.optional(types.string()), wallet: types.optional(WalletResponse$inboundSchema), wallet_transaction: types.optional(WalletTransactionResponse$inboundSchema), }), z.transform((v) => { return remap$(v, { "checkout_session": "checkoutSession", "invoice_id": "invoiceId", "wallet_transaction": "walletTransaction", }); }), ); export function topUpWalletResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TopUpWalletResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TopUpWalletResponse' from JSON`, ); }