/* * 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 { CreatePriceTier, CreatePriceTier$Outbound, CreatePriceTier$outboundSchema, } from "./create-price-tier.js"; import { InvoiceCadence, InvoiceCadence$outboundSchema, } from "./invoice-cadence.js"; import { PriceEntityType, PriceEntityType$outboundSchema, } from "./price-entity-type.js"; import { PriceTransformQuantity, PriceTransformQuantity$Outbound, PriceTransformQuantity$outboundSchema, } from "./price-transform-quantity.js"; import { PriceType, PriceType$outboundSchema } from "./price-type.js"; import { PriceUnitConfig, PriceUnitConfig$Outbound, PriceUnitConfig$outboundSchema, } from "./price-unit-config.js"; import { PriceUnitType, PriceUnitType$outboundSchema, } from "./price-unit-type.js"; export type CreatePriceRequest = { amount?: string | undefined; billingModel: BillingModel; billingPeriod: BillingPeriod; billingPeriodCount?: number | undefined; currency: string; description?: string | undefined; displayName?: string | undefined; endDate?: Date | undefined; entityId: string; entityType: PriceEntityType; filterValues?: { [k: string]: Array } | undefined; /** * GroupID is the id of the group to add the price to */ groupId?: string | undefined; invoiceCadence: InvoiceCadence; lookupKey?: string | undefined; metadata?: { [k: string]: string } | undefined; meterId?: string | undefined; /** * MinQuantity is the minimum quantity of the price */ minQuantity?: number | undefined; priceUnitConfig?: PriceUnitConfig | undefined; priceUnitType: PriceUnitType; startDate?: Date | undefined; tierMode?: BillingTier | undefined; tiers?: Array | undefined; transformQuantity?: PriceTransformQuantity | undefined; trialPeriodDays?: number | undefined; type: PriceType; }; /** @internal */ export type CreatePriceRequest$Outbound = { amount?: string | undefined; billing_model: string; billing_period: string; billing_period_count?: number | undefined; currency: string; description?: string | undefined; display_name?: string | undefined; end_date?: string | undefined; entity_id: string; entity_type: string; filter_values?: { [k: string]: Array } | undefined; group_id?: string | undefined; invoice_cadence: string; lookup_key?: string | undefined; metadata?: { [k: string]: string } | undefined; meter_id?: string | undefined; min_quantity?: number | undefined; price_unit_config?: PriceUnitConfig$Outbound | undefined; price_unit_type: string; start_date?: string | undefined; tier_mode?: string | undefined; tiers?: Array | undefined; transform_quantity?: PriceTransformQuantity$Outbound | undefined; trial_period_days?: number | undefined; type: string; }; /** @internal */ export const CreatePriceRequest$outboundSchema: z.ZodMiniType< CreatePriceRequest$Outbound, CreatePriceRequest > = z.pipe( z.object({ amount: z.optional(z.string()), billingModel: BillingModel$outboundSchema, billingPeriod: BillingPeriod$outboundSchema, billingPeriodCount: z.optional(z.int()), currency: z.string(), description: z.optional(z.string()), displayName: z.optional(z.string()), endDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), entityId: z.string(), entityType: PriceEntityType$outboundSchema, filterValues: z.optional(z.record(z.string(), z.array(z.string()))), groupId: z.optional(z.string()), invoiceCadence: InvoiceCadence$outboundSchema, lookupKey: z.optional(z.string()), metadata: z.optional(z.record(z.string(), z.string())), meterId: z.optional(z.string()), minQuantity: z.optional(z.int()), priceUnitConfig: z.optional(PriceUnitConfig$outboundSchema), priceUnitType: PriceUnitType$outboundSchema, startDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), tierMode: z.optional(BillingTier$outboundSchema), tiers: z.optional(z.array(CreatePriceTier$outboundSchema)), transformQuantity: z.optional(PriceTransformQuantity$outboundSchema), trialPeriodDays: z.optional(z.int()), type: PriceType$outboundSchema, }), z.transform((v) => { return remap$(v, { billingModel: "billing_model", billingPeriod: "billing_period", billingPeriodCount: "billing_period_count", displayName: "display_name", endDate: "end_date", entityId: "entity_id", entityType: "entity_type", filterValues: "filter_values", groupId: "group_id", invoiceCadence: "invoice_cadence", lookupKey: "lookup_key", meterId: "meter_id", minQuantity: "min_quantity", priceUnitConfig: "price_unit_config", priceUnitType: "price_unit_type", startDate: "start_date", tierMode: "tier_mode", transformQuantity: "transform_quantity", trialPeriodDays: "trial_period_days", }); }), ); export function createPriceRequestToJSON( createPriceRequest: CreatePriceRequest, ): string { return JSON.stringify( CreatePriceRequest$outboundSchema.parse(createPriceRequest), ); }