1 | 'use strict'; |
||
2 | const VBApi = require('./nodeVBulletinAPI'); |
||
3 | |||
4 | example(); |
||
5 | |||
6 | async function example() { |
||
7 | try { |
||
8 | // Let's connect to the server and start our session |
||
9 | let session = new VBApi( |
||
10 | 'http://google.com/forum/api.php', |
||
11 | 'xXxXxXxX', |
||
12 | 'testing script', |
||
13 | '1' |
||
14 | ); |
||
15 | |||
16 | // To use more command, let's log our session in |
||
17 | // login() uses cleartext while loginMD5() uses md5 hashed password |
||
18 | let userData = await session.login('username', 'password'); |
||
19 | console.log('logged in:', userData); |
||
0 ignored issues
–
show
Debugging Code
introduced
by
![]() |
|||
20 | |||
21 | // We're now also logged in (login() would have rejected otherwise) , we should be able to do much more |
||
22 | // Here are some more additional actions we can take: |
||
23 | |||
24 | //console.log('got forum list:', await session.getForums()); |
||
25 | |||
26 | //console.log('got forum:', await session.getForum(565)); |
||
27 | |||
28 | //console.log('got thread:', await session.getThread(44740)); |
||
29 | |||
30 | //console.log('got thread:', await session.getMember('apocist')); |
||
31 | |||
32 | //console.log('closed thread:', await session.modCloseThread(44740)); |
||
33 | |||
34 | /* |
||
35 | console.log( |
||
36 | await session.newPost( |
||
37 | 44740, |
||
38 | 'Wiggle new testings~!', |
||
39 | { |
||
40 | signature: true |
||
41 | } |
||
42 | ) |
||
43 | ); |
||
44 | */ |
||
45 | |||
46 | /* |
||
47 | console.log( |
||
48 | await session.newThread( |
||
49 | 565, |
||
50 | 'new Thread test', |
||
51 | 'Just testing again!' |
||
52 | ) |
||
53 | ); |
||
54 | */ |
||
55 | |||
56 | |||
57 | } catch (e) { |
||
58 | console.error(e); |
||
59 | } |
||
60 | } |