Skip to content

Commit 31fef54

Browse files
8BitKnitNerdRobert Gistvik
and
Robert Gistvik
authored
[Jira] Add filter functionality and experimental functionalities for attachment and comment properties (atlassian-api#594)
Co-authored-by: Robert Gistvik <robert.gistvik.external@veoneer.com>
1 parent 24ea31a commit 31fef54

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

atlassian/jira.py

+68
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,24 @@ def get_attachment_meta(self):
177177
url = 'rest/api/2/attachment/meta'
178178
return self.get(url)
179179

180+
def get_attachment_expand_human(self, attachment_id):
181+
"""
182+
Returns the information for an expandable attachment in human-readable format
183+
:param attachment_id: int
184+
:return:
185+
"""
186+
url = 'rest/api/2/attachment/{}/expand/human'.format(attachment_id)
187+
return self.get(url)
188+
189+
def get_attachment_expand_raw(self, attachment_id):
190+
"""
191+
Returns the information for an expandable attachment in raw format
192+
:param attachment_id: int
193+
:return:
194+
"""
195+
url = 'rest/api/2/attachment/{}/expand/raw'.format(attachment_id)
196+
return self.get(url)
197+
180198
#######################################################################################################
181199
# Audit Records. Resource representing the auditing records
182200
# Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/auditing
@@ -282,6 +300,38 @@ def get_comment_properties_keys(self, comment_id):
282300
url = 'rest/api/2/comment/{commentId}/properties'.format(commentId=comment_id)
283301
return self.get(url)
284302

303+
def get_comment_property(self, comment_id, property_key):
304+
"""
305+
Returns the value a property for a comment
306+
:param comment_id: int
307+
:param property_key: str
308+
:return:
309+
"""
310+
url = 'rest/api/2/comment/{commentId}/properties/{propertyKey}'.format(commentId=comment_id, propertyKey=property_key)
311+
return self.get(url, data=data)
312+
313+
def set_comment_property(self, comment_id, property_key, value_property):
314+
"""
315+
Returns the keys of all properties for the comment identified by the key or by the id.
316+
:param comment_id: int
317+
:param property_key: str
318+
:param value_property: object
319+
:return:
320+
"""
321+
url = 'rest/api/2/comment/{commentId}/properties/{propertyKey}'.format(commentId=comment_id, propertyKey=property_key)
322+
data = {'value': value_property}
323+
return self.put(url, data=data)
324+
325+
def delete_comment_property(self, comment_id, property_key):
326+
"""
327+
Deletes a property for a comment
328+
:param comment_id: int
329+
:param property_key: str
330+
:return:
331+
"""
332+
url = 'rest/api/2/comment/{commentId}/properties/{propertyKey}'.format(commentId=comment_id, propertyKey=property_key)
333+
return self.delete(url)
334+
285335
#######################################################################################################
286336
# Component
287337
# Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/component
@@ -426,6 +476,24 @@ def create_filter(self, name, jql, description=None, favourite=False):
426476
url = 'rest/api/2/filter'
427477
return self.post(url, data=data)
428478

479+
def get_filter(self, filter_id):
480+
"""
481+
Returns a full representation of a filter that has the given id.
482+
:param filter_id:
483+
:return:
484+
"""
485+
url = 'rest/api/2/filter/{id}'.format(id=filter_id)
486+
return self.get(url)
487+
488+
def delete_filter(self, filter_id):
489+
"""
490+
Deletes a filter that has the given id.
491+
:param filter_id:
492+
:return:
493+
"""
494+
url = 'rest/api/2/filter/{id}'.format(id=filter_id)
495+
return self.delete(url)
496+
429497
#######################################################################################################
430498
# Group.
431499
# Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/group

0 commit comments

Comments
 (0)