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

Q: high level api for comments #17

Closed chrns closed 11 months ago

chrns commented 10 years ago

Hi! I need read and add new comments in card. Do you planning to add this functionality?

its-rigs commented 10 years ago

Hi I will look at implementing this over the next couple of weeks when I get a bit of free time.

chrns commented 10 years ago

Thanks (:

06.08.2014, 19:37, "Luke Rigby" notifications@github.com:

Hi I will look at implementing this over the next couple of weeks when I get a bit of free time.

— Reply to this email directly or view it on GitHub.

С уважением, Тарасов Александр | chrns.com [HEC] | Hardware Engineering Club | heclub.ru

worldofchris commented 8 years ago

Great library. So much easier to use than the official Python lib.

Related to @chrns request re comments, I have a similar requirement for accessing the actions associated with a card.

RIght now I'm using Trolly to navigate to the card:

boards = client.get_boards()
my_board = boards[0]
cards = my_board.get_cards()
my_card = cards[4]

Then I switch over to the official Trello client to get the actions:

actions = trello.cards.get_action(my_card.id)

This returns something like this:

[{u'type': u'commentCard', u'idMemberCreator': u'559248f3a0ccaFFFFFdb6', u'memberCreator': {u'username': u'worldofchris', u'fullName': u'Chris Young', u'initials': u'CY', u'id': u'559248fFFFFcca5aeb0277db6', u'avatarHash': u'1171b29b10FFFFFa77187b79d8b9a41'}, u'date': u'2016-01-26T10:53:04.777Z', u'data': {u'text': u'How about  a comment?'...

So you can now read comments.

You can then add comments with:

trello.cards.new_action_comment(my_card.id, "Hello GitHub")

Which returns:

u'type': u'commentCard', u'display': {u'translationKey': u'action_comment_on_card', u'entities': {u'comment': {u'text': u'Hello GitHub', u'type': u'comment'}, u'contextOn': {u'translationKey': u'action_on', u'type': u'translatable', u'idContext': u'55a113FFFFFa5c9b5150e79', u'hideIfContext': True}...

This is good enough for me right now. I'll look at extending Trolly to remove the need to use the official api though as the Trolly one is so much better :-)

its-rigs commented 8 years ago

Glad you're liking trolly!!! I've kind of let development slide on this project. Pull requests are always welcome but I'll try and get my act together and implement this soon.