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.

Show JSON schema:
{
  "$defs": {
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "ListItemCategory": {
      "enum": [
        "businessDefined",
        "userDefined",
        "projects",
        "extensions",
        "inventory"
      ],
      "title": "ListItemCategory",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "An item in a list.\n\nAttributes\n----------\nname : str\n    The name of the list item.\nid : str | None\n    The Albert ID of the list item. Set when the list item is retrieved from Albert.\ncategory : ListItemCategory | None\n    The category of the list item. Allowed values are `businessDefined`, `userDefined`, `projects`, and `extensions`.\nlist_type : str | None\n    The type of the list item. Allowed values are `projectState` for `projects` and `extensions` for `extensions`.",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Albertid"
    },
    "category": {
      "anyOf": [
        {
          "$ref": "#/$defs/ListItemCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "listType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Listtype"
    }
  },
  "required": [
    "name"
  ],
  "title": "ListItem",
  "type": "object"
}

Fields:

Validators:

name

name: str

id

id: str | None = None

category

category: ListItemCategory | None = None

list_type

list_type: str | None = None

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