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.

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"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "Tag is a Pydantic model representing a tag entity.\n\nAttributes\n----------\ntag : str\n    The name of the tag.\nid : str | None\n    The Albert ID of the tag. Set when the tag is retrieved from Albert.\n\nMethods\n-------\nfrom_string(tag: str) -> \"Tag\"\n    Creates a Tag object from a string.",
  "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"
    }
  },
  "required": [
    "name"
  ],
  "title": "Tag",
  "type": "object"
}

Fields:

  • status (Status | None)
  • created (AuditFields | None)
  • updated (AuditFields | None)
  • tag (str)
  • id (str | None)

tag

tag: str

id

id: str | None = None

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)