const entitlement = await stiggClient.getEntitlement({
customerId: 'customer-demo-01',
featureId: 'feature-demo-01',
resourceId: 'resource-01', // optional, pass it to get entitlement of specific resource
});
if (entitlement.hasAccess) {
// Customer has access to the feature
} else {
// Access denied
console.log('Access denied reason:', entitlement.accessDeniedReason);
}
// Entitlement contains the specific entitlement details
// based on feature type (boolean, numeric, or metered)
switch (entitlement.type) {
case "NUMERIC":
console.log('Numeric value:', entitlement.value);
break;
case "METERED":
console.log('Usage limit:', entitlement.usageLimit);
console.log('Current usage:', entitlement.currentUsage);
break;
case "BOOLEAN":
break;
}