diff --git a/aioauth_client/__init__.py b/aioauth_client/__init__.py index 94f0e9a..8b79986 100644 --- a/aioauth_client/__init__.py +++ b/aioauth_client/__init__.py @@ -1160,38 +1160,28 @@ def user_parse(data): class TodoistClient(OAuth2Client): """Support Todoist. - * Dashboard: https://developer.todoist.com/appconsole.html - * Docs: https://developer.todoist.com/sync/v8/ + * Dashboard: https://app.todoist.com/app/settings/integrations/app-management + * Docs: https://developer.todoist.com/api/v1/ """ - authorize_url = "https://todoist.com/oauth/authorize" - access_token_url = "https://todoist.com/oauth/access_token" - user_info_url = "https://api.todoist.com/sync/v9/sync" - base_url = "https://api.todoist.com/rest/v2" + authorize_url = "https://app.todoist.com/oauth/authorize" + access_token_url = "https://api.todoist.com/oauth/access_token" + user_info_url = "https://api.todoist.com/api/v1/user" + base_url = "https://api.todoist.com/api/v1" name = "todoist" - async def user_info(self, access_token=None, params=None, **kwargs): - """Load user data.""" - params = params or { - "token": access_token or self.access_token, - "sync_token": "*", - "resource_types": '["user"]', - } - return await super(TodoistClient, self).user_info(params=params, **kwargs) - @staticmethod def user_parse(data): """Parse user data.""" assert isinstance(data, dict) - user = data.get("user") - yield "id", user.get("id") - yield "email", user.get("email") - first_name, _, last_name = user.get("full_name", "").partition(" ") + yield "id", data.get("id") + yield "email", data.get("email") + first_name, _, last_name = data.get("full_name", "").partition(" ") yield "first_name", first_name yield "last_name", last_name - yield "picture", user.get("avatar_big") - yield "locale", user.get("lang") + yield "picture", data.get("avatar_big") + yield "locale", data.get("lang") class TrelloClient(OAuth1Client):