Custom Templates
albert.collections.custom_templates.CustomTemplatesCollection
Bases: BaseCollection
CustomTemplatesCollection is a collection class for managing CustomTemplate entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_by_id |
Get a Custom Template by ID |
search |
Search for CustomTemplate matching the provided criteria. |
get_all |
Retrieve fully hydrated CustomTemplate entities with optional filters. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/custom_templates.py
get_by_id
get_by_id(*, id) -> CustomTemplate
Get a Custom Template by ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
id of the custom template |
required |
Returns:
Type | Description |
---|---|
CustomTemplate
|
The CutomTemplate with the provided ID (or None if not found) |
Source code in src/albert/collections/custom_templates.py
search
search(
*,
text: str | None = None,
max_items: int | None = None,
offset: int | None = 0,
) -> Iterator[CustomTemplateSearchItem]
Search for CustomTemplate matching the provided criteria.
⚠️ This method returns partial (unhydrated) entities to optimize performance.
To retrieve fully detailed entities, use :meth:get_all
instead.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Text to filter search results by. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
offset
|
int
|
Offset to begin pagination at. Default is 0. |
0
|
Returns:
Type | Description |
---|---|
Iterator[CustomTemplateSearchItem]
|
An iterator of CustomTemplateSearchItem items. |
Source code in src/albert/collections/custom_templates.py
get_all
get_all(
*,
text: str | None = None,
max_items: int | None = None,
offset: int | None = 0,
) -> Iterator[CustomTemplate]
Retrieve fully hydrated CustomTemplate entities with optional filters.
This method returns complete entity data using get_by_id
.
Use :meth:search
for faster retrieval when you only need lightweight, partial (unhydrated) entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Text filter for template name or content. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
offset
|
int
|
Offset for search pagination. |
0
|
Returns:
Type | Description |
---|---|
Iterator[CustomTemplate]
|
An iterator of CustomTemplate entities. |