Entitlement .check
POST /{namespace}/entitlements/check
Check says whether a Customer may call a Verb now, how much of its Limit remains, when that resets, and which Offer lifts it.
- Noun
- Entitlement
- Mode
do- Event
Entitlement.checked
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
customer | Customer | required | The Customer making the call. |
verb | Verb | required | The Verb it wants to call, as Noun.verb. |
amount | integer | How many units the call would use. Defaults to 1. |
Outputs
| Output | Type | Required | Description |
|---|---|---|---|
allowed | boolean | required | True when an Entitlement grants the call and its Limit has room for amount. |
entitlement | Entitlement | The Entitlement that grants the Verb, when one does. | |
remaining | integer | Units left in the current period; absent for a feature Entitlement. | |
resetsAt | datetime | When the period resets; absent when the Limit never resets. | |
upgrade | Offer | The Offer that lifts the bound, when its Offer’s atBound is upgrade. |
Effects
- Emits
Entitlement.checked. - Two-way: it runs at once, in the
try,sendanddomodes. - Changes nothing and never refuses: past the bound it answers
allowed:, and the Verb it guards then replies 402false payment-required, unlessatBoundisoverage.
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | Entitlement.check |
When it waits
| Gate | Default |
|---|---|
| Decision class | Low: two-way, nothing at stake |
| Delay window | None: it runs once review passes. |
| Limit | The call Limit of the Permission it runs under. |
| Over the Limit | It waits pending for an Approval from the Founder. Approved, it runs; refused, it ends refused with limit-exceeded; unanswered by its deadline, it ends canceled. |