new Client(serverUrl)
EasyDoseQM client object. Creates a new object handling all the communication with the EasyDoseQM server. Member functions usually take a 'callback' parameter for asynchronous processing. If this parameter is omitted a promise object will be returned.
Parameters:
Name | Type | Description |
---|---|---|
serverUrl |
string | URL of the server to connect to |
Methods
-
login(options [, callback])
Authenticate on the server. Send credentials to the server and authenticate the user. The session token is returned in the response cookie. This cookie is used in all subsequent requests to the server.
-
Parameters:
Name Type Argument Description options
Object Credentials fo the server connection Properties
Name Type Description username
string Name of the user password
string Password callback
callback <optional>
The callback that handles the response (optional). Returns:
A Promise object is returned if the callback parameter is omitted.- Type
- Promise
-
logout( [callback])
Log out from the server. Removes any session information from the server.
-
Parameters:
Name Type Argument Description callback
Client~callback <optional>
The callback that handles the response (optional). Returns:
A Promise object is returned if the callback parameter is omitted.- Type
- Promise
-
query(options [, callback])
Query data from the server. Sends the query information to the server for processing. The result will be cached on the server for some amount of time (default 300 seconds).
-
Parameters:
Name Type Argument Description options
Object Query options Properties
Name Type Description fields
Array.<string> Query meta tags (will be in result set) filter
Object Filter definition Properties
Name Type Description filters
Array.<Object> Array containing filters filters[].field
string Field to filter filters[].operator
string Operator filters[].value
string Filter value sort
Array.<Object> Array containing filters sort[].field
string Sort field sort[].dir
string Sort direction take
number Limit number of result rows (optional). skip
number Skip rows from the beginning of the result (optional). force
boolean Skip the server cache callback
Client~callback <optional>
The callback that handles the response (optional). Returns:
A Promise object is returned if the callback parameter is omitted.- Type
- Promise
-
analysis(options [, callback])
Analyse data on the server. Sends the analysis information to the server for processing. An analysis is equivalent to a SQL query using aggregate functions. The "group by" clause is the "x" parameter. And the "y" parameter holds all aggregated fields. The result will be cached on the server for some amount of time (default 300 seconds).
-
Parameters:
Name Type Argument Description options
Object Analysis options Properties
Name Type Description fields
Array.<string> Query properties filter
Object Filter definition Properties
Name Type Description filters
Array.<Object> Array containing filters filters[].field
string Field to filter filters[].operator
string Operator filters[].value
string Filter value sort
Array.<Object> Array containing filters sort[].field
string Sort field sort[].dir
string Sort direction take
number Limit number of result rows (optional). skip
number Skip rows from the beginning of the result (optional). x
string Category of the analysis (X-Axis / Group - Field) y
Object Analysis data definition Properties
Name Type Description field
string Aggregate of the field as
Object Result fieldname mapping force
boolean Skip the server cache callback
Client~callback <optional>
The callback that handles the response (optional). Returns:
A Promise object is returned if the callback parameter is omitted.- Type
- Promise
-
sqlQuery(options [, callback])
Run a SQL query on the server. Sends a simple SQL query to the server for processing. SQL queries are only allowed for privileged users.
-
Parameters:
Name Type Argument Description options
Object Query options Properties
Name Type Description fields
Array.<string> Query properties (will be in result set) from
string Query table filter
Object Filter definition Properties
Name Type Description filters
Array.<Object> Array containing filters filters[].field
string Field to filter filters[].operator
string Operator filters[].value
string Filter value sort
Array.<Object> Array containing filters sort[].field
string Sort field sort[].dir
string Sort direction take
number Limit number of result rows (optional). skip
number Skip rows from the beginning of the result (optional). callback
Client~callback <optional>
The callback that handles the response (optional). Returns:
A Promise object is returned if the callback parameter is omitted.- Type
- Promise