Parameters
albert.collections.parameters
AlbertHTTPError
Bases: AlbertException
Base class for all erors due to HTTP responses.
Source code in src/albert/exceptions.py
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | 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 requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/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
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_by_id |
Retrieve a parameter by its ID. |
list |
Lists parameters that match the provided criteria. |
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_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
list
list(
*,
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,
return_full: bool = True,
) -> Iterator[Parameter]
Lists parameters that match the provided criteria.
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
|
return_full
|
bool
|
Whether to make additional API call to fetch the full object, by default True |
True
|
Yields:
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. |