Lists
albert.collections.lists.ListsCollection
Bases: BaseCollection
ListsCollection is a collection class for managing ListItem entities in the Albert platform.
Example
stages = [
"1. Discovery",
"2. Concept Validation",
"3. Proof of Concept",
"4. Prototype Development",
"5. Preliminary Evaluation",
"6. Feasibility Study",
"7. Optimization",
"8. Scale-Up",
"9. Regulatory Assessment",
]
# Initialize the Albert client
client = Albert()
# Get the custom field this list is associated with
stage_gate_field = client.custom_fields.get_by_id(id="CF123")
# Create the list items
for s in stages:
item = ListItem(
name=s,
category=stage_gate_field.category,
list_type=stage_gate_field.name,
)
client.lists.create(list_item=item)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
list |
Generates a list of list entities with optional filters. |
get_by_id |
Retrieves a list entity by its ID. |
create |
Creates a list entity. |
delete |
Delete a lists entry item by its ID. |
get_matching_item |
Get a list item by name and list type. |
update |
Update a list item. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/lists.py
list
list(
*,
limit: int = 100,
names: list[str] | None = None,
category: ListItemCategory | None = None,
list_type: str | None = None,
start_key: str | None = None,
) -> Iterator[ListItem]
Generates a list of list entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of list entities to return. |
100
|
names
|
list[str]
|
A list of names of the list entity to retrieve. |
None
|
category
|
ListItemCategory
|
The category of the list entity to retrieve. |
None
|
list_type
|
str
|
The type of list entity to retrieve. |
None
|
Returns:
Type | Description |
---|---|
Iterator[ListItem]
|
An iterator of ListItems. |
Source code in src/albert/collections/lists.py
get_by_id
Retrieves a list entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the list entity to retrieve. |
required |
Returns:
Type | Description |
---|---|
List
|
A list entity. |
Source code in src/albert/collections/lists.py
create
Creates a list entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_item
|
ListItem
|
The list entity to create. |
required |
Returns:
Type | Description |
---|---|
List
|
The created list entity. |
Source code in src/albert/collections/lists.py
delete
delete(*, id: str) -> None
Delete a lists entry item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the lists item. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/lists.py
get_matching_item
Get a list item by name and list type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of it item to retrieve. |
required |
list_type
|
str
|
The type of list (can be the name of the custom field) |
required |
Returns:
Type | Description |
---|---|
ListItem | None
|
A list item with the provided name and list type, or None if not found. |
Source code in src/albert/collections/lists.py
update
Update a list item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_item
|
ListItem
|
The list item to update. |
ListItem
|
Returns:
Type | Description |
---|---|
ListItem
|
The updated list item. |