Skip to content

Periodic Notes Resource

PeriodicNotesResource(client)

Bases: ContentResource

Operations on periodic notes (daily, weekly, monthly, quarterly, yearly).

Source code in src/aiobsidian/rest/_base.py
def __init__(self, client: ObsidianClient) -> None:
    self._client = client

get(period, *, date=None, content_type=ContentType.MARKDOWN) async

get(
    period: Period,
    *,
    date: datetime.date | None = ...,
    content_type: Literal[ContentType.MARKDOWN] = ...,
) -> str
get(
    period: Period,
    *,
    date: datetime.date | None = ...,
    content_type: Literal[ContentType.NOTE_JSON],
) -> NoteJson
get(
    period: Period,
    *,
    date: datetime.date | None = ...,
    content_type: Literal[ContentType.DOCUMENT_MAP],
) -> DocumentMap

Get the content of a periodic note.

Parameters:

Name Type Description Default
period Period

The time period (e.g. Period.DAILY).

required
date date | None

Specific date to retrieve. Defaults to the current period.

None
content_type ContentType

Desired response format.

MARKDOWN

Returns:

Type Description
str | NoteJson | DocumentMap

Note content as str, NoteJson, or DocumentMap

str | NoteJson | DocumentMap

depending on the requested content type.

Source code in src/aiobsidian/rest/periodic.py
async def get(
    self,
    period: Period,
    *,
    date: datetime.date | None = None,
    content_type: ContentType = ContentType.MARKDOWN,
) -> str | NoteJson | DocumentMap:
    """Get the content of a periodic note.

    Args:
        period: The time period (e.g. `Period.DAILY`).
        date: Specific date to retrieve. Defaults to the current period.
        content_type: Desired response format.

    Returns:
        Note content as `str`, `NoteJson`, or `DocumentMap`
        depending on the requested content type.
    """
    return await self._get_content(self._build_url(period, date), content_type)

update(period, content, *, date=None) async

Replace the entire content of a periodic note.

If the note does not exist, it will be created.

Parameters:

Name Type Description Default
period Period

The time period.

required
content str

New Markdown content for the note.

required
date date | None

Specific date to target. Defaults to the current period.

None
Source code in src/aiobsidian/rest/periodic.py
async def update(
    self, period: Period, content: str, *, date: datetime.date | None = None
) -> None:
    """Replace the entire content of a periodic note.

    If the note does not exist, it will be created.

    Args:
        period: The time period.
        content: New Markdown content for the note.
        date: Specific date to target. Defaults to the current period.
    """
    await self._client.request(
        "PUT",
        self._build_url(period, date),
        content=content,
        headers={"Content-Type": ContentType.MARKDOWN},
    )

append(period, content, *, date=None) async

Append content to the end of a periodic note.

Parameters:

Name Type Description Default
period Period

The time period.

required
content str

Markdown content to append.

required
date date | None

Specific date to target. Defaults to the current period.

None
Source code in src/aiobsidian/rest/periodic.py
async def append(
    self, period: Period, content: str, *, date: datetime.date | None = None
) -> None:
    """Append content to the end of a periodic note.

    Args:
        period: The time period.
        content: Markdown content to append.
        date: Specific date to target. Defaults to the current period.
    """
    await self._append_content(self._build_url(period, date), content)

patch(period, content, *, date=None, operation, target_type, target, target_delimiter='::') async

Patch a specific section of a periodic note.

Parameters:

Name Type Description Default
period Period

The time period.

required
content str

Content to insert or replace.

required
date date | None

Specific date to target. Defaults to the current period.

None
operation PatchOperation

How to apply the content (append, prepend, or replace).

required
target_type TargetType

What to target (heading, block, or frontmatter).

required
target str

The target identifier.

required
target_delimiter str

Delimiter for nested targets.

'::'
Source code in src/aiobsidian/rest/periodic.py
async def patch(
    self,
    period: Period,
    content: str,
    *,
    date: datetime.date | None = None,
    operation: PatchOperation,
    target_type: TargetType,
    target: str,
    target_delimiter: str = "::",
) -> None:
    """Patch a specific section of a periodic note.

    Args:
        period: The time period.
        content: Content to insert or replace.
        date: Specific date to target. Defaults to the current period.
        operation: How to apply the content (`append`, `prepend`,
            or `replace`).
        target_type: What to target (`heading`, `block`, or
            `frontmatter`).
        target: The target identifier.
        target_delimiter: Delimiter for nested targets.
    """
    await self._patch_content(
        self._build_url(period, date),
        content,
        operation=operation,
        target_type=target_type,
        target=target,
        target_delimiter=target_delimiter,
    )

delete(period, *, date=None) async

Delete a periodic note.

Parameters:

Name Type Description Default
period Period

The time period of the note to delete.

required
date date | None

Specific date to target. Defaults to the current period.

None
Source code in src/aiobsidian/rest/periodic.py
async def delete(
    self, period: Period, *, date: datetime.date | None = None
) -> None:
    """Delete a periodic note.

    Args:
        period: The time period of the note to delete.
        date: Specific date to target. Defaults to the current period.
    """
    await self._client.request("DELETE", self._build_url(period, date))