Exemplo n.º 1
0
        /// <summary>
        /// Get card Ids from all action
        /// </summary>
        /// <param name="trello">trello interface</param>
        /// <param name="boardId">board Id</param>
        /// <param name="startDate">filter start date</param>
        /// <param name="endDate">filter end date</param>
        /// <returns>List of card ids</returns>
        public static List<string> GetCardIdsFromActions(ITrello trello, string boardId, DateTime startDate, DateTime endDate)
        {
            var actions = trello.Actions.ForBoard(
                            new BoardId(boardId),
                            since: Since.Date(startDate),
                            paging: new Paging(1000, 0),
                            filter: CardActionTypes);
            var changedCardActions = actions.Where(a => a.Date > startDate && a.Date < endDate).ToList();
            var changedCardIds = new List<string>();
            foreach (var changedCardAction in changedCardActions)
            {
                // get only cards
                var cardId = GetCardIdFromAction(changedCardAction);

                // modified card
                if (!string.IsNullOrEmpty(cardId))
                {
                    // card id isnt exist
                    if (!changedCardIds.Contains(cardId))
                    {
                        changedCardIds.Add(cardId);
                    }
                }
            }

            return changedCardIds;
        }
 private static Card RemoveUnusedMembers(this Card card, List<string> memberIds)
 {
     var memberList = card.Members.Where(c => memberIds.Contains(c.Id)).ToList();
     card.Members = memberList;
     return card;
 }