Skip to content

Commit

Permalink
Add update_filter to client
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarsj committed Jul 6, 2015
1 parent ce6c2b6 commit cc0aab2
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,35 @@ def create_filter(self, name=None, description=None,
raw_filter_json = json_loads(r)
return Filter(self._options, self._session, raw=raw_filter_json)

# Groups
def update_filter(self, filter_id,
name=None, description=None,
jql=None, favourite=None):

"""
Updates a filter and return a filter Resource for it.
Keyword arguments:
name -- name of the new filter
description -- useful human readable description of the new filter
jql -- query string that defines the filter
favourite -- whether to add this filter to the current user's favorites
"""
filter = self.filter(filter_id)
data = {}
data['name'] = name or filter.name
data['description'] = description or filter.description
data['jql'] = jql or filter.jql
data['favourite'] = favourite or filter.favourite

url = self._get_url('filter/%s' % filter_id)
r = self._session.put(url, headers={'content-type': 'application/json'},
data=json.dumps(data))

raw_filter_json = json.loads(r.text)
return Filter(self._options, self._session, raw=raw_filter_json)

# Groups

# non-resource
def groups(self, query=None, exclude=None, maxResults=None):
Expand Down

0 comments on commit cc0aab2

Please sign in to comment.