/* * 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 { BillingCadence, BillingCadence$inboundSchema, } from "./billing-cadence.js"; import { BillingPeriod, BillingPeriod$inboundSchema, } from "./billing-period.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type BillingCycleInfo = { /** * billing_anchor is the new billing anchor */ billingAnchor?: Date | undefined; billingCadence?: BillingCadence | undefined; billingPeriod?: BillingPeriod | undefined; /** * billing_period_count is the billing period count */ billingPeriodCount?: number | undefined; /** * period_end is the end of the new billing period */ periodEnd?: Date | undefined; /** * period_start is the start of the new billing period */ periodStart?: Date | undefined; }; /** @internal */ export const BillingCycleInfo$inboundSchema: z.ZodMiniType< BillingCycleInfo, unknown > = z.pipe( z.object({ billing_anchor: types.optional(types.date()), billing_cadence: types.optional(BillingCadence$inboundSchema), billing_period: types.optional(BillingPeriod$inboundSchema), billing_period_count: types.optional(types.number()), period_end: types.optional(types.date()), period_start: types.optional(types.date()), }), z.transform((v) => { return remap$(v, { "billing_anchor": "billingAnchor", "billing_cadence": "billingCadence", "billing_period": "billingPeriod", "billing_period_count": "billingPeriodCount", "period_end": "periodEnd", "period_start": "periodStart", }); }), ); export function billingCycleInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillingCycleInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillingCycleInfo' from JSON`, ); }