Skip to content

Commit

Permalink
Added documentation of Issue class
Browse files Browse the repository at this point in the history
  • Loading branch information
expobrain committed May 16, 2018
1 parent 19fae79 commit f47c616
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ JIRA

.. autoclass:: JIRA

Issue
========

.. autoclass:: Issue

Priority
========

Expand Down
21 changes: 16 additions & 5 deletions jira/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ def __init__(self, options, session, raw=None):
Resource.__init__(self, 'issue/{0}', options, session)

self.fields = None
""" :type : Issue._IssueFields """
""" :type: :class:`~Issue._IssueFields` """
self.id = None
""" :type : int """
""" :type: int """
self.key = None
""" :type : str """
""" :type: str """
if raw:
self._parse_raw(raw)

Expand All @@ -444,10 +444,12 @@ def update(self, fields=None, update=None, async=None, jira=None, notify=True, *
are available here: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues
:param fields: a dict containing field names and the values to use
:param update: a dict containing update operations to apply
:param fieldargs: keyword arguments will generally be merged into fields, except lists,
which will be merged into updates
keyword arguments will generally be merged into fields, except lists, which will be merged into updates
:type fields: dict
:type update: dict
"""
data = {}
if fields is not None:
Expand Down Expand Up @@ -486,20 +488,29 @@ def add_field_value(self, field, value):
"""Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select
:param field: The field name
:param value: The field's value
:type field: str
"""
super(Issue, self).update(fields={"update": {field: [{"add": value}]}})

def delete(self, deleteSubtasks=False):
"""Delete this issue from the server.
:param deleteSubtasks: if the issue has subtasks, this argument must be set to true for the call to succeed.
:type deleteSubtasks: bool
"""
super(Issue, self).delete(params={'deleteSubtasks': deleteSubtasks})

def permalink(self):
"""Get the URL of the issue, the browsable one not the REST one.
:return: URL of the issue
:rtype: str
"""
return "%s/browse/%s" % (self._options['server'], self.key)

Expand Down

0 comments on commit f47c616

Please sign in to comment.