# Views ## Create a view bundle (view + select/filter/sort) `client.views.create("action" | "deal" | "document" | 3 moreviewObjectType, ViewCreateParamsparams, RequestOptionsoptions?): ViewCreateResponse` **post** `/v2/prism/{teamId}/{viewObjectType}/views` Create a view bundle (view + select/filter/sort) ### Parameters - `viewObjectType: "action" | "deal" | "document" | 3 more` - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `params: ViewCreateParams` - `teamId?: string` Path param - `name: string` Body param - `view_type: string` Body param - `id?: string` Body param - `aggregation_prop_def_id?: string | null` Body param - `aggregation_type?: string | null` Body param - `column_layout?: Record | null` Body param - `combinator?: "AND" | "OR"` Body param - `"AND"` - `"OR"` - `created_at?: string` Body param - `filter?: Array>` Body param: Each entry is { slug: { comparator: value } } - `group_by?: string | null` Body param: Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` Body param - `Array` - `unknown` - `group_hide_empty?: boolean | null` Body param - `group_sort?: string | null` Body param - `icon?: string | null` Body param - `list_id?: string | null` Body param - `select?: Array` Body param: Property slugs (dot-paths permitted for refs) - `sort?: Array>` Body param: Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` Body param - `team_id?: string | null` Body param - `updated_at?: string | null` Body param - `user_id?: string | null` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ViewCreateResponse` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const view = await client.views.create('action', { name: 'name', view_type: 'view_type' }); console.log(view.id); ``` #### Response ```json { "name": "name", "view_type": "view_type", "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_type": "aggregation_type", "column_layout": { "foo": "bar" }, "combinator": "AND", "created_at": "created_at", "filter": [ { "foo": "bar" } ], "group_by": "group_by", "group_hidden_option_ids": [ {} ], "group_hide_empty": true, "group_sort": "group_sort", "icon": "icon", "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "select": [ "string" ], "sort": [ { "foo": "bar" } ], "sort_order": 0, "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "updated_at", "user_id": "user_id" } ``` ## Read a view bundle `client.views.get(stringviewID, ViewGetParamsparams, RequestOptionsoptions?): ViewGetResponse` **get** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}` 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}`. ### Parameters - `viewID: string` - `params: ViewGetParams` - `teamId?: string` Path param - `viewObjectType: "action" | "deal" | "document" | 3 more` Path param - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `cursor?: string` Query param: Forwarded to the records sub-resource when `include=records`. - `include?: string` Query param: 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?: number` Query param: Forwarded to the records sub-resource when `include=records`. - `page?: number` Query param: Forwarded to the records sub-resource when `include=records`. ### Returns - `ViewGetResponse = ViewBundle | ViewBundleWithRecords` 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. - `ViewBundle` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` - `ViewBundleWithRecords` Returned by `GET /views/{viewId}?include=records`. Same `records` shape as the standalone list-view-records endpoint. - `records: Records` - `data: Array>` - `has_more: boolean` - `next_cursor?: string | null` - `view: View` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const view = await client.views.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', }); console.log(view); ``` #### Response ```json { "name": "name", "view_type": "view_type", "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_type": "aggregation_type", "column_layout": { "foo": "bar" }, "combinator": "AND", "created_at": "created_at", "filter": [ { "foo": "bar" } ], "group_by": "group_by", "group_hidden_option_ids": [ {} ], "group_hide_empty": true, "group_sort": "group_sort", "icon": "icon", "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "select": [ "string" ], "sort": [ { "foo": "bar" } ], "sort_order": 0, "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "updated_at", "user_id": "user_id" } ``` ## Update a view bundle (select/filter/sort arrays are replaced wholesale when supplied) `client.views.update(stringviewID, ViewUpdateParamsparams, RequestOptionsoptions?): ViewUpdateResponse` **patch** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}` Update a view bundle (select/filter/sort arrays are replaced wholesale when supplied) ### Parameters - `viewID: string` - `params: ViewUpdateParams` - `teamId?: string` Path param - `viewObjectType: "action" | "deal" | "document" | 3 more` Path param - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `aggregation_prop_def_id?: string | null` Body param - `aggregation_type?: string | null` Body param - `column_layout?: Record | null` Body param - `combinator?: "AND" | "OR"` Body param - `"AND"` - `"OR"` - `filter?: Array>` Body param - `group_by?: string | null` Body param - `group_hidden_option_ids?: Array | unknown | null` Body param - `Array` - `unknown` - `group_hide_empty?: boolean | null` Body param - `group_sort?: string | null` Body param - `icon?: string | null` Body param - `list_id?: string | null` Body param - `name?: string` Body param - `select?: Array` Body param - `sort?: Array>` Body param - `sort_order?: number | null` Body param - `team_id?: string | null` Body param - `user_id?: string | null` Body param - `view_type?: string` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Returns - `ViewUpdateResponse` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const view = await client.views.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', }); console.log(view.id); ``` #### Response ```json { "name": "name", "view_type": "view_type", "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "aggregation_type": "aggregation_type", "column_layout": { "foo": "bar" }, "combinator": "AND", "created_at": "created_at", "filter": [ { "foo": "bar" } ], "group_by": "group_by", "group_hidden_option_ids": [ {} ], "group_hide_empty": true, "group_sort": "group_sort", "icon": "icon", "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "select": [ "string" ], "sort": [ { "foo": "bar" } ], "sort_order": 0, "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "updated_at", "user_id": "user_id" } ``` ## Delete a view bundle `client.views.delete(stringviewID, ViewDeleteParamsparams, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}` Delete a view bundle ### Parameters - `viewID: string` - `params: ViewDeleteParams` - `teamId?: string` - `viewObjectType: "action" | "deal" | "document" | 3 more` - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.views.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action' }); ``` ## Domain Types ### View Create Response - `ViewCreateResponse` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` ### View Get Response - `ViewGetResponse = ViewBundle | ViewBundleWithRecords` 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. - `ViewBundle` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` - `ViewBundleWithRecords` Returned by `GET /views/{viewId}?include=records`. Same `records` shape as the standalone list-view-records endpoint. - `records: Records` - `data: Array>` - `has_more: boolean` - `next_cursor?: string | null` - `view: View` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` ### View Update Response - `ViewUpdateResponse` 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. - `name: string` - `view_type: string` - `id?: string` - `aggregation_prop_def_id?: string | null` - `aggregation_type?: string | null` - `column_layout?: Record | null` - `combinator?: "AND" | "OR"` - `"AND"` - `"OR"` - `created_at?: string` - `filter?: Array>` Each entry is { slug: { comparator: value } } - `group_by?: string | null` Property slug to group by - `group_hidden_option_ids?: Array | unknown | null` - `Array` - `unknown` - `group_hide_empty?: boolean | null` - `group_sort?: string | null` - `icon?: string | null` - `list_id?: string | null` - `select?: Array` Property slugs (dot-paths permitted for refs) - `sort?: Array>` Each entry is { slug: 'asc' | 'desc' } - `sort_order?: number | null` - `team_id?: string | null` - `updated_at?: string | null` - `user_id?: string | null` # Records ## List records selected by a view (filters and sorts applied; pinned record_order overlaid first) `client.views.records.list(stringviewID, RecordListParamsparams, RequestOptionsoptions?): RecordListResponse` **get** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}/records` List records selected by a view (filters and sorts applied; pinned record_order overlaid first) ### Parameters - `viewID: string` - `params: RecordListParams` - `teamId?: string` Path param - `viewObjectType: "action" | "deal" | "document" | 3 more` Path param - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `cursor?: string` Query param: Opaque cursor from a previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When set, `page` and `limit` are derived from the cursor. - `limit?: number` Query param - `page?: number` Query param: Page number (1-based). Prefer `cursor`. ### Returns - `RecordListResponse` - `data: Array>` - `has_more: boolean` True if more records exist beyond this page. - `next_cursor?: string | null` Opaque cursor for the next page; null when `has_more` is false. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); const records = await client.views.records.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', }); console.log(records.data); ``` #### Response ```json { "data": [ { "foo": "bar" } ], "has_more": true, "next_cursor": "next_cursor" } ``` ## Bulk reorder pinned records `client.views.records.reorder(stringviewID, RecordReorderParamsparams, RequestOptionsoptions?): void` **patch** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}/records` Bulk reorder pinned records ### Parameters - `viewID: string` - `params: RecordReorderParams` - `teamId?: string` Path param - `viewObjectType: "action" | "deal" | "document" | 3 more` Path param - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `object_ids: Array` Body param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.views.records.reorder('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', object_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], }); ``` ## Pin a record to the view (append to record_order) `client.views.records.pin(stringobjectID, RecordPinParamsparams, RequestOptionsoptions?): void` **post** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}/records/{objectId}` Pin a record to the view (append to record_order) ### Parameters - `objectID: string` - `params: RecordPinParams` - `teamId?: string` Path param - `viewObjectType: "action" | "deal" | "document" | 3 more` Path param - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `viewId: string` Path param - `idempotencyKey?: string` Header param: A unique key (UUID or any opaque string up to 255 chars) that identifies this logical request. The server caches the first response under this key for 24 hours and replays it on retry — safe to use on every POST/PUT/PATCH to make network retries deterministic. Reusing the same key with a different body returns 409 `idempotency_key_mismatch`. Replays include the `idempotent-replay: true` response header. ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.views.records.pin('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', viewId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); ``` ## Unpin a record from the view `client.views.records.unpin(stringobjectID, RecordUnpinParamsparams, RequestOptionsoptions?): void` **delete** `/v2/prism/{teamId}/{viewObjectType}/views/{viewId}/records/{objectId}` Unpin a record from the view ### Parameters - `objectID: string` - `params: RecordUnpinParams` - `teamId?: string` - `viewObjectType: "action" | "deal" | "document" | 3 more` - `"action"` - `"deal"` - `"document"` - `"event"` - `"identity"` - `"organization"` - `viewId: string` ### Example ```typescript import Micro from '@micro-so/sdk'; const client = new Micro({ teamID: 'My Team ID', apiKey: process.env['MICRO_API_KEY'], // This is the default and can be omitted }); await client.views.records.unpin('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { viewObjectType: 'action', viewId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); ``` ## Domain Types ### Record List Response - `RecordListResponse` - `data: Array>` - `has_more: boolean` True if more records exist beyond this page. - `next_cursor?: string | null` Opaque cursor for the next page; null when `has_more` is false.