diff --git a/basecamp_client.py b/basecamp_client.py index fc1e697..35dc48e 100644 --- a/basecamp_client.py +++ b/basecamp_client.py @@ -201,7 +201,7 @@ class BasecampClient: raise Exception(f"Failed to create todo: {response.status_code} - {response.text}") def update_todo(self, project_id, todo_id, content=None, description=None, assignee_ids=None, - completion_subscriber_ids=None, due_on=None, starts_on=None): + completion_subscriber_ids=None, notify=None, due_on=None, starts_on=None): """ Update an existing todo item. @@ -212,6 +212,7 @@ class BasecampClient: description (str, optional): HTML description assignee_ids (list, optional): List of person IDs to assign completion_subscriber_ids (list, optional): List of person IDs to notify on completion + notify (bool, optional): Whether to notify assignees due_on (str, optional): Due date in YYYY-MM-DD format starts_on (str, optional): Start date in YYYY-MM-DD format @@ -221,18 +222,23 @@ class BasecampClient: endpoint = f'buckets/{project_id}/todos/{todo_id}.json' data = {} - if content: + if content is not None: data['content'] = content - if description: + if description is not None: data['description'] = description - if assignee_ids: + if assignee_ids is not None: data['assignee_ids'] = assignee_ids - if completion_subscriber_ids: + if completion_subscriber_ids is not None: data['completion_subscriber_ids'] = completion_subscriber_ids - if due_on: + if notify is not None: + data['notify'] = notify + if due_on is not None: data['due_on'] = due_on - if starts_on: + if starts_on is not None: data['starts_on'] = starts_on + + if not data: + raise ValueError("No fields provided to update") response = self.put(endpoint, data) if response.status_code == 200: