/* * 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 { WindowSize, WindowSize$outboundSchema } from "./window-size.js"; export type GetUsageAnalyticsRequest = { /** * BreakdownBucket when true augments each time-series point with BucketID/PriceID * * @remarks * and appends a BucketSummaries rollup to each item. Requires WindowSize to be set * and the item to be linked to a subscription line item that has CommitmentTimeBuckets. * Default: false (opt-in, backward compatible). */ breakdownBucket?: boolean | undefined; endTime?: Date | undefined; /** * allowed values: "price", "meter", "feature", "subscription_line_item","plan","addon" */ expand?: Array | undefined; /** * ExternalCustomerID is the single external customer ID. * * @remarks * Optional when ExternalCustomerIDs is provided; required otherwise. */ externalCustomerId?: string | undefined; featureIds?: Array | undefined; /** * allowed values: "source", "feature_id", "properties." */ groupBy?: Array | undefined; /** * IncludeChildren when true folds child customers' usage into the single aggregated total. * * @remarks * Default: false. */ includeChildren?: boolean | undefined; /** * Property filters to filter the events by the keys in `properties` field of the event */ propertyFilters?: { [k: string]: Array } | undefined; sources?: Array | undefined; startTime?: Date | undefined; windowSize?: WindowSize | undefined; }; /** @internal */ export type GetUsageAnalyticsRequest$Outbound = { breakdown_bucket?: boolean | undefined; end_time?: string | undefined; expand?: Array | undefined; external_customer_id?: string | undefined; feature_ids?: Array | undefined; group_by?: Array | undefined; include_children?: boolean | undefined; property_filters?: { [k: string]: Array } | undefined; sources?: Array | undefined; start_time?: string | undefined; window_size?: string | undefined; }; /** @internal */ export const GetUsageAnalyticsRequest$outboundSchema: z.ZodMiniType< GetUsageAnalyticsRequest$Outbound, GetUsageAnalyticsRequest > = z.pipe( z.object({ breakdownBucket: z.optional(z.boolean()), endTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), expand: z.optional(z.array(z.string())), externalCustomerId: z.optional(z.string()), featureIds: z.optional(z.array(z.string())), groupBy: z.optional(z.array(z.string())), includeChildren: z.optional(z.boolean()), propertyFilters: z.optional(z.record(z.string(), z.array(z.string()))), sources: z.optional(z.array(z.string())), startTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), windowSize: z.optional(WindowSize$outboundSchema), }), z.transform((v) => { return remap$(v, { breakdownBucket: "breakdown_bucket", endTime: "end_time", externalCustomerId: "external_customer_id", featureIds: "feature_ids", groupBy: "group_by", includeChildren: "include_children", propertyFilters: "property_filters", startTime: "start_time", windowSize: "window_size", }); }), ); export function getUsageAnalyticsRequestToJSON( getUsageAnalyticsRequest: GetUsageAnalyticsRequest, ): string { return JSON.stringify( GetUsageAnalyticsRequest$outboundSchema.parse(getUsageAnalyticsRequest), ); }