logger.info(f"Found {len(task_lists)} task lists for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"""Task List Details for {user_google_email}:
- Title: {task_list['title']}
- ID: {task_list['id']}
- Updated: {task_list.get('updated','N/A')}
- Self Link: {task_list.get('selfLink','N/A')}"""
logger.info(f"Retrieved task list '{task_list['title']}' for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"""Task List Created for {user_google_email}:
- Title: {result['title']}
- ID: {result['id']}
- Created: {result.get('updated','N/A')}
- Self Link: {result.get('selfLink','N/A')}"""
logger.info(f"Created task list '{title}' with ID {result['id']} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"""Task List Updated for {user_google_email}:
- Title: {result['title']}
- ID: {result['id']}
- Updated: {result.get('updated','N/A')}"""
logger.info(f"Updated task list {task_list_id} with new title '{title}' for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"Task list {task_list_id} has been deleted for {user_google_email}. All tasks in this list have also been deleted."
logger.info(f"Deleted task list {task_list_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
logger.info(f"Found {len(tasks)} tasks in list {task_list_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"""Task Details for {user_google_email}:
- Title: {task.get('title','Untitled')}
- ID: {task['id']}
- Status: {task.get('status','N/A')}
- Updated: {task.get('updated','N/A')}"""
iftask.get('due'):
response+=f"\n- Due Date: {task['due']}"
iftask.get('completed'):
response+=f"\n- Completed: {task['completed']}"
iftask.get('notes'):
response+=f"\n- Notes: {task['notes']}"
iftask.get('parent'):
response+=f"\n- Parent Task ID: {task['parent']}"
iftask.get('position'):
response+=f"\n- Position: {task['position']}"
iftask.get('selfLink'):
response+=f"\n- Self Link: {task['selfLink']}"
iftask.get('webViewLink'):
response+=f"\n- Web View Link: {task['webViewLink']}"
logger.info(f"Retrieved task '{task.get('title','Untitled')}' for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
user_google_email (str): The user's Google email address. Required.
task_list_id (str): The ID of the task list to create the task in.
title (str): The title of the task.
notes (Optional[str]): Notes/description for the task.
due (Optional[str]): Due date in RFC 3339 format (e.g., "2024-12-31T23:59:59Z").
parent (Optional[str]): Parent task ID (for subtasks).
previous (Optional[str]): Previous sibling task ID (for positioning).
Returns:
str: Confirmation message with the new task ID and details.
"""
logger.info(f"[create_task] Invoked. Email: '{user_google_email}', Task List ID: {task_list_id}, Title: '{title}'")
try:
body={
"title":title
}
ifnotes:
body["notes"]=notes
ifdue:
body["due"]=due
params={"tasklist":task_list_id,"body":body}
ifparent:
params["parent"]=parent
ifprevious:
params["previous"]=previous
result=awaitasyncio.to_thread(
service.tasks().insert(**params).execute
)
response=f"""Task Created for {user_google_email}:
- Title: {result['title']}
- ID: {result['id']}
- Status: {result.get('status','N/A')}
- Updated: {result.get('updated','N/A')}"""
ifresult.get('due'):
response+=f"\n- Due Date: {result['due']}"
ifresult.get('notes'):
response+=f"\n- Notes: {result['notes']}"
ifresult.get('webViewLink'):
response+=f"\n- Web View Link: {result['webViewLink']}"
logger.info(f"Created task '{title}' with ID {result['id']} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"""Task Updated for {user_google_email}:
- Title: {result['title']}
- ID: {result['id']}
- Status: {result.get('status','N/A')}
- Updated: {result.get('updated','N/A')}"""
ifresult.get('due'):
response+=f"\n- Due Date: {result['due']}"
ifresult.get('notes'):
response+=f"\n- Notes: {result['notes']}"
ifresult.get('completed'):
response+=f"\n- Completed: {result['completed']}"
logger.info(f"Updated task {task_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"Task {task_id} has been deleted from task list {task_list_id} for {user_google_email}."
logger.info(f"Deleted task {task_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
logger.info(f"Moved task {task_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."
response=f"All completed tasks have been cleared from task list {task_list_id} for {user_google_email}. The tasks are now hidden and won't appear in default task list views."
logger.info(f"Cleared completed tasks from list {task_list_id} for {user_google_email}")
returnresponse
exceptHttpErroraserror:
message=f"API error: {error}. You might need to re-authenticate. LLM: Try 'start_google_auth' with the user's email ({user_google_email}) and service_name='Google Tasks'."