Tasks
tasks
¶
Google Tasks API adapters.
__all__ = ['GTasksClient', 'SyncGTasks']
module-attribute
¶
GTasksClient(config: Config | None = None, *, read_only: bool = False)
¶
Google API to easily handle Google Tasks.
read_only: bool = read_only
instance-attribute
¶
resource: Resource = self._build_resource()
instance-attribute
¶
__enter__() -> GTasksClient
¶
__exit__(exc_type, exc_value, traceback)
¶
all_tasklists(max_results: int | None = None) -> list[GTaskList]
¶
Returns a list of all task lists.
close()
¶
Closes the client.
create_tasklist(title: str) -> GTaskList
¶
Creates a new task list.
get_or_create_tasklist(title: str) -> GTaskList
¶
Returns the task list with the given title or creates it if it doesn't exist yet.
get_tasklist(tasklist_id: str = '@default') -> GTaskList
¶
Returns the task list with the given ID.
If no ID is given, the default task list is returned.
recreate_token()
¶
Recreate the current token using the scopes given at initialization.
search_tasklist(title: str) -> SList[GTaskList]
¶
Returns the task list with the given title.
SyncGTasks(*, notion_db: Database, tasklist: GTaskList, completed_col: Property | str, completed_val: Any, not_completed_val: Any, due_col: Property | str, name: str = 'SyncGTasks', conflict_mode: ConflictMode = ConflictMode.NEWER)
¶
Syncs a Notion database with a Google Tasks task list.
completed_col = completed_col
instance-attribute
¶
completed_val = completed_val
instance-attribute
¶
due_col = due_col
instance-attribute
¶
not_completed_val = not_completed_val
instance-attribute
¶
notion_db = notion_db
instance-attribute
¶
tasklist = tasklist
instance-attribute
¶
title_col = self.notion_db.schema.get_title_prop().name
instance-attribute
¶
get_notion_objects() -> list[Page]
¶
Get all pages from database.
get_other_objects() -> list[GTask]
¶
Get all Google Taks from Tasklist.
notion_create_obj(**kwargs: Any) -> Page
¶
Create a new page.
notion_delete_obj(obj: Page) -> None
¶
Delete the page.
notion_hash(obj: Page) -> str
¶
Get the hash of the Notion page for object mapping/linking.
notion_id(obj: Page) -> ID
¶
Get the ID of the Notion page.
notion_timestamp(obj: Page) -> datetime
¶
Get the timestamp of the Notion page.
notion_to_dict(obj: Page) -> dict[str, Any]
¶
Convert a Notion object to a dictionary.
notion_update_obj(obj: Page, attr: str, value: Any) -> None
¶
Set an attribute of the Notion object, e.g. page.
other_create_obj(**kwargs: Any) -> GTask
¶
Create a new other object.
other_delete_obj(obj: GTask) -> None
¶
Delete the other object.
other_hash(obj: GTask) -> str
¶
Get the hash of the other object for object mapping/linking.
other_id(obj: GTask) -> ID
¶
Get the ID of the Google Task.
other_timestamp(obj: GTask) -> datetime
¶
Get the timestamp of the Google Task.
other_to_dict(obj: GTask) -> dict[str, Any]
¶
Convert another object to a dictionary.
other_update_obj(obj: GTask, attr: str, value: Any) -> None
¶
Set an attribute of the other object.