/* * 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 { EntitlementAggregationMode, EntitlementAggregationMode$outboundSchema, } from "./entitlement-aggregation-mode.js"; import { EntitlementGrantAllocationBehavior, EntitlementGrantAllocationBehavior$outboundSchema, } from "./entitlement-grant-allocation-behavior.js"; import { EntitlementGrantDurationUnit, EntitlementGrantDurationUnit$outboundSchema, } from "./entitlement-grant-duration-unit.js"; import { EntitlementGrantMeasure, EntitlementGrantMeasure$outboundSchema, } from "./entitlement-grant-measure.js"; import { EntitlementUsageResetPeriod, EntitlementUsageResetPeriod$outboundSchema, } from "./entitlement-usage-reset-period.js"; export type UpdateEntitlementRequest = { aggregationMode?: EntitlementAggregationMode | undefined; /** * Grant config — nil fields leave the current value alone. * * @remarks * ClearGrantConfig=true wipes the whole grant config (back to a legacy entitlement). */ clearGrantConfig?: boolean | undefined; configValue?: { [k: string]: any } | undefined; grantAllocationBehavior?: EntitlementGrantAllocationBehavior | undefined; grantDurationUnit?: EntitlementGrantDurationUnit | undefined; grantDurationValue?: number | undefined; grantMeasure?: EntitlementGrantMeasure | undefined; grantQuota?: string | undefined; isEnabled?: boolean | undefined; isSoftLimit?: boolean | undefined; staticValue?: string | undefined; usageLimit?: number | undefined; usageResetPeriod?: EntitlementUsageResetPeriod | undefined; }; /** @internal */ export type UpdateEntitlementRequest$Outbound = { aggregation_mode?: string | undefined; clear_grant_config?: boolean | undefined; config_value?: { [k: string]: any } | undefined; grant_allocation_behavior?: string | undefined; grant_duration_unit?: string | undefined; grant_duration_value?: number | undefined; grant_measure?: string | undefined; grant_quota?: string | undefined; is_enabled?: boolean | undefined; is_soft_limit?: boolean | undefined; static_value?: string | undefined; usage_limit?: number | undefined; usage_reset_period?: string | undefined; }; /** @internal */ export const UpdateEntitlementRequest$outboundSchema: z.ZodMiniType< UpdateEntitlementRequest$Outbound, UpdateEntitlementRequest > = z.pipe( z.object({ aggregationMode: z.optional(EntitlementAggregationMode$outboundSchema), clearGrantConfig: z.optional(z.boolean()), configValue: z.optional(z.record(z.string(), z.any())), grantAllocationBehavior: z.optional( EntitlementGrantAllocationBehavior$outboundSchema, ), grantDurationUnit: z.optional(EntitlementGrantDurationUnit$outboundSchema), grantDurationValue: z.optional(z.int()), grantMeasure: z.optional(EntitlementGrantMeasure$outboundSchema), grantQuota: z.optional(z.string()), isEnabled: z.optional(z.boolean()), isSoftLimit: z.optional(z.boolean()), staticValue: z.optional(z.string()), usageLimit: z.optional(z.int()), usageResetPeriod: z.optional(EntitlementUsageResetPeriod$outboundSchema), }), z.transform((v) => { return remap$(v, { aggregationMode: "aggregation_mode", clearGrantConfig: "clear_grant_config", configValue: "config_value", grantAllocationBehavior: "grant_allocation_behavior", grantDurationUnit: "grant_duration_unit", grantDurationValue: "grant_duration_value", grantMeasure: "grant_measure", grantQuota: "grant_quota", isEnabled: "is_enabled", isSoftLimit: "is_soft_limit", staticValue: "static_value", usageLimit: "usage_limit", usageResetPeriod: "usage_reset_period", }); }), ); export function updateEntitlementRequestToJSON( updateEntitlementRequest: UpdateEntitlementRequest, ): string { return JSON.stringify( UpdateEntitlementRequest$outboundSchema.parse(updateEntitlementRequest), ); }