Research Notes¶
Methods for managing research notes and replies (/api/notes).
pyclann.client.NotesClient
¶
Methods for the /api/notes resource.
list
¶
Return top-level research notes (replies excluded).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
created_by
|
str | None
|
Filter by creator username. |
None
|
tree
|
str | None
|
Filter by tree slug. |
None
|
Returns:
| Type | Description |
|---|---|
list[ResearchNote]
|
List of :class: |
Raises:
| Type | Description |
|---|---|
ClannAuthError
|
If not authenticated. |
create
¶
create(title: str, trees: list[str], *, description: str | None = None, body: str | None = None, folder_id: str | None = None, created_by: str | None = None, is_shared: bool = False) -> ResearchNote
Create a research note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Note title. |
required |
trees
|
list[str]
|
Tree slugs this note is linked to. |
required |
description
|
str | None
|
Short description. |
None
|
body
|
str | None
|
Markdown body. |
None
|
folder_id
|
str | None
|
ID of the folder to file this note in. |
None
|
created_by
|
str | None
|
Username of the creator. |
None
|
is_shared
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
ResearchNote
|
The newly created :class: |
Raises:
| Type | Description |
|---|---|
ClannAuthError
|
If not authenticated. |
get
¶
Fetch a single research note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID ( |
required |
Returns:
| Type | Description |
|---|---|
ResearchNote
|
class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannAuthError
|
If not authenticated. |
update
¶
update(note_id: str, *, title: str | None = None, description: str | None = None, body: str | None = None, trees: list[str] | None = None, is_shared: bool | None = None) -> ResearchNote
Update a research note; only supplied fields are changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID or bare ULID. |
required |
Returns:
| Type | Description |
|---|---|
ResearchNote
|
The updated :class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannAuthError
|
If not authenticated. |
delete
¶
Delete a note and all its replies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID or bare ULID. |
required |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannAuthError
|
If not authenticated. |
set_folder
¶
Move a note to a folder, or unfile it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID or bare ULID. |
required |
folder_id
|
str | None
|
ID of the destination folder, or |
required |
Returns:
| Type | Description |
|---|---|
ResearchNote
|
The updated :class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannAuthError
|
If not authenticated. |
list_replies
¶
Return all replies to a note, ordered by creation time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID or bare ULID of the parent note. |
required |
Returns:
| Type | Description |
|---|---|
list[ResearchNote]
|
List of reply :class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannAuthError
|
If not authenticated. |
create_reply
¶
create_reply(note_id: str, body: str, *, created_by: str | None = None, trees: list[str] | None = None) -> ResearchNote
Post a reply to a shared note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
note_id
|
str
|
Full record ID or bare ULID of the parent note. |
required |
body
|
str
|
Reply text (Markdown supported). |
required |
created_by
|
str | None
|
Username of the reply author. |
None
|
trees
|
list[str] | None
|
Tree slugs to link the reply to (defaults to empty list). |
None
|
Returns:
| Type | Description |
|---|---|
ResearchNote
|
The created reply :class: |
Raises:
| Type | Description |
|---|---|
ClannNotFoundError
|
If the note does not exist. |
ClannValidationError
|
If the note is private ( |
ClannAuthError
|
If not authenticated. |