Projects
albert.collections.projects.ProjectCollection
Bases: BaseCollection
ProjectCollection is a collection class for managing Project entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new project. |
get_by_id |
Retrieve a project by its ID. |
update |
Update a project. |
delete |
Delete a project by its ID. |
search |
Search for Project matching the provided criteria. |
get_all |
Retrieve fully hydrated Project entities with optional filters. |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/projects.py
create
Create a new project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project
|
Project
|
The project to create. |
required |
Returns:
Type | Description |
---|---|
Optional[Project]
|
The created project object if successful, None otherwise. |
Source code in src/albert/collections/projects.py
get_by_id
Retrieve a project by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the project to retrieve. |
required |
Returns:
Type | Description |
---|---|
Project
|
The project object if found |
Source code in src/albert/collections/projects.py
update
Update a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project
|
Project
|
The updated project object. |
required |
Returns:
Type | Description |
---|---|
Project
|
The updated project object as returned by the server. |
Source code in src/albert/collections/projects.py
delete
delete(*, id: ProjectId) -> None
Delete a project by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the project to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/projects.py
search
search(
*,
text: str | None = None,
status: list[str] | None = None,
market_segment: list[str] | None = None,
application: list[str] | None = None,
technology: list[str] | None = None,
created_by: list[str] | None = None,
location: list[str] | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
contains_field: list[str] | None = None,
contains_text: list[str] | None = None,
linked_to: str | None = None,
my_project: bool | None = None,
my_role: list[str] | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
offset: int | None = None,
max_items: int | None = None,
) -> Iterator[ProjectSearchItem]
Search for Project 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
|
Full-text search query. |
None
|
status
|
list of str
|
Filter by project statuses. |
None
|
market_segment
|
list of str
|
Filter by market segment. |
None
|
application
|
list of str
|
Filter by application. |
None
|
technology
|
list of str
|
Filter by technology tags. |
None
|
created_by
|
list of str
|
Filter by user names who created the project. |
None
|
location
|
list of str
|
Filter by location(s). |
None
|
from_created_at
|
str
|
Earliest creation date in 'YYYY-MM-DD' format. |
None
|
to_created_at
|
str
|
Latest creation date in 'YYYY-MM-DD' format. |
None
|
facet_field
|
str
|
Facet field to filter on. |
None
|
facet_text
|
str
|
Facet text to search for. |
None
|
contains_field
|
list of str
|
Fields to search inside. |
None
|
contains_text
|
list of str
|
Values to search for within the |
None
|
linked_to
|
str
|
Entity ID the project is linked to. |
None
|
my_project
|
bool
|
If True, return only projects owned by current user. |
None
|
my_role
|
list of str
|
User roles to filter by. |
None
|
order_by
|
OrderBy
|
Sort order. Default is DESCENDING. |
DESCENDING
|
sort_by
|
str
|
Field to sort by. |
None
|
offset
|
int
|
Pagination offset. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
Returns:
Type | Description |
---|---|
Iterator[ProjectSearchItem]
|
An iterator of matching partial (unhydrated) Project results. |
Source code in src/albert/collections/projects.py
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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
get_all
get_all(
*,
text: str | None = None,
status: list[str] | None = None,
market_segment: list[str] | None = None,
application: list[str] | None = None,
technology: list[str] | None = None,
created_by: list[str] | None = None,
location: list[str] | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
contains_field: list[str] | None = None,
contains_text: list[str] | None = None,
linked_to: str | None = None,
my_project: bool | None = None,
my_role: list[str] | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
offset: int | None = None,
max_items: int | None = None,
) -> Iterator[Project]
Retrieve fully hydrated Project 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.
Returns:
Type | Description |
---|---|
Iterator[Project]
|
An iterator of fully hydrated Project entities. |