MonetizationOS Docs
Workflows ReferenceType Definitions

IngestBucketWorkflowUtils

type IngestBucketWorkflowUtils = {
  delete: Promise<void>;
  get: Promise<T | null>;
  put: Promise<void>;
};

Methods

delete()

delete(bucketSlug, key): Promise<void>;

Delete a value from a named bucket by key. Deleting a non-existent key will return successfully.

Parameters

ParameterTypeDescription
bucketSlugstringThe name of the bucket to delete the value from.
keystringThe key to delete. Must be a non-empty string of up to 128 characters.

Returns

Promise<void>

Example

ts await utils.buckets.delete('user-preferences', 'theme')


get()

get<T>(bucketSlug, key): Promise<T | null>;

Retrieve a value from a named bucket by key. Buckets are scoped to this app.

Type Parameters

Type ParameterDescription
TThe expected type of the stored value.

Parameters

ParameterTypeDescription
bucketSlugstringThe name of the bucket to retrieve the value from.
keystringThe key to retrieve. Must be a non-empty string of up to 128 characters.

Returns

Promise<T | null>

The stored value, or null if not found.

Example

ts const theme = await utils.buckets.get('bot-config', 'all-sites')


put()

put(
   bucketSlug, 
   key, 
value): Promise<void>;

Store a value in a named bucket under a specific key. Buckets are scoped to this app.

Parameters

ParameterTypeDescription
bucketSlugstringThe name of the bucket to store the value in.
keystringThe key under which to store the value. Must be a non-empty string of up to 128 characters.
valueunknownThe value to store. Maximum size is 20MB.

Returns

Promise<void>

Example

ts await utils.buckets.put('bot-config', 'all-sites', { theme: 'dark' })

On this page