forked from ingshtrom/stash-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
61 lines (53 loc) · 1.51 KB
/
test.js
File metadata and controls
61 lines (53 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// requires that stash is running at the expected location,
// as defined by your environment variables
var util = require('util'),
request = require('request'),
stashApiModule = require('./src/app'),
StashApi = stashApiModule.StashApi,
PullRequest = stashApiModule.models.PullRequest,
stash = new StashApi('http', 'localhost', '7990', 'hey', 'testing1234');
request.debug = true;
// PROJECTS
stash.getProjects()
.spread(function (response, body) {
console.log('getProjects: ', JSON.stringify({
statusCode: response.statusCode,
body: body
}, null, 2));
});
// REPOS
stash.getRepos('FOOB')
.spread(function (response, body) {
console.log('getRepos: ', JSON.stringify({
statusCode: response.statusCode,
body: body
}, null, 2));
});
// BRANCHES
stash.getBranches('FOOB', 'repo1')
.spread(function (response, body) {
console.log('getBranches: ', JSON.stringify({
statusCode: response.statusCode,
body: body
}, null, 2));
});
stash.getDefaultBranch('FOOB', 'repo1')
.spread(function (response, body) {
console.log('getDefaultBranch: ', JSON.stringify({
statusCode: response.statusCode,
body: body
}, null, 2));
});
// PULL REQUESTS
// TODO: implement the createPullRequest
// GROUPS
stash.getGroupMembers({
'context': 'stash-users',
'limit': '1000'
})
.spread(function (response, body) {
console.log('getGroupMembers: ', JSON.stringify({
statusCode: response.statusCode,
body: body
}, null, 2));
});