Projects
albert.collections.projects
AlbertHTTPError
Bases: AlbertException
Base class for all erors due to HTTP responses.
Source code in src/albert/exceptions.py
AlbertPaginator
AlbertPaginator(
*,
path: str,
mode: PaginationMode,
session: AlbertSession,
deserialize: Callable[
[Iterable[dict]], Iterable[ItemType]
],
params: dict[str, str] | None = None,
)
Bases: Iterator[ItemType]
Helper class for pagination through Albert endpoints.
Two pagination modes are possible:
- Offset-based via by the offset query parameter
- Key-based via by the startKey query parameter and 'lastKey' response field
A custom deserialize function is provided when additional logic is required to load
the raw items returned by the search listing, e.g., making additional Albert API calls.
Source code in src/albert/core/pagination.py
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
auth_manager: AlbertClientCredentials
| AlbertSSOClient
| 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 relative request paths (e.g., "https://app.albertinvent.com"). |
required |
token
|
str | None
|
A static JWT token for authentication. Ignored if |
None
|
auth_manager
|
AlbertClientCredentials | AlbertSSOClient
|
An authentication manager used to dynamically fetch and refresh tokens.
If provided, it overrides |
None
|
retries
|
int
|
The number of automatic retries on failed requests (default is 3). |
None
|
Methods:
| Name | Description |
|---|---|
request |
|
Source code in src/albert/core/session.py
request
Source code in src/albert/core/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
PaginationMode
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_all |
Retrieve fully hydrated Project entities with optional filters. |
get_by_id |
Retrieve a project by its ID. |
search |
Search for Project matching the provided criteria. |
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_all
get_all(
*, params: ProjectFilterParams | 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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ProjectFilterParams
|
Structured query parameters to filter, sort, and paginate projects. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[Project]
|
An iterator of fully hydrated Project entities. |
Source code in src/albert/collections/projects.py
get_by_id
search
search(
*, params: ProjectFilterParams | 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 |
|---|---|---|---|
params
|
ProjectFilterParams
|
Structured query parameters to filter, sort, and paginate projects. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[Project]
|
An iterator of Project resources. |
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
ProjectFilterParams
pydantic-model
Bases: BaseAlbertModel
Filtering and query parameters for retrieving Projects via search() or get_all().
This model centralizes all supported filters, sorting, and pagination options. It is used to construct query payloads for partial or fully hydrated project listings.
Show JSON schema:
{
"$defs": {
"OrderBy": {
"enum": [
"desc",
"asc"
],
"title": "OrderBy",
"type": "string"
}
},
"description": "Filtering and query parameters for retrieving Projects via `search()` or `get_all()`.\n\nThis model centralizes all supported filters, sorting, and pagination options.\nIt is used to construct query payloads for partial or fully hydrated project listings.",
"properties": {
"text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Full-text search across multiple fields of the project.",
"title": "Text"
},
"status": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "List of project statuses to filter by.",
"title": "Status"
},
"market_segment": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Market segments to include in the result set.",
"title": "Market Segment"
},
"application": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Application types associated with the projects.",
"title": "Application"
},
"technology": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Technology tags used in the projects.",
"title": "Technology"
},
"created_by": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Filter projects created by specific users.",
"title": "Created By"
},
"location": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Geographic or facility locations for the projects.",
"title": "Location"
},
"from_created_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Lower bound of project creation date (inclusive), formatted as 'YYYY-MM-DD'.",
"title": "From Created At"
},
"to_created_at": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Upper bound of project creation date (inclusive), formatted as 'YYYY-MM-DD'.",
"title": "To Created At"
},
"facet_field": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Field name for facet search (e.g., status, application).",
"title": "Facet Field"
},
"facet_text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Text to match within the given facet field.",
"title": "Facet Text"
},
"contains_field": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "List of fields to check for specific content (used in advanced filters).",
"title": "Contains Field"
},
"contains_text": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Text snippets to search for within the specified `contains_field`.",
"title": "Contains Text"
},
"linked_to": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional ID or label to find projects linked to a specific entity (e.g., in Task creation).",
"title": "Linked To"
},
"my_projects": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "If True, return only projects owned by the authenticated user.",
"title": "My Projects"
},
"my_role": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Roles the user has in projects to filter (e.g., Lead, Reviewer).",
"title": "My Role"
},
"order_by": {
"$ref": "#/$defs/OrderBy",
"default": "desc",
"description": "Ordering of results, either ascending or descending."
},
"sort_by": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Field to sort by (e.g., createdAt, updatedAt, name).",
"title": "Sort By"
},
"limit": {
"default": 50,
"description": "Maximum number of items to return (default is 50, max is 1000).",
"maximum": 1000,
"minimum": 1,
"title": "Limit",
"type": "integer"
}
},
"title": "ProjectFilterParams",
"type": "object"
}
Fields:
-
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) -
sort_by(str | None) -
limit(int)
application
pydantic-field
Application types associated with the projects.
contains_field
pydantic-field
List of fields to check for specific content (used in advanced filters).
contains_text
pydantic-field
Text snippets to search for within the specified contains_field.
created_by
pydantic-field
Filter projects created by specific users.
facet_field
pydantic-field
facet_field: str | None = None
Field name for facet search (e.g., status, application).
from_created_at
pydantic-field
from_created_at: str | None = None
Lower bound of project creation date (inclusive), formatted as 'YYYY-MM-DD'.
limit
pydantic-field
limit: int = 50
Maximum number of items to return (default is 50, max is 1000).
linked_to
pydantic-field
linked_to: str | None = None
Optional ID or label to find projects linked to a specific entity (e.g., in Task creation).
location
pydantic-field
Geographic or facility locations for the projects.
market_segment
pydantic-field
Market segments to include in the result set.
my_projects
pydantic-field
my_projects: bool | None = None
If True, return only projects owned by the authenticated user.
my_role
pydantic-field
Roles the user has in projects to filter (e.g., Lead, Reviewer).
order_by
pydantic-field
order_by: OrderBy = DESCENDING
Ordering of results, either ascending or descending.
sort_by
pydantic-field
sort_by: str | None = None
Field to sort by (e.g., createdAt, updatedAt, name).
to_created_at
pydantic-field
to_created_at: str | None = None
Upper bound of project creation date (inclusive), formatted as 'YYYY-MM-DD'.
ProjectSearchItem
pydantic-model
Bases: BaseAlbertModel, HydrationMixin[Project]
Show JSON schema:
{
"properties": {
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"description": {
"maxLength": 2000,
"minLength": 1,
"title": "Description",
"type": "string"
},
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Status"
}
},
"required": [
"description"
],
"title": "ProjectSearchItem",
"type": "object"
}
Fields:
-
_collection(BaseCollection | None) -
id(ProjectId | None) -
description(str) -
status(str | None)