Workflows ReferenceType Definitions
WorkflowConsumableMeter
type WorkflowConsumableMeter = {
consume: (options?) => Promise<WorkflowMeterablePropertyEvaluation & WorkflowMeterablePropertyDefinition>;
incrementCounter: (options?) => Promise<void>;
};Properties
consume()
consume: (options?) => Promise<WorkflowMeterablePropertyEvaluation & WorkflowMeterablePropertyDefinition>;Record consumption against a meter.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { allowPartialConsumption?: boolean; units?: number; } | - |
options.allowPartialConsumption? | boolean | If true, allows consuming fewer units than requested if insufficient units are available. Defaults to false. If true, check unrecordedUnitsInRequest after evaluation. |
options.units? | number | The number of units to consume. Defaults to 1. |
Returns
Promise<WorkflowMeterablePropertyEvaluation & WorkflowMeterablePropertyDefinition>
The updated meter evaluation after consumption.
incrementCounter()
incrementCounter: (options?) => Promise<void>;Increment the counter backing this metered property. The counter will be incremented regardless of the usage already recorded against the meter.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { units?: number; } | - |
options.units? | number | The number of units to increment by. Defaults to 1. Must be a non-zero positive integer if specified. |
Returns
Promise<void>
Example
await features.myFeature.incrementCounter({ units: 1 })