Skip to content

Commit 216ec04

Browse files
author
Gonchik Tsymzhitov
committed
JIRA: get project versions with paginations
1 parent 802b28b commit 216ec04

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

atlassian/jira.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,43 @@ def get_project_components(self, key):
129129
"""
130130
return self.get('rest/api/2/project/{0}/components'.format(key))
131131

132+
def get_project_versions(self, key, expand=None):
133+
"""
134+
Contains a full representation of a the specified project's versions.
135+
:param key:
136+
:param expand: the parameters to expand
137+
:return:
138+
"""
139+
if expand is not None:
140+
params["expand"] = expand
141+
return self.get('rest/api/2/project/{}/versions'.format(key))
142+
143+
def get_project_versions_paginated(self, key, start=None, limit=None, order_by=None, expand=None):
144+
"""
145+
Returns all versions for the specified project. Results are paginated.
146+
Results can be ordered by the following fields:
147+
sequence
148+
name
149+
startDate
150+
releaseDate
151+
:param key: the project key or id
152+
:param start: the page offset, if not specified then defaults to 0
153+
:param limit: how many results on the page should be included. Defaults to 50.
154+
:param order_by: ordering of the results.
155+
:param expand: the parameters to expand
156+
:return:
157+
"""
158+
params = {}
159+
if start is not None:
160+
params["startAt"] = int(start)
161+
if limit is not None:
162+
params["maxResults"] = int(limit)
163+
if order_by is not None:
164+
params["orderBy"] = order_by
165+
if expand is not None:
166+
params["expand"] = expand
167+
return self.get('rest/api/2/project/{}/version'.format(key), params)
168+
132169
def issue(self, key, fields='*all'):
133170
return self.get('rest/api/2/issue/{0}?fields={1}'.format(key, fields))
134171

0 commit comments

Comments
 (0)