/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type SourceUsageItem = { /** * cost is the cost attributed to this source for the line item */ cost?: string | undefined; /** * event_count is the number of events from this source (optional) */ eventCount?: number | undefined; /** * percentage is the percentage of total line item cost from this source (optional) */ percentage?: string | undefined; /** * source is the name of the event source */ source?: string | undefined; /** * usage is the total usage amount from this source (optional, for additional context) */ usage?: string | undefined; }; /** @internal */ export const SourceUsageItem$inboundSchema: z.ZodMiniType< SourceUsageItem, unknown > = z.pipe( z.object({ cost: types.optional(types.string()), event_count: types.optional(types.number()), percentage: types.optional(types.string()), source: types.optional(types.string()), usage: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "event_count": "eventCount", }); }), ); export function sourceUsageItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SourceUsageItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SourceUsageItem' from JSON`, ); }