/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 CreditExpiration = { /** * The current balance of the credit expiration. */ balance: number; /** * The date and time the credit expiration was created. */ createdAt?: Date | undefined; /** * The date and time the credit expiration will expire. */ expiresAt?: Date | undefined; /** * The initial balance of the credit expiration (i.e. how much was purchased). */ initialBalance: number; }; /** @internal */ export const CreditExpiration$inboundSchema: z.ZodType< CreditExpiration, z.ZodTypeDef, unknown > = z.object({ balance: z.number().int(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), initial_balance: z.number().int(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "expires_at": "expiresAt", "initial_balance": "initialBalance", }); }); export function creditExpirationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreditExpiration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreditExpiration' from JSON`, ); }