---
sidebar:
  hidden: true
title: roboto.domain.actions.trigger_view
---
## Module Contents

### TriggerOnEvent

```python
class roboto.domain.actions.trigger_view.TriggerOnEvent(/, **data: Any)
```

`from roboto.domain.actions import TriggerOnEvent`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L46-L68)

Bases: `pydantic.BaseModel`

Settings of an event-driven trigger: the platform events it responds to and the files it passes to its action.

Carried in `TriggerView.on_event`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **TriggerOnEvent.additional_inputs** (`list[str] | None`) = `None`: Gitignore-style patterns for more files to pass to the action as input data, or `None` to add none.

  Unlike `required_inputs`, no file has to match them for the trigger to invoke its action.

- **TriggerOnEvent.causes** (`list[roboto.domain.actions.trigger_record.TriggerEvaluationCause]`): Platform events that cause Roboto to evaluate the trigger.

- **TriggerOnEvent.condition** (`roboto.query.ConditionType | None`) = `None`: Condition the data must meet for the trigger to invoke its action, or `None` if the trigger has none.

- **TriggerOnEvent.for_each** (`roboto.domain.actions.trigger_record.TriggerForEachPrimitive`): Whether the trigger invokes its action once per dataset or once per file.

- **TriggerOnEvent.required_inputs** (`list[str]`): Gitignore-style patterns for the files the trigger requires, and passes to the action as its input data.

### TriggerOnSchedule

```python
class roboto.domain.actions.trigger_view.TriggerOnSchedule(/, **data: Any)
```

`from roboto.domain.actions import TriggerOnSchedule`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L71-L87)

Bases: `pydantic.BaseModel`

Settings of a scheduled trigger: its schedule and the input each invocation receives.

Carried in `TriggerView.on_schedule`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **TriggerOnSchedule.invocation_input** (`roboto.domain.actions.invocation_record.InvocationInput | None`) = `None`: Input each invocation receives, or `None` if invocations take no input.

- **TriggerOnSchedule.next_occurrence** (`datetime.datetime | None`) = `None`: Next time the trigger invokes the action, or `None` if the trigger is disabled.

  Roboto sets it from `schedule`; no request does.

- **TriggerOnSchedule.schedule** (`str`): Cron expression, in UTC, for when the trigger invokes the action, such as `"0 * * * *"` for every hour.

### TriggerType

```python
class roboto.domain.actions.trigger_view.TriggerType
```

`from roboto.domain.actions import TriggerType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L33-L43)

Bases: `roboto.compat.StrEnum`

Kind of trigger: event-driven or scheduled.

**Attributes**

- **TriggerType.EventDriven** = `'event_driven'`: Trigger that invokes its action in response to platform events, such as an upload of files.

  [`TriggerEvaluationCause`](/docs/reference/python-sdk/roboto/domain/actions/trigger_record#roboto.domain.actions.trigger_record.TriggerEvaluationCause) lists the platform events it can respond to.

- **TriggerType.Scheduled** = `'scheduled'`: Trigger that invokes its action on a recurring schedule.

### TriggerView

```python
class roboto.domain.actions.trigger_view.TriggerView(/, **data: Any)
```

`from roboto.domain.actions import TriggerView`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L90-L234)

Bases: `pydantic.BaseModel`

Data record of a trigger, as an item of the response body of `POST /v1/triggers/aggregated/query`.

Event-driven and scheduled triggers share this one shape: `trigger_type` says which kind the trigger is, and so which of `on_event` and `on_schedule` is set. The record belongs to the legacy trigger model and covers only the triggers that model can express; [`Trigger`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger) reads and edits every trigger.

**Parameters**

- **data** (`Any`)

**Attributes**

- **TriggerView.action** (`roboto.domain.actions.action_record.ActionReference`): Action the trigger invokes. A reference without a digest invokes the action's latest version.

- **TriggerView.compute_requirement_overrides** (`roboto.domain.actions.action_record.ComputeRequirements | None`) = `None`: Compute requirements that replace the action's own in each invocation, or `None` to use the action's.

- **TriggerView.container_parameter_overrides** (`roboto.domain.actions.action_record.ContainerParameters | None`) = `None`: Container parameters that replace the action's own in each invocation, or `None` to use the action's.

- **TriggerView.created** (`datetime.datetime`): Time the trigger was created.

- **TriggerView.created_by** (`str`): ID of the user who created the trigger.

- **TriggerView.enabled** (`bool`): Whether the trigger is enabled. A disabled trigger never invokes its action.

- **TriggerView.invocation_upload_destination** (`roboto.domain.actions.invocation_record.InvocationUploadDestination | None`) = `None`: Where each invocation uploads its output files, or `None` if the trigger sets no destination.

- **TriggerView.modified** (`datetime.datetime`): Time the trigger was last modified.

- **TriggerView.modified_by** (`str`): ID of the user who last modified the trigger.

  Roboto's own system user when Roboto made the change.

- **TriggerView.name** (`str`): Human-readable name of the trigger, unique within its organization.

- **TriggerView.on_event** (`TriggerOnEvent | None`) = `None`: Settings of an event-driven trigger, or `None` if the trigger is scheduled.

- **TriggerView.on_schedule** (`TriggerOnSchedule | None`) = `None`: Settings of a scheduled trigger, or `None` if the trigger is event-driven.

- **TriggerView.org_id** (`str`): ID of the organization that owns the trigger.

- **TriggerView.parameter_values** (`dict[str, Any] | None`) = `None`: Values for the action's parameters, keyed by parameter name, or `None` if the trigger sets none.

- **TriggerView.service_user_id** (`str`): ID of the service user the trigger invokes its action as.

- **TriggerView.timeout** (`int | None`) = `None`: Maximum run time of each invocation, in minutes, or `None` to use the action's timeout.

- **TriggerView.trigger_id** (`str`): Unique ID of the trigger.

- **TriggerView.trigger_type** (`TriggerType`): Whether the trigger is event-driven or scheduled.

#### TriggerView.to_event_trigger_record()

```python
def to_event_trigger_record() -> Optional[roboto.domain.actions.trigger_record.TriggerRecord]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L155-L192)

Return this trigger as a [`TriggerRecord`](/docs/reference/python-sdk/roboto/domain/actions/trigger_record#roboto.domain.actions.trigger_record.TriggerRecord), or `None` if it is scheduled.

The record has no field for `invocation_upload_destination`, so it leaves that setting out.

**Raises**

- `RuntimeError`: The trigger is event-driven but `on_event` is `None`.

**Returns**

- `Optional[roboto.domain.actions.trigger_record.TriggerRecord]`

#### TriggerView.to_scheduled_trigger_record()

```python
def to_scheduled_trigger_record() -> Optional[roboto.domain.actions.scheduled_trigger_record.ScheduledTriggerRecord]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/actions/trigger_view.py#L194-L234)

Return this trigger as a scheduled trigger record, or `None` if it is event-driven.

The record is a [`ScheduledTriggerRecord`](/docs/reference/python-sdk/roboto/domain/actions/scheduled_trigger_record#roboto.domain.actions.scheduled_trigger_record.ScheduledTriggerRecord), which has no field for `service_user_id` and so leaves it out.

**Raises**

- `RuntimeError`: The trigger is scheduled but `on_schedule` is `None`.

**Returns**

- `Optional[roboto.domain.actions.scheduled_trigger_record.ScheduledTriggerRecord]`
