/* * 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 { BillingPeriod, BillingPeriod$inboundSchema, } from "./billing-period.js"; import { CommitmentType, CommitmentType$inboundSchema, } from "./commitment-type.js"; import { InvoiceCadence, InvoiceCadence$inboundSchema, } from "./invoice-cadence.js"; import { MeterMeter, MeterMeter$inboundSchema } from "./meter-meter.js"; import { PricePrice, PricePrice$inboundSchema } from "./price-price.js"; import { PriceType, PriceType$inboundSchema } from "./price-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; import { SubscriptionLineItemEntityType, SubscriptionLineItemEntityType$inboundSchema, } from "./subscription-line-item-entity-type.js"; import { TimeOfDayBucket, TimeOfDayBucket$inboundSchema, } from "./time-of-day-bucket.js"; export type SubscriptionSubscriptionLineItem = { addonAssociationId?: string | undefined; billingPeriod?: BillingPeriod | undefined; /** * from price at create; default 1 */ billingPeriodCount?: number | undefined; /** * Commitment fields */ commitmentAmount?: string | undefined; commitmentDuration?: BillingPeriod | undefined; commitmentOverageFactor?: string | undefined; commitmentQuantity?: string | undefined; commitmentTimeBuckets?: Array | undefined; commitmentTrueUpEnabled?: boolean | undefined; commitmentType?: CommitmentType | undefined; commitmentWindowed?: boolean | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; currency?: string | undefined; customerId?: string | undefined; displayName?: string | undefined; endDate?: Date | undefined; entityId?: string | undefined; entityType?: SubscriptionLineItemEntityType | undefined; environmentId?: string | undefined; id?: string | undefined; invoiceCadence?: InvoiceCadence | undefined; metadata?: { [k: string]: string } | undefined; meter?: MeterMeter | undefined; meterDisplayName?: string | undefined; meterId?: string | undefined; planDisplayName?: string | undefined; price?: PricePrice | undefined; priceId?: string | undefined; priceType?: PriceType | undefined; priceUnit?: string | undefined; priceUnitId?: string | undefined; quantity?: string | undefined; startDate?: Date | undefined; status?: Status | undefined; subscriptionId?: string | undefined; subscriptionPhaseId?: string | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; }; /** @internal */ export const SubscriptionSubscriptionLineItem$inboundSchema: z.ZodMiniType< SubscriptionSubscriptionLineItem, unknown > = z.pipe( z.object({ addon_association_id: types.optional(types.string()), billing_period: types.optional(BillingPeriod$inboundSchema), billing_period_count: types.optional(types.number()), commitment_amount: types.optional(types.string()), commitment_duration: types.optional(BillingPeriod$inboundSchema), commitment_overage_factor: types.optional(types.string()), commitment_quantity: types.optional(types.string()), commitment_time_buckets: types.optional( z.array(TimeOfDayBucket$inboundSchema), ), commitment_true_up_enabled: types.optional(types.boolean()), commitment_type: types.optional(CommitmentType$inboundSchema), commitment_windowed: types.optional(types.boolean()), created_at: types.optional(types.date()), created_by: types.optional(types.string()), currency: types.optional(types.string()), customer_id: types.optional(types.string()), display_name: types.optional(types.string()), end_date: types.optional(types.date()), entity_id: types.optional(types.string()), entity_type: types.optional(SubscriptionLineItemEntityType$inboundSchema), environment_id: types.optional(types.string()), id: types.optional(types.string()), invoice_cadence: types.optional(InvoiceCadence$inboundSchema), metadata: types.optional(z.record(z.string(), types.string())), meter: types.optional(MeterMeter$inboundSchema), meter_display_name: types.optional(types.string()), meter_id: types.optional(types.string()), plan_display_name: types.optional(types.string()), price: types.optional(PricePrice$inboundSchema), price_id: types.optional(types.string()), price_type: types.optional(PriceType$inboundSchema), price_unit: types.optional(types.string()), price_unit_id: types.optional(types.string()), quantity: types.optional(types.string()), start_date: types.optional(types.date()), status: types.optional(Status$inboundSchema), subscription_id: types.optional(types.string()), subscription_phase_id: types.optional(types.string()), tenant_id: types.optional(types.string()), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "addon_association_id": "addonAssociationId", "billing_period": "billingPeriod", "billing_period_count": "billingPeriodCount", "commitment_amount": "commitmentAmount", "commitment_duration": "commitmentDuration", "commitment_overage_factor": "commitmentOverageFactor", "commitment_quantity": "commitmentQuantity", "commitment_time_buckets": "commitmentTimeBuckets", "commitment_true_up_enabled": "commitmentTrueUpEnabled", "commitment_type": "commitmentType", "commitment_windowed": "commitmentWindowed", "created_at": "createdAt", "created_by": "createdBy", "customer_id": "customerId", "display_name": "displayName", "end_date": "endDate", "entity_id": "entityId", "entity_type": "entityType", "environment_id": "environmentId", "invoice_cadence": "invoiceCadence", "meter_display_name": "meterDisplayName", "meter_id": "meterId", "plan_display_name": "planDisplayName", "price_id": "priceId", "price_type": "priceType", "price_unit": "priceUnit", "price_unit_id": "priceUnitId", "start_date": "startDate", "subscription_id": "subscriptionId", "subscription_phase_id": "subscriptionPhaseId", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", }); }), ); export function subscriptionSubscriptionLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriptionSubscriptionLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionSubscriptionLineItem' from JSON`, ); }