/* * 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 { AddonResponse, AddonResponse$inboundSchema, } from "./addon-response.js"; import { EntitlementAggregationMode, EntitlementAggregationMode$inboundSchema, } from "./entitlement-aggregation-mode.js"; import { EntitlementEntityType, EntitlementEntityType$inboundSchema, } from "./entitlement-entity-type.js"; import { EntitlementGrantAllocationBehavior, EntitlementGrantAllocationBehavior$inboundSchema, } from "./entitlement-grant-allocation-behavior.js"; import { EntitlementGrantDurationUnit, EntitlementGrantDurationUnit$inboundSchema, } from "./entitlement-grant-duration-unit.js"; import { EntitlementGrantMeasure, EntitlementGrantMeasure$inboundSchema, } from "./entitlement-grant-measure.js"; import { EntitlementUsageResetPeriod, EntitlementUsageResetPeriod$inboundSchema, } from "./entitlement-usage-reset-period.js"; import { FeatureResponse, FeatureResponse$inboundSchema, } from "./feature-response.js"; import { FeatureType, FeatureType$inboundSchema } from "./feature-type.js"; import { PlanResponse, PlanResponse$inboundSchema } from "./plan-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; export type EntitlementResponse = { addon?: AddonResponse | undefined; aggregationMode?: EntitlementAggregationMode | undefined; configValue?: { [k: string]: any } | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; displayOrder?: number | undefined; endDate?: Date | undefined; entityId?: string | undefined; entityType?: EntitlementEntityType | undefined; environmentId?: string | undefined; feature?: FeatureResponse | undefined; featureId?: string | undefined; featureType?: FeatureType | undefined; grantAllocationBehavior?: EntitlementGrantAllocationBehavior | undefined; grantDurationUnit?: EntitlementGrantDurationUnit | undefined; grantDurationValue?: number | undefined; grantMeasure?: EntitlementGrantMeasure | undefined; grantQuota?: string | undefined; id?: string | undefined; isEnabled?: boolean | undefined; isSoftLimit?: boolean | undefined; parentEntitlementId?: string | undefined; plan?: PlanResponse | undefined; /** * TODO: Remove this once we have a proper entitlement entity type */ planId?: string | undefined; startDate?: Date | undefined; staticValue?: string | undefined; status?: Status | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; usageLimit?: number | undefined; usageResetPeriod?: EntitlementUsageResetPeriod | undefined; }; /** @internal */ export const EntitlementResponse$inboundSchema: z.ZodMiniType< EntitlementResponse, unknown > = z.pipe( z.object({ addon: types.optional(z.lazy(() => AddonResponse$inboundSchema)), aggregation_mode: types.optional(EntitlementAggregationMode$inboundSchema), config_value: types.optional(z.record(z.string(), z.any())), created_at: types.optional(types.date()), created_by: types.optional(types.string()), display_order: types.optional(types.number()), end_date: types.optional(types.date()), entity_id: types.optional(types.string()), entity_type: types.optional(EntitlementEntityType$inboundSchema), environment_id: types.optional(types.string()), feature: types.optional(FeatureResponse$inboundSchema), feature_id: types.optional(types.string()), feature_type: types.optional(FeatureType$inboundSchema), grant_allocation_behavior: types.optional( EntitlementGrantAllocationBehavior$inboundSchema, ), 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()), id: types.optional(types.string()), is_enabled: types.optional(types.boolean()), is_soft_limit: types.optional(types.boolean()), parent_entitlement_id: types.optional(types.string()), plan: types.optional(z.lazy(() => PlanResponse$inboundSchema)), plan_id: types.optional(types.string()), start_date: types.optional(types.date()), static_value: types.optional(types.string()), status: types.optional(Status$inboundSchema), tenant_id: types.optional(types.string()), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), usage_limit: types.optional(types.number()), usage_reset_period: types.optional( EntitlementUsageResetPeriod$inboundSchema, ), }), z.transform((v) => { return remap$(v, { "aggregation_mode": "aggregationMode", "config_value": "configValue", "created_at": "createdAt", "created_by": "createdBy", "display_order": "displayOrder", "end_date": "endDate", "entity_id": "entityId", "entity_type": "entityType", "environment_id": "environmentId", "feature_id": "featureId", "feature_type": "featureType", "grant_allocation_behavior": "grantAllocationBehavior", "grant_duration_unit": "grantDurationUnit", "grant_duration_value": "grantDurationValue", "grant_measure": "grantMeasure", "grant_quota": "grantQuota", "is_enabled": "isEnabled", "is_soft_limit": "isSoftLimit", "parent_entitlement_id": "parentEntitlementId", "plan_id": "planId", "start_date": "startDate", "static_value": "staticValue", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", "usage_limit": "usageLimit", "usage_reset_period": "usageResetPeriod", }); }), ); export function entitlementResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EntitlementResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EntitlementResponse' from JSON`, ); }