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()
|
|
|
|
|
|
|
|
|
2018-04-24 00:32:22 +00:00
|
|
|
def put_story(token: str, story_id: int, **kwargs) -> Dict[str, Any]:
|
|
|
|
r = requests.put(
|
|
|
|
f'https://www.pivotaltracker.com/services/v5/stories/{story_id}',
|
|
|
|
headers={'X-TrackerToken': token}, json=kwargs)
|
|
|
|
return r.json()
|
|
|
|
|
|
|
|
|
2018-04-03 10:56:07 +00:00
|
|
|
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(
|
2018-04-24 00:32:22 +00:00
|
|
|
f'https://www.pivotaltracker.com/services/v5/projects/{project_id}'
|
|
|
|
f'/stories/{story_id}/blockers', headers={'X-TrackerToken': token})
|
2018-04-03 10:56:07 +00:00
|
|
|
return r.json()
|