Parameter Groups
albert.collections.parameter_groups
Functions:
| Name | Description |
|---|---|
generate_parameter_group_patches |
|
AlbertHTTPError
Bases: AlbertException
Base class for all erors due to HTTP responses.
Source code in src/albert/exceptions.py
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
PGType
PaginationMode
ParameterGroup
Bases: BaseTaggedResource
Use 'Standards' key in metadata to store standards
acl
class-attribute
instance-attribute
documents
class-attribute
instance-attribute
metadata
class-attribute
instance-attribute
parameters
class-attribute
instance-attribute
parameters: list[ParameterValue] = Field(
default_factory=list, alias="Parameters"
)
security_class
class-attribute
instance-attribute
verified
class-attribute
instance-attribute
verified: bool = Field(
default=False, exclude=True, frozen=True
)
ParameterGroupCollection
ParameterGroupCollection(*, session: AlbertSession)
Bases: BaseCollection
ParameterGroupCollection is a collection class for managing ParameterGroup entities in the Albert platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The Albert session to use for making requests. |
required |
Methods:
| Name | Description |
|---|---|
create |
Create a new parameter group. |
delete |
Delete a parameter group by its ID. |
get_all |
Search and hydrate all Parameter Groups matching the given criteria. |
get_by_id |
Get a parameter group by its ID. |
get_by_ids |
|
get_by_name |
Get a parameter group by its name. |
search |
Search for Parameter Groups matching the given criteria. |
update |
Update a parameter group. |
Source code in src/albert/collections/parameter_groups.py
create
create(
*, parameter_group: ParameterGroup
) -> ParameterGroup
Create a new parameter group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_group
|
ParameterGroup
|
The parameter group to create. |
required |
Returns:
| Type | Description |
|---|---|
ParameterGroup
|
The created parameter group. |
Source code in src/albert/collections/parameter_groups.py
delete
delete(*, id: str) -> None
Delete a parameter group by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the parameter group to delete |
required |
Source code in src/albert/collections/parameter_groups.py
get_all
get_all(
*,
text: str | None = None,
types: PGType | list[PGType] | None = None,
order_by: OrderBy = DESCENDING,
limit: int = 25,
offset: int | None = None,
) -> Iterator[ParameterGroup]
Search and hydrate all Parameter Groups matching the given criteria.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Text to search for, by default None. |
None
|
types
|
PGType | list[PGType] | None
|
Filter the returned Parameter Groups by Type, by default None. |
None
|
order_by
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING. |
DESCENDING
|
limit
|
int
|
Page size for each search request, by default 25. |
25
|
offset
|
int | None
|
Offset to start from, by default None. |
None
|
Yields:
| Type | Description |
|---|---|
Iterator[ParameterGroup]
|
An iterator of fully hydrated Parameter Groups. |
Source code in src/albert/collections/parameter_groups.py
get_by_id
get_by_id(*, id: str) -> ParameterGroup
Get a parameter group by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the parameter group to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
ParameterGroup
|
The parameter group with the given ID. |
Source code in src/albert/collections/parameter_groups.py
get_by_ids
get_by_ids(*, ids: list[str]) -> ParameterGroup
Source code in src/albert/collections/parameter_groups.py
get_by_name
get_by_name(*, name: str) -> ParameterGroup | None
Get a parameter group by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the parameter group to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
ParameterGroup | None
|
The parameter group with the given name, or None if not found. |
Source code in src/albert/collections/parameter_groups.py
search
search(
*,
text: str | None = None,
types: PGType | list[PGType] | None = None,
order_by: OrderBy = DESCENDING,
limit: int = 25,
offset: int | None = None,
) -> Iterator[ParameterGroupSearchItem]
Search for Parameter Groups matching the given criteria.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Text to search for, by default None |
None
|
types
|
PGType | list[PGType] | None
|
Filer the returned Parameter Groups by Type, by default None |
None
|
order_by
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
Yields:
| Type | Description |
|---|---|
Iterator[ParameterGroup]
|
An iterator of Parameter Groups matching the given criteria. |
Source code in src/albert/collections/parameter_groups.py
update
update(
*, parameter_group: ParameterGroup
) -> ParameterGroup
Update a parameter group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_group
|
ParameterGroup
|
The updated ParameterGroup. The ParameterGroup must have an ID. |
required |
Returns:
| Type | Description |
|---|---|
ParameterGroup
|
The updated ParameterGroup as returned by the server. |
Source code in src/albert/collections/parameter_groups.py
ParameterGroupSearchItem
pydantic-model
Bases: BaseAlbertModel, HydrationMixin[ParameterGroup]
Lightweight representation of a ParameterGroup returned from unhydrated search().
Show JSON schema:
{
"$defs": {
"LocalizedNames": {
"properties": {
"de": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "De"
},
"ja": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Ja"
},
"zh": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Zh"
},
"es": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Es"
}
},
"title": "LocalizedNames",
"type": "object"
},
"PGType": {
"description": "The type of a parameter group",
"enum": [
"general",
"batch",
"property"
],
"title": "PGType",
"type": "string"
},
"ParameterSearchItemParameter": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"id": {
"title": "Id",
"type": "string"
},
"localizedNames": {
"$ref": "#/$defs/LocalizedNames"
}
},
"required": [
"name",
"id",
"localizedNames"
],
"title": "ParameterSearchItemParameter",
"type": "object"
}
},
"description": "Lightweight representation of a ParameterGroup returned from unhydrated search().",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"type": {
"anyOf": [
{
"$ref": "#/$defs/PGType"
},
{
"type": "null"
}
],
"default": null
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"parameters": {
"items": {
"$ref": "#/$defs/ParameterSearchItemParameter"
},
"title": "Parameters",
"type": "array"
}
},
"required": [
"name"
],
"title": "ParameterGroupSearchItem",
"type": "object"
}
Fields:
-
_collection(BaseCollection | None) -
name(str) -
type(PGType | None) -
id(str | None) -
description(str | None) -
parameters(list[ParameterSearchItemParameter])
generate_parameter_group_patches
generate_parameter_group_patches(
initial_patches: PatchPayload,
updated_parameter_group: ParameterGroup,
existing_parameter_group: ParameterGroup,
)