/* * 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 { ClosedEnum } from "../../types/enums.js"; import { BillingPeriod, BillingPeriod$outboundSchema, } from "./billing-period.js"; import { FilterCondition, FilterCondition$Outbound, FilterCondition$outboundSchema, } from "./filter-condition.js"; import { PriceEntityType, PriceEntityType$outboundSchema, } from "./price-entity-type.js"; import { Status, Status$outboundSchema } from "./status.js"; export const PriceFilterOrder = { Asc: "asc", Desc: "desc", } as const; export type PriceFilterOrder = ClosedEnum; export type PriceFilter = { allowExpiredPrices?: boolean | undefined; billingPeriods?: Array | undefined; endTime?: Date | undefined; entityIds?: Array | undefined; entityType?: PriceEntityType | undefined; expand?: string | undefined; /** * DSL filters */ filters?: Array | undefined; limit?: number | undefined; meterIds?: Array | undefined; offset?: number | undefined; order?: PriceFilterOrder | undefined; parentPriceId?: string | undefined; /** * Price override filtering fields */ planIds?: Array | undefined; priceIds?: Array | undefined; sort?: string | undefined; startDateLt?: string | undefined; startTime?: Date | undefined; status?: Status | undefined; subscriptionId?: string | undefined; }; /** @internal */ export const PriceFilterOrder$outboundSchema: z.ZodMiniEnum< typeof PriceFilterOrder > = z.enum(PriceFilterOrder); /** @internal */ export type PriceFilter$Outbound = { allow_expired_prices: boolean; billing_periods?: Array | undefined; end_time?: string | undefined; entity_ids?: Array | undefined; entity_type?: string | undefined; expand?: string | undefined; filters?: Array | undefined; limit?: number | undefined; meter_ids?: Array | undefined; offset?: number | undefined; order?: string | undefined; parent_price_id?: string | undefined; plan_ids?: Array | undefined; price_ids?: Array | undefined; sort?: string | undefined; start_date_lt?: string | undefined; start_time?: string | undefined; status?: string | undefined; subscription_id?: string | undefined; }; /** @internal */ export const PriceFilter$outboundSchema: z.ZodMiniType< PriceFilter$Outbound, PriceFilter > = z.pipe( z.object({ allowExpiredPrices: z._default(z.boolean(), false), billingPeriods: z.optional(z.array(BillingPeriod$outboundSchema)), endTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), entityIds: z.optional(z.array(z.string())), entityType: z.optional(PriceEntityType$outboundSchema), expand: z.optional(z.string()), filters: z.optional(z.array(FilterCondition$outboundSchema)), limit: z.optional(z.int()), meterIds: z.optional(z.array(z.string())), offset: z.optional(z.int()), order: z.optional(PriceFilterOrder$outboundSchema), parentPriceId: z.optional(z.string()), planIds: z.optional(z.array(z.string())), priceIds: z.optional(z.array(z.string())), sort: z.optional(z.string()), startDateLt: z.optional(z.string()), startTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), status: z.optional(Status$outboundSchema), subscriptionId: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { allowExpiredPrices: "allow_expired_prices", billingPeriods: "billing_periods", endTime: "end_time", entityIds: "entity_ids", entityType: "entity_type", meterIds: "meter_ids", parentPriceId: "parent_price_id", planIds: "plan_ids", priceIds: "price_ids", startDateLt: "start_date_lt", startTime: "start_time", subscriptionId: "subscription_id", }); }), ); export function priceFilterToJSON(priceFilter: PriceFilter): string { return JSON.stringify(PriceFilter$outboundSchema.parse(priceFilter)); }