forked from LeCantaloop/Qwiq
-
Notifications
You must be signed in to change notification settings - Fork 0
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
41 changed files
with
202 additions
and
532 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 |
---|---|---|
@@ -1,20 +1,16 @@ | ||
using System; | ||
|
||
using JetBrains.Annotations; | ||
#pragma warning disable 618 | ||
using JetBrains.Annotations; | ||
|
||
namespace Microsoft.Qwiq.Client.Soap | ||
{ | ||
public class WorkItemLinkInfo : Qwiq.WorkItemLinkInfo | ||
public class WorkItemLinkInfo : Qwiq.WorkItemLinkInfo, IIdentifiable<int> | ||
{ | ||
/// <inheritdoc /> | ||
internal WorkItemLinkInfo(int sourceId, int targetId, int linkTypeId, [CanBeNull] IWorkItemLinkTypeEnd linkTypeEnd) | ||
: base(sourceId, targetId, linkTypeEnd) | ||
{ | ||
LinkTypeId = linkTypeId; | ||
Id = linkTypeId; | ||
} | ||
|
||
[Obsolete("This property is deprecated and will be removed in a future release.")] | ||
public int LinkTypeId { get; } | ||
public int Id { get; } | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
namespace Microsoft.Qwiq | ||
{ | ||
// ReSharper disable InconsistentNaming | ||
public static class IWorkItemLinkInfoExtensions | ||
// ReSharper restore InconsistentNaming | ||
{ | ||
/// <summary> | ||
/// Gets an Id for a <see cref="IWorkItemLinkTypeEnd"/>. | ||
/// </summary> | ||
/// <param name="item">A <see cref="IWorkItemLinkInfo"/> with a <see cref="IWorkItemLinkTypeEnd"/></param> | ||
/// <returns>0 if no link or link type; otherwise, the link type id.</returns> | ||
/// <remarks> | ||
/// A true Id is only returned for SOAP instances of <paramref name="item"/>. | ||
/// </remarks> | ||
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/> | ||
public static int LinkTypeId(this IWorkItemLinkInfo item) | ||
{ | ||
if (item == null) return 0; | ||
|
||
// In SOAP, WorkItemLinkInfo is IIdentifiable<int>, where the Id is the LinkTypeId | ||
if (item is IIdentifiable<int> i) | ||
{ | ||
return i.Id; | ||
} | ||
|
||
return item.LinkType.LinkTypeId(); | ||
} | ||
} | ||
} |
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,29 @@ | ||
namespace Microsoft.Qwiq | ||
{ | ||
// ReSharper disable InconsistentNaming | ||
public static class IWorkItemLinkTypeExtensions | ||
// ReSharper restore InconsistentNaming | ||
{ | ||
///<summary> | ||
/// Gets the Id for the link type's forward end. | ||
/// </summary> | ||
/// <param name="item">An instance of <see cref="IWorkItemLinkType"/>.</param> | ||
/// <returns>0 if no link or link type; otherwise, the link type id.</returns> | ||
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/> | ||
public static int ForwardEndLinkTypeId(this IWorkItemLinkType item) | ||
{ | ||
return item?.ForwardEnd.LinkTypeId() ?? 0; | ||
} | ||
|
||
///<summary> | ||
/// Gets the Id for the link type's reverse end. | ||
/// </summary> | ||
/// <param name="item">An instance of <see cref="IWorkItemLinkType"/>.</param> | ||
/// <returns>0 if no link or link type; otherwise, the link type id.</returns> | ||
/// <seealso cref="IWorkItemLinkTypeEndExtensions"/> | ||
public static int ReverseEndLinkTypeId(this IWorkItemLinkType item) | ||
{ | ||
return item?.ReverseEnd.LinkTypeId() ?? 0; | ||
} | ||
} | ||
} |
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,54 @@ | ||
using System; | ||
|
||
namespace Microsoft.Qwiq | ||
{ | ||
public static class IWorkItemLinkTypeEndExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the Id from the specified <paramref name="item"/>. | ||
/// </summary> | ||
/// <param name="item">An instance of <see cref="IWorkItemLinkTypeEnd"/>.</param> | ||
/// <returns> | ||
/// 0 if <paramref name="item"/> is null or the <see cref="M:IWorkItemLinkTypeEnd.LinkType"/> is null; otherwise the link type id. | ||
/// </returns> | ||
/// <remarks> | ||
/// A true Id is only returned for SOAP instances of <paramref name="item"/> | ||
/// </remarks> | ||
public static int LinkTypeId(this IWorkItemLinkTypeEnd item) | ||
{ | ||
// No link type. In SOAP this is equivilent to SELF and has a constant id of 0 | ||
if (item == null) | ||
{ | ||
return 0; | ||
} | ||
|
||
// In SOAP, the IWorkItemLinkTypeEnd is IIdentifiable<int>. Try to cast and return the Id | ||
if (item is IIdentifiable<int> i) | ||
{ | ||
return i.Id; | ||
} | ||
|
||
// Same as initial case--no link type. | ||
if (item.LinkType == null) | ||
{ | ||
return 0; | ||
} | ||
|
||
// Hack for REST: If there is an immutable name, get a case-insensitive hash | ||
if (!string.IsNullOrEmpty(item.ImmutableName)) | ||
{ | ||
var hash = Math.Abs(StringComparer.OrdinalIgnoreCase.GetHashCode(item.ImmutableName)); | ||
// Forward links are ALWAYS a positive value | ||
if (item.IsForwardLink) | ||
{ | ||
return hash; | ||
} | ||
|
||
// Reverse links are ALWAYS a negative value | ||
return hash * -1; | ||
} | ||
|
||
return 0; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,9 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Microsoft.Qwiq.Credentials; | ||
|
||
namespace Microsoft.Qwiq | ||
{ | ||
public interface IWorkItemStoreFactory | ||
{ | ||
IWorkItemStore Create(AuthenticationOptions options); | ||
|
||
[Obsolete( | ||
"This method is deprecated and will be removed in a future release. See Create(AuthenticationOptions) instead.", | ||
false)] | ||
IWorkItemStore Create(Uri endpoint, TfsCredentials credentials); | ||
|
||
[Obsolete( | ||
"This method is deprecated and will be removed in a future release. See Create(AuthenticationOptions) instead.", | ||
false)] | ||
IWorkItemStore Create( | ||
Uri endpoint, | ||
IEnumerable<TfsCredentials> credentials); | ||
} | ||
} |
Oops, something went wrong.