Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.triggers.samples

Sample events: what a trigger’s condition and target templates can see, shown with realistic values.

Before writing a condition or a message template, an author needs to know what {{dataset.name}} or file.relative_path will resolve to. The event catalog says which namespace roots an event exposes, but not what sits under them. A sample fills that in: it is built with the same EventNamespace and record models that serve a real firing, so the shape it shows is the shape a trigger sees. One coherent scenario runs through every root — one robot, one drive, one file, one action run on it — so the values read as a story rather than as placeholders.

Values are illustrative, not templates for real ids. Every id here is fabricated.

Module Contents

PlatformEventSample

class roboto.domain.triggers.samples.PlatformEventSample(/, **data)#View Source

Bases: pydantic.BaseModel

One event type, dereferenced: the envelope, every root it exposes, and the template paths that resolve against them.

Parameters

data Any

Attributes

PlatformEventSample.event

event dict[str, Any] #

The event envelope as it would arrive: id, type, time, org, and payload.

PlatformEventSample.event_type

The event type this sample illustrates.

PlatformEventSample.namespace

namespace dict[str, dict[str, Any]] #

Every namespace root a condition or template may reference for this event type, keyed by root name, with the full record under each. Always includes envelope and trigger; the rest are the catalog’s exposed roots for the type.

PlatformEventSample.paths

paths list[str] #

Every root.path a {{ }} placeholder or condition field may name, in the order the roots and their fields appear in namespace.

PlatformEventSamplesResponse

class roboto.domain.triggers.samples.PlatformEventSamplesResponse(/, **data)#View Source

Bases: pydantic.BaseModel

Wire shape of GET /v1/triggers/events/samples: one sample per platform event type.

Parameters

data Any

Attributes

PlatformEventSamplesResponse.samples

SAMPLE_TIME

roboto.domain.triggers.samples.SAMPLE_TIME#View Source

The instant every sample event and record is dated from, so samples are stable across calls.

SampleNamespaceSource

class roboto.domain.triggers.samples.SampleNamespaceSource#View Source

A NamespaceSource that hydrates every root from the sample scenario.

Serves each root the way a real firing does — including action as the invocation’s provenance and upload as the bare transaction id — so a sample carries exactly the roots a trigger would see.

SampleNamespaceSource.record_for_root()

record_for_root(root, event)#View Source

Return type

Optional[collections.abc.Mapping[str, Any]]

platform_event_sample()

roboto.domain.triggers.samples.platform_event_sample(event_type, catalog=DEFAULT_PLATFORM_EVENT_CATALOG)#View Source

Build the sample for one event type.

The event, changed and tag roots are built by the same EventNamespace that serves them when a trigger fires; the entity roots are exactly the ones catalog exposes for the type.

platform_event_samples()

roboto.domain.triggers.samples.platform_event_samples(catalog=DEFAULT_PLATFORM_EVENT_CATALOG)#View Source

A sample for every event type in catalog, in catalog order.

sample_platform_event()

roboto.domain.triggers.samples.sample_platform_event(event_type)#View Source

A valid, fully populated event of event_type from the sample scenario.

sample_trigger()

roboto.domain.triggers.samples.sample_trigger()#View Source

The trigger the sample is evaluated for; what {{trigger.*}} sees.

template_paths()

roboto.domain.triggers.samples.template_paths(record, prefix)#View Source

Every dotted path a template may reference under prefix, in document order.

Walks nested mappings only. A list is a leaf, because path resolution descends through mappings and stops at anything else: dataset.tags is addressable, dataset.tags.0 is not.

Parameters

record collections.abc.Mapping[str, Any]
prefix str

Return type

list[str]

Was this page helpful?