We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

ReferenceTypescript SDKFeature ClientsCrons

Cron Client

The cron client is a client for managing cron workflows within Hatchet.

Methods

create()

Creates a new Cron workflow.

Parameters

ParameterTypeDescription
workflowstring | BaseWorkflowDeclaration<any, any> | WorkflowThe workflow identifier or Workflow object.
cron{ additionalMetadata?: Record<string, string>; expression: string; input?: Record<string, any>; name: string; priority?: number; }The input data for creating the Cron Trigger.
cron.additionalMetadata?Record<string, string>-
cron.expressionstring-
cron.input?Record<string, any>-
cron.namestring-
cron.priority?number-

Returns

Promise<CronWorkflows>

A promise that resolves to the created CronWorkflows object.

Throws

Will throw an error if the input is invalid or the API call fails.

delete()

Deletes an existing Cron Trigger.

Parameters

ParameterTypeDescription
cronstring | CronWorkflowsThe Cron Trigger ID as a string or CronWorkflows object.

Returns

Promise<void>

A promise that resolves when the Cron Trigger is deleted.

get()

Retrieves a specific Cron Trigger by its ID.

Parameters

ParameterTypeDescription
cronstring | CronWorkflowsThe Cron Trigger ID as a string or CronWorkflows object.

Returns

Promise<CronWorkflows>

A promise that resolves to the CronWorkflows object.

list()

Lists all Cron Triggers based on the provided query parameters.

Parameters

ParameterTypeDescription
queryobject & objectQuery parameters for listing Cron Triggers.

Returns

Promise<CronWorkflowsList>

A promise that resolves to a CronWorkflowsList object.