its-rigs / Trolly

A Python wrapper around the Trello API. Provides a group of Python classes to represent Trello Objects. All classes come with basic Trello API method calls and are easily extensible to suit your needs. See the README for more details.
MIT License
100 stars 29 forks source link

Add a high level API for editing checklist items. #9

Closed coling closed 8 years ago

coling commented 10 years ago

Hi,

For an integration I'm working on, I found the need to edit checklist item names and their state, but didn't find any nice way to do that via this wrapper. The API does have (slightly odd) methods for making this change, so I tried to wrap them up nicely.

Commit message

Until now the only way to mark a checklist item as complete was to remove it and re-add it which is certainly sub-optimal and also messes with the ordering of items.

The exposed API does have a mechanism for updating the name and state of checklist items but it's non-obvious and requires that the both the card id and checklist id are known.

This commit adds a highlevel API to do this renaming and state changing.

In order to not break API, a new method called 'getItemObjects' has been added to supplement the 'getItems' method of the Checklist class. This new method will return objects rather than a plain dict and exposes 'updateName' and 'updateState' methods.

its-rigs commented 10 years ago

Hi Colin,

Thanks for this, I never really got around to doing this properly :)

One thing (and I realise I am nit picking but) could you change self.idCard and self.idChecklist to self.card_id and self.checklist_id or self.id_card and self.id_checklist (I prefer the former).

I'm trying to keep as much of this as Pythonic as possible since my function names aren't I'm trying my best to keep the rest as standard as possible.

When you've made the changes I'll merge the pull request.

Thanks again, LR

coling commented 10 years ago

No problem will get around to that at some point soon.

When I do can I also include another small change in my PR?

https://github.com/coling/Trolly/commit/d4b3f67a18254351383d3e0c6fda2284df953902

Fairly contentions I feel. Just saves me several API calls for my integration as all I care about are Checklists, not really about the cards they are attached to (although this will likely change at some point and void any saving, but there doesn't seem to be any reason not to have this in the API!)

its-rigs commented 10 years ago

That change was in your original pull request anyway. See no reason for it not to go in.

LR

coling commented 10 years ago

Hmm, strange... I didn't push that until after I'd created this ticket... I thought the pull requests here were based on snapshots at the time, but it seems if you update your ref, it follows it. Handy and confusing at the same time :)

jean commented 8 years ago

Superseded by #35