Parameters
albert.collections.parameters.ParameterCollection
Bases: BaseCollection
ParameterCollection is a collection class for managing Parameter entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_by_id |
Retrieve a parameter by its ID. |
create |
Create a new parameter. |
get_or_create |
Retrieves a Parameter or creates it if it does not exist. |
delete |
Delete a parameter by its ID. |
get_all |
Retrieve all Parameter items with optional filters. |
update |
Update a parameter. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/parameters.py
get_by_id
get_by_id(*, id: ParameterId) -> Parameter
Retrieve a parameter by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter to retrieve. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
The parameter with the given ID. |
Source code in src/albert/collections/parameters.py
create
Create a new parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
Parameter
|
The parameter to create. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
Returns the created parameter. |
Source code in src/albert/collections/parameters.py
get_or_create
Retrieves a Parameter or creates it if it does not exist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
Parameter
|
The parameter to get or create. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
The existing or newly created parameter. |
Source code in src/albert/collections/parameters.py
delete
delete(*, id: ParameterId) -> None
Delete a parameter by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter to delete. |
required |
Source code in src/albert/collections/parameters.py
get_all
get_all(
*,
ids: list[ParameterId] | None = None,
names: str | list[str] = None,
exact_match: bool = False,
order_by: OrderBy = DESCENDING,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[Parameter]
Retrieve all Parameter items with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str]
|
A list of parameter IDs to retrieve. |
None
|
names
|
str or list[str]
|
One or more parameter names to filter by. |
None
|
exact_match
|
bool
|
Whether to require exact name matches. Default is False. |
False
|
order_by
|
OrderBy
|
Sort order of results. Default is DESCENDING. |
DESCENDING
|
start_key
|
str
|
The pagination key to start from. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
Returns:
Type | Description |
---|---|
Iterator[Parameter]
|
An iterator of Parameters matching the given criteria. |
Source code in src/albert/collections/parameters.py
update
Update a parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
Parameter
|
The updated parameter to save. The parameter must have an ID. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
The updated parameter as returned by the server. |