Storage Locations
albert.collections.storage_locations.StorageLocationsCollection
Bases: BaseCollection
Manage Storage Locations in the Albert platform.
A Storage Location is a specific place where an Inventory Item is physically
kept, such as a flammables cabinet, freezer, or storeroom shelf. Every
Storage Location belongs to a parent Location
(Location), and Inventory search filters
can narrow results to items held in a given Storage Location.
Storage Location IDs use the format STL... (for example, "STL1").
This collection is accessed as client.storage_locations.
Example
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 location requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new storage location. |
get_by_id |
Get a single storage location by its Albert ID. |
get_all |
Iterate over storage locations, optionally filtered by name or location. |
update |
Update an existing storage location. |
get_or_create |
Return the matching storage location if it exists, otherwise create it. |
delete |
Delete a storage location by its Albert ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/storage_locations.py
get_by_id
get_by_id(*, id: str) -> StorageLocation
Get a single Storage Location by its Albert ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Albert ID of the storage location to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
StorageLocation
|
The fully populated storage location. |
Source code in src/albert/collections/storage_locations.py
get_all
get_all(
*,
name: str | list[str] | None = None,
exact_match: bool = False,
location: str | Location | None = None,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[StorageLocation]
Iterate over Storage Locations, optionally filtered by name or location.
Results are yielded lazily and pagination is handled automatically.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str or list[str]
|
One or more storage location names to filter by. |
None
|
exact_match
|
bool
|
If True, match |
False
|
location
|
str or Location
|
Restrict results to a parent Location, given either as a location ID
or a |
None
|
start_key
|
str
|
Pagination key to resume iteration from a previous page. |
None
|
max_items
|
int
|
Maximum number of storage locations to return in total. If None, all matching storage locations are returned. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[StorageLocation]
|
Storage locations matching the given filters. Preserves |
Source code in src/albert/collections/storage_locations.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
create
create(
*, storage_location: StorageLocation
) -> StorageLocation
Create a new Storage Location.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_location
|
StorageLocation
|
The storage location to create. Its |
required |
Returns:
| Type | Description |
|---|---|
StorageLocation
|
The newly created storage location, populated with its assigned |
Source code in src/albert/collections/storage_locations.py
get_or_create
get_or_create(
*, storage_location: StorageLocation
) -> StorageLocation
Return the matching Storage Location if it exists, otherwise create it.
Looks for an existing storage location with the same name under the same parent Location (case-insensitive) via a parent-location listing and returns it; if none is found, creates the storage location.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_location
|
StorageLocation
|
The storage location to retrieve or create. |
required |
Returns:
| Type | Description |
|---|---|
StorageLocation
|
The existing or newly created storage location. |
Source code in src/albert/collections/storage_locations.py
delete
delete(*, id: str) -> None
Delete a Storage Location by its Albert ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Albert ID of the storage location to delete. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/storage_locations.py
update
update(
*, storage_location: StorageLocation
) -> StorageLocation
Update an existing Storage Location.
Fetch a storage location (e.g. via get_by_id),
modify its name, then pass it here. The storage location is matched by its id.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_location
|
StorageLocation
|
The storage location to update. Its |
required |
Returns:
| Type | Description |
|---|---|
StorageLocation
|
The updated storage location, re-fetched from Albert. |
Notes
Only the name field can be updated.