-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.js
66 lines (61 loc) · 1.41 KB
/
example.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
56
57
58
59
60
61
62
63
64
65
66
//--------------- sample code ----------------
const Fritz = require('./index.js').Fritz;
const fritz = new Fritz('admin', 'password', 'http://localhost:3333', false);
async function test() {
const login = await fritz.login_SID().catch((e) => {
console.log('fault calling login() ', e);
});
console.log('login', login);
if (login) {
await fritz
.getDeviceListInfos()
.then(function(response) {
console.log('Devices' + response);
})
.catch((e) => {
console.log('Fehler Devicelist ', e);
});
await fritz
.getUserPermissions()
.then(function(response) {
console.log('Rights : ' + response);
})
.catch((e) => {
console.log('Fehler getUserPermissions', e);
});
await fritz
.check_SID()
.then(function(response) {
console.log('Checkresponse : ' + response);
})
.catch((e) => {
console.log('Fehler checkSID', e);
});
await fritz
.logout_SID()
.then(function(response) {
console.log('logout : ' + response);
})
.catch((e) => {
console.log('Fehler logout_SID', e);
});
}
//with relogin
await fritz
.getDeviceListInfos()
.then(function(response) {
console.log('Devices' + response);
})
.catch((e) => {
console.log('Fehler Devicelist ', e);
});
await fritz
.logout_SID()
.then(function(response) {
console.log('logout : ' + response);
})
.catch((e) => {
console.log('Fehler logout_SID', e);
});
}
test();