Entity Types (🧪Beta)
albert.collections.entity_types.EntityTypeCollection
Bases: BaseCollection
A collection of configurable entity types in the Albert system.
Beta Feature!
Please do not use in production or without explicit guidance from Albert. You might otherwise have a bad experience. This feature currently falls outside of the Albert support contract, but we'd love your feedback!
Methods:
| Name | Description |
|---|---|
get_by_id |
Get an entity type by its ID. |
create |
Create an entity type. |
update |
Update an entity type. |
delete |
Delete an entity type. |
get_rules |
Get the rules for an entity type. |
set_rules |
Create or update the rules for an entity type. |
delete_rules |
Delete the rules for an entity type. |
get_all |
Searches for EntityType items based on the provided parameters. |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
|
Source code in src/albert/collections/entity_types.py
get_by_id
get_by_id(*, id: EntityTypeId) -> EntityType
Get an entity type by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
EntityTypeId
|
The ID of the entity type to get. |
required |
Source code in src/albert/collections/entity_types.py
create
create(*, entity_type: EntityType) -> EntityType
Create an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_type
|
EntityType
|
The entity type to create. |
required |
Source code in src/albert/collections/entity_types.py
update
update(*, entity_type: EntityType) -> EntityType
Update an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_type
|
EntityType
|
The entity type to update. |
required |
Source code in src/albert/collections/entity_types.py
delete
delete(*, id: EntityTypeId) -> None
Delete an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
EntityTypeId
|
The ID of the entity type to delete. |
required |
get_rules
get_rules(*, id: EntityTypeId) -> list[EntityTypeRule]
Get the rules for an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
EntityTypeId
|
The ID of the entity type to get the rules for. |
required |
Source code in src/albert/collections/entity_types.py
set_rules
set_rules(
*, id: EntityTypeId, rules: list[EntityTypeRule]
) -> list[EntityTypeRule]
Create or update the rules for an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
EntityTypeId
|
The ID of the entity type to update the rules for. |
required |
rules
|
list[EntityTypeRule]
|
The rules to update. |
required |
Returns:
| Type | Description |
|---|---|
list[EntityTypeRule]
|
The updated rules. |
Source code in src/albert/collections/entity_types.py
delete_rules
delete_rules(*, id: EntityTypeId) -> None
Delete the rules for an entity type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
EntityTypeId
|
The ID of the entity type to delete the rules for. |
required |
Source code in src/albert/collections/entity_types.py
get_all
get_all(
*,
service: EntityServiceType | None = None,
start_key: str | None = None,
order: OrderBy | None = None,
max_items: int | None = None,
) -> Iterator[EntityType]
Searches for EntityType items based on the provided parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
EntityServiceType | None
|
The service type the entity type is associated with, by default None |
None
|
limit
|
int
|
Maximum number of results to return, by default 100 |
required |
start_key
|
str | None
|
Key to start pagination from, by default None |
None
|
order
|
OrderBy | None
|
Sort order (ascending/descending), by default None |
None
|
Yields:
| Type | Description |
|---|---|
Iterator[EntityType]
|
Returns an iterator of EntityType items matching the search criteria. |