/* * 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 { EntitlementGrantDurationUnit, EntitlementGrantDurationUnit$inboundSchema, } from "./entitlement-grant-duration-unit.js"; import { EntitlementGrantMeasure, EntitlementGrantMeasure$inboundSchema, } from "./entitlement-grant-measure.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type AggregatedEntitlementBucket = { entitlementId?: string | undefined; grantDurationUnit?: EntitlementGrantDurationUnit | undefined; grantDurationValue?: number | undefined; grantMeasure?: EntitlementGrantMeasure | undefined; grantQuota?: string | undefined; sourceEntityId?: string | undefined; usageLimit?: number | undefined; }; /** @internal */ export const AggregatedEntitlementBucket$inboundSchema: z.ZodMiniType< AggregatedEntitlementBucket, unknown > = z.pipe( z.object({ entitlement_id: types.optional(types.string()), grant_duration_unit: types.optional( EntitlementGrantDurationUnit$inboundSchema, ), grant_duration_value: types.optional(types.number()), grant_measure: types.optional(EntitlementGrantMeasure$inboundSchema), grant_quota: types.optional(types.string()), source_entity_id: types.optional(types.string()), usage_limit: types.optional(types.number()), }), z.transform((v) => { return remap$(v, { "entitlement_id": "entitlementId", "grant_duration_unit": "grantDurationUnit", "grant_duration_value": "grantDurationValue", "grant_measure": "grantMeasure", "grant_quota": "grantQuota", "source_entity_id": "sourceEntityId", "usage_limit": "usageLimit", }); }), ); export function aggregatedEntitlementBucketFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AggregatedEntitlementBucket$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AggregatedEntitlementBucket' from JSON`, ); }