Vault Resource¶
VaultResource(client)
¶
Bases: ContentResource
Operations on files and directories in the vault.
Source code in src/aiobsidian/rest/_base.py
get(path, *, content_type=ContentType.MARKDOWN)
async
¶
Get the content of a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root
(e.g. |
required |
content_type
|
ContentType
|
Desired response format. Use
|
MARKDOWN
|
Returns:
| Type | Description |
|---|---|
str | NoteJson | DocumentMap
|
File content as |
str | NoteJson | DocumentMap
|
depending on the requested content type. |
Raises:
| Type | Description |
|---|---|
NotFoundError
|
If the file does not exist. |
Source code in src/aiobsidian/rest/vault.py
update(path, content)
async
¶
Create or replace a file in the vault.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path for the file relative to the vault root. |
required |
content
|
str
|
Markdown content to write. |
required |
Source code in src/aiobsidian/rest/vault.py
append(path, content)
async
¶
Append content to the end of a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
content
|
str
|
Markdown content to append. |
required |
Raises:
| Type | Description |
|---|---|
NotFoundError
|
If the file does not exist. |
Source code in src/aiobsidian/rest/vault.py
patch(path, content, *, operation, target_type, target, target_delimiter='::')
async
¶
Patch a specific section of a vault file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
content
|
str
|
Content to insert or replace. |
required |
operation
|
PatchOperation
|
How to apply the content ( |
required |
target_type
|
TargetType
|
What to target ( |
required |
target
|
str
|
The target identifier (e.g. heading text, block ID, or frontmatter field name). |
required |
target_delimiter
|
str
|
Delimiter for nested targets. |
'::'
|
Raises:
| Type | Description |
|---|---|
NotFoundError
|
If the file does not exist. |
Source code in src/aiobsidian/rest/vault.py
delete(path)
async
¶
Delete a file from the vault.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the file relative to the vault root. |
required |
Raises:
| Type | Description |
|---|---|
NotFoundError
|
If the file does not exist. |
Source code in src/aiobsidian/rest/vault.py
list(path='')
async
¶
List files in a vault directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory path relative to the vault root. Empty string for the root directory. |
''
|
Returns:
| Type | Description |
|---|---|
VaultDirectory
|
A |