-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
590 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace TrelloDotNet.Model | ||
{ | ||
/// <summary> | ||
/// A set of handy extension methods for Checklists | ||
/// </summary> | ||
public static class ChecklistExtensions | ||
{ | ||
/// <summary> | ||
/// Get Number of Items on the Checklist regardless of state | ||
/// </summary> | ||
/// <returns>Number of Items</returns> | ||
public static int GetNumberOfItems(this Checklist checklist) | ||
{ | ||
return checklist.Items.Count; | ||
} | ||
|
||
/// <summary> | ||
/// Get the Number of Completed items on the Checklist | ||
/// </summary> | ||
/// <returns>Number of Completed Items</returns> | ||
public static int GetNumberOfCompletedItems(this Checklist checklist) | ||
{ | ||
return checklist.Items.Count(x => x.State == ChecklistItemState.Complete); | ||
} | ||
|
||
/// <summary> | ||
/// Get the Number of Incomplete items on the Checklist | ||
/// </summary> | ||
/// <returns>Number of Completed Items</returns> | ||
public static int GetNumberOfIncompleteItems(this Checklist checklist) | ||
{ | ||
return checklist.Items.Count(x => x.State == ChecklistItemState.Incomplete); | ||
} | ||
|
||
/// <summary> | ||
/// Returns if all items on the Checklist is complete | ||
/// </summary> | ||
/// <returns>True if all Items are complete</returns> | ||
public static bool IsAllComplete(this Checklist checklist) | ||
{ | ||
return checklist.Items.All(x => x.State == ChecklistItemState.Complete); | ||
} | ||
|
||
/// <summary> | ||
/// Returns if any of the checklist items ar not yet complete | ||
/// </summary> | ||
/// <returns>True if on or more is incomplete</returns> | ||
public static bool IsAnyIncomplete(this Checklist checklist) | ||
{ | ||
return checklist.Items.Any(x => x.State != ChecklistItemState.Complete); | ||
} | ||
|
||
/// <summary> | ||
/// Get Number of Items across a collection of Checklists regardless of state | ||
/// </summary> | ||
/// <returns>Number of Items</returns> | ||
public static int GetNumberOfItems(this IEnumerable<Checklist> checklists) | ||
{ | ||
return checklists.Sum(x => x.GetNumberOfItems()); | ||
} | ||
|
||
/// <summary> | ||
/// Get the Number of Completed items across a collection of Checklists | ||
/// </summary> | ||
/// <returns>Number of Completed Items</returns> | ||
public static int GetNumberOfCompletedItems(this IEnumerable<Checklist> checklists) | ||
{ | ||
return checklists.Sum(x => x.GetNumberOfCompletedItems()); | ||
} | ||
|
||
/// <summary> | ||
/// Get the Number of Incomplete items across a collection of Checklists | ||
/// </summary> | ||
/// <returns>Number of Completed Items</returns> | ||
public static int GetNumberOfIncompleteItems(this IEnumerable<Checklist> checklists) | ||
{ | ||
return checklists.Sum(x => x.GetNumberOfIncompleteItems()); | ||
} | ||
|
||
/// <summary> | ||
/// Returns if all items on the Checklist is complete | ||
/// </summary> | ||
/// <returns>True if all Items are complete</returns> | ||
public static bool IsAllComplete(this IEnumerable<Checklist> checklists) | ||
{ | ||
return checklists.All(x => x.IsAllComplete()); | ||
} | ||
|
||
/// <summary> | ||
/// Returns if any of the checklist items ar not yet complete | ||
/// </summary> | ||
/// <returns>True if on or more is incomplete</returns> | ||
public static bool IsAnyIncomplete(this IEnumerable<Checklist> checklists) | ||
{ | ||
return checklists.Any(x => x.IsAnyIncomplete()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
TrelloDotNet/TrelloDotNet/Model/Options/GetMemberOptions/GetMemberOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace TrelloDotNet.Model.Options.GetMemberOptions | ||
{ | ||
/// <summary> | ||
/// Options when retrieving members | ||
/// </summary> | ||
public class GetMemberOptions | ||
{ | ||
/// <summary> | ||
/// all or a comma-separated list of fields. | ||
/// </summary> | ||
public MemberFields MemberFields { get; set; } | ||
|
||
internal QueryParameter[] GetParameters() | ||
{ | ||
List<QueryParameter> parameters = new List<QueryParameter>(); | ||
if (MemberFields != null) | ||
{ | ||
parameters.Add(new QueryParameter("fields", string.Join(",", MemberFields.Fields))); | ||
} | ||
|
||
return parameters.ToArray(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
TrelloDotNet/TrelloDotNet/Model/Options/MoveCardToBoardOptions/MoveCardToBoardOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace TrelloDotNet.Model.Options.MoveCardToBoardOptions | ||
{ | ||
/// <summary> | ||
/// Options when moving a card to a new board | ||
/// </summary> | ||
public class MoveCardToBoardOptions | ||
{ | ||
/// <summary> | ||
/// Id of a List on the new Board (if not specified card will be moved to the first list on the board) | ||
/// </summary> | ||
public string NewListId { get; set; } | ||
|
||
/// <summary> | ||
/// Position of the card on the new list (Will not be used if NamedPosition is used) | ||
/// </summary> | ||
public decimal? PositionOnNewList { get; set; } | ||
|
||
/// <summary> | ||
/// Named position of the card on the new list (will ignore position given in these options if any) | ||
/// </summary> | ||
public NamedPosition? NamedPositionOnNewList { get; set; } | ||
|
||
/// <summary> | ||
/// Define what should happen to Labels on the Card (Default = 'MigrateToLabelsOfSameNameAndColorAndCreateMissing') | ||
/// </summary> | ||
public MoveCardToBoardOptionsLabelOptions LabelOptions { get; set; } = MoveCardToBoardOptionsLabelOptions.MigrateToLabelsOfSameNameAndColorAndCreateMissing; | ||
|
||
/// <summary> | ||
/// Define what should happen to Members on the Card (Default = 'KeepMembersAlsoOnNewBoardAndRemoveRest') | ||
/// </summary> | ||
public MoveCardToBoardOptionsMemberOptions MemberOptions { get; set; } = MoveCardToBoardOptionsMemberOptions.KeepMembersAlsoOnNewBoardAndRemoveRest; | ||
|
||
/// <summary> | ||
/// If the Start Date of the Card should be removed (Default = False) | ||
/// </summary> | ||
public bool RemoveStartDate { get; set; } | ||
|
||
/// <summary> | ||
/// If the Due Date of the Card should be removed (Default = False) | ||
/// </summary> | ||
public bool RemoveDueDate { get; set; } | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...t/TrelloDotNet/Model/Options/MoveCardToBoardOptions/MoveCardToBoardOptionsLabelOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace TrelloDotNet.Model.Options.MoveCardToBoardOptions | ||
{ | ||
/// <summary> | ||
/// Label options when moving a Card to another board | ||
/// </summary> | ||
public enum MoveCardToBoardOptionsLabelOptions | ||
{ | ||
/// <summary> | ||
/// Migrate Labels with the same color and name, and create those missing as labels on the new board | ||
/// </summary> | ||
MigrateToLabelsOfSameNameAndColorAndCreateMissing, | ||
|
||
/// <summary> | ||
/// Migrate Labels with the same color and name, and remove all labels that does not exist on the new board | ||
/// </summary> | ||
MigrateToLabelsOfSameNameAndColorAndRemoveMissing, | ||
|
||
/// <summary> | ||
/// Migrate Labels with the same name (allow color change), and create those missing as labels on the new board | ||
/// </summary> | ||
MigrateToLabelsOfSameNameAndCreateMissing, | ||
|
||
/// <summary> | ||
/// Migrate Labels with the same name (allow color change), and remove all labels that does not exist on the new board | ||
/// </summary> | ||
MigrateToLabelsOfSameNameAndRemoveMissing, | ||
|
||
/// <summary> | ||
/// Remove all labels before move to new board | ||
/// </summary> | ||
RemoveAllLabelsOnCard, | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../TrelloDotNet/Model/Options/MoveCardToBoardOptions/MoveCardToBoardOptionsMemberOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace TrelloDotNet.Model.Options.MoveCardToBoardOptions | ||
{ | ||
/// <summary> | ||
/// Member options when moving a Card to another board | ||
/// </summary> | ||
public enum MoveCardToBoardOptionsMemberOptions | ||
{ | ||
/// <summary> | ||
/// Keep the members on the card that is also members of the new board, and remove the rest | ||
/// </summary> | ||
KeepMembersAlsoOnNewBoardAndRemoveRest, | ||
|
||
/// <summary> | ||
/// Remove all members on the board | ||
/// </summary> | ||
RemoveAllMembersOnCard | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
TrelloDotNet/TrelloDotNet/Model/Options/MoveCardToListOptions/MoveCardToListOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace TrelloDotNet.Model.Options.MoveCardToListOptions | ||
{ | ||
/// <summary> | ||
/// Option of the Move | ||
/// </summary> | ||
public class MoveCardToListOptions | ||
{ | ||
/// <summary> | ||
/// Position of the card on the new list (Will not be used if NamedPosition is used) | ||
/// </summary> | ||
public decimal? PositionOnNewList { get; set; } | ||
|
||
/// <summary> | ||
/// Named position of the card on the new list (will ignore position given in these options if any) | ||
/// </summary> | ||
public NamedPosition? NamedPositionOnNewList { get; set; } | ||
} | ||
} |
Oops, something went wrong.