Cas
albert.collections.cas.CasCollection
Bases: BaseCollection
CasCollection is a collection class for managing Cas entities on the Albert Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
list |
Lists CAS entities with optional filters. |
cas_exists |
Checks if a CAS exists by its number. |
create |
Creates a new CAS entity. |
get_by_id |
Retrieves a CAS by its ID. |
get_by_number |
Retrieves a CAS by its number. |
delete |
Deletes a CAS by its ID. |
update |
Updates a CAS entity. The updated object must have the same ID as the object you want to update. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/cas.py
list
list(
*,
limit: int = 50,
start_key: str | None = None,
number: str | None = None,
id: str | None = None,
order_by: OrderBy = DESCENDING,
) -> Iterator[Cas]
Lists CAS entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int | None
|
The maximum number of CAS entities to return, by default 50. |
50
|
start_key
|
str | None
|
The primary key of the first item that this operation will evaluate. |
None
|
number
|
str | None
|
Fetches list of CAS by CAS number. |
None
|
id
|
str | None
|
Fetches list of CAS using the CAS Albert ID. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
Returns:
Type | Description |
---|---|
Iterator[Cas]
|
An iterator of Cas objects. |
Source code in src/albert/collections/cas.py
cas_exists
Checks if a CAS exists by its number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The number of the CAS to check. |
required |
exact_match
|
bool
|
Whether to match the number exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if the CAS exists, False otherwise. |
Source code in src/albert/collections/cas.py
create
Creates a new CAS entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cas
|
Union[str, Cas]
|
The CAS number or Cas object to create. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The created Cas object. |
Source code in src/albert/collections/cas.py
get_by_id
Retrieves a CAS by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the CAS to retrieve. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The Cas object if found, None otherwise. |
Source code in src/albert/collections/cas.py
get_by_number
Retrieves a CAS by its number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The number of the CAS to retrieve. |
required |
exact_match
|
bool
|
Whether to match the number exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
Optional[Cas]
|
The Cas object if found, None otherwise. |
Source code in src/albert/collections/cas.py
delete
delete(*, id: str) -> None
Deletes a CAS by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the CAS to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/cas.py
update
Updates a CAS entity. The updated object must have the same ID as the object you want to update.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
updated_object
|
Cas
|
The Updated Cas object. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The updated Cas object as it appears in Albert |