Tasks

Use the Bringg Dispatcher SDK Tasks methods to integrate Bringg tasks management into your own systems.

Overview

Use the Bringg Dispatcher SDK tasks functionality to:

📘

Exception Handling

The Bringg Dispatcher SDK Tasks methods use a promise pattern and a decorator factory for error exception handling. You can chain your method callback using then and catch to customize error handling for your own application. You can also delegate the Bringg Dispatcher SDK Logger to various log levels and implement your own functionality. For more information, see Exception Handling.

Syntax

bringgDashboardSDK.tasks.

Example

The following examples include three types of implementation:

  • web
  • node.js
  • TypeScript

This code snippet demonstrates the tasks.get(:taskId) method.

<!doctype html>
<html lang="en">
<head>
  <!-- ... -->
  <script src="/bringg-dashboard-sdk.js"></script>
</head>
<body>
<!-- ... -->
<script>
BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
  bringgDashboardSDK.tasks.get(1).then(console.log).catch(console.error);
});
</script> 
</body>
</html>
const BringgDashboardSDK = require("bringg-dashboard-sdk");

BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
  bringgDashboardSDK.tasks.get(1).then(console.log).catch(console.error);
});
import BringgDashboardSDK = require("bringg-dashboard-sdk");

async function runAwait() {
  
  try {
      const bringgDashboardSDK = await BringgDashboardSDK.initWithAuthToken(region, authToken);
      console.log(await bringgDashboardSDK.tasks.get(1));
    } catch (e) {
      console.error(e); 
    }
  }

runAwait();

Methods

Use Task Methods to get detailed task information, update, cancel, and finish (complete) tasks.

task.get(:taskId)

Gets detailed task information for the specified task Id.

Input Parameters

taskId

number

REQUIRED

The Id of the task whose detailed information is returned.

Response

task.update()

Object

JSON

A Task object containing detailed information for the task whose Id is specified.

Updates the task specified by the task Id.

Input Parameters

taskId

number

REQUIRED

The Id of the task whose detailed information is returned.

Object

JSON

REQUIRED

A JTask object containing detailed information for the task parameters to update.

Response

taskId

number

The Id of the task updated.

Object

JSON

A Task object containing detailed information for the task whose Id is specified.

task.cancel()

Cancels the task specified by the task Id.

Input Parameters

taskId

number

REQUIRED

The Id of the task to deleted.

Response

taskId

number

The Id of the task deleted.

task.finish()

Finishes (completes) the task specified by the task Id.

Input Parameters

taskId

number

REQUIRED

The Id of the task to finish (complete).

Response

taskId

number

The Id of the task finished (completed).