Projects
albert.collections.projects
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL to prefix to all requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
OrderBy
Project
Bases: BaseResource
A project in Albert.
Attributes:
Name | Type | Description |
---|---|---|
description |
str
|
The description of the project. Used as the name of the project as well. |
id |
str | None
|
The Albert ID of the project. Set when the project is retrieved from Albert. |
locations |
list[Location] | None
|
The locations associated with the project. Optional. |
project_class |
ProjectClass
|
The class of the project. Defaults to PRIVATE. |
metadata |
dict[str, str | list[EntityLink] | EntityLink] | None
|
The metadata of the project. Optional. Metadata allowed values can be found using the Custom Fields API. |
prefix |
str | None
|
The prefix of the project. Optional. |
acl |
list[ACL] | None
|
The ACL of the project. Optional. |
task_config |
list[TaskConfig] | None
|
The task configuration of the project. Optional. |
grid |
GridDefault | None
|
The default grid of the project. Optional. |
state |
State | None
|
The state/status of the project. Allowed states are customizeable using the entitystatus API. Optional. |
application_engineering_inventory_ids |
list[str] | None
|
Inventory Ids to be added as application engineering. Optional. |
Methods:
Name | Description |
---|---|
validate_status |
Somehow, some statuses are capitalized in the API response. This ensures they are always lowercase. |
acl
class-attribute
instance-attribute
application_engineering_inventory_ids
class-attribute
instance-attribute
application_engineering_inventory_ids: list[str] | None = (
Field(
default=None,
alias="appEngg",
description="Inventory Ids to be added as application engineering",
)
)
description
class-attribute
instance-attribute
description: str = Field(min_length=1, max_length=2000)
locations
class-attribute
instance-attribute
locations: list[SerializeAsEntityLink[Location]] | None = (
Field(
default=None,
min_length=1,
max_length=20,
alias="Locations",
)
)
metadata
class-attribute
instance-attribute
project_class
class-attribute
instance-attribute
status
class-attribute
instance-attribute
status: str | None = Field(
default=None, exclude=True, frozen=True
)
task_config
class-attribute
instance-attribute
validate_status
Somehow, some statuses are capitalized in the API response. This ensures they are always lowercase.
Source code in src/albert/resources/projects.py
ProjectCollection
ProjectCollection(*, session: AlbertSession)
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. |
delete |
Delete a project by its ID. |
get_by_id |
Retrieve a project by its ID. |
list |
List projects with optional filters. |
update |
Update a project. |
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
delete
delete(*, id: str) -> 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
get_by_id
list
list(
*,
text: str = None,
status: list[str] = None,
market_segment: list[str] = None,
application: list[str] = None,
technology: list[str] = None,
created_by: list[str] = None,
location: list[str] = None,
from_created_at: str = None,
to_created_at: str = None,
facet_field: str = None,
facet_text: str = None,
contains_field: list[str] = None,
contains_text: list[str] = None,
linked_to: str = None,
my_projects: bool = None,
my_role: list[str] = None,
order_by: OrderBy = DESCENDING,
sort_by: str = None,
limit: int = 50,
) -> Iterator[Project]
List projects with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Search any test in the project. |
None
|
status
|
list[str]
|
The status filter for the projects. |
None
|
market_segment
|
list[str]
|
The market segment filter for the projects. |
None
|
application
|
list[str]
|
The application filter for the projects. |
None
|
technology
|
list[str]
|
The technology filter for the projects. |
None
|
created_by
|
list[str]
|
The name of the user who created the project. |
None
|
location
|
list[str]
|
The location filter for the projects. |
None
|
from_created_at
|
str
|
The start date filter for the projects. |
None
|
to_created_at
|
str
|
The end date filter for the projects. |
None
|
facet_field
|
str
|
The facet field for the projects. |
None
|
facet_text
|
str
|
The facet text for the projects. |
None
|
contains_field
|
list[str]
|
To power project facets search |
None
|
contains_text
|
list[str]
|
To power project facets search |
None
|
linked_to
|
str
|
To pass text for linked to dropdown search in Task creation flow. |
None
|
my_projects
|
bool
|
Return Projects owned by you. |
None
|
my_role
|
list[str]
|
Filter Projects to ones which you have a specific role in. |
None
|
order_by
|
OrderBy
|
The order in which to retrieve items (default is OrderBy.DESCENDING). |
DESCENDING
|
sort_by
|
str
|
The field to sort by. |
None
|
Returns:
Type | Description |
---|---|
Iterator[Project]
|
An iterator of Project resources. |
Source code in src/albert/collections/projects.py
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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
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. |