User Types

Use the Bringg Dispatcher SDK User Types methods to integrate Bringg user types management into your own systems.

Overview

Use the Bringg Dispatcher SDK user types functionality to:

📘

Exception Handling

The Bringg Dispatcher SDK User Types 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.userstypes.

Example

The following examples include three types of implementation:

  • web
  • node.js
  • TypeScript

This code snippet demonstrates the userType.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.userType.getAll().then(console.log).catch(console.error);
});
</script> 
</body>
</html>
const BringgDashboardSDK = require("bringg-dashboard-sdk");

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

runAwait();

Methods

Use User Type Methods to get JSON objects containing user type detailed information.

userType.get(:userTypeId)

Gets detailed user type information for the specified user type Id.

Input Parameters

userTypeId

number

REQUIRED

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

Response

Object

JSON

A UserType object containing detailed information for the user type whose Id is specified.

userType.getAll()

Gets an array of objects containing detailed information for all user types.

Input Parameters

None

Response

Array of Objects

JSON

An array of UserType objects containing detailed information for all user types.

userType.create()

Creates a new user type.

Input Parameters

merchant_id

number

REQUIRED

The Id of the merchant for which a user type is to be created.

title

number

REQUIRED

The title of the new user type.

cost_per_shift

number

TBD

cost_per_task

number

TBD

default_for_merchant

boolean

Indicates whether this new user type is the default for the merchange. The values are:

  • false - the new user type is not the default user type.
  • true - the new user type is the default user type.

external_id

string

The Id of this user type in your own system.

is_crowd

boolean

  • false
  • true

maximum_tasks_per_shift

number

The maximum number of allowed tasks per shift for this new user type.

max_total_weight

number

TBD

minimum_tasks_per_shift

number

The minimum number of allowed tasks per shift for this new user type.

vehicle_height

number

TBD

vehicle_length

number

TBD

vehicle_width

number

TBD

Response

Object

JSON

A UserType object containing the new user type's detailed information.

userType.update()

Updates an existing user type.

Input Parameters

merchant_id

number

REQUIRED

The Id of the merchant for which a user type is to be created.

title

number

REQUIRED

The title of the new user type.

cost_per_shift

number

TBD

cost_per_task

number

TBD

default_for_merchant

boolean

Indicates whether this new user type is the default for the merchange. The values are:

  • false - the new user type is not the default user type.
  • true - the new user type is the default user type.

external_id

string

The Id of this user type in your own system.

is_crowd

boolean

  • false
  • true

maximum_tasks_per_shift

number

The maximum number of allowed tasks per shift for this new user type.

minimum_tasks_per_shift

number

The minimum number of allowed tasks per shift for this new user type.

Response

Object

JSON

A UserType object containing the updated user type's detailed information.