feat(tasks): add recurrency and reminder write support to update_task (v1.1.0)
Verified parameters from JS-Bundle xb-Encoder/fc-Encoder now wired up: recurrencyDescriptor (recurrency, recurrencyInterval, rrule) and reminder (reminderUnit, reminderValue). Adds clear_recurrency and clear_reminder flags. SPEC.md, CHANGELOG.md, CLAUDE.md updated accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -926,6 +926,13 @@ def update_task(
|
||||
clear_due_date: bool = False,
|
||||
assignee_ids: list[str] | None = None,
|
||||
list_id: str | None = None,
|
||||
recurrency: str | None = None,
|
||||
recurrency_interval: int | None = None,
|
||||
rrule: str | None = None,
|
||||
clear_recurrency: bool = False,
|
||||
reminder_unit: str | None = None,
|
||||
reminder_value: int | None = None,
|
||||
clear_reminder: bool = False,
|
||||
) -> str:
|
||||
"""Update an existing task's fields.
|
||||
|
||||
@@ -948,12 +955,40 @@ def update_task(
|
||||
list_id: Move the task to a different list by providing the target list ID
|
||||
from get_lists (e.g. ``"taskList/23431854_29740942"``). Omit to keep in
|
||||
current list.
|
||||
recurrency: Recurrence frequency — ``"DAILY"``, ``"WEEKLY"``, ``"MONTHLY"``,
|
||||
``"YEARLY"``, or ``"NONE"``. Examples: daily → ``recurrency="DAILY",
|
||||
recurrency_interval=1``; every 2 weeks on Friday →
|
||||
``recurrency="WEEKLY", recurrency_interval=2,
|
||||
rrule="FREQ=WEEKLY;INTERVAL=2;BYDAY=FR"``.
|
||||
Cannot be used together with *clear_recurrency*.
|
||||
recurrency_interval: Repeat every N units (e.g. ``2`` for "every 2 weeks").
|
||||
Only meaningful when *recurrency* is set.
|
||||
rrule: Full iCalendar RRULE string (e.g. ``"FREQ=WEEKLY;INTERVAL=2;BYDAY=FR"``).
|
||||
Overrides simple recurrency fields when set.
|
||||
clear_recurrency: Set to ``True`` to remove the recurrence rule from the task.
|
||||
Cannot be used together with *recurrency*.
|
||||
reminder_unit: Unit for the reminder offset — ``"MINUTE"``, ``"HOUR"``, or
|
||||
``"DAY"``. Must be provided together with *reminder_value*. Requires a
|
||||
*due_date* to be set on the task.
|
||||
reminder_value: Offset before the due date/time (e.g. ``0`` = at the time,
|
||||
``15`` = 15 min before, ``1`` with unit ``"DAY"`` = 1 day before).
|
||||
Must be provided together with *reminder_unit*.
|
||||
clear_reminder: Set to ``True`` to remove the reminder from the task.
|
||||
Cannot be used together with *reminder_unit*/*reminder_value*.
|
||||
|
||||
Returns:
|
||||
JSON success indicator or an error message.
|
||||
"""
|
||||
if clear_due_date and due_date is not None:
|
||||
return _err("'clear_due_date' and 'due_date' cannot be used together.")
|
||||
if clear_recurrency and recurrency is not None:
|
||||
return _err("'clear_recurrency' and 'recurrency' cannot be used together.")
|
||||
if clear_reminder and (reminder_unit is not None or reminder_value is not None):
|
||||
return _err(
|
||||
"'clear_reminder' cannot be used together with 'reminder_unit'/'reminder_value'."
|
||||
)
|
||||
if (reminder_unit is None) != (reminder_value is None):
|
||||
return _err("'reminder_unit' and 'reminder_value' must be provided together.")
|
||||
|
||||
if (
|
||||
text is None
|
||||
@@ -963,10 +998,16 @@ def update_task(
|
||||
and not clear_due_date
|
||||
and assignee_ids is None
|
||||
and list_id is None
|
||||
and recurrency is None
|
||||
and not clear_recurrency
|
||||
and reminder_unit is None
|
||||
and not clear_reminder
|
||||
):
|
||||
return _err(
|
||||
"At least one of 'text', 'description', 'category_id', 'due_date',"
|
||||
" 'clear_due_date', 'assignee_ids', or 'list_id' must be provided."
|
||||
" 'clear_due_date', 'assignee_ids', 'list_id', 'recurrency',"
|
||||
" 'clear_recurrency', 'reminder_unit'/'reminder_value', or"
|
||||
" 'clear_reminder' must be provided."
|
||||
)
|
||||
|
||||
params: dict[str, Any] = {"metaId": task_id}
|
||||
@@ -986,6 +1027,33 @@ def update_task(
|
||||
if list_id is not None:
|
||||
params["taskListId"] = list_id
|
||||
|
||||
recurrency_descriptor: dict[str, Any] = {}
|
||||
if clear_recurrency:
|
||||
recurrency_descriptor["recurrency"] = "NONE"
|
||||
elif recurrency is not None:
|
||||
recurrency_descriptor["recurrency"] = recurrency
|
||||
if recurrency_interval is not None:
|
||||
recurrency_descriptor["recurrencyInterval"] = recurrency_interval
|
||||
if rrule is not None:
|
||||
recurrency_descriptor["rrule"] = rrule
|
||||
if recurrency_descriptor:
|
||||
params["recurrencyDescriptor"] = recurrency_descriptor
|
||||
|
||||
if clear_reminder:
|
||||
params["reminder"] = {
|
||||
"reminderUnit": "",
|
||||
"reminderValue": 0,
|
||||
"reminderType": "SNOOZE",
|
||||
"localId": 0,
|
||||
}
|
||||
elif reminder_unit is not None and reminder_value is not None:
|
||||
params["reminder"] = {
|
||||
"reminderUnit": reminder_unit,
|
||||
"reminderValue": reminder_value,
|
||||
"reminderType": "SNOOZE",
|
||||
"localId": 0,
|
||||
}
|
||||
|
||||
try:
|
||||
_authenticated_call("taskupdate2", params)
|
||||
except RuntimeError as exc:
|
||||
|
||||
Reference in New Issue
Block a user