-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added standalone CLI * Upgraded to Graph v1.0 API * Improved tod0 API
- Loading branch information
Showing
12 changed files
with
856 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
prompt_toolkit==3.0.3 | ||
requests_oauthlib==1.3.0 | ||
PyYAML==5.3 | ||
|
||
pytz~=2020.4 | ||
tzlocal~=2.1 | ||
setuptools~=49.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import setuptools | ||
from setuptools import setup, find_packages | ||
|
||
setuptools.setup( | ||
setup( | ||
name="tod0", | ||
version="0.5.0", | ||
version="0.6.0", | ||
author="kiblee", | ||
author_email="[email protected]", | ||
packages=["todocli", "todocli.test"], | ||
packages=find_packages(), | ||
url="https://github.com/kiblee/tod0", | ||
license="LICENSE", | ||
description="A Terminal Client for Microsoft To-Do.", | ||
|
@@ -14,11 +14,13 @@ | |
"pyyaml", | ||
"requests", | ||
"requests_oauthlib", | ||
"tzlocal", | ||
], | ||
include_package_data=True, | ||
entry_points=""" | ||
[console_scripts] | ||
tod0=todocli.interface:run | ||
todocli=todocli.cli:main | ||
""", | ||
python_requires=">=3.6", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from odata_system_query import ODataSystemQuery | ||
|
||
base_api_url = "https://graph.microsoft.com/v1.0/me/todo" | ||
|
||
|
||
def _lists(): | ||
return "{}/lists".format(base_api_url) | ||
|
||
|
||
def _list(todo_task_list_id): | ||
return "{}/lists/{}".format(base_api_url, todo_task_list_id) | ||
|
||
|
||
def _tasks(todo_task_list_id): | ||
return "{}/lists/{}/tasks".format(base_api_url, todo_task_list_id) | ||
|
||
|
||
def _task(todo_task_list_id, task_id): | ||
return "{}/lists/{}/tasks/{}".format(base_api_url, todo_task_list_id, task_id) | ||
|
||
|
||
def new_list(): | ||
return _lists() | ||
|
||
|
||
def modify_list(todo_task_list_id): | ||
return _list(todo_task_list_id) | ||
|
||
|
||
def all_lists(): | ||
return _lists() | ||
|
||
|
||
def query_list_id_by_name(list_name): | ||
return ( | ||
_lists() + ODataSystemQuery().filter_startsWith("displayName", list_name).get() | ||
) | ||
|
||
|
||
def new_task(todo_task_list_id): | ||
return _tasks(todo_task_list_id) | ||
|
||
|
||
def modify_task(todo_task_list_id, task_id): | ||
return _task(todo_task_list_id, task_id) | ||
|
||
|
||
def query_completed_tasks(todo_task_list_id, num_tasks: int): | ||
return ( | ||
_tasks(todo_task_list_id) | ||
+ ODataSystemQuery().filter_ne("status", "completed").top(num_tasks).get() | ||
) | ||
|
||
|
||
def query_task_by_name(todo_task_list_id, task_name: str): | ||
return ( | ||
_tasks(todo_task_list_id) | ||
+ ODataSystemQuery().filter_eq("title", task_name).get() | ||
) | ||
|
||
|
||
def delete_task(todo_task_list_id, task_id): | ||
return _task(todo_task_list_id, task_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.