Skip to content

GetActionsOnCardAsync

Rasmus Wulff Jensen edited this page Nov 1, 2023 · 8 revisions

Back to Action Features

Get the most recent Actions (Changelog Events) of a Card

Note: By default if no filter is given the default filter of Trello API is 'commentCard, updateCard:idList' (aka 'Move Card To List' and 'Add Comment')

Tip: Use this video to find the Id of a Card

Signature

/// <summary>
/// Get the most recent Actions (Changelog Events) on a Card
/// </summary>
/// <remarks>
/// If no filter is given the default filter of Trello API is 'commentCard, updateCard:idList' (aka 'Move Card To List' and 'Add Comment')
/// </remarks>
/// <param name="cardId">The Id of the Card</param>
/// <param name="filter">A set of event-types to filter by (You can see a list of event in TrelloDotNet.Model.Webhook.WebhookActionTypes). Default: 'commentCard, updateCard:idList' (aka 'Move Card To List' and 'Add Comment')</param>
/// <param name="limit">How many recent events to get back; Default 50, Max 1000</param>
/// <param name="cancellationToken">Cancellation Token</param>
/// <returns>List of most Recent Trello Actions</returns>
public async Task<List<TrelloAction>> GetActionsOnCardAsync(string cardId, List<string> filter = null, int limit = 50, CancellationToken cancellationToken = default) {...}

Examples

var cardId = "63c939a5cea0cb006dc9e88c";

//Get last 50 actions on the card (Default filter 'commentCard, updateCard:idList')
List<TrelloAction> last50ActionsOnCard = await _trelloClient.GetActionsOnCardAsync(cardId);

//Get last 200 actions on the card  (Default filter 'commentCard, updateCard:idList')
List<TrelloAction> last200ActionsOnCard = await _trelloClient.GetActionsOnCardAsync(cardId, limit: 200);

//Get last 100 actions of type 'removeLabelFromCard' and 'addLabelToCard'
var filter = new List<string>
{
    TrelloDotNet.Model.Webhook.WebhookActionTypes.RemoveLabelFromCard,
    TrelloDotNet.Model.Webhook.WebhookActionTypes.AddLabelToCard,
    
};
List<TrelloAction> last100ActionsOnCArdOfSpecificTypes = await _trelloClient.GetActionsOnCardAsync(cardId, filter, limit: 100);
Clone this wiki locally