def createSubtasks(parentKey, summaries): issueUpdates = [] for summary in summaries: issueUpdates.append(createSubtaskInput(parentKey, summary)) return post('https://sofiinc.atlassian.net/rest/api/2/issue/bulk', {'issueUpdates': issueUpdates})
def handleSprint(sprintId, summaries): boardId = '318' issueUpdates = [] # get all IPY issues from the sprint issues = filter( lambda i: 'labels' in i['fields'] and 'IPY' in i['fields']['labels'], getIssuesFromBoard(boardId=boardId, sprintId=sprintId)) ''' for issue in issues: print(issue['key']) ''' # for each issue, if the issue does not already have subtasks, create subtask json and append to issueUpdates array for issue in issues: if len(issue['fields']['subtasks']) == 0: # if there are no subtasks for summary in summaries: issueUpdates.append(createSubtaskInput(issue['key'], summary)) # bulk create subtasks return post('https://sofiinc.atlassian.net/rest/api/2/issue/bulk', {'issueUpdates': issueUpdates})
def createSubtask(parentKey, summary): return post('https://sofiinc.atlassian.net/rest/api/2/issue', issue)