Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(calendar): add nc_calendar_complete_todo convenience tool#768

Open
KuriGohan-Kamehameha wants to merge 1 commit into
cbcoutinho:masterfrom
KuriGohan-Kamehameha:feat/calendar-complete-todo
Open

feat(calendar): add nc_calendar_complete_todo convenience tool#768
KuriGohan-Kamehameha wants to merge 1 commit into
cbcoutinho:masterfrom
KuriGohan-Kamehameha:feat/calendar-complete-todo

Conversation

@KuriGohan-Kamehameha

Copy link
Copy Markdown
Contributor

Summary

Adds nc_calendar_complete_todo — a one-shot "complete this task" tool that wraps the existing update_todo to set STATUS=COMPLETED, PERCENT-COMPLETE=100, and a COMPLETED timestamp in a single call.

Why

The same operation is already possible through nc_calendar_update_todo:

update_todo(
  calendar_name=..., todo_uid=...,
  status="COMPLETED",
  percent_complete=100,
  completed="<now in ISO 8601>",
)

…but for AI clients, "complete this task" is a much more natural phrasing than "set three specific fields, and remember to compute the current timestamp." The dedicated tool also pairs naturally with the existing create_todo / update_todo / delete_todo trio, mirroring CalDAV libraries that ship a one-shot complete operation (e.g., the Node CalDAV client stack).

The new tool is a thin wrapper:

async def nc_calendar_complete_todo(calendar_name, todo_uid, ctx, completed_at=None):
    if completed_at is None:
        completed_at = dt.datetime.now(dt.timezone.utc).isoformat()
    return await client.calendar.update_todo(calendar_name, todo_uid, {
        "status": "COMPLETED",
        "percent_complete": 100,
        "completed": completed_at,
    })

No client-side, model, or schema changes — the existing update_todo client method already accepts these three fields.

Verification

End-to-end against a live Nextcloud 33.0.2 instance:

  1. nc_calendar_create_todo(calendar_name="tasks", summary="…", description="…") → returned UID
  2. nc_calendar_complete_todo(calendar_name="tasks", todo_uid=<UID>){"status_code": 200, "uid": "<UID>", "href": "…"}
  3. nc_calendar_search_todos(calendar_name="tasks", query="…") → entry shows status: "COMPLETED", percent_complete: 100, completed: "2026-…"
  4. nc_calendar_delete_todo(...) cleanup OK

Notes

  • Annotation: idempotentHint=True — calling complete on an already-completed todo just refreshes the COMPLETED timestamp (matches CalDAV semantics).
  • Scope: todo.write, calendar.read (same as update_todo).
  • License: AGPL-3.0, same as the project.

Copilot AI review requested due to automatic review settings May 8, 2026 01:51
@CLAassistant

CLAassistant commented May 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Add a one-shot "complete this todo" wrapper around update_todo. It sets
STATUS=COMPLETED, PERCENT-COMPLETE=100, and the COMPLETED timestamp in
a single call.

The same operation has always been possible via nc_calendar_update_todo
with three explicit fields, but for AI clients the phrasing
"complete this task" is much more natural than "set status to COMPLETED,
set percent_complete to 100, and set completed to <now>" — the latter
forces the client to compute a timestamp and remember three field names.
A dedicated tool also pairs naturally with the existing delete_todo,
update_todo, and create_todo trio.

The implementation is a thin wrapper: it delegates to
client.calendar.update_todo with a fixed three-field payload, defaulting
completed_at to dt.datetime.now(dt.timezone.utc).isoformat() when the
caller doesn't supply one. No client-side or model changes are needed.

Verified end-to-end against Nextcloud 33.0.2:
  create_todo -> complete_todo -> search_todos shows
  status=COMPLETED, percent_complete=100, completed=<timestamp>.
@KuriGohan-Kamehameha KuriGohan-Kamehameha force-pushed the feat/calendar-complete-todo branch from 433d0b8 to 94ecf40 Compare May 8, 2026 01:57
@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants