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

roboto.domain.views

Wire types for Views: named, shareable searches over a single resource type.

A View saves the filters, sort, page size, and column layout a user arrived at, so they can return to it later or hand it to a teammate rather than rebuilding it.

Submodules

Package Contents

CreateViewRequest

class roboto.domain.views.CreateViewRequest(/, **data)#View Source

Bases: pydantic.BaseModel

Request payload to create a View.

Parameters

data Any

Attributes

CreateViewRequest.definition

The query and presentation state to save.

CreateViewRequest.name

name str = None #

Display name. Need not be unique.

CreateViewRequest.target

The resource type this View searches. Cannot be changed afterwards.

CreateViewRequest.visibility

Who the View is visible to once created.

Private by default. A View is a saved search someone arrived at while working, and most are of no interest to anyone else; publishing every one of them to the whole org on the author’s behalf is the harder default to undo, since by the time they notice, their colleagues have already seen it. Sharing afterwards is one call to the access endpoint, and is reserved to the author.

Only these two tiers exist at creation. Granting one named colleague access is a per-user grant, which the access endpoint handles and which no create-time field could express without duplicating it.

MAX_VIEW_NAME_LENGTH

roboto.domain.views.MAX_VIEW_NAME_LENGTH: Final[int] = 120#View Source

Longest permitted View name, matching the limit layouts uses.

ROBOQL_VIEW_TARGETS

roboto.domain.views.ROBOQL_VIEW_TARGETS: Final[frozenset[roboto.query.QueryTarget]]#View Source

Targets whose list page can show a View written in RoboQL.

The other View targets (sessions, devices, collections) have filter controls only, so a RoboQL View saved against one of them stores without complaint and then fails for whoever opens it. The web app’s counterpart is the roboql config each of these three lists passes to its filter bar; a list that gains RoboQL mode is added here at the same time.

UpdateViewRequest

class roboto.domain.views.UpdateViewRequest(/, **data)#View Source

Bases: pydantic.BaseModel

Request payload to update a View.

Omitted fields are left unchanged. target is absent by design: a View’s conditions are written against one resource type, so retargeting it would leave them referring to fields the new target does not have. Create a new View instead.

Parameters

data Any

Attributes

UpdateViewRequest.definition

Replacement query and presentation state, or NotSet to leave it alone.

Replaces the definition wholesale rather than merging, so a caller changing one filter must send the whole definition back.

UpdateViewRequest.model_config

model_config #

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

UpdateViewRequest.name

name str | roboto.sentinels.NotSetType = None #

New display name, or NotSet to leave it alone.

VIEW_SCHEMA_VERSION_V1

roboto.domain.views.VIEW_SCHEMA_VERSION_V1: Final[int] = 1#View Source

Value stored in the schema_version column for a VIEW_SCHEME_V1 definition.

VIEW_SCHEME_V1

roboto.domain.views.VIEW_SCHEME_V1: Final = 'view_v1'#View Source

Identifier for the first version of the View definition schema.

ViewDefinition

class roboto.domain.views.ViewDefinition(/, **data)#View Source

Bases: pydantic.BaseModel

The saved contents of a View: what its author searched for, and how they were shown it.

Stored as JSON, with no schema constraint behind it: this model is the only thing enforcing the shape.

A View records intent, not a query. It holds what the author expressed — filter controls or RoboQL text — and the client rebuilds an executable query from that on load. It does not hold a ready-made QuerySpecification, because one cannot be stored faithfully: Comparator has no way to say “the last 7 days”, so translating a relative date filter resolves it to fixed instants. A stored query would show the week the View was saved forever after, presented as though it were live.

Intent is nonetheless recorded in a typed form — SavedFilters — so that anything able to call the API can create a View, not only a client that already knows how a filter control is shaped. A filter-backed View still has to be translated into a query before it runs, and the Roboto web app is what does that; a RoboQL View needs no translation, since its text runs anywhere.

A View’s search target is not part of this definition. The View itself carries it, and repeating it here would let the two disagree.

Parameters

data Any

Attributes

ViewDefinition.display

display ViewDisplay = None #

Presentation state to restore when the View is loaded: columns, sort, and page size.

ViewDefinition.filters

filters roboto.query.SavedFilters | None = None #

The filter controls the author built.

Serves the same purpose as roboql for Views built from filter controls rather than typed queries: it records what the author expressed, so a client can rebuild the query on load rather than replaying a translation that has since gone stale.

This and roboql are alternatives, not a pair: at most one is ever set. Both are None for a View that filters nothing, which is a legitimate thing to save — it captures a column layout and a sort over the unfiltered list. So None here does not imply the View is a RoboQL one.

Typed rather than an opaque blob, so that a View is something any caller can construct. An untyped shape would leave an SDK user, the CLI, or an agent with nothing to build against and no way to learn they got it wrong — the row would store, and only fail later when a client tried to render it. That would make Views a web-UI feature rather than a platform one.

The cost is a definition that must agree with the filter UI’s own. That agreement was always required; it was simply unchecked before, and is now enforced where the data enters.

ViewDefinition.roboql

roboql str | None = None #

The RoboQL text the author wrote, when the View came from RoboQL rather than filter controls.

RoboQL has no relative-date syntax, so this text does not go stale — it means the same thing whenever it is run, and a backend can execute it directly.

None for a View built from structured filters, and also for one that filters nothing at all — see filters.

ViewDefinition.scheme

scheme Literal['view_v1'] = 'view_v1' #

Version tag for this definition’s shape.

Readers dispatch on this field, so a definition saved in a later shape is recognized as such instead of being misread as this one.

ViewDisplay

class roboto.domain.views.ViewDisplay(/, **data)#View Source

Bases: pydantic.BaseModel

How a View presents its results: which columns, in what order, sorted how, how many rows.

Presentation state only. Nothing here changes which records match.

Parameters

data Any

Attributes

ViewDisplay.page_size

page_size int | None = None #

Rows per page, or None to accept whatever the client’s table would pick on its own.

ViewDisplay.sort_by

sort_by str | None = None #

Field to sort results by, or None to leave the target’s default sort in place.

ViewDisplay.sort_direction

sort_direction roboto.query.SortDirection | None = None #

Direction to sort in. Only meaningful alongside sort_by.

ViewDisplay.visible_columns

visible_columns list[str] = None #

Columns to show, in display order.

Visibility and ordering are carried by this one list rather than a visibility map plus a separate order: two fields could disagree about a column, and there is no sensible way to resolve that. A column absent from the list is hidden. An empty list means the client falls back to its own defaults, which is what a View saved before a new column shipped will do.

ViewRecord

class roboto.domain.views.ViewRecord(/, **data)#View Source

Bases: pydantic.BaseModel

A wire-transmissible representation of a View.

A View is a named, org-scoped, shareable search over one resource type. Who may see or edit it is held in the authorization service rather than in the table this record is read from. visibility is the one part of that answer carried here, because a client cannot otherwise separate a caller’s own Views from their team’s without a request per row; every finer-grained grant stays behind the access endpoint.

Parameters

data Any

Attributes

ViewRecord.created

created datetime.datetime #

When the View was first saved.

ViewRecord.created_by

created_by str #

User who created the View. The author, who alone may delete it or change who can see it.

ViewRecord.definition

definition ViewDefinition #

The saved query and presentation state.

ViewRecord.modified

modified datetime.datetime #

When the View’s name or definition last changed. Shown in the picker alongside modified_by, so a shared View can be judged on how current it is.

ViewRecord.modified_by

modified_by str #

User who last changed the View. Surfaced in the picker so a shared View can be judged.

ViewRecord.name

name str #

Display name. Not unique — Views are addressed by view_id, never by name.

ViewRecord.org_id

org_id str #

Organization that owns the View.

ViewRecord.schema_version

schema_version int #

Version of definition’s shape, mirroring its scheme so rows can be selected by version in SQL without parsing the JSON.

ViewRecord.target

The resource type this View searches, e.g. datasets or files.

Fixed at creation: a View’s conditions are written against one target’s fields.

ViewRecord.view_id

view_id str #

Unique identifier for the View, and the token that addresses it in a shareable URL.

ViewRecord.visibility

visibility ViewVisibility | None = None #

Who can see this View, or None when it has not been resolved.

Every API response carrying a View fills this in. None means only that the question was not asked — it does not mean private, and a client treating it as private would show a shared View under a personal heading.

ViewVisibility

class roboto.domain.views.ViewVisibility#View Source

Bases: roboto.compat.StrEnum

Who a View is visible to: asked for when it is created, reported when it is read.

Governs who can see a View, never who can change it. An organization View is readable by the whole org and still editable only by its author, anyone granted editor on it, and org admins.

Attributes

ViewVisibility.Organization

Organization = 'organization' #

Visible to every member of the owning org.

ViewVisibility.Private

Private = 'private' #

Visible to its author, anyone later granted access directly, and the org’s admins.

ensure_definition_renders_for()

roboto.domain.views.ensure_definition_renders_for(target, definition)#View Source

Refuse a definition that no client could show for the target it is saved against.

Applied wherever a definition enters storage, on create and on update, for every caller. The check is per target rather than global because RoboQL is a legitimate way to write a datasets, files, or events View; it is only unrenderable on the targets outside ROBOQL_VIEW_TARGETS. Filter controls and unfiltered definitions render everywhere.

Parameters

Resource type the View searches.

definition ViewDefinition

What the View would store.

Raises

definition carries RoboQL text and target has no RoboQL-capable list.

Return type

None

Was this page helpful?