Skip to content

Commit

Permalink
Merge pull request #191 from tclh123/dev2
Browse files Browse the repository at this point in the history
enhance trellolist list_cards
  • Loading branch information
sarumont authored Apr 10, 2017
2 parents ca86d8f + 27a3d39 commit 9c939d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def from_json(cls, parent, json_obj):
card._attachments = []
for attachment_json in json_obj["attachments"]:
card._attachments.append(attachment_json)
if 'actions' in json_obj:
card.actions = json_obj['actions']
return card

def __repr__(self):
Expand Down
10 changes: 8 additions & 2 deletions trello/trellolist.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ def fetch(self):
self.closed = json_obj['closed']
self.pos = json_obj['pos']

def list_cards(self, card_filter="open"):
def list_cards(self, card_filter="open", actions=None):
"""Lists all cards in this list"""
json_obj = self.client.fetch_json('/lists/' + self.id + '/cards/' + card_filter)
query_params = {}
if card_filter:
query_params['filter'] = card_filter
if actions:
query_params['actions'] = actions
json_obj = self.client.fetch_json('/lists/' + self.id + '/cards',
query_params=query_params)
return [Card.from_json(self, c) for c in json_obj]

def add_card(self, name, desc=None, labels=None, due="null", source=None, position=None):
Expand Down

0 comments on commit 9c939d4

Please sign in to comment.