Update basecamp_client.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -201,7 +201,7 @@ class BasecampClient:
|
|||||||
raise Exception(f"Failed to create todo: {response.status_code} - {response.text}")
|
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,
|
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.
|
Update an existing todo item.
|
||||||
|
|
||||||
@@ -212,6 +212,7 @@ class BasecampClient:
|
|||||||
description (str, optional): HTML description
|
description (str, optional): HTML description
|
||||||
assignee_ids (list, optional): List of person IDs to assign
|
assignee_ids (list, optional): List of person IDs to assign
|
||||||
completion_subscriber_ids (list, optional): List of person IDs to notify on completion
|
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
|
due_on (str, optional): Due date in YYYY-MM-DD format
|
||||||
starts_on (str, optional): Start 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'
|
endpoint = f'buckets/{project_id}/todos/{todo_id}.json'
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
if content:
|
if content is not None:
|
||||||
data['content'] = content
|
data['content'] = content
|
||||||
if description:
|
if description is not None:
|
||||||
data['description'] = description
|
data['description'] = description
|
||||||
if assignee_ids:
|
if assignee_ids is not None:
|
||||||
data['assignee_ids'] = assignee_ids
|
data['assignee_ids'] = assignee_ids
|
||||||
if completion_subscriber_ids:
|
if completion_subscriber_ids is not None:
|
||||||
data['completion_subscriber_ids'] = completion_subscriber_ids
|
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
|
data['due_on'] = due_on
|
||||||
if starts_on:
|
if starts_on is not None:
|
||||||
data['starts_on'] = starts_on
|
data['starts_on'] = starts_on
|
||||||
|
|
||||||
|
if not data:
|
||||||
|
raise ValueError("No fields provided to update")
|
||||||
|
|
||||||
response = self.put(endpoint, data)
|
response = self.put(endpoint, data)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user