Integrate with Visual Studio Team Services from your Node.js apps.
npm install vso-node-api
var vsts = require('vso-node-api');
var collectionUrl = "https://fabrikam.visualstudio.com/defaultcollection";
var creds = vsts.getBasicHandler("myaltusername", "myaltpassword");
var connection = new vsts.WebApi(collectionUrl, creds);
-
For general development and testing, a personal access token is recommended.
vsts.getBasicHandler(token, "");
-
For production, OAuth access token are recommended.
vsts.getBearerHandler(token);
The library provides both promise-based and callback style APIs. Your choice.
// Promise style Git client
var gitApi = connection.getQGitApi();
// Callback style Git client
var gitApi = connection.getGitApi();
- Build
- Core
- FileContainer
- Gallery
- Git
- Release
- TaskAgent
- Task
- Test
- Tfvc
- Web
- WorkItemTracking
var gitApi = connection.getQGitApi();
var projectName = "MyProject";
var repoName = "MyRepo";
// Get latest pull requests from the repo
gitApi.getPullRequests(repoName, {}, projectName).then(function(pullRequests) {
pullRequests.forEach(function(pullRequest) {
// Display each pull request
console.log(pullRequest.pullRequestId + ": "+ pullRequest.title);
});
}, function(error) {
console.log(error);
});
// Get latest pull requests from the repo
gitApi.getPullRequests(repoName, {}, projectName, null, null, null, function(error, status, pullRequests) {
if (error) {
console.log(error);
} else {
pullRequests.forEach(function(pullRequest) {
// Display each pull request
console.log(pullRequest.pullRequestId + ": "+ pullRequest.title);
});
}
});
To see what APIs are available, see the appropriate client interface. For example, GitApi.ts
To contribute to this repository, see the contribution guide