Parameters
albert.collections.parameters
AlbertPaginator
AlbertPaginator(
*,
path: str,
mode: PaginationMode,
session: AlbertSession,
deserialize: Callable[
[Iterable[dict]], Iterable[ItemType]
],
params: dict[str, str] | None = None,
)
Bases: Iterator[ItemType]
Helper class for pagination through Albert endpoints.
Two pagination modes are possible:
- Offset-based via by the offset query parameter
- Key-based via by the startKey query parameter and 'lastKey' response field
A custom deserialize function is provided when additional logic is required to load
the raw items returned by the search listing, e.g., making additional Albert API calls.
Source code in src/albert/core/pagination.py
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
auth_manager: AlbertClientCredentials
| AlbertSSOClient
| None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
The base URL to prefix to all relative request paths (e.g., "https://app.albertinvent.com"). |
required |
token
|
str | None
|
A static JWT token for authentication. Ignored if |
None
|
auth_manager
|
AlbertClientCredentials | AlbertSSOClient
|
An authentication manager used to dynamically fetch and refresh tokens.
If provided, it overrides |
None
|
retries
|
int
|
The number of automatic retries on failed requests (default is 3). |
None
|
Methods:
| Name | Description |
|---|---|
request |
|
Source code in src/albert/core/session.py
request
Source code in src/albert/core/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
OrderBy
PaginationMode
Parameter
Bases: BaseResource
A parameter in Albert.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the parameter. Names must be unique. |
id |
str | None
|
The Albert ID of the parameter. Set when the parameter is retrieved from Albert. |
category |
ParameterCategory
|
The category of the parameter. Allowed values are |
rank |
int
|
The rank of the returned parameter. Read-only. |
category
class-attribute
instance-attribute
metadata
class-attribute
instance-attribute
rank
class-attribute
instance-attribute
rank: int | None = Field(
default=None, exclude=True, frozen=True
)
ParameterCollection
ParameterCollection(*, session: AlbertSession)
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 |
|---|---|
create |
Create a new parameter. |
delete |
Delete a parameter by its ID. |
get_all |
Retrieve all Parameter items with optional filters. |
get_by_id |
Retrieve a parameter by its ID. |
update |
Update a parameter. |
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 or the existing parameter if it already exists. |
Source code in src/albert/collections/parameters.py
delete
delete(*, id: str) -> None
Delete a parameter by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the parameter to delete. |
required |
get_all
get_all(
*,
ids: list[str] | None = None,
names: str | list[str] = None,
exact_match: bool = False,
order_by: OrderBy = DESCENDING,
start_key: str | None = None,
limit: int = 50,
) -> Iterator[Parameter]
Retrieve all Parameter items with optional filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[str] | None
|
A list of parameter IDs to retrieve, by default None |
None
|
names
|
str | list[str]
|
A list of parameter names to retrieve, by default None |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default False |
False
|
order_by
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
Yields:
| Type | Description |
|---|---|
Iterator[Parameter]
|
An iterator of Parameters matching the given criteria. |
Source code in src/albert/collections/parameters.py
get_by_id
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
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. |