/* * 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 { EntitlementEntityType, EntitlementEntityType$inboundSchema, } from "./entitlement-entity-type.js"; import { EntitlementUsageResetPeriod, EntitlementUsageResetPeriod$inboundSchema, } from "./entitlement-usage-reset-period.js"; import { FeatureType, FeatureType$inboundSchema } from "./feature-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type WebhookDtoEntitlement = { entityId?: string | undefined; entityType?: EntitlementEntityType | undefined; featureId?: string | undefined; featureType?: FeatureType | undefined; id?: string | undefined; isEnabled?: boolean | undefined; isSoftLimit?: boolean | undefined; staticValue?: string | undefined; usageLimit?: number | undefined; usageResetPeriod?: EntitlementUsageResetPeriod | undefined; }; /** @internal */ export const WebhookDtoEntitlement$inboundSchema: z.ZodMiniType< WebhookDtoEntitlement, unknown > = z.pipe( z.object({ entity_id: types.optional(types.string()), entity_type: types.optional(EntitlementEntityType$inboundSchema), feature_id: types.optional(types.string()), feature_type: types.optional(FeatureType$inboundSchema), id: types.optional(types.string()), is_enabled: types.optional(types.boolean()), is_soft_limit: types.optional(types.boolean()), static_value: types.optional(types.string()), usage_limit: types.optional(types.number()), usage_reset_period: types.optional( EntitlementUsageResetPeriod$inboundSchema, ), }), z.transform((v) => { return remap$(v, { "entity_id": "entityId", "entity_type": "entityType", "feature_id": "featureId", "feature_type": "featureType", "is_enabled": "isEnabled", "is_soft_limit": "isSoftLimit", "static_value": "staticValue", "usage_limit": "usageLimit", "usage_reset_period": "usageResetPeriod", }); }), ); export function webhookDtoEntitlementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDtoEntitlement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDtoEntitlement' from JSON`, ); }