<a id="scheduleclient"></a>

### ScheduleClient

The scheduled client is a client for managing scheduled workflows within Hatchet

#### Methods

<a id="bulkdelete"></a>

##### `bulkDelete()`

Bulk deletes scheduled runs (by explicit IDs and/or a filter).

Parameters

| Parameter             | Type                                                                                     | Description                                                       |
| --------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `opts`                | \{ `filter?`: `ScheduledWorkflowsBulkDeleteFilter`; `scheduledRuns?`: (... \| ...)[]; \} | Either `scheduledRuns` (ids/objects) and/or a server-side filter. |
| `opts.filter?`        | `ScheduledWorkflowsBulkDeleteFilter`                                                     | -                                                                 |
| `opts.scheduledRuns?` | (... \| ...)[]                                                                           | -                                                                 |

Returns

`Promise`\<`ScheduledWorkflowsBulkDeleteResponse`\>

A promise that resolves to deleted ids + per-id errors.

<a id="bulkupdate"></a>

##### `bulkUpdate()`

Bulk updates (reschedules) scheduled runs.

Parameters

| Parameter | Type       | Description                        |
| --------- | ---------- | ---------------------------------- |
| `updates` | `object`[] | List of id/object + new triggerAt. |

Returns

`Promise`\<`ScheduledWorkflowsBulkUpdateResponse`\>

A promise that resolves to updated ids + per-id errors.

<a id="create"></a>

##### `create()`

Creates a new Scheduled Run.

Parameters

| Parameter                  | Type                                                                                                                                            | Description                           |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| `workflow`                 | `string` \| `Workflow`                                                                                                                          | The workflow name or Workflow object. |
| `cron`                     | \{ `additionalMetadata?`: `Record`\<`string`, `string`\>; `input?`: `Record`\<`string`, `any`\>; `priority?`: `number`; `triggerAt`: `Date`; \} | -                                     |
| `cron.additionalMetadata?` | `Record`\<`string`, `string`\>                                                                                                                  | -                                     |
| `cron.input?`              | `Record`\<`string`, `any`\>                                                                                                                     | -                                     |
| `cron.priority?`           | `number`                                                                                                                                        | -                                     |
| `cron.triggerAt`           | `Date`                                                                                                                                          | -                                     |

Returns

`Promise`\<`ScheduledWorkflows`\>

A promise that resolves to the created ScheduledWorkflows object.

Throws

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

###### Important

This method is instrumented by HatchetInstrumentor.\_patchScheduleCreate.
Keep the signature in sync with the instrumentor wrapper.

<a id="delete"></a>

##### `delete()`

Deletes an existing Scheduled Run.

Parameters

| Parameter      | Type                             | Description                                                    |
| -------------- | -------------------------------- | -------------------------------------------------------------- |
| `scheduledRun` | `string` \| `ScheduledWorkflows` | The Scheduled Run ID as a string or ScheduledWorkflows object. |

Returns

`Promise`\<`void`\>

A promise that resolves when the Scheduled Run is deleted.

<a id="get"></a>

##### `get()`

Retrieves a specific Scheduled Run by its ID.

Parameters

| Parameter      | Type                             | Description                                                    |
| -------------- | -------------------------------- | -------------------------------------------------------------- |
| `scheduledRun` | `string` \| `ScheduledWorkflows` | The Scheduled Run ID as a string or ScheduledWorkflows object. |

Returns

`Promise`\<`ScheduledWorkflows`\>

A promise that resolves to the ScheduledWorkflows object.

<a id="list"></a>

##### `list()`

Lists all Cron Triggers based on the provided query parameters.

Parameters

| Parameter | Type                | Description                                  |
| --------- | ------------------- | -------------------------------------------- |
| `query`   | `object` & `object` | Query parameters for listing Scheduled Runs. |

Returns

`Promise`\<`ScheduledWorkflowsList`\>

A promise that resolves to a ScheduledWorkflowsList object.

<a id="update"></a>

##### `update()`

Updates (reschedules) an existing Scheduled Run.

Parameters

| Parameter          | Type                             | Description                                                    |
| ------------------ | -------------------------------- | -------------------------------------------------------------- |
| `scheduledRun`     | `string` \| `ScheduledWorkflows` | The Scheduled Run ID as a string or ScheduledWorkflows object. |
| `update`           | \{ `triggerAt`: `Date`; \}       | The update payload (currently only triggerAt).                 |
| `update.triggerAt` | `Date`                           | -                                                              |

Returns

`Promise`\<`ScheduledWorkflows`\>

A promise that resolves to the updated ScheduledWorkflows object.
