GithubHelp home page GithubHelp logo

jasminsehic / infinity.net Goto Github PK

View Code? Open in Web Editor NEW
36.0 5.0 13.0 241 KB

.NET API for Azure DevOps and DevOps Server formerly Visual Studio Online and Team Foundation Server

License: Other

C# 99.64% Perl 0.36%

infinity.net's Introduction

Infinity.NET

Build Status NuGet package

Infinity.NET is a .NET client library for the Azure DevOps REST API, providing access to Azure DevOps servers.

Example

var client = new TfsClient(new TfsClientConfiguration
{
    Url = new Uri("https://dev.azure.com/YourOrganization"),
    Credentials = new NetworkCredential("username", "password"),
});

var projects = client.Project.GetProjects().Result;

Progress

Infinity.NET is a work in progress; it is not yet fully complete. Here are the currently implemented client functions:

  • Git: 100%
  • Projects and Teams
    • Projects: 100%
    • Teams: 100%
  • Team Rooms
    • Messages: 100%
    • Rooms: 100%
    • Users: 100%

Unit Tests

The REST APIs are tested by mocking them, using the Azure DevOps REST API Reference examples. To add a new test:

  1. Add the expected JSON output from the REST method in the Infinity.Tests/Resources directory. Ensure that the file is added to the Infinity.Tests project.

  2. Add the file as a resource to the Infinity.Tests project.

  3. Add a new unit test that expects the appropriate URL and (for POST or PUT methods) the appropriate JSON input and returns the given resource. For example:

     TfsClient mockClient = NewMockClient(
         new MockRequestConfiguration
         {
             // The URI given in the API Reference
             Uri = "/_apis/model/action",
    
             // The name of the resource containing the JSON response
             ResponseResource = "Model.Action",
         });
    
     Model model = base.ExecuteSync<Model>(
         () => { return client.Model.Action(); });
    
  4. Write the test assertions. You can use the Infinity.Tests/Resources/test_from_json.pl script to generate assertions from the expected JSON output.

Command-Line Interface

A simple command-line interface is available in the Infinity.Clients project. For example, to merge a pull request:

Infinity.Client https://dev.azure.com/YourOrganization
--username=username --password=password Git.UpdatePullRequest
<RepositoryId> <PullRequestId> Completed <CommitId

This project is not made to be authoritative, but it may help in development and debugging.

License

Copyright (c) Edward Thomson. All rights reserved.

Available under the MIT license (refer to the LICENSE file).

infinity.net's People

Contributors

andrewcoll avatar ethomson avatar jasminsehic avatar jogleasonjr avatar nulltoken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

infinity.net's Issues

Any plans for WorkItems?

This library looks really high quality, but the last commit was in January. Do you have plans to implement Work Item querying? Without that, it's of rather limited usefulness. Would you accept Pull Requests for it?

Regards,
Pi Lanningham

[blueprint] pull requests policies management API

Hi Edward,

It would be great if this library could support the management of pull request policies. They have been introduced in TFS 2015, and they help the administrators to define review policies, default reviewers by file path, and so on (I bet you already know this ;-) -- other guys: have a look at this video https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2015-Final-Release-Event/Git-Branches-and-Policies-in-Team-Foundation-Server-2015).

I could propose a pull request, if only there was a public and documented API.... :-)

Error: {"Unauthorized"}

So, I copied the example verbatim and am targeting a brand new account. I am 100% certain the credentials are correct. Is there something I am missing?

var client = new TfsClient(new TfsClientConfiguration
      {
        Url = new Uri(collectionUri),
        Credentials = new NetworkCredential(username,password),
      });

      IEnumerable<Project> projects = new List<Project>();
      Task.Run(async () =>
      {
        projects = await client.Project.GetProjects(); // <-- throws {"Unauthorized"}
      }).Wait();

Need support for session tokens (aka personal access tokens)

Visual Studio Online now has support for scoped access tokens. If Infinity.NET supported them, then there would be no need for any complex authentication protocol support. It would involve a dependency on the Azure Directory Authentication Libraries (ADAL).

If that's allowed, I can help by adding in the required things to support session tokens.

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.