Skip to content

Commit 965c93a

Browse files
Jira: Added time tracking and worklog getters. (#598)
1 parent 22e70f3 commit 965c93a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

atlassian/jira.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,37 @@ def get_issue_transitions_full(self, issue_key, transition_id=None, expand=None)
10731073
params['expand'] = expand
10741074
return self.get(url, params=params)
10751075

1076+
def get_updated_worklogs(self, since, expand=None):
1077+
"""
1078+
Returns a list of IDs and update timestamps for worklogs updated after a date and time.
1079+
:param since: The date and time, as a UNIX timestamp in milliseconds, after which updated worklogs are returned.
1080+
:param expand: Use expand to include additional information about worklogs in the response. This parameter accepts properties that returns the properties of each worklog.
1081+
"""
1082+
url = 'rest/api/3/worklog/updated'
1083+
params = {}
1084+
if since:
1085+
params['since'] = str(int(since*1000))
1086+
if expand:
1087+
params['expand'] = expand
1088+
1089+
return self.get(url, params=params)
1090+
1091+
def get_worklogs(self, ids, expand=None):
1092+
"""
1093+
Returns worklog details for a list of worklog IDs.
1094+
:param expand: Use expand to include additional information about worklogs in the response. This parameter accepts properties that returns the properties of each worklog.
1095+
:param ids: REQUIRED A list of worklog IDs.
1096+
"""
1097+
1098+
url = 'rest/api/3/worklog/list'
1099+
params = {}
1100+
if expand:
1101+
params['expand'] = expand
1102+
data = {
1103+
'ids': ids
1104+
}
1105+
return self.post(url, params=params, data=data)
1106+
10761107
#######################################################################################################
10771108
# User
10781109
# Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/user
@@ -1748,6 +1779,30 @@ def get_status_for_project(self, project_key):
17481779
url = 'rest/api/2/project/{name}/statuses'.format(name=project_key)
17491780
return self.get(url)
17501781

1782+
def get_all_time_tracking_providers(self):
1783+
"""
1784+
Returns all time tracking providers. By default, Jira only has one time tracking provider: JIRA provided time tracking. However, you can install other time tracking providers via apps from the Atlassian Marketplace.
1785+
"""
1786+
1787+
url = 'rest/api/3/configuration/timetracking/list'
1788+
return self.get(url)
1789+
1790+
def get_selected_time_tracking_provider(self):
1791+
"""
1792+
Returns the time tracking provider that is currently selected. Note that if time tracking is disabled, then a successful but empty response is returned.
1793+
"""
1794+
1795+
url = 'rest/api/3/configuration/timetracking'
1796+
return self.get(url)
1797+
1798+
def get_time_tracking_settings(self):
1799+
"""
1800+
Returns the time tracking settings. This includes settings such as the time format, default time unit, and others.
1801+
"""
1802+
1803+
url = 'rest/api/3/configuration/timetracking/options'
1804+
return self.get(url)
1805+
17511806
def get_transition_id_to_status_name(self, issue_key, status_name):
17521807
for transition in self.get_issue_transitions(issue_key):
17531808
if status_name.lower() == transition['to'].lower():

0 commit comments

Comments
 (0)