File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Logs in, returns number of active users
3+ */
4+
5+ var ApiFactory = require ( './../../' ) . ApiFactory ;
6+ var ApiConstants = require ( './../../' ) . ApiConstants ;
7+ var util = require ( 'util' ) ;
8+
9+ var instance = ApiFactory . getInstance ( {
10+ hostname : 'localhost' ,
11+ version : '5.0' ,
12+ port : 8080
13+ } ) ;
14+
15+ util . print ( 'Logs in, returns number of active users\n' ) ;
16+ util . log ( 'Logging in ...' ) ;
17+ instance . login ( 'new@user.attask' , 'user' ) . then (
18+ function ( ) {
19+ util . log ( 'Getting number of active users ...' ) ;
20+ var query = { } ;
21+ query [ 'isActive' ] = true ;
22+ query [ 'isActive' + ApiConstants . MOD ] = ApiConstants . Operators . EQUAL ;
23+ instance . count ( 'user' , query ) . then (
24+ function ( data ) {
25+ util . log ( 'Get success. Received data:' ) ;
26+ console . log ( util . inspect ( data , { colors :true } ) ) ;
27+ } ,
28+ function ( error ) {
29+ util . log ( 'Get failure. Received data:' ) ;
30+ console . log ( util . inspect ( error , { colors :true } ) ) ;
31+ }
32+ ) ;
33+ } ,
34+ function ( error ) {
35+ util . log ( 'Login failure. Received data:' ) ;
36+ console . log ( util . inspect ( error , { colors :true } ) ) ;
37+ }
38+ ) ;
You can’t perform that action at this time.
0 commit comments