diff --git a/.gitignore b/.gitignore index 2097bf1..f3c80b6 100644 --- a/.gitignore +++ b/.gitignore @@ -220,3 +220,4 @@ pip-log.txt packages *.DotSettings +.vs \ No newline at end of file diff --git a/LeanKit.API.Client.Library.Tests/LeanKit.API.Client.Library.Tests.csproj b/LeanKit.API.Client.Library.Tests/LeanKit.API.Client.Library.Tests.csproj index 0b0d4f2..edafa23 100644 --- a/LeanKit.API.Client.Library.Tests/LeanKit.API.Client.Library.Tests.csproj +++ b/LeanKit.API.Client.Library.Tests/LeanKit.API.Client.Library.Tests.csproj @@ -38,15 +38,15 @@ False - ..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll False ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - + False - ..\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll + ..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll False diff --git a/LeanKit.API.Client.Library.Tests/packages.config b/LeanKit.API.Client.Library.Tests/packages.config index a747bde..1895610 100644 --- a/LeanKit.API.Client.Library.Tests/packages.config +++ b/LeanKit.API.Client.Library.Tests/packages.config @@ -1,7 +1,7 @@  - + - + \ No newline at end of file diff --git a/LeanKit.API.Client.Library/Extensions/CollectionExtensions.cs b/LeanKit.API.Client.Library/Extensions/CollectionExtensions.cs index 021d63f..7f98e12 100644 --- a/LeanKit.API.Client.Library/Extensions/CollectionExtensions.cs +++ b/LeanKit.API.Client.Library/Extensions/CollectionExtensions.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // Copyright (c) LeanKit Inc. All rights reserved. -// +// //------------------------------------------------------------------------------ using System.Collections.Generic; @@ -16,21 +16,24 @@ public static class CollectionExtensions public static Card FindContainedCard(this IEnumerable lanes, long laneId, long cardId) { var list = lanes as IList ?? lanes.ToList(); - var candidateLane = list.FindLane(laneId); - - //Get the card from the lane - var candidateCard = candidateLane.Cards.FirstOrDefault(card => card.Id == cardId); + if (list.ContainsLane(laneId)) + { + var candidateLane = list.FindLane(laneId); - if (candidateCard != null) return candidateCard.ToCard(); + //Get the card from the lane + var candidateCard = candidateLane.Cards.FirstOrDefault(card => card.Id == cardId); + if (candidateCard != null) return candidateCard.ToCard(); + } //the card may have been moved so look in all the affected lanes - candidateCard = list.SelectMany(x => x.Cards).FirstOrDefault(card => card.Id == cardId); - if (candidateCard == null) + var candidateCard2 = list.SelectMany(x => x.Cards).FirstOrDefault(card => card.Id == cardId); + if (candidateCard2 == null) { - throw new ItemNotFoundException(string.Format("Unable to find the Card [{0}] in the associated Lane [{1}].", cardId, laneId)); + throw new ItemNotFoundException(string.Format("Unable to find the Card [{0}] in the associated Lane [{1}].", cardId, + laneId)); } - return candidateCard.ToCard(); + return candidateCard2.ToCard(); } public static Lane FindLane(this IEnumerable lanes, long laneId) @@ -82,4 +85,4 @@ public static IEnumerable GetFlatLanes(this IEnumerable } } } -} \ No newline at end of file +} diff --git a/LeanKit.API.Client.Library/IInitializable.cs b/LeanKit.API.Client.Library/IInitializable.cs index 4080adb..8b6ed86 100644 --- a/LeanKit.API.Client.Library/IInitializable.cs +++ b/LeanKit.API.Client.Library/IInitializable.cs @@ -4,12 +4,15 @@ // //------------------------------------------------------------------------------ +using System; using LeanKit.API.Client.Library.TransferObjects; namespace LeanKit.API.Client.Library { public interface ILeanKitClient { + [Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")] ILeanKitApi Initialize(LeanKitAccountAuth accountAuth); + ILeanKitApi Initialize(ILeanKitAccountAuth accountAuth); } } \ No newline at end of file diff --git a/LeanKit.API.Client.Library/ILeanKitAccountAuth.cs b/LeanKit.API.Client.Library/ILeanKitAccountAuth.cs new file mode 100644 index 0000000..95ef95d --- /dev/null +++ b/LeanKit.API.Client.Library/ILeanKitAccountAuth.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) LeanKit Inc. All rights reserved. +// +//------------------------------------------------------------------------------ + +namespace LeanKit.API.Client.Library +{ + public interface ILeanKitAccountAuth + { + string GetAccountUrl(); + string Hostname { get; set; } + } +} diff --git a/LeanKit.API.Client.Library/ILeanKitApi.cs b/LeanKit.API.Client.Library/ILeanKitApi.cs index 2393f70..408f379 100644 --- a/LeanKit.API.Client.Library/ILeanKitApi.cs +++ b/LeanKit.API.Client.Library/ILeanKitApi.cs @@ -1,12 +1,11 @@ //------------------------------------------------------------------------------ // // Copyright (c) LeanKit Inc. All rights reserved. -// +// //------------------------------------------------------------------------------ using System; using System.Collections.Generic; -using System.IO; using LeanKit.API.Client.Library.TransferObjects; namespace LeanKit.API.Client.Library @@ -19,8 +18,8 @@ public interface ILeanKitApi IEnumerable GetBacklogLanes(long boardId); IEnumerable GetArchiveLanes(long boardId); IEnumerable GetArchiveCards(long boardId); - Board GetNewerIfExists(long boardId, int version); - IEnumerable GetBoardHistorySince(long boardId, int version); + Board GetNewerIfExists(long boardId, long version); + IEnumerable GetBoardHistorySince(long boardId, long version); CardView GetCard(long boardId, long cardId); Card GetCardByExternalId(long boardId, string externalCardId); BoardIdentifiers GetBoardIdentifiers(long boardId); @@ -38,16 +37,17 @@ public interface ILeanKitApi CardsUpdateResult UpdateCards(long boardId, IEnumerable updatedCards); long DeleteCard(long boardId, long cardId); CardsDeleteResult DeleteCards(long boardId, IEnumerable cardIds); - CardDelegationResult DelegateCard(long cardId, long delegationBoardId); - BoardUpdates CheckForUpdates(long boardId, int version); + CardDelegationResult DelegateCard(long cardId, long delegationBoardId); + BoardUpdates CheckForUpdates(long boardId, long version); IEnumerable GetComments(long boardId, long cardId); - int PostComment(long boardId, long cardId, Comment comment); - int PostCommentByExternalId(long boardId, string externalId, Comment comment); + long PostComment(long boardId, long cardId, Comment comment); + long PostCommentByExternalId(long boardId, string externalId, Comment comment); IEnumerable GetCardHistory(long boardId, long cardId); IEnumerable SearchCards(long boardId, SearchOptions options); IEnumerable ListNewCards(long boardId); CardMoveBetweenBoardsResult MoveCardToAnotherBoard(long cardId, long destBoardId); User GetCurrentUser(long boardId); + DrillThroughStatistics GetDrillThroughStatistics(long boardId, long cardId); Taskboard GetTaskboardById(long boardId, long taskboardId); Taskboard GetTaskboard(long boardId, long cardId); @@ -58,36 +58,44 @@ public interface ILeanKitApi long DeleteTask(long boardId, long cardId, long taskId); CardMoveResult MoveTask(long boardId, long cardId, long taskId, long toLaneId, int position); CardMoveResult MoveTask(long boardId, long cardId, long taskId, long toLaneId, int position, string wipOverrideReason); + long SaveAttachment(long boardId, long cardId, string fileName, string description, string mimeType, byte[] fileBytes); long DeleteAttachment(long boardId, long cardId, long attachmentId); Asset GetAttachment(long boardId, long cardId, long attachmentId); IEnumerable GetAttachments(long boardId, long cardId); + AssetFile DownloadAttachment(long boardId, long attachmentId); #region Obsolete - + [Obsolete("Creating taskboards is no longer supported", true)] - TaskboardCreateResult CreateTaskboard(long boardId, long containingCardId, TaskboardTemplateType templateType, long cardContextId); + TaskboardCreateResult CreateTaskboard(long boardId, long containingCardId, TaskboardTemplateType templateType, + long cardContextId); + [Obsolete("Deleting taskboards is no longer supported", true)] TaskboardDeleteResult DeleteTaskboard(long boardId, long taskboardId); [Obsolete("Use AddTask instead")] CardAddResult AddTaskboardCard(long boardId, long taskboardId, Card newCard); + [Obsolete("Use AddTask instead")] CardAddResult AddTaskboardCard(long boardId, long taskboardId, Card newCard, string wipOverrideReason); + [Obsolete("Use UpdateTask instead")] CardUpdateResult UpdateTaskboardCard(long boardId, long taskboardId, Card updatedCard, string wipOverrideReason); + [Obsolete("Use UpdateTask instead")] CardUpdateResult UpdateTaskboardCard(long boardId, long taskboardId, Card updatedCard); + [Obsolete("Use DeleteTask instead")] long DeleteTaskboardCard(long boardId, long taskboardId, long cardId); + [Obsolete("Use MoveTask instead")] CardMoveResult MoveTaskboardCard(long boardId, long taskboardId, long cardId, long toLaneId, int position, string wipOverrideReason); + [Obsolete("Use MoveTask instead")] CardMoveResult MoveTaskboardCard(long boardId, long taskboardId, long cardId, long toLaneId, int position); #endregion - - } -} \ No newline at end of file +} diff --git a/LeanKit.API.Client.Library/ILeanKitClientFactory.cs b/LeanKit.API.Client.Library/ILeanKitClientFactory.cs index 6191b12..2399132 100644 --- a/LeanKit.API.Client.Library/ILeanKitClientFactory.cs +++ b/LeanKit.API.Client.Library/ILeanKitClientFactory.cs @@ -4,6 +4,7 @@ // //------------------------------------------------------------------------------ +using System; using LeanKit.API.Client.Library.TransferObjects; namespace LeanKit.API.Client.Library @@ -15,6 +16,11 @@ namespace LeanKit.API.Client.Library /// public interface ILeanKitClientFactory { + ILeanKitApi Create(ILeanKitAccountAuth accountAuth); + + ILeanKitApi Create(ILeanKitAccountAuth accountAuth, string dateFormat); + + [Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")] ILeanKitApi Create(LeanKitAccountAuth accountAuth); } } \ No newline at end of file diff --git a/LeanKit.API.Client.Library/ILeanKitIntegration.cs b/LeanKit.API.Client.Library/ILeanKitIntegration.cs index 26fbb6a..fa61a35 100644 --- a/LeanKit.API.Client.Library/ILeanKitIntegration.cs +++ b/LeanKit.API.Client.Library/ILeanKitIntegration.cs @@ -38,6 +38,7 @@ public interface ILeanKitIntegration void MoveCard(long cardId, long toLaneId, int position, string wipOverrideReason); void MoveCard(long cardId, long toLaneId, int position); IEnumerable SearchCards(SearchOptions options); + DrillThroughStatistics GetDrillThroughStatistics(long cardId, long boardId); Taskboard GetTaskboard(long cardId); void AddTask(Card task, long cardId); diff --git a/LeanKit.API.Client.Library/ILeanKitIntegrationFactory.cs b/LeanKit.API.Client.Library/ILeanKitIntegrationFactory.cs index baad95f..5652cde 100644 --- a/LeanKit.API.Client.Library/ILeanKitIntegrationFactory.cs +++ b/LeanKit.API.Client.Library/ILeanKitIntegrationFactory.cs @@ -4,6 +4,7 @@ // //------------------------------------------------------------------------------ +using System; using LeanKit.API.Client.Library.TransferObjects; namespace LeanKit.API.Client.Library @@ -20,8 +21,22 @@ public interface ILeanKitIntegrationFactory /// The Identity of the Board that will be watched and modified. /// The account authentication information used to connect to the LeanKit API. /// The used to monitor and modify the specified board. + [Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")] ILeanKitIntegration Create(long boardId, LeanKitAccountAuth accountAuth); + [Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")] ILeanKitIntegration Create(long boardId, LeanKitAccountAuth accountAuth, IntegrationSettings settings); + /// + /// Factory method that creates and returns the implementation using the + /// LeanKitClient created with the default . + /// + /// + /// The default implementation of the uses RestSharp. + /// + /// The Identity of the Board that will be watched and modified. + /// The account authentication information used to connect to the LeanKit API. + /// The used to monitor and modify the specified board. + ILeanKitIntegration Create(long boardId, ILeanKitAccountAuth accountAuth); + ILeanKitIntegration Create(long boardId, ILeanKitAccountAuth accountAuth, IntegrationSettings settings); } } \ No newline at end of file diff --git a/LeanKit.API.Client.Library/IRestCommandProcessor.cs b/LeanKit.API.Client.Library/IRestCommandProcessor.cs index 348452f..e407c0b 100644 --- a/LeanKit.API.Client.Library/IRestCommandProcessor.cs +++ b/LeanKit.API.Client.Library/IRestCommandProcessor.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using LeanKit.API.Client.Library.TransferObjects; -using RestSharp; namespace LeanKit.API.Client.Library { @@ -16,10 +15,11 @@ namespace LeanKit.API.Client.Library /// public interface IRestCommandProcessor { - T Get(LeanKitAccountAuth accountAuth, string resource) where T : new(); - T Get(LeanKitAccountAuth accountAuth, string resource, object body) where T : new(); - T Post(LeanKitAccountAuth accountAuth, string resource, object body) where T : new(); - T Post(LeanKitAccountAuth accountAuth, string resource) where T : new(); - T PostFile(LeanKitAccountAuth accountAuth, string resource, Dictionary parameters, string fileName, string mimeType, byte[] fileBytes) where T : new(); + T Get(ILeanKitAccountAuth accountAuth, string resource) where T : new(); + T Get(ILeanKitAccountAuth accountAuth, string resource, object body) where T : new(); + T Post(ILeanKitAccountAuth accountAuth, string resource, object body) where T : new(); + T Post(ILeanKitAccountAuth accountAuth, string resource) where T : new(); + T PostFile(ILeanKitAccountAuth accountAuth, string resource, Dictionary parameters, string fileName, string mimeType, byte[] fileBytes) where T : new(); + AssetFile Download(ILeanKitAccountAuth accountAuth, string resource); } } \ No newline at end of file diff --git a/LeanKit.API.Client.Library/LeanKit.API.Client.Library.csproj b/LeanKit.API.Client.Library/LeanKit.API.Client.Library.csproj index 3de8532..a0bbefb 100644 --- a/LeanKit.API.Client.Library/LeanKit.API.Client.Library.csproj +++ b/LeanKit.API.Client.Library/LeanKit.API.Client.Library.csproj @@ -37,16 +37,12 @@ - ..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.6.0.6\lib\net40\Newtonsoft.Json.dll + True - + False - ..\..\LeanKit.IntegrationService\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll - ..\packages\Newtonsoft.Json.6.0.3\lib\net40\Newtonsoft.Json.dll - - - False - ..\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll + ..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll @@ -71,6 +67,7 @@ + @@ -78,6 +75,9 @@ + + + @@ -85,9 +85,11 @@ + + @@ -105,6 +107,8 @@ + + @@ -128,6 +132,9 @@ + + copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)publish\lib\net40\$(ProjectName).dll" +