Code Monkey home page Code Monkey logo

vsts.net's Introduction

VSTS.Net

.Net client for Azure DevOps Services (Visual Studio Team Services) API

Build status

Nuget

Nuget

Api documentation

Usage

Console app

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 urlBuilderFactory = new OnlineUrlBuilderFactory("foo");
var client = VstsClient.Get(urlBuilderFactory, accessToken: "secure token");
var items = await client.GetWorkItemsAsync(new WorkItemsQuery(query));

For OnPrem (TFS) versions use OnPremUrlBuilderFactory instead of OnlineUrlBuilderFactory

Asp.Net Core

In the Startup.cs add VstsNet to the services collection

services.AddAzureDevOpsServices(instanceName: "foo", accessToken: "secure token");

or if you have OnPrem (TFS) version:

services.AddAzureDevOpsServices(new Uri("https://foo.mydomain.com"), accessToken: "secure token");

To use Azure DevOps Services style url:

services.AddAzureDevOpsServices(new Uri("https://dev.azure.com/{organization}"), 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) });
}

vsts.net's People

Contributors

azure-pipelines[bot] avatar berserkerdotnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vsts.net's Issues

GetWorkItems by wiql should return query metadata

Currently, GetWorkItemsAsync that accepts wiql query will return only workitems and no query metadata.
If query metadata is needed the second request has to be made to retrieve it.

By metadata, I mean the list of display columns and the list sort columns.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.