-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsts.js
55 lines (39 loc) · 1.57 KB
/
vsts.js
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
var vsts = require('./modules/vsts');
var email = require('./modules/email');
var command = process.argv[2];
main();
async function main(){
if(command == "Add")
{
var workitem = {
Title: "Requisito criado via API",
AssignedTo: "[email protected]",
AreaPath: "AtentoBR\\Estudo",
IterationPath:"AtentoBR\\Estudo",
Description: "Este é o contéudo do workitem criado as "+ Date() + " !!"
};
var wi = await vsts.workItemAdd(workitem);
var content = 'protocolo número ' + wi.id + '\n' +
'area path ' + wi.fields["System.AreaPath"] + '\n' +
'AssignTo ' + wi.fields["System.AssignedTo"] + '\n' +
'Acompanhe sua solicitação em: https://atentoalm.visualstudio.com/AtentoBR/_boards/board/t/Estudo/Requirements'
//email.sendEmail('Solicitação criada com sucesso', content);
console.log(content)
var attach = await vsts.attachmentAdd();
vsts.workItemAtt({id: wi.id, url: attach.url})
}
else if(command == "Del"){
var workitemId = process.argv[3];
var wi = await vsts.workItemDel(workitemId);
console.log('workitem '+ wi.id + " excluido com sucesso");
}
else if(command == "Upd"){
var workitemId = process.argv[3];
var wi = vsts.workItemUpd(workitemId);
console.log('workitem atualizado com sucesso');
}
else if(command == "Att"){
var wi = vsts.attachmentAdd();
console.log(wi);
}
}