-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace VSTS/TFS/AzureDevOps libraries (#815)
Replace VSTS/TFS/AzureDevOps libraries with plain HttpClient usage because it is faster and easier to test
- Loading branch information
1 parent
da46850
commit 7b99168
Showing
8 changed files
with
308 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Tingle.Dependabot.Models.Azure; | ||
|
||
public class AzdoRepository | ||
{ | ||
[JsonPropertyName("id")] | ||
public required string Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public required string Name { get; set; } | ||
|
||
[JsonPropertyName("project")] | ||
public required AzdoProject Project { get; set; } | ||
|
||
[JsonPropertyName("isDisabled")] | ||
public bool IsDisabled { get; set; } | ||
|
||
[JsonPropertyName("isFork")] | ||
public bool IsFork { get; set; } | ||
} | ||
|
||
public class AzdoListResponse<T> where T : class | ||
{ | ||
[JsonPropertyName("value")] | ||
public required List<T> Value { get; set; } | ||
|
||
[JsonPropertyName("count")] | ||
public required int Count { get; set; } | ||
} |
68 changes: 68 additions & 0 deletions
68
server/Tingle.Dependabot/Models/Azure/AzdoRepositoryItem.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,68 @@ | ||
using System.Runtime.Serialization; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Tingle.Dependabot.Models.Azure; | ||
|
||
public class AzdoRepositoryItem | ||
{ | ||
[JsonPropertyName("objectId")] | ||
public required string ObjectId { get; set; } | ||
|
||
[JsonPropertyName("originalObjectId")] | ||
public string? OriginalObjectId { get; set; } | ||
|
||
[JsonPropertyName("gitObjectType")] | ||
public required AzdoRepositoryItemType GitObjectType { get; set; } | ||
|
||
[JsonPropertyName("commitId")] | ||
public required string CommitId { get; set; } | ||
|
||
[JsonPropertyName("latestProcessedChange")] | ||
public required AzdoCommitRef LatestProcessedChange { get; set; } | ||
|
||
[JsonPropertyName("path")] | ||
public required string Path { get; set; } | ||
|
||
[JsonPropertyName("isFolder")] | ||
public bool IsFolder { get; set; } | ||
|
||
[JsonPropertyName("content")] | ||
public required string Content { get; set; } | ||
|
||
[JsonPropertyName("isSymLink")] | ||
public bool IsSymbolicLink { get; set; } | ||
} | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum AzdoRepositoryItemType | ||
{ | ||
[EnumMember(Value = "bad")] | ||
Bad, | ||
|
||
[EnumMember(Value = "blob")] | ||
Blob, | ||
|
||
[EnumMember(Value = "commit")] | ||
Commit, | ||
|
||
[EnumMember(Value = "ext2")] | ||
Ext2, | ||
|
||
[EnumMember(Value = "ofsDelta")] | ||
OfsDelta, | ||
|
||
[EnumMember(Value = "refDelta")] | ||
RefDelta, | ||
|
||
[EnumMember(Value = "tree")] | ||
Tree, | ||
|
||
[EnumMember(Value = "tag")] | ||
Tag, | ||
} | ||
|
||
public class AzdoCommitRef | ||
{ | ||
[JsonPropertyName("commitId")] | ||
public required string CommitId { get; set; } | ||
} |
119 changes: 119 additions & 0 deletions
119
server/Tingle.Dependabot/Models/Azure/AzdoSubscriptionsQuery.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,119 @@ | ||
using System.Runtime.Serialization; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Tingle.Dependabot.Models.Azure; | ||
|
||
public class AzdoSubscriptionsQuery | ||
{ | ||
[JsonPropertyName("consumerActionId")] | ||
public string? ConsumerActionId { get; set; } | ||
|
||
[JsonPropertyName("consumerId")] | ||
public string? ConsumerId { get; set; } | ||
|
||
[JsonPropertyName("consumerInputFilters")] | ||
public List<AzdoSubscriptionsQueryInputFilter>? ConsumerInputFilters { get; set; } | ||
|
||
[JsonPropertyName("eventType")] | ||
public string? EventType { get; set; } | ||
|
||
[JsonPropertyName("publisherId")] | ||
public string? PublisherId { get; set; } | ||
|
||
[JsonPropertyName("publisherInputFilters")] | ||
public List<AzdoSubscriptionsQueryInputFilter>? PublisherInputFilters { get; set; } | ||
|
||
[JsonPropertyName("subscriberId")] | ||
public string? SubscriberId { get; set; } | ||
} | ||
|
||
public class AzdoSubscriptionsQueryInputFilter | ||
{ | ||
[JsonPropertyName("conditions")] | ||
public List<AzdoSubscriptionsQueryInputFilterCondition>? Conditions { get; set; } | ||
} | ||
|
||
public class AzdoSubscriptionsQueryInputFilterCondition | ||
{ | ||
[JsonPropertyName("caseSensitive")] | ||
public bool? CaseSensitive { get; set; } | ||
|
||
[JsonPropertyName("inputId")] | ||
public string? InputId { get; set; } | ||
|
||
[JsonPropertyName("inputValue")] | ||
public string? InputValue { get; set; } | ||
|
||
[JsonPropertyName("operator")] | ||
public AzdoSubscriptionsQueryInputFilterOperator Operator { get; set; } | ||
} | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum AzdoSubscriptionsQueryInputFilterOperator | ||
{ | ||
[EnumMember(Value = "equals")] | ||
Equals, | ||
[EnumMember(Value = "notEquals")] | ||
NotEquals | ||
} | ||
|
||
public class AzdoSubscriptionsQueryResponse : AzdoSubscriptionsQuery | ||
{ | ||
[JsonPropertyName("results")] | ||
public required List<AzdoSubscription> Results { get; set; } | ||
} | ||
|
||
public class AzdoSubscription | ||
{ | ||
[JsonPropertyName("id")] | ||
public string? Id { get; set; } | ||
|
||
[JsonPropertyName("status")] | ||
public AzdoSubscriptionStatus Status { get; set; } | ||
|
||
[JsonPropertyName("publisherId")] | ||
public required string PublisherId { get; set; } | ||
|
||
[JsonPropertyName("publisherInputs")] | ||
public Dictionary<string, string> PublisherInputs { get; set; } = new(); | ||
|
||
[JsonPropertyName("consumerId")] | ||
public string? ConsumerId { get; set; } | ||
|
||
[JsonPropertyName("consumerActionId")] | ||
public string? ConsumerActionId { get; set; } | ||
|
||
[JsonPropertyName("consumerInputs")] | ||
public Dictionary<string, string> ConsumerInputs { get; set; } = new(); | ||
|
||
[JsonPropertyName("eventType")] | ||
public required string EventType { get; set; } | ||
|
||
[JsonPropertyName("resourceVersion")] | ||
public required string ResourceVersion { get; set; } | ||
|
||
[JsonPropertyName("eventDescription")] | ||
public string? EventDescription { get; set; } | ||
|
||
[JsonPropertyName("actionDescription")] | ||
public string? ActionDescription { get; set; } | ||
} | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum AzdoSubscriptionStatus | ||
{ | ||
[EnumMember(Value = "enabled")] | ||
Enabled, | ||
|
||
[EnumMember(Value = "onProbation")] | ||
OnProbation, | ||
|
||
[EnumMember(Value = "disabledByUser")] | ||
DisabledByUser, | ||
|
||
[EnumMember(Value = "disabledBySystem")] | ||
DisabledBySystem, | ||
|
||
[EnumMember(Value = "disabledByInactiveIdentity")] | ||
DisabledByInactiveIdentity, | ||
} |
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
Oops, something went wrong.