Workflows ReferenceType Definitions
WriteIdentityWorkflowUtils
type WriteIdentityWorkflowUtils = WriteIdentityLinksWorkflowUtils & {
deleteCustomData: (identifier, key, options?) => Promise<void>;
incrementCounter: (identifier, counter, options?) => Promise<void>;
writeCustomData: (identifier, key, value, options?) => Promise<void>;
};Type Declaration
deleteCustomData()
deleteCustomData: (identifier, key, options?) => Promise<void>;Delete an item of custom data against a user or session. If the data was written with the 'crossBrand' option, that must be passed here too to delete the value.
Parameters
| Parameter | Type | Description |
|---|---|---|
identifier | WorkflowUserIdentifier | The user or session to delete the data against. |
key | string | The key to delete. Must be a non-empty string of less than 1000 characters. |
options? | CustomDataOptions | Optional settings for the operation. |
Returns
Promise<void>
Example
await utils.identity.deleteCustomData(identity, 'user-profile')incrementCounter()
incrementCounter: (identifier, counter, options?) => Promise<void>;Increment the counter backing a meter.
Parameters
| Parameter | Type |
|---|---|
identifier | WorkflowUserIdentifier |
counter | { counterId: string; } |
counter.counterId | string |
options? | { increment?: number; } |
options.increment? | number |
Returns
Promise<void>
Examples
await utils.identity.incrementCounter(identity, featureSchema['my-feature'].enabled)
await utils.identity.incrementCounter(identity, { counterId: 'my-custom-counter' })
writeCustomData()
writeCustomData: (identifier, key, value, options?) => Promise<void>;Write an item of custom data against a user or session. Data will be available for this brand only, unless the 'crossBrand' option is set to true, in which case it can be retrieved by any brand by passing the 'crossBrand' option when reading.
Parameters
| Parameter | Type | Description |
|---|---|---|
identifier | WorkflowUserIdentifier | The user or session to write the data against. |
key | string | The key to write the data against. Must be a non-empty string of less than 1000 characters. |
value | NonNullable<unknown> | The value to write. Must be non-null and less than 32kb when stringified. |
options? | CustomDataOptions | Optional settings for the operation. |
Returns
Promise<void>
Example
await utils.identity.writeCustomData(identity, 'user-profile', { name: 'Joe Blogs' })