<a id="runsclient"></a>

### Runs Client

The runs client is a client for interacting with task and workflow runs within Hatchet.

#### Methods

<a id="branchdurabletask"></a>

##### `branchDurableTask()`

Fork (reset) a durable task from a specific node, triggering re-execution from that point.

Parameters

Parameter, Type, Default value, Description

`taskExternalId`, `string`, `undefined`, The external ID of the durable task to reset.
`nodeId`, `number`, `undefined`, The node ID to replay from.
`branchId`, `number`, `0`, -

Returns

`Promise`\<`AxiosResponse`\<`V1BranchDurableTaskResponse`, `any`, \{
\}\>\>

<a id="cancel"></a>

##### `cancel()`

Cancels a task or workflow run by its ID.

Parameters

Parameter, Type, Description

`opts`, `CancelRunOpts`, The options for the cancel operation.

Returns

`Promise`\<`AxiosResponse`\<`V1CancelledTasks`, `any`, \{
\}\>\>

A promise that resolves to the cancelled run.

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

##### `get()`

Gets a task or workflow run by its ID.

Parameters

Parameter, Type, Description

`run`, `string` \, `WorkflowRunRef`\<`T`\>, The ID of the run to get.

Returns

`Promise`\<`V1WorkflowRunDetails`\>

A promise that resolves to the run.

<a id="get_status"></a>

##### `get_status()`

Gets the status of a task or workflow run by its ID.

Parameters

Parameter, Type, Description

`run`, `string` \, `WorkflowRunRef`\<`T`\>, The ID of the run to get the status of.

Returns

`Promise`\<`V1TaskStatus`\>

A promise that resolves to the status of the run.

<a id="gettaskexternalid"></a>

##### `getTaskExternalId()`

Resolve the task external ID for a workflow run. For runs with multiple tasks,
returns the first task's external ID.

Parameters

Parameter, Type, Description

`workflowRunId`, `string`, The workflow run ID to look up.

Returns

`Promise`\<`string`\>

The task external ID.

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

##### `list()`

Lists all task and workflow runs for the current tenant.

Parameters

Parameter, Type, Description

`opts?`, `Partial`\<`ListRunsOpts`\>, The options for the list operation.

Returns

`Promise`\<`V1TaskSummaryList`\>

A promise that resolves to the list of runs.

<a id="replay"></a>

##### `replay()`

Replays a task or workflow run by its ID.

Parameters

Parameter, Type, Description

`opts`, `ReplayRunOpts`, The options for the replay operation.

Returns

`Promise`\<`AxiosResponse`\<`V1ReplayedTasks`, `any`, \{
\}\>\>

A promise that resolves to the replayed run.

<a id="restoretask"></a>

##### `restoreTask()`

Restore an evicted durable task so it can resume execution.

Parameters

Parameter, Type, Description

`taskExternalId`, `string`, The external ID of the evicted task.

Returns

`Promise`\<`AxiosResponse`\<`V1RestoreTaskResponse`, `any`, \{
\}\>\>

<a id="subscribetostream"></a>

##### `subscribeToStream()`

Subscribes to a stream of events for a task or workflow run by its ID.

Parameters

Parameter, Type, Description

`workflowRunId`, `string`, The ID of the run to subscribe to.

Returns

`AsyncIterableIterator`\<`string`\>

A promise that resolves to the stream of events.
