43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from typing import Any, Dict, List
|
|
import requests
|
|
|
|
from . import _BASE_URL, _headers, _with_token
|
|
|
|
|
|
@_with_token
|
|
def get(token: str, story_id: int = None) -> Dict[str, Any]:
|
|
r = requests.get(f'{_BASE_URL}/stories/{story_id}',
|
|
headers=_headers(token))
|
|
return r.json()
|
|
|
|
|
|
@_with_token
|
|
def put_story(story_id: int, token: str, **kwargs: Any) -> Dict[str, Any]:
|
|
r = requests.put(f'{_BASE_URL}/stories/{story_id}',
|
|
headers=_headers(token), json=kwargs)
|
|
return r.json()
|
|
|
|
|
|
@_with_token
|
|
def get_tasks(project_id: int, story_id: int, token: str) \
|
|
-> List[Dict[str, Any]]:
|
|
url = f'{_BASE_URL}/projects/{project_id}/stories/{story_id}/tasks'
|
|
r = requests.get(url, headers=_headers(token))
|
|
return r.json()
|
|
|
|
|
|
@_with_token
|
|
def get_comments(project_id: int, story_id: int, token: str) \
|
|
-> List[Dict[str, Any]]:
|
|
url = f'{_BASE_URL}/projects/{project_id}/stories/{story_id}/comments'
|
|
r = requests.get(url, headers=_headers(token))
|
|
return r.json()
|
|
|
|
|
|
@_with_token
|
|
def get_blockers(project_id: int, story_id: int, token: str) \
|
|
-> List[Dict[str, Any]]:
|
|
url = f'{_BASE_URL}/projects/{project_id}/stories/{story_id}/blockers'
|
|
r = requests.get(url, headers=_headers(token))
|
|
return r.json()
|