Notes
albert.collections.notes.NotesCollection
Bases: BaseCollection
Manage Notes in the Albert platform.
A Note is a free-text comment attached to another entity (its "parent"),
such as a Task, Project, or Inventory Item. Notes are commonly used to record
observations, discussion, or context alongside an entity. Users can be
mentioned inside a note's text via to_note_mention,
and files can be attached to a note through the
AttachmentCollection.
This collection is accessed as client.notes.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for note requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new note attached to a parent entity. |
get_by_id |
Get a single note by its ID. |
update |
Update an existing note. |
delete |
Delete a note by its ID. |
get_by_parent_id |
List all notes attached to a given parent entity. |
Source code in src/albert/collections/notes.py
create
Create a new note.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note
|
Note
|
The note to create. Requires |
required |
Returns:
| Type | Description |
|---|---|
Note
|
The created note, populated with its assigned ID. |
Source code in src/albert/collections/notes.py
get_by_id
Get a note by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the note to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Note
|
The fully populated note. |
Source code in src/albert/collections/notes.py
update
Update a note.
Fetch a note (e.g. via get_by_id), modify its
fields, then pass it here. The note is matched by its id.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note
|
Note
|
The note with updated fields. Must include |
required |
Returns:
| Type | Description |
|---|---|
Note
|
The updated note, re-fetched from Albert. |
Notes
The following fields can be updated: note, parent_id.
Source code in src/albert/collections/notes.py
delete
delete(*, id: str) -> None
Delete a note by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the note to delete. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/notes.py
get_by_parent_id
get_by_parent_id(
*, parent_id: str, order_by: OrderBy = DESCENDING
) -> list[Note]
List all notes attached to a parent entity.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
str
|
The ID of the parent entity whose notes should be listed (e.g. a Task
ID such as |
required |
order_by
|
OrderBy
|
The order to return notes in. Defaults to |
DESCENDING
|
Returns:
| Type | Description |
|---|---|
list[Note]
|
The notes attached to the parent entity. |