Class: Client

Client

Client for Bespoken testing, training and monitoring API


new Client(apiKey [, baseURL])

Creates a new client for interacting with the Bespoken Test API Must pass the API key which can be found in the Bespoken Dashboard under account settings

Parameters:
Name Type Argument Description
apiKey string
baseURL string <optional>
Source:

Methods


<async> classifyRun(runID)

Classifies the specified run

Parameters:
Name Type Description
runID string
Source:
Returns:
Type
Promise.<void>

<async> createDevice(platform)

Creates a new device - must be one of the types allowed by the platform parameter

Parameters:
Name Type Description
platform 'ALEXA' | 'GOOGLE' | 'PHONE' | 'SMS' | 'WATSON' | 'WEBCHAT' | 'WHATSAPP'
Source:
Returns:
Type
Promise.<DeviceDTO>

<async> deleteDevice(deviceToken)

Deletes the specified device

Parameters:
Name Type Description
deviceToken string
Source:
Returns:
Type
Promise.<boolean>

<async> deleteJobNotification(jobID, notificationID)

Deletes the specified notification

Parameters:
Name Type Description
jobID string
notificationID string
Source:
Returns:
Type
Promise.<boolean>

<async> deleteJobRecord(jobID, recordID)

Deletes the specified notification

Parameters:
Name Type Description
jobID string
recordID string
Source:
Returns:
Type
Promise.<boolean>

<async> deleteRun(runID)

Deletes the specified run

Parameters:
Name Type Description
runID string
Source:
Returns:
Type
Promise.<boolean>

<async> explainCron(cron)

Translates a cron schedule to readable english

Parameters:
Name Type Description
cron string
Source:
Returns:
Type
Promise.<string>

<async> fetchDevice(deviceToken)

Fetches information about the named device

Parameters:
Name Type Description
deviceToken string
Source:
Returns:
Type
Promise.<(DeviceDTO|undefined)>

<async> fetchDevices()

Fetches all devices associated with the account

Source:
Returns:
Type
Promise.<Array.<DeviceDTO>>

<async> fetchJobByID(id)

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Promise.<(JobDTO|undefined)>

<async> fetchJobResultByID(id)

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Promise.<(JobResultDTO|undefined)>

<async> fetchJobRunsByJobID(id)

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Promise.<Array.<JobRunDTO>>

<async> fetchJobs(organizationID)

Parameters:
Name Type Description
organizationID string
Source:
Returns:
Type
Promise.<Array.<JobDTO>>

<async> fetchTemplates()

Source:
Returns:
Type
Promise.<Array.<JobTemplateDTO>>

<async> fetchTestSuite(testSuiteName)

Retrieves the named test suite

Parameters:
Name Type Description
testSuiteName string
Source:
Returns:
Type
Promise.<TestSuiteDTO>

<async> generateID()

Source:
Returns:
Type
Promise.<string>

onTestResult(callback)

Callback to receive results from a test run as they occur

Parameters:
Name Type Description
callback TestResultCallback
Source:
Returns:
Type
void

<async> resumeRun(runID)

Resumes the specified run

Parameters:
Name Type Description
runID string
Source:
Returns:
Type
Promise.<JobRunDTO>

<async> runStatus(runID)

Returns the status of the job run

Parameters:
Name Type Description
runID string
Source:
Returns:
Type
Promise.<JobRunDTO>

<async> runTest(testSuiteName [, variables])

Runs the named test suite Optionalls includes variables to be set as passed to the test suite

Parameters:
Name Type Argument Default Description
testSuiteName string
variables Object.<string, string> <optional>
{}
Source:
Returns:
Type
Promise.<Array.<TestResultDTO>>

<async> saveJob(json)

Saves a job

  • Creates a new job if none exists
  • Updates if it is already existing
Parameters:
Name Type Description
json any
Source:
Returns:
Type
Promise.<void>

<async> saveNotification(jobID, notification)

Parameters:
Name Type Description
jobID string
notification JobNotificationDTO
Source:
Returns:
Type
Promise.<void>

<async> saveRecord(jobID, record)

Saves a record

  • Creates a new test suite if none exists
  • Updates if it is already existing
Parameters:
Name Type Description
jobID string
record JobRecordDTO
Source:
Returns:
Type
Promise.<void>

<async> saveTestSuite(testSuite)

Saves a test suite

  • Creates a new test suite if none exists
  • Updates if it is already existing
Parameters:
Name Type Description
testSuite TestSuiteDTO
Source:
Returns:
Type
Promise.<void>

<async> startJob(jobID)

Runs the specified job, returns a unique ID to track the status of the run

Parameters:
Name Type Description
jobID string
Source:
Returns:
Type
Promise.<JobRunDTO>

<async> stopRun(runID)

Stops the specified run

Parameters:
Name Type Description
runID string
Source:
Returns:
Type
Promise.<void>

<async> testStatus(testRunID)

Checks the status of a test run

Parameters:
Name Type Description
testRunID string
Source:
Returns:
Type
Promise.<TestRunDTO>