def query_list_id_by_name(list_name): url = api_urls.query_list_id_by_name(list_name) res = RestRequestGet(url).execute() try: return res[0]["id"] except IndexError: raise ListNotFound(list_name)
def query_lists(): lists = RestRequestGet(api_urls.all_lists()).execute() return lists
def query_task(list_name: str, task_name: str): query_url = api_urls.query_task_by_name(get_list_id_by_name(list_name), task_name) return RestRequestGet(query_url).execute()
def query_tasks(list_name: str, num_tasks: int = 100): query_url = api_urls.query_completed_tasks( get_list_id_by_name(list_name), num_tasks ) return RestRequestGet(query_url).execute()
def query_lists(): result = RestRequestGet(api_urls.all_lists()).execute() return [TodoList(x) for x in result]
def query_task(list_name: str, task_name: str): query_url = api_urls.query_task_by_name(get_list_id_by_name(list_name), task_name) result = RestRequestGet(query_url).execute() return [Task(x) for x in result]