/* * 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 { BillingTier, BillingTier$outboundSchema } from "./billing-tier.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 UpdatePriceRequest = { /** * Amount is the new price amount that overrides the original price (optional) */ amount?: string | undefined; billingModel?: BillingModel | undefined; description?: string | undefined; displayName?: string | undefined; effectiveFrom?: string | undefined; /** * GroupID is the id of the group to update the price in. * * @remarks * If not provided (nil), the group will not be changed * If provided as empty string (""), the group will be removed (price will be ungrouped) * If provided as a group ID, the price will be assigned to that group (must exist and be published) */ groupId?: string | undefined; /** * All price fields that can be updated * * @remarks * Non-critical fields (can be updated directly) */ lookupKey?: string | undefined; metadata?: { [k: string]: string } | undefined; /** * PriceUnitAmount is the price unit amount (for CUSTOM price unit type, FLAT_FEE/PACKAGE billing models) */ priceUnitAmount?: string | undefined; /** * PriceUnitTiers are the price unit tiers (for CUSTOM price unit type, TIERED billing model) */ priceUnitTiers?: Array | undefined; tierMode?: BillingTier | undefined; /** * Tiers determines the pricing tiers for this line item */ tiers?: Array | undefined; transformQuantity?: PriceTransformQuantity | undefined; }; /** @internal */ export type UpdatePriceRequest$Outbound = { amount?: string | undefined; billing_model?: string | undefined; description?: string | undefined; display_name?: string | undefined; effective_from?: string | undefined; group_id?: string | undefined; lookup_key?: string | undefined; metadata?: { [k: string]: string } | undefined; price_unit_amount?: string | undefined; price_unit_tiers?: Array | undefined; tier_mode?: string | undefined; tiers?: Array | undefined; transform_quantity?: PriceTransformQuantity$Outbound | undefined; }; /** @internal */ export const UpdatePriceRequest$outboundSchema: z.ZodMiniType< UpdatePriceRequest$Outbound, UpdatePriceRequest > = z.pipe( z.object({ amount: z.optional(z.string()), billingModel: z.optional(BillingModel$outboundSchema), description: z.optional(z.string()), displayName: z.optional(z.string()), effectiveFrom: z.optional(z.string()), groupId: z.optional(z.string()), lookupKey: z.optional(z.string()), metadata: z.optional(z.record(z.string(), z.string())), priceUnitAmount: z.optional(z.string()), priceUnitTiers: z.optional(z.array(CreatePriceTier$outboundSchema)), 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", displayName: "display_name", effectiveFrom: "effective_from", groupId: "group_id", lookupKey: "lookup_key", priceUnitAmount: "price_unit_amount", priceUnitTiers: "price_unit_tiers", tierMode: "tier_mode", transformQuantity: "transform_quantity", }); }), ); export function updatePriceRequestToJSON( updatePriceRequest: UpdatePriceRequest, ): string { return JSON.stringify( UpdatePriceRequest$outboundSchema.parse(updatePriceRequest), ); }