pivotalcli/api/stories.py

34 lines
1.1 KiB
Python
Raw Normal View History

2018-04-03 10:56:07 +00:00
import requests
from typing import Dict, Any, List
def get(token: str, story_id: int = None) -> Dict[str, Any]:
r = requests.get(
f'https://www.pivotaltracker.com/services/v5/stories/{story_id}',
headers={'X-TrackerToken': token})
return r.json()
def get_tasks(token: str, project_id: int, story_id: int) \
-> List[Dict[str, Any]]:
r = requests.get(
f'https://www.pivotaltracker.com/services/v5/projects/{project_id}'
f'/stories/{story_id}/tasks', headers={'X-TrackerToken': token})
return r.json()
def get_comments(token: str, project_id: int, story_id: int) \
-> List[Dict[str, Any]]:
r = requests.get(
f'https://www.pivotaltracker.com/services/v5/projects/{project_id}'
f'/stories/{story_id}/comments', headers={'X-TrackerToken': token})
return r.json()
def get_blockers(token: str, project_id: int, story_id: int) \
-> List[Dict[str, Any]]:
r = requests.get(
f'https://www.pivotaltracker.com/services/v5/projects/{project_id}'
f'/stories/{story_id}/blockers', headers={'X-TrackerToken': token})
return r.json()