How to use ApplyAction

129 views Asked by At

I've been trying to search for information on how use the copyCard trello action, it looks like I should use Card.ApplyAction, but I am not sure if thats the correct way. I have not found how to set the needed data on the action to copy the card.

Is there a method in Manatee.Trello to copy a card or do I just do it all myself? If there is how do you use it?

1

There are 1 answers

1
gregsdennis On BEST ANSWER

To copy a card, you'll need the destination list. If you're just trying to put it in the same list, that's card.List.

Then you can just add a new card using the existing card as a source:

var card = new Card("<card ID>");
var copy = Card.List.Cards.Add(card);

Done!

Edit for completeness

The ActionTypes enum serves two purposes:

  1. Identify the type of action when you get the list of actions (card.Actions) for objects that expose them (boards, lists, cards, etc.)
  2. Filter actions that are included in the Filter() extension method.

You can find out more on the Manatee.Trello wiki

Another edit for more completeness

The card.ApplyAction() method is for web hooks. When a request is received, the content is deserialized as a string and passed to this method. It is an alternative updating mechanism from the default on-demand polling.