# Views

Views — Micro Python reference.

Reference for Python SDK **0.8.0**.

[Release source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/api.md) · [Setup and client configuration](/docs/reference/python)

## create

`POST /v2/prism/{teamId}/{viewObjectType}/views`

````text
client.views.create(view_object_type, *, path_team_id, **params) -> ViewCreateResponse
````

Create a view bundle (view + select/filter/sort)

## update

`PATCH /v2/prism/{teamId}/{viewObjectType}/views/{viewId}`

````text
client.views.update(view_id, *, path_team_id, view_object_type, **params) -> ViewUpdateResponse
````

Update a view bundle (select/filter/sort arrays are replaced wholesale when supplied)

## delete

`DELETE /v2/prism/{teamId}/{viewObjectType}/views/{viewId}`

````text
client.views.delete(view_id, *, team_id, view_object_type) -> None
````

Delete a view bundle

## get

`GET /v2/prism/{teamId}/{viewObjectType}/views/{viewId}`

````text
client.views.get(view_id, *, team_id, view_object_type, **params) -> ViewGetResponse
````

Returns the view bundle. Pass `?include=records` to also fetch a page of records selected by the view in the same call; the response is then wrapped as `{view, records}`.

## Parameter and response types

These declarations show the request parameters and response shapes used by the methods above.

### ViewCreateParams

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_create_params.py)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `path_team_id` | `str` | No | API name: `teamId`. |
| `name` | `Required[str]` | Yes | — |
| `view_type` | `Required[str]` | Yes | — |
| `id` | `str` | No | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Literal["AND", "OR"]` | No | — |
| `created_at` | `str` | No | — |
| `filter` | `Iterable[Dict[str, object]]` | No | Each entry is &#123; slug: &#123; comparator: value &#125; &#125; |
| `group_by` | `Optional[str]` | No | Property slug to group by |
| `group_hidden_option_ids` | `Union[Iterable[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `select` | `SequenceNotStr[str]` | No | Property slugs (dot-paths permitted for refs) |
| `sort` | `Iterable[Dict[str, object]]` | No | Each entry is &#123; slug: 'asc' \| 'desc' &#125; |
| `sort_order` | `Optional[int]` | No | — |
| `body_team_id` | `Optional[str]` | No | API name: `team_id`. |
| `updated_at` | `Optional[str]` | No | — |
| `user_id` | `Optional[str]` | No | — |
| `idempotency_key` | `str` | No | API name: `Idempotency-Key`. |

### ViewCreateResponse

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_create_response.py)

A view (saved configuration for displaying records of a given object type) plus its select/filter/sort children. Properties in select/filter/sort are referenced by slug.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `str` | Yes | — |
| `view_type` | `str` | Yes | — |
| `id` | `Optional[str]` | No | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Optional[Literal["AND", "OR"]]` | No | — |
| `created_at` | `Optional[str]` | No | — |
| `filter` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: &#123; comparator: value &#125; &#125; |
| `group_by` | `Optional[str]` | No | Property slug to group by |
| `group_hidden_option_ids` | `Union[List[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `select` | `Optional[List[str]]` | No | Property slugs (dot-paths permitted for refs) |
| `sort` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: 'asc' \| 'desc' &#125; |
| `sort_order` | `Optional[int]` | No | — |
| `team_id` | `Optional[str]` | No | — |
| `updated_at` | `Optional[str]` | No | — |
| `user_id` | `Optional[str]` | No | — |

### ViewUpdateParams

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_update_params.py)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `path_team_id` | `str` | No | API name: `teamId`. |
| `view_object_type` | `Required[` | Yes | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Literal["AND", "OR"]` | No | — |
| `filter` | `Iterable[Dict[str, object]]` | No | — |
| `group_by` | `Optional[str]` | No | — |
| `group_hidden_option_ids` | `Union[Iterable[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `name` | `str` | No | — |
| `select` | `SequenceNotStr[str]` | No | — |
| `sort` | `Iterable[Dict[str, object]]` | No | — |
| `sort_order` | `Optional[int]` | No | — |
| `body_team_id` | `Optional[str]` | No | API name: `team_id`. |
| `user_id` | `Optional[str]` | No | — |
| `view_type` | `str` | No | — |
| `idempotency_key` | `str` | No | API name: `Idempotency-Key`. |

### ViewUpdateResponse

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_update_response.py)

A view (saved configuration for displaying records of a given object type) plus its select/filter/sort children. Properties in select/filter/sort are referenced by slug.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `str` | Yes | — |
| `view_type` | `str` | Yes | — |
| `id` | `Optional[str]` | No | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Optional[Literal["AND", "OR"]]` | No | — |
| `created_at` | `Optional[str]` | No | — |
| `filter` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: &#123; comparator: value &#125; &#125; |
| `group_by` | `Optional[str]` | No | Property slug to group by |
| `group_hidden_option_ids` | `Union[List[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `select` | `Optional[List[str]]` | No | Property slugs (dot-paths permitted for refs) |
| `sort` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: 'asc' \| 'desc' &#125; |
| `sort_order` | `Optional[int]` | No | — |
| `team_id` | `Optional[str]` | No | — |
| `updated_at` | `Optional[str]` | No | — |
| `user_id` | `Optional[str]` | No | — |

### ViewGetParams

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_params.py)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `team_id` | `str` | No | API name: `teamId`. |
| `view_object_type` | `Required[` | Yes | — |
| `cursor` | `str` | No | Forwarded to the records sub-resource when `include=records`. |
| `include` | `str` | No | Comma-separated list of optional sub-resources to inline. Currently the only recognized value is `records` — when present, the response is `{view, records}` rather than the bare view bundle. |
| `limit` | `int` | No | Forwarded to the records sub-resource when `include=records`. |
| `page` | `int` | No | Forwarded to the records sub-resource when `include=records`. |

### ViewBundle

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_response.py)

A view (saved configuration for displaying records of a given object type) plus its select/filter/sort children. Properties in select/filter/sort are referenced by slug.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `str` | Yes | — |
| `view_type` | `str` | Yes | — |
| `id` | `Optional[str]` | No | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Optional[Literal["AND", "OR"]]` | No | — |
| `created_at` | `Optional[str]` | No | — |
| `filter` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: &#123; comparator: value &#125; &#125; |
| `group_by` | `Optional[str]` | No | Property slug to group by |
| `group_hidden_option_ids` | `Union[List[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `select` | `Optional[List[str]]` | No | Property slugs (dot-paths permitted for refs) |
| `sort` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: 'asc' \| 'desc' &#125; |
| `sort_order` | `Optional[int]` | No | — |
| `team_id` | `Optional[str]` | No | — |
| `updated_at` | `Optional[str]` | No | — |
| `user_id` | `Optional[str]` | No | — |

### ViewBundleWithRecordsRecords

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_response.py)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `List[Dict[str, object]]` | Yes | — |
| `has_more` | `bool` | Yes | — |
| `next_cursor` | `Optional[str]` | No | — |

### ViewBundleWithRecordsView

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_response.py)

A view (saved configuration for displaying records of a given object type) plus its select/filter/sort children. Properties in select/filter/sort are referenced by slug.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `str` | Yes | — |
| `view_type` | `str` | Yes | — |
| `id` | `Optional[str]` | No | — |
| `aggregation_prop_def_id` | `Optional[str]` | No | — |
| `aggregation_type` | `Optional[str]` | No | — |
| `column_layout` | `Optional[Dict[str, object]]` | No | — |
| `combinator` | `Optional[Literal["AND", "OR"]]` | No | — |
| `created_at` | `Optional[str]` | No | — |
| `filter` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: &#123; comparator: value &#125; &#125; |
| `group_by` | `Optional[str]` | No | Property slug to group by |
| `group_hidden_option_ids` | `Union[List[object], object, None]` | No | — |
| `group_hide_empty` | `Optional[bool]` | No | — |
| `group_sort` | `Optional[str]` | No | — |
| `icon` | `Optional[str]` | No | — |
| `list_id` | `Optional[str]` | No | — |
| `select` | `Optional[List[str]]` | No | Property slugs (dot-paths permitted for refs) |
| `sort` | `Optional[List[Dict[str, object]]]` | No | Each entry is &#123; slug: 'asc' \| 'desc' &#125; |
| `sort_order` | `Optional[int]` | No | — |
| `team_id` | `Optional[str]` | No | — |
| `updated_at` | `Optional[str]` | No | — |
| `user_id` | `Optional[str]` | No | — |

### ViewBundleWithRecords

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_response.py)

Returned by `GET /views/{viewId}?include=records`. Same `records` shape as the standalone list-view-records endpoint.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `records` | `ViewBundleWithRecordsRecords` | Yes | — |
| `view` | `ViewBundleWithRecordsView` | Yes | A view (saved configuration for displaying records of a given object type) plus its select/filter/sort children. Properties in select/filter/sort are referenced by slug. |

<span id="view_get_responsepy"></span>

### ViewGetResponse

[Source](https://github.com/micro-so/micro-sdk-py/blob/v0.8.0/src/micro_so/types/view_get_response.py)

`ViewGetResponse = Union[ViewBundle, ViewBundleWithRecords]`
