Notes
albert.collections.notes
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
Note
Bases: BaseResource
Represents a Note on the Albert Platform. Users can be mentioned in notes by using f-string and the User.to_note_mention() method. This allows for easy tagging and referencing of users within notes. example: f"Hello {tagged_user.to_note_mention()}!"
attachments
class-attribute
instance-attribute
attachments: list[EntityLink] | None = Field(
default=None,
exclude=True,
frozen=True,
alias="Attachments",
)
NotesCollection
NotesCollection(*, session: AlbertSession)
Bases: BaseCollection
NotesCollection is a collection class for managing Note entities in the Albert platform.
Methods:
| Name | Description |
|---|---|
create |
Creates a new note. |
delete |
Deletes a note by its ID. |
get_all |
Get all notes by their parent ID. |
get_by_id |
Retrieves a note by its ID. |
update |
Updates a note. |
Source code in src/albert/collections/notes.py
create
Creates a new note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note
|
str
|
The note content. |
required |
Returns:
| Type | Description |
|---|---|
Note
|
The created note. |
Source code in src/albert/collections/notes.py
delete
delete(*, id: str) -> None
Deletes a note by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the note to delete. |
required |
get_all
get_all(
*, parent_id: str, order_by: OrderBy = DESCENDING
) -> list[Note]
Get all notes by their parent ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
str
|
The parent ID of the notes to list. |
required |
order_by
|
OrderBy
|
The order to list notes in, by default OrderBy.DESCENDING. |
DESCENDING
|
Returns:
| Type | Description |
|---|---|
List[Note]
|
The list of notes. |
Source code in src/albert/collections/notes.py
get_by_id
update
Updates a note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note
|
Note
|
The note to update. The note must have an ID. |
required |
Returns:
| Type | Description |
|---|---|
Note
|
The updated note as returned by the server. |