Users

Use the Bringg Dispatcher SDK Users methods to integrate Bringg user management into your own systems.

Overview

Use the Bringg Dispatcher SDK users functionality to:

📘

Exception Handling

The Bringg Dispatcher SDK Users 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.

📘

Types of Users in Bringg

In Bringg, users include drivers, dispatchers, and administrators. The Bringg Dispatcher SDK includes methods for all users and methods for each type of user.

The following two methods demonstrate the difference:

  • users.getAll() - gets all users
  • users.getAllDrivers() - only get all drivers

Syntax

bringgDashboardSDK.users.

Examples

The following examples include three types of implementation:

  • web
  • node.js
  • TypeScript

This code snippet demonstrates the users.getAll() method.

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

BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => {
  bringgDashboardSDK.users.getAll().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.users.getAll());
    } catch (e) {
      console.error(e); 
    }
}

runAwait();

Methods

Use Users Methods to get JSON objects containing user detailed information, including dispatcher, driver, and admin users.

users.get(:userId)

Gets detailed user information for the specified user Id.

Input Parameters

userId

number

REQUIRED

The Id of the user whose detailed information is returned.

Response

Object

JSON

A Users object containing detailed user information.

users.getAdmin(:adminId)

Get an object containing detailed admin user information for the specified admin Id.

Input Parameters

adminId

number

REQUIRED

The Id of the admin whose detailed information is returned.

Response

Object

JSON

A Users object containing detailed admin information.

users.getDispatcher(:dispatcherId)

Get an object containing detailed dispatcher information for the specified dispatcher Id.

Input Parameters

dispatcherId

number

REQUIRED

The Id of the dispatcher user whose detailed information is returned.

Response

Object

JSON

A Users object containing detailed dispatcher information.

users.getDriver(:driverId)

Get an object containing detailed driver user information for the specified driver Id.

Input Parameters

driverId

number

REQUIRED

The Id of the driver user whose detailed information is returned.

Response

Object

JSON

A Users object containing detailed driver information.

users.getAll()

Get an array of objects containing detailed information for all users.

Input Parameters

None

Response

User

Array of Objects

An array of Users objects containing detailed information for all users.

users.getAllAdmins()

Get an array of objects containing detailed information for all admins.

Input Parameters

None

Response

Admin

Array of Objects

An array of Users objects containing detailed information for all admins.

users.getAllDrivers()

Get an array of objects containing detailed information for all drivers.

Input Parameters

None

Response

Array of Objects

JSON

An array of Users objects containing detailed information for all drivers.