Skip to content

Projects

albert.resources.projects

ProjectClass

Bases: str, Enum

The ACL Class of a project

Attributes:

Name Type Description
SHARED
PUBLIC
CONFIDENTIAL
PRIVATE

SHARED

SHARED = 'shared'

PUBLIC

PUBLIC = 'public'

CONFIDENTIAL

CONFIDENTIAL = 'confidential'

PRIVATE

PRIVATE = 'private'

State

Bases: str, Enum

The current state of a project

Attributes:

Name Type Description
NOT_STARTED
ACTIVE
CLOSED_SUCCESS
CLOSED_ARCHIVED

NOT_STARTED

NOT_STARTED = 'Not Started'

ACTIVE

ACTIVE = 'Active'

CLOSED_SUCCESS

CLOSED_SUCCESS = 'Closed - Success'

CLOSED_ARCHIVED

CLOSED_ARCHIVED = 'Closed - Archived'

TaskConfig

Bases: BaseModel

The task configuration for a project

Show JSON schema:
{
  "description": "The task configuration for a project",
  "properties": {
    "datatemplateId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Datatemplateid"
    },
    "workflowId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Workflowid"
    },
    "defaultTaskName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Defaulttaskname"
    },
    "target": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Target"
    },
    "hidden": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": false,
      "title": "Hidden"
    }
  },
  "title": "TaskConfig",
  "type": "object"
}

Fields:

datatemplateId

datatemplateId: str | None = None

workflowId

workflowId: str | None = None

defaultTaskName

defaultTaskName: str | None = None

target

target: str | None = None

hidden

hidden: bool | None = False

GridDefault

Bases: str, Enum

The default grid for a project

Attributes:

Name Type Description
PD
WKS

PD

PD = 'PD'

WKS

WKS = 'WKS'

Project

Bases: BaseResource

A project in Albert.

Attributes:

Name Type Description
description str

The description of the project. Used as the name of the project as well.

id str | None

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

locations list[Location] | None

The locations associated with the project. Optional.

project_class ProjectClass

The class of the project. Defaults to PRIVATE.

metadata dict[str, str | list[EntityLink] | EntityLink] | None

The metadata of the project. Optional. Metadata allowed values can be found using the Custom Fields API.

prefix str | None

The prefix of the project. Optional.

acl list[ACL] | None

The ACL of the project. Optional.

task_config list[TaskConfig] | None

The task configuration of the project. Optional.

grid GridDefault | None

The default grid of the project. Optional.

state State | None

The state/status of the project. Allowed states are customizeable using the entitystatus API. Optional.

application_engineering_inventory_ids list[str] | None

Inventory Ids to be added as application engineering. Optional.

Show JSON schema:
{
  "$defs": {
    "ACL": {
      "description": "The Access Control List (ACL) for a user",
      "properties": {
        "id": {
          "description": "The id of the user for which this ACL applies",
          "title": "Id",
          "type": "string"
        },
        "fgc": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccessControlLevel"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Fine-Grain Control Level"
        }
      },
      "required": [
        "id"
      ],
      "title": "ACL",
      "type": "object"
    },
    "AccessControlLevel": {
      "description": "The fine grain control",
      "enum": [
        "ProjectOwner",
        "ProjectEditor",
        "ProjectViewer",
        "ProjectAllTask",
        "ProjectPropertyTask",
        "InventoryOwner",
        "InventoryViewer",
        "CustomTemplateOwner"
      ],
      "title": "AccessControlLevel",
      "type": "string"
    },
    "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"
    },
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "GridDefault": {
      "description": "The default grid for a project",
      "enum": [
        "PD",
        "WKS"
      ],
      "title": "GridDefault",
      "type": "string"
    },
    "Location": {
      "description": "A location in Albert.\n\nAttributes\n----------\nname : str\n    The name of the location.\nid : str | None\n    The Albert ID of the location. Set when the location is retrieved from Albert.\nlatitude : float\n    The latitude of the location.\nlongitude : float\n    The longitude of the location.\naddress : str\n    The address of the location.\ncountry : str | None\n    The country code of the location. Must be two characters long.",
      "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"
        },
        "latitude": {
          "title": "Latitude",
          "type": "number"
        },
        "longitude": {
          "title": "Longitude",
          "type": "number"
        },
        "address": {
          "title": "Address",
          "type": "string"
        },
        "country": {
          "anyOf": [
            {
              "maxLength": 2,
              "minLength": 2,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Country"
        }
      },
      "required": [
        "name",
        "latitude",
        "longitude",
        "address"
      ],
      "title": "Location",
      "type": "object"
    },
    "ProjectClass": {
      "description": "The ACL Class of a project",
      "enum": [
        "shared",
        "public",
        "confidential",
        "private"
      ],
      "title": "ProjectClass",
      "type": "string"
    },
    "State": {
      "description": "The current state of a project",
      "enum": [
        "Not Started",
        "Active",
        "Closed - Success",
        "Closed - Archived"
      ],
      "title": "State",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "TaskConfig": {
      "description": "The task configuration for a project",
      "properties": {
        "datatemplateId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Datatemplateid"
        },
        "workflowId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Workflowid"
        },
        "defaultTaskName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Defaulttaskname"
        },
        "target": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Target"
        },
        "hidden": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": false,
          "title": "Hidden"
        }
      },
      "title": "TaskConfig",
      "type": "object"
    }
  },
  "description": "A project in Albert.\n\nAttributes\n----------\ndescription : str\n    The description of the project. Used as the name of the project as well.\nid : str | None\n    The Albert ID of the project. Set when the project is retrieved from Albert.\nlocations : list[Location] | None\n    The locations associated with the project. Optional.\nproject_class : ProjectClass\n    The class of the project. Defaults to PRIVATE.\nmetadata : dict[str, str | list[EntityLink] | EntityLink] | None\n    The metadata of the project. Optional. Metadata allowed values can be found using the Custom Fields API.\nprefix : str | None\n    The prefix of the project. Optional.\n\nacl : list[ACL] | None\n    The ACL of the project. Optional.\ntask_config : list[TaskConfig] | None\n    The task configuration of the project. Optional.\ngrid : GridDefault | None\n    The default grid of the project. Optional.\nstate : State | None\n    The state/status of the project. Allowed states are customizeable using the entitystatus API. Optional.\napplication_engineering_inventory_ids : list[str] | None\n    Inventory Ids to be added as application engineering. Optional.",
  "properties": {
    "status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Status"
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "description": {
      "maxLength": 2000,
      "minLength": 1,
      "title": "Description",
      "type": "string"
    },
    "Locations": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Location"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "maxItems": 20,
          "minItems": 1,
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Locations"
    },
    "class": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectClass"
        },
        {
          "type": "null"
        }
      ],
      "default": "private"
    },
    "prefix": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Prefix"
    },
    "appEngg": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Inventory Ids to be added as application engineering",
      "title": "Appengg"
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Albertid"
    },
    "ACL": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ACL"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Acl"
    },
    "old_api_params": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Old Api Params"
    },
    "task_config": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TaskConfig"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task Config"
    },
    "grid": {
      "anyOf": [
        {
          "$ref": "#/$defs/GridDefault"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "$ref": "#/$defs/EntityLink"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metadata"
    },
    "state": {
      "anyOf": [
        {
          "$ref": "#/$defs/State"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "description"
  ],
  "title": "Project",
  "type": "object"
}

Fields:

Validators:

description

description: str

locations

locations: list[SerializeAsEntityLink[Location]] | None = (
    None
)

project_class

project_class: ProjectClass | None = PRIVATE

prefix

prefix: str | None = None

application_engineering_inventory_ids

application_engineering_inventory_ids: list[str] | None = (
    None
)

Inventory Ids to be added as application engineering

id

id: str | None = None

acl

acl: list[ACL] | None

old_api_params

old_api_params: dict | None = None

task_config

task_config: list[TaskConfig] | None

grid

grid: GridDefault | None = None

metadata

metadata: dict[str, MetadataItem] | None = None

status

status: str | None = None

state

state: State | None = None

validate_status

validate_status(value)

Somehow, some statuses are capitalized in the API response. This ensures they are always lowercase.

Source code in src/albert/resources/projects.py
@field_validator("status", mode="before")
def validate_status(cls, value):
    """Somehow, some statuses are capitalized in the API response. This ensures they are always lowercase."""
    if isinstance(value, str):
        return value.lower()
    return value