Manual Reference Source Test
import SystemService from 'clinical6/src/services/SystemService.js'
public class | source

SystemService

Service handling System Utility calls.

Method Summary

Public Methods
public

log(logEntry: Object, requestInformation: Object, deviceInformation: Object): Promise

Tracks a new event in the log.

public

xAuth(json: Object): Promise

Submits the provided JSON to the server.

Public Methods

public log(logEntry: Object, requestInformation: Object, deviceInformation: Object): Promise source

Tracks a new event in the log.

Params:

NameTypeAttributeDescription
logEntry Object
  • optional

The new log entry to track. (optional)

logEntry.message String
  • optional

The message of the log entry. (optional)

logEntry.tag String
  • optional

The tag value of the log entry. (optional)

logEntry.level String

Indicates the level of importance of the log entry. (required)

requestInformation Object
  • optional

The request information of the API call. (optional)

requestInformation.method String
  • optional

The method of the request. (optional)

requestInformation.params String
  • optional

The body or parameters that were sent on the failing/debugging request. (optional)

requestInformationtry.status_code String
  • optional

The response of the request. (optional)

requestInformationtry.url String
  • optional

The URL of the request. (optional)

deviceInformation Object
  • optional

The device information of the device that made the request. (optional)

deviceInformation.app_version String
  • optional

The version of the app that was running on the device. (optional)

deviceInformation.brand String
  • optional

The brand of the device. (optional)

deviceInformation.carrier String
  • optional

The carrier of the device . (optional)

deviceInformation.gps_status String
  • optional

The gps status of the device. (optional)

deviceInformation.latitude Number
  • optional

The latitude value where the device was. (optional)

deviceInformation.longitude Number
  • optional

The longitude value where the device was. (optional)

deviceInformation.manufacturer String
  • optional

The manufacturer of the device. (optional)

deviceInformation.network_status String
  • optional

The network status of the device. (optional)

deviceInformation.os_version String
  • optional

The OS version of the device. (optional)

deviceInformation.push_id String
  • optional

The push ID value of the device. (optional)

deviceInformation.token String
  • optional

The token value of the device. (optional)

deviceInformation.udid String
  • optional

The UDID value of the device. (optional)

deviceInformation.technology String
  • optional

The technology of the device. (optional)

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing token or missing required parameters

Example:

Log
import { systemService } from 'Clinical6';
systemService.log({
 "message": "MyText",
 "tag": "MyString",
 "level": "Error"
}, {
  "url": "MyString",
  "method": "MyString",
  "params": "MyText",
  "status_code": "MyString"
}, {
  "udid": "MyString",
  "token": "MyString",
  "push_id": "MyString",
  "app_version": "MyString",
  "os_version": "MyString",
  "network_status": "MyString",
  "gps_status": "MyString",
  "latitude": "1.5",
  "longitude": "1.5",
  "brand": "MyString",
  "manufacturer": "MyString",
  "carrier": "MyString"
});
Success Response
{
  "status": "ok",
  "message": "Debug Log was successfully created"
}

Test:

public xAuth(json: Object): Promise source

Submits the provided JSON to the server. This is meant as a stub to submit any json to the server that will handle the xAuth according to the client. The examples are ways that the x_auth could be implemented.

Params:

NameTypeAttributeDescription
json Object

The JSON value with the attributes to validate.

Return:

Promise

Promise object that returns success or failure

Throw:

Clinical6Error

If missing required parameters

Example:

xAuth
import { systemService } from 'Clinical6';
systemService.xAuth({
  site_id: '1234342',
  user_id: '2323423'
});
Success, Invited
{"status":"active"}
Success, Not Invited
{"status":"not_invited"}
Success, No Password
{
  "status":"new",
  "token":"my-invitation-token",
  "site:":{
      "name":"La Jolla Clinic",
      "address_line_1":"5555 La Jolla Center Dr.",
      "address_line_2":"Suite 101",
      "address_line_3":"",
      "city":"San Diego",
      "state":"CA",
      "country":"USA",
      "zip_code":"920237"
  },
  "mobile_user":{
      "prefix":"Dr.",
      "first_name":"Pat",
      "last_name":"Cooper",
      "role":"Physician",
      "phone":"619-333-3456",
      "email":"pcooper@lajollaclinic.com"
  }
}
Success, Invalid
{"status":"invalid"}
Success, Participant example
{
  "participant_id": "03929850"
}
200
{
  "status": "new",
  "token": "38762f553bf5abb1e318b5a5471b72394c82e0efa35b941506cbf834e0948827"
}

Test: