/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomerSubscriptionMeterMeter, CustomerSubscriptionMeterMeter$inboundSchema, } from "./customersubscriptionmetermeter.js"; export type CustomerSubscriptionMeter = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the object. */ id: string; /** * The number of consumed units so far in this billing period. */ consumedUnits: number; /** * The number of credited units so far in this billing period. */ creditedUnits: number; /** * The amount due in cents so far in this billing period. */ amount: number; /** * The ID of the meter. */ meterId: string; meter: CustomerSubscriptionMeterMeter; }; /** @internal */ export const CustomerSubscriptionMeter$inboundSchema: z.ZodMiniType< CustomerSubscriptionMeter, unknown > = z.pipe( z.object({ created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), id: z.string(), consumed_units: z.number(), credited_units: z.int(), amount: z.int(), meter_id: z.string(), meter: CustomerSubscriptionMeterMeter$inboundSchema, }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "consumed_units": "consumedUnits", "credited_units": "creditedUnits", "meter_id": "meterId", }); }), ); export function customerSubscriptionMeterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerSubscriptionMeter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerSubscriptionMeter' from JSON`, ); }