From 9b782e8357fcc8e6a767e41dd04b192b1bb4ff7a Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Sun, 27 May 2018 19:21:30 -0700 Subject: [PATCH] idonethis: Improve typing & note unused function. --- zulip_bots/zulip_bots/bots/idonethis/idonethis.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/idonethis/idonethis.py b/zulip_bots/zulip_bots/bots/idonethis/idonethis.py index 87d29b7..7f6b476 100644 --- a/zulip_bots/zulip_bots/bots/idonethis/idonethis.py +++ b/zulip_bots/zulip_bots/bots/idonethis/idonethis.py @@ -2,7 +2,7 @@ import requests import logging import re -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, List API_BASE_URL = "https://beta.idonethis.com/api/v2" @@ -42,25 +42,26 @@ def make_API_request(endpoint: str, logging.error('Error make API request, code ' + str(r.status_code) + '. json: ' + r.json()) raise UnspecifiedProblemException() -def api_noop() -> Any: - return make_API_request("/noop") +def api_noop() -> None: + make_API_request("/noop") -def api_list_team() -> Any: +def api_list_team() -> List[Dict[str, str]]: return make_API_request("/teams") -def api_show_team(hash_id: str) -> Any: +def api_show_team(hash_id: str) -> Dict[str, str]: return make_API_request("/teams/{}".format(hash_id)) +# NOTE: This function is not currently used def api_show_users(hash_id: str) -> Any: return make_API_request("/teams/{}/members".format(hash_id)) -def api_list_entries(team_id: Optional[str]=None) -> Any: +def api_list_entries(team_id: Optional[str]=None) -> List[Dict[str, Any]]: if team_id: return make_API_request("/entries", params=dict(team_id=team_id)) else: return make_API_request("/entries") -def api_create_entry(body: str, team_id: str) -> Any: +def api_create_entry(body: str, team_id: str) -> Dict[str, Any]: return make_API_request("/entries", "POST", {"body": body, "team_id": team_id}) def list_steams() -> str: