Coder Social home page Coder Social logo

vsts-node-api's Introduction

Visual Studio Team Services Client for Node.js

Integrate with Visual Studio Team Services from your Node.js apps.

Install the library

npm install vso-node-api --save

News

6.3.2 has been released and is out of preview. This release contains the latest generated 4.0 VSTS/TFS api contracts. It also consumes the latest typed-rest-client.

Note: as of released 6.3.2 version, the web api create methods need to be async so you must use await. For example, note the await in this sample

Get started

Samples

See samples for complete coding examples

Install the library

npm install vso-node-api --save

Intellisense

Create a connection

let vsts = require('vso-node-api');

// your collection url
let collectionUrl = "https://fabrikam.visualstudio.com/defaultcollection";

// ideally from config
let token: string = "cbdeb34vzyuk5l4gxc4qfczn3lko3avfkfqyb47etahq6axpcqha"; 

let authHandler = vsts.getPersonalAccessTokenHandler(token); 
let connect = new vsts.WebApi(collectionUrl, authHandler);    

Get an instance of a client

import * as ba from 'vso-node-api/BuildApi';

let vstsBuild: ba.IBuildApi = connection.getBuildApi();

Available clients

These clients are available in the new 6.x preview API (npm install vso-node-api@preview)

  • Build
  • Core
  • Dashboard
  • ExtensionManagement
  • FeatureManagement
  • FileContainer
  • Git
  • Locations
  • Notification
  • Policy
  • Profile
  • ProjectAnalysis
  • Release
  • SecurityRoles
  • TaskAgent
  • Task
  • Test
  • Tfvc
  • Work
  • WorkItemTracking
  • WorkItemTrackingProcess
  • WorkItemTrackingProcessDefinitions

Use the client

Coding is easy using linear coding with async/await in typescript

import * as bi from 'vso-node-api/interfaces/BuildInterfaces';

async function run() {
    let project: string = 'myProject';
    let defs: bi.DefinitionReference[] = await vstsBuild.getDefinitions(project);

    defs.forEach((defRef: bi.DefinitionReference) => {
        console.log(defRef.name + ' (' + defRef.id + ')');
    });    
}

run();

APIs

To see what APIs are available, see the appropriate client interface. For example, GitApi.ts

Running Samples

Pre-reqs: Node >= 4.4.7 LTS and typescript (tsc) >= 1.8

Run npm install first

Set environment variables using set or export:

API_URL=https://fabrikam.visualstudio.com/defaultcollection  

// use your token
API_TOKEN=cbdeb34vzyuk5l4gxc4qfczn3lko3avfkfqyb47etahq6axpcqha  

API_PROJECT=myProject  

Run samples:

$ npm run samples

Run a specific sample:

$ npm run samples -- http

Contributing

To contribute to this repository, see the contribution guide

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

vsts-node-api's People

Contributors

alpersogukpinar avatar ankitgo avatar bryanmacfarlane avatar gregjhogan avatar lszomoru avatar madhurig avatar ojferro avatar scottdallamura avatar scottdallamura2 avatar seanfisher avatar stephenmichaelf avatar t-hugs avatar tedchamb avatar thechrisjohnson avatar tingluohuang avatar tingluohuang-test avatar willsmythe avatar

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.