pivotalcli/api/stories.py
2018-04-03 12:56:07 +02:00

33 lines
1.1 KiB
Python

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()