Skip to content

Tags

albert.resources.tags

TagEntity

Bases: str, Enum

TagEntity is an enumeration of possible tag entities.

Attributes:

Name Type Description
INVENTORY
COMPANY

INVENTORY

INVENTORY = 'Inventory'

COMPANY

COMPANY = 'Company'

Tag

Bases: BaseResource

Tag is a Pydantic model representing a tag entity.

Attributes:

Name Type Description
tag str

The name of the tag.

id str | None

The Albert ID of the tag. Set when the tag is retrieved from Albert.

Methods:

Name Description
from_string

Creates a Tag object from a string.

tag

tag: str = Field(
    alias=AliasChoices("name", "tagName"),
    serialization_alias="name",
)

id

id: str | None = Field(
    None,
    alias=AliasChoices("albertId", "tagId"),
    serialization_alias="albertId",
)

from_string

from_string(tag: str) -> Tag

Creates a Tag object from a string.

Parameters:

Name Type Description Default
tag str

The name of the tag.

required

Returns:

Type Description
Tag

The Tag object created from the string.

Source code in src/albert/resources/tags.py
@classmethod
def from_string(cls, tag: str) -> Tag:
    """
    Creates a Tag object from a string.

    Parameters
    ----------
    tag : str
        The name of the tag.

    Returns
    -------
    Tag
        The Tag object created from the string.
    """
    return cls(tag=tag)