表示 TFS 服务 Hook 事件的 C# 对象

标签 c# azure tfs hook ado

我正在寻找一个与 https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=vsts#build.complete 中找到的 build.complete 事件的示例负载相匹配的 C# 对象。 。引用页面推荐了一个 nuget 包,但我在其中找不到“BuildCompleteEvent”。

我正在寻找这个对象,因为我有一个 TFS 服务 Hook 输出到 Azure 存储队列,当我在 Azure 函数中从队列中读取该消息时,我希望能够将消息字符串解析为有用的 C#对象。

最佳答案

对于“构建完成”事件:

public class Message
{
    public string text { get; set; }
    public string html { get; set; }
    public string markdown { get; set; }
}

public class DetailedMessage
{
    public string text { get; set; }
    public string html { get; set; }
    public string markdown { get; set; }
}

public class Drop
{
    public string location { get; set; }
    public string type { get; set; }
    public string url { get; set; }
    public string downloadUrl { get; set; }
}

public class Log
{
    public string type { get; set; }
    public string url { get; set; }
    public string downloadUrl { get; set; }
}

public class LastChangedBy
{
    public string id { get; set; }
    public string displayName { get; set; }
    public string uniqueName { get; set; }
    public string url { get; set; }
    public string imageUrl { get; set; }
}

public class Definition
{
    public int batchSize { get; set; }
    public string triggerType { get; set; }
    public string definitionType { get; set; }
    public int id { get; set; }
    public string name { get; set; }
    public string url { get; set; }
}

public class Queue
{
    public string queueType { get; set; }
    public int id { get; set; }
    public string name { get; set; }
    public string url { get; set; }
}

public class RequestedFor
{
    public string id { get; set; }
    public string displayName { get; set; }
    public string uniqueName { get; set; }
    public string url { get; set; }
    public string imageUrl { get; set; }
}

public class Request
{
    public int id { get; set; }
    public string url { get; set; }
    public RequestedFor requestedFor { get; set; }
}

public class Resource
{
    public string uri { get; set; }
    public int id { get; set; }
    public string buildNumber { get; set; }
    public string url { get; set; }
    public DateTime startTime { get; set; }
    public DateTime finishTime { get; set; }
    public string reason { get; set; }
    public string status { get; set; }
    public string dropLocation { get; set; }
    public Drop drop { get; set; }
    public Log log { get; set; }
    public string sourceGetVersion { get; set; }
    public LastChangedBy lastChangedBy { get; set; }
    public bool retainIndefinitely { get; set; }
    public bool hasDiagnostics { get; set; }
    public Definition definition { get; set; }
    public Queue queue { get; set; }
    public List<Request> requests { get; set; }
}

public class Collection
{
    public string id { get; set; }
}

public class Account
{
    public string id { get; set; }
}

public class Project
{
    public string id { get; set; }
}

public class ResourceContainers
{
    public Collection collection { get; set; }
    public Account account { get; set; }
    public Project project { get; set; }
}

public class RootObject
{
    public string id { get; set; }
    public string eventType { get; set; }
    public string publisherId { get; set; }
    public string scope { get; set; }
    public Message message { get; set; }
    public DetailedMessage detailedMessage { get; set; }
    public Resource resource { get; set; }
    public string resourceVersion { get; set; }
    public ResourceContainers resourceContainers { get; set; }
    public DateTime createdDate { get; set; }
}

关于表示 TFS 服务 Hook 事件的 C# 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54258486/

相关文章:

java - 由于 SSL 问题,无法使用 JDBC 连接到 Azure(基于连接字符串和提供的示例)

linux - 如何从 Linux 访问 Team Foundation Server (TFS)

azure - 有关永久删除/销毁工作项 Azure DevOps 的信息

visual-studio - 你能建立自己的 MSTEST 数据源吗

c# - 如何使用 Phantomjs、selenium 和 c# 连接到 Tor 网络

c# - 类型 'string' 必须是不可为 null 的类型才能将其用作泛型类型或方法 'System.Nullable<T>' 中的参数 T

sql-server - Azure 数据库防火墙问题

azure - 子网不包含在虚拟机的地址空间内

c# - 如何替换前导空格但保留多行?

c# - Azure 用于 C# 中的并行数学计算