/* * 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 { CustomerCustomerMeterMeter, CustomerCustomerMeterMeter$inboundSchema, } from "./customercustomermetermeter.js"; export type CustomerCustomerMeter = { /** * The ID of the object. */ id: string; /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the customer. */ customerId: string; /** * The ID of the meter. */ meterId: string; /** * The number of consumed units. */ consumedUnits: number; /** * The number of credited units. */ creditedUnits: number; /** * The balance of the meter, i.e. the difference between credited and consumed units. */ balance: number; meter: CustomerCustomerMeterMeter; }; /** @internal */ export const CustomerCustomerMeter$inboundSchema: z.ZodMiniType< CustomerCustomerMeter, unknown > = z.pipe( z.object({ id: z.string(), 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))), ), customer_id: z.string(), meter_id: z.string(), consumed_units: z.number(), credited_units: z.int(), balance: z.number(), meter: CustomerCustomerMeterMeter$inboundSchema, }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "customer_id": "customerId", "meter_id": "meterId", "consumed_units": "consumedUnits", "credited_units": "creditedUnits", }); }), ); export function customerCustomerMeterFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerCustomerMeter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerCustomerMeter' from JSON`, ); }