/* * 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 { Bucket, Bucket$inboundSchema } from "./bucket.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type BucketSummary = { baseCharge?: string | undefined; bucketId?: string | undefined; commitmentType?: string | undefined; commitmentValue?: string | undefined; computedOverage?: string | undefined; computedTrueUp?: string | undefined; computedUtilized?: string | undefined; end?: Bucket | undefined; /** * PriceID is the bucket's own price (the line item's price for the * * @remarks * out-of-bucket row). */ priceId?: string | undefined; start?: Bucket | undefined; /** * SubscriptionLineItemID is the line item this bucket is configured on. */ subscriptionLineItemId?: string | undefined; totalUsage?: string | undefined; }; /** @internal */ export const BucketSummary$inboundSchema: z.ZodMiniType< BucketSummary, unknown > = z.pipe( z.object({ base_charge: types.optional(types.string()), bucket_id: types.optional(types.string()), commitment_type: types.optional(types.string()), commitment_value: types.optional(types.string()), computed_overage: types.optional(types.string()), computed_true_up: types.optional(types.string()), computed_utilized: types.optional(types.string()), end: types.optional(Bucket$inboundSchema), price_id: types.optional(types.string()), start: types.optional(Bucket$inboundSchema), subscription_line_item_id: types.optional(types.string()), total_usage: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "base_charge": "baseCharge", "bucket_id": "bucketId", "commitment_type": "commitmentType", "commitment_value": "commitmentValue", "computed_overage": "computedOverage", "computed_true_up": "computedTrueUp", "computed_utilized": "computedUtilized", "price_id": "priceId", "subscription_line_item_id": "subscriptionLineItemId", "total_usage": "totalUsage", }); }), ); export function bucketSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BucketSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BucketSummary' from JSON`, ); }