diff --git a/trello/__init__.py b/trello/__init__.py index 3886b294..f8bd2d3c 100644 --- a/trello/__init__.py +++ b/trello/__init__.py @@ -615,6 +615,20 @@ def date_last_activity(self): def description(self, value): self.desc = value + @property + def idLabels(self): + return self.label_ids + + @idLabels.setter + def idLabels(self, values): + self.label_ids = values + + @property + def list_labels(self): + if self.labels: + return self.labels + return None + @property def comments(self): """ @@ -660,6 +674,8 @@ def from_json(cls, trello_list, json_obj): card.closed = json_obj['closed'] card.url = json_obj['url'] card.member_ids = json_obj['idMembers'] + card.idLabels = json_obj['idLabels'] + card.labels = json_obj['labels'] return card def __repr__(self): @@ -682,6 +698,7 @@ def fetch(self, eager=True): self.idShort = json_obj['idShort'] self.idList = json_obj['idList'] self.idBoard = json_obj['idBoard'] + self.idLabels = json_obj['idLabels'] self.labels = json_obj['labels'] self.badges = json_obj['badges'] # For consistency, due date is in YYYY-MM-DD format @@ -901,6 +918,26 @@ def _post_remote_data(self, attribute, files=None, **kwargs): files=files, post_args=kwargs ) +class Label(object): + """ + Class representing a Trello Label. + """ + def __init__(self, client, label_id, name, color=""): + self.client = client + self.id = label_id + self.name = name + self.color = color + + def __repr__(self): + return '