Skip to content

Lists

albert.resources.lists

ListItemCategory

Bases: str, Enum

Attributes:

Name Type Description
BUSINESS_DEFINED
USER_DEFINED
PROJECTS
EXTENSIONS
INVENTORY

BUSINESS_DEFINED

BUSINESS_DEFINED = 'businessDefined'

USER_DEFINED

USER_DEFINED = 'userDefined'

PROJECTS

PROJECTS = 'projects'

EXTENSIONS

EXTENSIONS = 'extensions'

INVENTORY

INVENTORY = 'inventory'

ListItem

Bases: BaseResource

An item in a list.

Attributes:

Name Type Description
name str

The name of the list item.

id str | None

The Albert ID of the list item. Set when the list item is retrieved from Albert.

category ListItemCategory | None

The category of the list item. Allowed values are businessDefined, userDefined, projects, and extensions.

list_type str | None

The type of the list item. Allowed values are projectState for projects and extensions for extensions.

Methods:

Name Description
validate_list_type

name

name: str

id

id: str | None = Field(default=None, alias='albertId')

category

category: ListItemCategory | None = Field(default=None)

list_type

list_type: str | None = Field(
    default=None, alias="listType"
)

validate_list_type

validate_list_type() -> ListItem
Source code in src/albert/resources/lists.py
@model_validator(mode="after")
def validate_list_type(self) -> "ListItem":
    if (
        self.category == ListItemCategory.PROJECTS
        and self.list_type is not None
        and self.list_type != "projectState"
    ) or (
        self.category == ListItemCategory.EXTENSIONS
        and self.list_type is not None
        and self.list_type != "extensions"
    ):
        raise ValueError(
            f"List type {self.list_type} is not allowed for category {self.category}"
        )
    return self