Skip to content

Storage Classes

albert.collections.storage_classes.StorageClassesCollection

StorageClassesCollection(*, session: AlbertSession)

Bases: BaseCollection

Access hazardous-materials Storage Classes in the Albert platform.

A Storage Class is a hazardous-materials storage classification that governs which materials may be safely stored together. Each class carries a compatibility matrix listing the other classes it may, may not, or may with warnings be co-stored with. Inventory Items carry a storage/security class that ties back to these classifications.

Storage classes are reference data served from a static endpoint, so this collection is read-only.

This collection is accessed as client.storage_classes.

Example

from albert import Albert
client = Albert()
for storage_class in client.storage_classes.get_all():
    print(storage_class.storage_class_number, storage_class.storage_class_name)

Parameters:

Name Type Description Default
session AlbertSession

The authenticated Albert session used for API calls.

required

Attributes:

Name Type Description
base_path str

The base API route for storage class requests.

Methods:

Name Description
get_all

Get every storage class and its compatibility matrix.

Source code in src/albert/collections/storage_classes.py
def __init__(self, *, session: AlbertSession):
    super().__init__(session=session)
    self.base_path = f"/api/{self._api_version}/static/storageclass"

base_path

base_path = f'/api/{self._api_version}/static/storageclass'

get_all

get_all() -> list[StorageClass]

Get every Storage Class and its compatibility matrix.

Example

storage_classes = client.storage_classes.get_all()
for storage_class in storage_classes:
    print(storage_class.storage_class_name)

Returns:

Type Description
list[StorageClass]

All storage class records, each with its co-storage compatibility matrix.

Source code in src/albert/collections/storage_classes.py
@validate_call
def get_all(self) -> list[StorageClass]:
    """Get every Storage Class and its compatibility matrix.

    !!! example
        ```python
        storage_classes = client.storage_classes.get_all()
        for storage_class in storage_classes:
            print(storage_class.storage_class_name)
        ```

    Returns
    -------
    list[StorageClass]
        All storage class records, each with its co-storage compatibility
        matrix.
    """
    response = self.session.get(self.base_path)
    return [StorageClass(**item) for item in response.json()]