.Net client for Visual Studio Team Services API
var query = @"SELECT [System.Id] FROM WorkItems
WHERE [System.WorkItemType] IN ('Bug', 'Task') AND [System.AssignedTo] Ever '[email protected]' AND System.ChangedDate >= '01/01/2018'";
var client = VstsClient.Get(instanceName: "foo", accessToken: "secure token");
var items = await client.GetWorkItemsAsync(new WorkItemsQuery(query));
In the Startup.cs
add VstsNet
to the services collection
services.AddVstsNet(instanceName: "foo", accessToken: "secure token");
Now you can consume Vsts client through DI:
private readonly IVstsClient client;
public HomeController(IVstsClient client)
{
this.client = client;
}
public async Task<IActionResult> Index()
{
var prs = await client.GetPullRequestsAsync("MyProject", "MyRepository", new PullRequestQuery { CreatedAfter = DateTime.Now.AddDays(-5) });
}