/* * 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 { BillingModel, BillingModel$outboundSchema } from "./billing-model.js"; import { BillingPeriod, BillingPeriod$outboundSchema, } from "./billing-period.js"; import { BillingTier, BillingTier$outboundSchema } from "./billing-tier.js"; import { CommitmentBucketRequest, CommitmentBucketRequest$Outbound, CommitmentBucketRequest$outboundSchema, } from "./commitment-bucket-request.js"; import { CommitmentType, CommitmentType$outboundSchema, } from "./commitment-type.js"; import { CreatePriceTier, CreatePriceTier$Outbound, CreatePriceTier$outboundSchema, } from "./create-price-tier.js"; import { PriceTransformQuantity, PriceTransformQuantity$Outbound, PriceTransformQuantity$outboundSchema, } from "./price-transform-quantity.js"; export type UpdateSubscriptionLineItemRequest = { /** * Amount is the new price amount that overrides the original price */ amount?: string | undefined; billingModel?: BillingModel | undefined; /** * Commitment fields */ commitmentAmount?: number | undefined; commitmentDuration?: BillingPeriod | undefined; commitmentOverageFactor?: number | undefined; commitmentQuantity?: number | undefined; /** * Pointer so an explicit empty array can clear existing buckets (omission keeps them). */ commitmentTimeBuckets?: Array | undefined; commitmentTrueUpEnabled?: boolean | undefined; commitmentType?: CommitmentType | undefined; commitmentWindowed?: boolean | undefined; /** * EffectiveFrom for the existing line item (if not provided, defaults to now) */ effectiveFrom?: string | undefined; /** * Metadata for the new line item */ metadata?: { [k: string]: string } | undefined; tierMode?: BillingTier | undefined; /** * Tiers determines the pricing tiers for this line item */ tiers?: Array | undefined; transformQuantity?: PriceTransformQuantity | undefined; }; /** @internal */ export type UpdateSubscriptionLineItemRequest$Outbound = { amount?: string | undefined; billing_model?: string | undefined; commitment_amount?: number | undefined; commitment_duration?: string | undefined; commitment_overage_factor?: number | undefined; commitment_quantity?: number | undefined; commitment_time_buckets?: Array | undefined; commitment_true_up_enabled?: boolean | undefined; commitment_type?: string | undefined; commitment_windowed?: boolean | undefined; effective_from?: string | undefined; metadata?: { [k: string]: string } | undefined; tier_mode?: string | undefined; tiers?: Array | undefined; transform_quantity?: PriceTransformQuantity$Outbound | undefined; }; /** @internal */ export const UpdateSubscriptionLineItemRequest$outboundSchema: z.ZodMiniType< UpdateSubscriptionLineItemRequest$Outbound, UpdateSubscriptionLineItemRequest > = z.pipe( z.object({ amount: z.optional(z.string()), billingModel: z.optional(BillingModel$outboundSchema), commitmentAmount: z.optional(z.number()), commitmentDuration: z.optional(BillingPeriod$outboundSchema), commitmentOverageFactor: z.optional(z.number()), commitmentQuantity: z.optional(z.number()), commitmentTimeBuckets: z.optional( z.array(CommitmentBucketRequest$outboundSchema), ), commitmentTrueUpEnabled: z.optional(z.boolean()), commitmentType: z.optional(CommitmentType$outboundSchema), commitmentWindowed: z.optional(z.boolean()), effectiveFrom: z.optional(z.string()), metadata: z.optional(z.record(z.string(), z.string())), tierMode: z.optional(BillingTier$outboundSchema), tiers: z.optional(z.array(CreatePriceTier$outboundSchema)), transformQuantity: z.optional(PriceTransformQuantity$outboundSchema), }), z.transform((v) => { return remap$(v, { billingModel: "billing_model", commitmentAmount: "commitment_amount", commitmentDuration: "commitment_duration", commitmentOverageFactor: "commitment_overage_factor", commitmentQuantity: "commitment_quantity", commitmentTimeBuckets: "commitment_time_buckets", commitmentTrueUpEnabled: "commitment_true_up_enabled", commitmentType: "commitment_type", commitmentWindowed: "commitment_windowed", effectiveFrom: "effective_from", tierMode: "tier_mode", transformQuantity: "transform_quantity", }); }), ); export function updateSubscriptionLineItemRequestToJSON( updateSubscriptionLineItemRequest: UpdateSubscriptionLineItemRequest, ): string { return JSON.stringify( UpdateSubscriptionLineItemRequest$outboundSchema.parse( updateSubscriptionLineItemRequest, ), ); }