/* * 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"; export type GetCostAnalyticsRequest = { endTime?: Date | undefined; /** * Expand options - specify which entities to expand */ expand?: Array | undefined; /** * Optional - for specific customer */ externalCustomerId?: string | undefined; /** * Additional filters */ featureIds?: Array | undefined; /** * IncludeChildren, when true and ExternalCustomerID belongs to a parent * * @remarks * customer, aggregates every inherited-child customer's usage into the * revenue and cost totals. Default (false) restricts the query to the * customer's own usage — mirrors the meter-usage analytics contract. */ includeChildren?: boolean | undefined; /** * Pagination */ limit?: number | undefined; offset?: number | undefined; /** * Property filters to filter the events by the keys in `properties` field of the event */ propertyFilters?: { [k: string]: Array } | undefined; /** * Time range fields (optional - defaults to last 7 days if not provided) */ startTime?: Date | undefined; }; /** @internal */ export type GetCostAnalyticsRequest$Outbound = { end_time?: string | undefined; expand?: Array | undefined; external_customer_id?: string | undefined; feature_ids?: Array | undefined; include_children?: boolean | undefined; limit?: number | undefined; offset?: number | undefined; property_filters?: { [k: string]: Array } | undefined; start_time?: string | undefined; }; /** @internal */ export const GetCostAnalyticsRequest$outboundSchema: z.ZodMiniType< GetCostAnalyticsRequest$Outbound, GetCostAnalyticsRequest > = z.pipe( z.object({ 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())), includeChildren: z.optional(z.boolean()), limit: z.optional(z.int()), offset: z.optional(z.int()), propertyFilters: z.optional(z.record(z.string(), z.array(z.string()))), startTime: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), }), z.transform((v) => { return remap$(v, { endTime: "end_time", externalCustomerId: "external_customer_id", featureIds: "feature_ids", includeChildren: "include_children", propertyFilters: "property_filters", startTime: "start_time", }); }), ); export function getCostAnalyticsRequestToJSON( getCostAnalyticsRequest: GetCostAnalyticsRequest, ): string { return JSON.stringify( GetCostAnalyticsRequest$outboundSchema.parse(getCostAnalyticsRequest), ); }