Skip to content

Documents

albert.resources.documents

DocumentState

Bases: str, Enum

Lifecycle state of a document version.

Attributes:

Name Type Description
DRAFT
PUBLISHED
ARCHIVED

DRAFT

DRAFT = 'draft'

PUBLISHED

PUBLISHED = 'published'

ARCHIVED

ARCHIVED = 'archived'

DocumentClass

Bases: str, Enum

Access class of a document.

Attributes:

Name Type Description
PRIVATE
PUBLIC
SHARED
CONFIDENTIAL
RESTRICTED

PRIVATE

PRIVATE = 'private'

PUBLIC

PUBLIC = 'public'

SHARED

SHARED = 'shared'

CONFIDENTIAL

CONFIDENTIAL = 'confidential'

RESTRICTED

RESTRICTED = 'restricted'

DocumentVersion

Bases: BaseAlbertModel

A single version entry in a document's version history.

Each entry represents one version of a document attached to a Data Template. Obtain the document ID from DataTemplate.documents and pass it to get_document_version_history.

Example

from albert import Albert

client = Albert()
dt = client.data_templates.get_by_id(id="DAT8967")
for doc in dt.documents:
    for version in client.data_templates.get_document_version_history(
        document_id=doc.id
    ):
        print(version.doc_version, version.state)
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"
    },
    "DocumentClass": {
      "description": "Access class of a document.",
      "enum": [
        "private",
        "public",
        "shared",
        "confidential",
        "restricted"
      ],
      "title": "DocumentClass",
      "type": "string"
    },
    "DocumentState": {
      "description": "Lifecycle state of a document version.",
      "enum": [
        "draft",
        "published",
        "archived"
      ],
      "title": "DocumentState",
      "type": "string"
    }
  },
  "description": "A single version entry in a document's version history.\n\nEach entry represents one version of a document attached to a Data Template.\nObtain the document ID from\n[`DataTemplate.documents`][albert.resources.data_templates.DataTemplate.documents]\nand pass it to\n[`get_document_version_history`][albert.collections.data_templates.DataTemplateCollection.get_document_version_history].\n\n!!! example\n    ```python\n    from albert import Albert\n\n    client = Albert()\n    dt = client.data_templates.get_by_id(id=\"DAT8967\")\n    for doc in dt.documents:\n        for version in client.data_templates.get_document_version_history(\n            document_id=doc.id\n        ):\n            print(version.doc_version, version.state)\n    ```",
  "properties": {
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The document ID (format ``DOC...``).",
      "title": "Albertid"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The document name.",
      "title": "Name"
    },
    "nameSpace": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The S3 bucket namespace.",
      "title": "Namespace"
    },
    "key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The S3 storage path for this version.",
      "title": "Key"
    },
    "versionId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The S3 version key for this version.",
      "title": "Versionid"
    },
    "docVersion": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The sequential version number (increments with each new version).",
      "title": "Docversion"
    },
    "class": {
      "anyOf": [
        {
          "$ref": "#/$defs/DocumentClass"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The access class of the document."
    },
    "state": {
      "anyOf": [
        {
          "$ref": "#/$defs/DocumentState"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lifecycle state of this document version."
    },
    "signedUrl": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A short-lived S3 download URL for this version's file.",
      "title": "Signedurl"
    },
    "publishedAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The timestamp when this version was published, if applicable.",
      "title": "Publishedat"
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Who created this version and when."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Who last updated this version and when."
    }
  },
  "title": "DocumentVersion",
  "type": "object"
}

Fields:

id

id: str | None = None

The document ID (format DOC...).

name

name: str | None = None

The document name.

name_space

name_space: str | None = None

The S3 bucket namespace.

key

key: str | None = None

The S3 storage path for this version.

version_id

version_id: str | None = None

The S3 version key for this version.

doc_version

doc_version: int | None = None

The sequential version number (increments with each new version).

document_class

document_class: DocumentClass | None = None

The access class of the document.

state

state: DocumentState | None = None

The lifecycle state of this document version.

signed_url

signed_url: str | None = None

A short-lived S3 download URL for this version's file.

published_at

published_at: str | None = None

The timestamp when this version was published, if applicable.

created

created: AuditFields | None = None

Who created this version and when.

updated

updated: AuditFields | None = None

Who last updated this version and when.