### Install and Test SDK Installation Source: https://developers.bringg.com/docs/getting-started-with-the-dashboard-sdk Commands to install project dependencies via npm and a sample test application to verify the SDK connection using email/password authentication. ```shell npm install node MyTestApp.js ``` ```javascript let BringgDashboardSDK = require("bringg-dashboard-sdk"); async function runAwait() { try { BringgDashboardSDK.setConfigurations("https://","https://localhost:3030"); BringgDashboardSDK.delegateLogger({debug:console.log, info:console.log, warn:console.log, error:console.log, log:console.log}); BringgDashboardSDK.initWithEmail("", "password"); BringgDashboardSDK.setLogLevel(BringgDashboardSDK.LOG_DEBUG); console.log(await bringgDashboardSDK.users.getAll()) } catch (e) { console.error(e.details); } } runAwait(); ``` -------------------------------- ### Example Podfile Configuration (Ruby) Source: https://developers.bringg.com/docs/bringg-new-sdk-for-ios-getting-started An example Podfile demonstrating the structure for including the BringgDriverSDK and optionally the Starscream fork. This configuration targets iOS 9.0 and uses frameworks. ```ruby platform :ios, '9.0' use_frameworks! target 'BringgDriverSDKExampleApp' do pod 'BringgDriverSDK', '1.7.0' # The next line is optional and allows logging socket data usage pod 'Starscream', :git => "https://github.com/bringg/Starscream", :branch => "feature/notification-center-data-usage" end ``` -------------------------------- ### Initialize Project Directory and Dependencies Source: https://developers.bringg.com/docs/getting-started-with-the-dashboard-sdk Commands to create a project directory and the required package.json configuration file. This setup defines the necessary dependencies and devDependencies for the Bringg SDK. ```shell mkdir c:\\MyBringgSDKProject cd MyBringgSDKProject ``` ```json { "name": "bringg-sdk-nodejs-example", "version": "0.0.1", "dependencies": { "async-await-es7": "^1.0.2", "cache-decorator": "^0.1.6", "typescript": "2.7.2" }, "devDependencies": { "babel-preset-es2017": "^6.24.1", "bringg-dashboard-sdk": "file:" } } ``` -------------------------------- ### Start Shift Example Source: https://developers.bringg.com/docs/shiftmanager An example demonstrating how to initiate a shift using the `startShift` method of the shiftManager. It includes handling success and various error states. ```APIDOC ## Start Shift ### Description Initiates a new shift for the current user. Handles potential errors during the shift start process. ### Method `startShift(:completion:)` ### Endpoint `Bringg.shared.shiftManager.startShift` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example (Swift) ```swift @objc private func startShiftButtonPressed(_ sender: UIButton) { activityIndicatorView.startAnimating() Bringg.shared.shiftManager.startShift { (error, shiftStateError) in self.activityIndicatorView.stopAnimating() if let error = error { self.showError("Error starting shift. (error)") return } switch shiftStateError { case .none: print("Started shift") self.setViewTextAndEnabledDependingOnIsOnShiftState() case .alreadyExists: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift already exists") case .alreadyExistsOnDifferentDevice: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift already exists on different device") case .notAllowedDueToDistanceFromHome: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to distance from home") case .notAllowedDueToScheduleTimeOfDay: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to schedule time of day") case .notAllowedDueToDistanceFromScheduleHomeAndTimeOfDay: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to schedule time of day and distance from home") } } } ``` ### Response #### Success Response (200) - `error` (Error?) - An error object if the shift start failed for a general reason. - `shiftStateError` (ShiftStateError?) - An enum case indicating the specific reason for shift start failure or `.none` if successful. #### Response Example ```json { "error": null, "shiftStateError": "none" } ``` #### Error Response Examples ```json { "error": { "message": "Some general error occurred" }, "shiftStateError": null } ``` ```json { "error": null, "shiftStateError": "alreadyExists" } ``` ``` -------------------------------- ### Install Pods (Bash) Source: https://developers.bringg.com/docs/bringg-new-sdk-for-ios-getting-started This bash command installs all the dependencies listed in the project's Podfile. It should be executed after modifying the Podfile to include new libraries like BringgDriverSDK. ```bash $ pod install ``` -------------------------------- ### Configure and Initialize Bringg SDK Source: https://developers.bringg.com/docs/getting-started-with-the-dashboard-sdk Demonstrates how to initialize the Bringg Dashboard SDK using an authentication token and configure logging. This script serves as the primary entry point for interacting with the Bringg API. ```javascript let BringgDashboardSDK = require("bringg-dashboard-sdk"); async function runAwait() { try { BringgDashboardSDK.setConfigurations(("https://","https://"); BringgDashboardSDK.delegateLogger({debug:console.log, info:console.log, warn:console.log, error:console.log, log:console.log}); const bringgDashboardSDK = await BringgDashboardSDK.initWithAuthToken(, ); BringgDashboardSDK.setLogLevel(BringgDashboardSDK.LOG_DEBUG); console.log(await bringgDashboardSDK.users.getAll()) } catch (e) { console.error(e.details); } } runAwait(); ``` -------------------------------- ### Initialize CocoaPods (Bash) Source: https://developers.bringg.com/docs/bringg-new-sdk-for-ios-getting-started This bash command is used to initialize CocoaPods in a new project directory. It creates a Podfile, which is necessary for managing project dependencies using CocoaPods. ```bash $ pod init ``` -------------------------------- ### Start Order API Source: https://developers.bringg.com/docs/bringg-services Initiates or starts a specific order within the Bringg platform. This action typically signifies that work on the order has begun. ```APIDOC ## POST /start-order ### Description Start an order. ### Method POST ### Endpoint /start-order ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **order_id** (string) - Required - The unique identifier of the order to start. ### Request Example ```json { "order_id": "ord_fghij" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the order has started. - **order_id** (string) - The identifier of the order that was started. #### Response Example ```json { "message": "Order started successfully.", "order_id": "ord_fghij" } ``` ``` -------------------------------- ### Install Pods in Xcode Project Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Installs all dependencies defined in the Podfile, including the BringgTracking SDK, into the Xcode project. ```bash pod install ``` -------------------------------- ### CocoaPods Installation for Swift 3+ (Ruby) Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Illustrates the standard CocoaPods installation command for the BringgTracking pod, suitable for Swift 3 and later versions. This command fetches the latest version from the main repository. ```ruby pod 'BringgTracking' ``` -------------------------------- ### Android SDK Installation Source: https://developers.bringg.com/docs/bringg-sdk-for-android Instructions for adding the Bringg SDK to your Android project's build.gradle file. ```APIDOC ## Android Studio Installation Add the following lines to your `build.gradle` file: ```java repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/groups/public' } } dependencies { compile 'com.bringg:ordertrack:1.+' } ``` **Note:** The latest version is 1.2.1. To specifically use this version, you can use `compile 'com.bringg:ordertrack:1.1.15'`. ``` -------------------------------- ### Initialize BringgDriverSDK in AppDelegate (Swift) Source: https://developers.bringg.com/docs/bringg-new-sdk-for-ios-getting-started This Swift code snippet demonstrates how to initialize the BringgDriverSDK within the application(_:didFinishLaunchingWithOptions:) method of your AppDelegate. This initialization must occur before any SDK controller actions are called. ```swift import BringgDriverSDK class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Initialize Bringg SDK. Bringg.initializeSDK() } } ``` -------------------------------- ### SDK Usage - Connecting and Watching Events Source: https://developers.bringg.com/docs/bringg-sdk-for-android Instructions on how to connect to the Bringg service and start watching orders or drivers. ```APIDOC ### Step 3: Connect to Bringg Call the `connect()` method of the `BringgClient` instance. ### Step 4: Watch Orders/Drivers and Rate Call the `watchOrder()`, `watchDriver()`, and/or `rate()` methods of the `BringgClient` instance. **Notes:** - Ensure the client is connected (i.e., the `onConnected` callback has been called) before calling these methods. - You need to obtain the relevant IDs: `order_uuid`, `driver_uuid`, and `shared_location_uuid` (if not signed in). - Implement the necessary callbacks for handling the events you subscribe to. ``` -------------------------------- ### Start Task in Bringg Driver SDK (Kotlin) Source: https://developers.bringg.com/docs/bringg-driver-sdk-android-task-flow-handling Initiates a task, marking the beginning of the driver's journey to the first destination. The task must be in a 'started' state before arriving or leaving destinations. This function takes a task ID and a callback to handle the result. ```kotlin DriverSdkProvider.driverSdk().task.startTask(task.getId(), object : ResultCallback { override fun onResult(result: TaskStartResult) { if (result.success) { Log.i(TAG, "task was successfully started, LiveData event will be posted, result=$result") } else { Log.i(TAG, "starting the task failed, error=${result.error}") } } }) ``` -------------------------------- ### Start Shift API Source: https://developers.bringg.com/docs/bringg-services Initiates or starts the shift for a specific user within the Bringg system. This is typically used to mark a user as available for tasks. ```APIDOC ## POST /start-shift ### Description Start the shift of a user. ### Method POST ### Endpoint /start-shift ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **user_id** (string) - Required - The unique identifier of the user whose shift is to be started. ### Request Example ```json { "user_id": "usr_abcde" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the shift has started. - **user_id** (string) - The identifier of the user whose shift was started. #### Response Example ```json { "message": "User shift started successfully.", "user_id": "usr_abcde" } ``` ``` -------------------------------- ### CocoaPods Installation for Swift 2.2 (Ruby) Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Provides the CocoaPods dependency installation command for the BringgTracking pod, specifically for Swift 2.2 compatibility. This command points to a specific branch in the GitHub repository. ```ruby pod 'BringgTracking', :git => 'https://github.com/bringg/customer-sdk-ios.git', :branch => 'swift_2_2' ``` -------------------------------- ### Install Bringg SDK via Gradle Source: https://developers.bringg.com/docs/bringg-sdk-for-android Configures the project build.gradle file to include the Bringg repository and the ordertrack dependency. Ensure you use the latest version for optimal performance. ```gradle repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/groups/public' } } dependencies { compile 'com.bringg:ordertrack:1.+' } ``` -------------------------------- ### JWT Webhook Authentication Example Source: https://developers.bringg.com/docs/webhook-authentication-methods Configuration example for JSON Web Token (JWT) authentication in Bringg webhooks. This method involves a header, payload, and signature, secured with a secret key. The signature_header specifies where the token is placed. ```json "authenticator": { "bearer_name": "JWTBearer", "name": "jwt", "signature_header": "Authorization", "jwtConfig": { "header": { "alg": "HS256" }, "payload": { "sub": "bringg-event", "aud": "your-audience", "iss": "https://us2-admin-api.bringg.com", "exp": 20160, "iat": 0 }, "signature": { "key": "yourkey", "type": "base64" } } } ``` -------------------------------- ### Driver Tip Configuration - Get and Update Source: https://developers.bringg.com/docs/merchantconfigurations Retrieve and update the driver tip configuration details. ```APIDOC ## Driver Tip Configuration - Get and Update ### Description Retrieve and update the driver tip configuration details. ### Method GET /merchantConfiguration/tipDriverConfiguration ### Endpoint /merchantConfiguration/tipDriverConfiguration ### Parameters #### Query Parameters - **merchantId** (integer) - Required - The ID of the merchant. ### Request Example ```json { "merchantId": 12345 } ``` ### Response #### Success Response (200) - **driverTipConfiguration** (object) - Driver tip configuration settings. #### Response Example ```json { "driverTipConfiguration": { "enabled": true, "defaultTipPercentage": 10 } } ``` ``` -------------------------------- ### Add BringgDriverSDK to Podfile (Ruby) Source: https://developers.bringg.com/docs/bringg-new-sdk-for-ios-getting-started This snippet shows how to add the BringgDriverSDK and optionally the Starscream fork for data usage logging to your project's Podfile. It requires CocoaPods to be installed and executed via 'pod install'. ```ruby pod 'BringgDriverSDK', '1.7.0' pod 'Starscream', :git => "https://github.com/bringg/Starscream", :branch => "feature/notification-center-data-usage" ``` -------------------------------- ### SDK Usage - Connection and Callbacks Source: https://developers.bringg.com/docs/bringg-sdk-for-android Steps for implementing the `RealTimeConnectionCallback` interface and initializing the `BringgClient`. ```APIDOC ## Usage ### Step 1: Implement `RealTimeConnectionCallback` Implement the `RealTimeConnectionCallback` interface, which has the following methods: ```java public void onConnect(); public void onDisconnect(); public void onError(String message); public void onAck(String event, boolean success, String error); ``` It is highly recommended to at least handle the `onConnect()` callback. ### Step 2: Create `BringgClient` Instance Create an instance of the `BringgClient` class, passing a callback for handling connection events: ```java public BringgClient(Context context, RealTimeConnectionCallback connectionCallback, String devAccessToken, String merchantId) ``` Pass a reference to the interface implemented in Step 1. ``` -------------------------------- ### ShiftEventsDelegate Implementation Source: https://developers.bringg.com/docs/shiftmanager Implement the ShiftEventsDelegate methods to handle shift start and end events. This example shows how ShiftViewController updates its UI and displays messages. ```APIDOC ## ShiftEventsDelegate Methods ### Description Implement these methods to respond to shift lifecycle events. ### Methods - `shiftStarted()`: Called when a shift begins. - `shiftEnded()`: Called when a shift ends. ### Example (Swift) ```swift class ShiftViewController: UIViewController, ShiftEventsDelegate { func shiftStarted() { setViewTextAndEnabledDependingOnIsOnShiftState() } func shiftEnded() { setViewTextAndEnabledDependingOnIsOnShiftState() if view.window != nil { showMessage(title: "Shift ended", message: "Shift ended from the server") } } } ``` ``` -------------------------------- ### Initialize and Access DriverSdkProvider Source: https://developers.bringg.com/docs/getting-started-with-the-bringg-driver-sdk-android Initializes the SDK provider using the application context and a notification provider, followed by the method to retrieve the SDK instance. Initialization must occur before any SDK methods are invoked to avoid runtime exceptions. ```kotlin DriverSdkProvider.init(applicationContext, foregroundServiceNotificationProvider) // Access the SDK instance DriverSdkProvider.driverSdk() ``` -------------------------------- ### Initialize and Connect BringgClient in Android Activity Source: https://developers.bringg.com/docs/bringg-sdk-for-android Demonstrates how to instantiate the BringgClient and BringgCustomerManager within an Android Activity. It includes logic for signing in a customer asynchronously and managing the connection lifecycle to ensure resources are released correctly. ```java import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import com.bringg.ordertrack.callbacks.RealTimeConnectionCallback; import com.bringg.ordertrack.http.BringgCustomerManager; import org.json.JSONObject; import java.io.IOException; public class ExampleBogusActivity extends Activity implements RealTimeConnectionCallback { private static final String TAG = "ClientExample"; private static final String EXAMPLE_DEV_ACCESS_TOKEN = "aaaaa"; private static final String EXAMPLE_MERCHANT_ID = "-1100"; private BringgClient bringgClient; private BringgCustomerManager customerManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); bringgClient = new BringgClient(this, this, EXAMPLE_DEV_ACCESS_TOKEN); customerManager = BringgCustomerManager.getInstance(this); customerManager.setCredentials(EXAMPLE_DEV_ACCESS_TOKEN, EXAMPLE_MERCHANT_ID); signCustomerToBringgOnce(); if (customerManager.isSignedIn()) { bringgClient.connect(customerManager.getCredentials()); } } @Override protected void onDestroy() { bringgClient.disconnect(); super.onDestroy(); } private void signCustomerToBringgOnce() { if (!customerManager.isSignedIn()) { new AsyncTask() { @Override protected JSONObject doInBackground(Void... voids) { try { return customerManager.signIn("111", null, "aaa", String.valueOf(EXAMPLE_MERCHANT_ID)); } catch (IOException e) { e.printStackTrace(); return null; } } @Override protected void onPostExecute(JSONObject result) { if (result != null && result.has("access_token")) { if (!bringgClient.isConnected()) { bringgClient.connect(result.optString("access_token")); } } } }.execute(); } } @Override public void onConnect() { Log.i(TAG, "connected"); } } ``` -------------------------------- ### Start User Shift (Swift) Source: https://developers.bringg.com/docs/shiftmanager Initiates a user shift. This asynchronous method returns either a network error or a specific start shift error upon completion. It's essential for starting the work period for a user. ```swift @objc func startShift(completion: @escaping (_ networkError: Error?, _ stateError: StartShiftErrorType)->Void) ``` -------------------------------- ### Configuration Parameters Source: https://developers.bringg.com/docs/dashboard-sdk-resources This section details various configuration parameters for the Bringg platform, covering order settings, driver behavior, and UI customization. ```APIDOC ## Configuration Parameters ### Description This section details various configuration parameters for the Bringg platform, covering order settings, driver behavior, and UI customization. ### Method PUT ### Endpoint /websites/developers_bringg ### Parameters #### Request Body - **default_minutes_buffer_for_asap_orders** (number) - Optional - The required wait time before dispatching ASAP orders. - **default_minutes_buffer_for_scheduled_orders** (number) - Optional - The required wait time before dispatching scheduled orders. - **delivery_pin** (string) - Optional - The full path to the map pin image for the delivery location. - **destination_pin** (string) - Optional - The full path to the map pin image for the destination location. - **distance_threshold** (number) - Optional - The driver's distance from the target point at which a notification is sent. - **driver_at_home_flow_options** (number) - Optional - Indicates whether to display drivers that are at home. - **driver_preparation_time_seconds** (number) - Optional - Not in use. - **email_logo** (string) - Optional - The full path and file name of the email logo. - **email_style_color** (string) - Optional - The hex value for the email base color. - **enable_dashboard** (boolean) - Optional - Indicates whether the Bringg dashboard is enabled for this merchant. `false` to disable, `true` to enable. - **enable_dimension_editing_in_ui** (boolean) - Optional - Indicates whether the driver is allowed to edit the package size. `false` to disable, `true` to enable. - **enable_future_tasks** (boolean) - Optional - Not in use. - **enable_kds** (boolean) - Optional - Indicates whether to allow tasks by status for the kitchen delivery system. `false` to disallow, `true` to allow. - **enable_looping_alert_sound** (boolean) - Optional - Indicates whether to allow the alert snooze feature. `false` to disallow, `true` to allow. - **enable_map_overlays** (boolean) - Optional - Indicates whether to allow map overlays. `false` to disallow, `true` to allow. - **enable_reschedule_flow** (boolean) - Optional - Indicates whether to enable the reschedule flow. ### Request Example ```json { "default_minutes_buffer_for_asap_orders": 5, "enable_dashboard": true, "email_style_color": "#FF0000" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the configuration was updated. #### Response Example ```json { "message": "Configuration updated successfully." } ``` ``` -------------------------------- ### Initialize BringgClient Instance Source: https://developers.bringg.com/docs/bringg-sdk-for-android Constructs a new BringgClient instance by providing the application context, the connection callback interface, and authentication credentials including the access token and merchant ID. ```java public BringgClient(Context context, RealTimeConnectionCallback connectionCallback, String devAccessToken, String merchantId) ``` -------------------------------- ### Install CocoaPods Dependency Manager Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Installs the CocoaPods dependency manager using RubyGems. This is a prerequisite for managing project dependencies with CocoaPods. ```bash gem install cocoapods ``` -------------------------------- ### Initialize Bringg Dispatcher SDK Session Source: https://developers.bringg.com/docs/initializing-a-session Demonstrates how to authenticate and initialize the SDK session. Includes examples for browser-based environments using email/password and server-side environments using auth tokens. ```html ``` ```javascript const BringgDashboardSDK = require("bringg-dashboard-sdk"); BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => { bringgDashboardSDK.users.getAll().then(console.log).catch(console.error); }); ``` ```typescript 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(); ``` -------------------------------- ### Merchant Administration Methods - GET /merchants/admin/all Source: https://developers.bringg.com/docs/merchant Retrieves detailed information for merchant administration. This method is used to get an overview of merchant administration settings. ```APIDOC ## GET /merchants/admin/all ### Description Gets detailed merchant administration information. This endpoint provides access to administrative details for merchants. ### Method GET ### Endpoint /merchants/admin/all ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```javascript BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => { bringgDashboardSDK.merchant.admin.getAll().then(console.log).catch(console.error); }); ``` ### Response #### Success Response (200) - **Object** (JSON) - A JSON object containing detailed merchant administration information. ``` -------------------------------- ### Bringg Data Type: Integer Example Source: https://developers.bringg.com/docs/data-formatting Provides an example of the 'Integer' data type for whole numbers in Bringg APIs. Integers are frequently used for IDs or status codes. ```json { "status": 2 } ``` -------------------------------- ### Retrieve all users using users.getAll() Source: https://developers.bringg.com/docs/users-2 Demonstrates how to fetch a list of all users from the Bringg platform. The implementation uses the SDK's promise-based pattern to handle successful responses and potential errors. ```html ``` ```javascript const BringgDashboardSDK = require("bringg-dashboard-sdk"); BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => { bringgDashboardSDK.users.getAll().then(console.log).catch(console.error); }); ``` ```typescript 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(); ``` -------------------------------- ### Initialize BringgTrackingClient Singleton Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Creates or retrieves the singleton instance of the BringgTrackingClient. Requires a developer token and a connection delegate to monitor the status of the tracking client. ```objectivec + (nonnull instancetype)clientWithDeveloperToken:(nonnull NSString *)developerToken connectionDelegate:(nonnull id)delegate; ``` -------------------------------- ### Website Configuration Parameters Source: https://developers.bringg.com/docs/dashboard-sdk-resources This section details the various boolean and other type parameters used to configure the Bringg website, affecting features like logo display, ETA visibility, sound alerts, and task management. ```APIDOC ## Website Configuration Parameters ### Description This section details the various parameters used to configure the Bringg website. These parameters control aspects such as UI elements, notification settings, and task handling logic. ### Method GET/PUT (Implied, as these are configuration parameters) ### Endpoint /websites/developers_bringg ### Parameters #### Query Parameters - **show_bringg_logo** (boolean) - Optional - Indicates whether to display the Bringg logo. `true` to display, `false` to hide. - **show_eta_to_home** (boolean) - Optional - Indicates whether to show the estimated time of arrival to the home location. `true` to show, `false` to hide. - **soft_csv_import** (boolean) - Optional - Not in use. - **sound_on_new_order** (boolean) - Optional - Indicates whether an audible alert is played when a new order is created. `true` to play alert, `false` to disable. - **support_parcel_shop_last_mile** (boolean) - Optional - Not in use. - **task_forwarding_enabled** (boolean) - Optional - Indicates whether forwarding tasks to another phone is enabled. `true` to enable, `false` to disable. - **task_home_when_delivery_ends** (boolean) - Optional - Indicates whether a return task for the driver returning home is allowed. `true` to allow, `false` to disallow. - **the_batcher** (boolean) - Optional - Not in use. - **tip_driver_enabled** (boolean) - Optional - Indicates whether tipping the driver is enabled. #### Path Parameters None #### Request Body *Note: The following parameters are described but their specific request body format is not fully detailed in the provided text.* - **task_fields** (Array of Objects) - Optional - An array of `TaskField` objects containing task fields associated with this merchant configuration. Refer to `./dashboard-sdk-resources#section-taskfield` for `TaskField` object details. - **task_invoice_template_name** (string) - Optional - The text for the task invoice template. - **task_window_bottom_buffer_minutes** (number) - Optional - Not in use. - **task_window_top_buffer_minutes** (number) - Optional - Not in use. - **tasks_page_size** (number) - Optional - The number of task items per page. - **time_to_remind_before_start_task** (number) - Optional - The amount of time before a task starts to remind the driver that the task is about to start. ### Request Example ```json { "show_bringg_logo": true, "show_eta_to_home": false, "sound_on_new_order": true, "task_fields": [ { "label": "Customer Signature", "type": "signature", "required": true } ], "task_invoice_template_name": "Invoice Template A", "tasks_page_size": 20, "time_to_remind_before_start_task": 15 } ``` ### Response #### Success Response (200) - **Configuration Status** (object) - Contains the updated configuration settings. #### Response Example ```json { "message": "Website configuration updated successfully.", "configuration": { "show_bringg_logo": true, "show_eta_to_home": false, "sound_on_new_order": true, "task_fields": [ { "label": "Customer Signature", "type": "signature", "required": true } ], "task_invoice_template_name": "Invoice Template A", "tasks_page_size": 20, "time_to_remind_before_start_task": 15 } } ``` ``` -------------------------------- ### Shift Started Notification (Swift) Source: https://developers.bringg.com/docs/shiftmanager A delegate method called automatically when a shift successfully starts. After this callback, user shift data becomes accessible via the `currentShift` property. Registration for shift events is required to receive this notification. ```swift @objc func shiftStarted() ``` -------------------------------- ### GET /users/profile Source: https://developers.bringg.com/docs/dashboard-sdk-resources Retrieves the detailed profile information for a specific user or driver. ```APIDOC ## GET /users/profile ### Description Retrieves the profile attributes for a user, including status, vehicle information, and contact details. ### Method GET ### Endpoint /users/profile ### Request Body - **num_ratings** (number) - Optional - The number of times the user (driver) was rated. - **original_phone_number** (string) - Optional - The original phone number of this user, if the phone number was changed. - **original_user_id** (number) - Optional - The original Id of this user, if the Id was changed. - **password_hash** (string) - Optional - The hash of this user's password. - **phone** (string) - Optional - The phone number of this customer. - **private_vehicle** (boolean) - Optional - Indicates whether the user uses a private vehicle (false: uses, true: does not). - **privilege_id** (number) - Optional - The Id of the privileges for this user. - **profile_image** (text) - Optional - The URL of a profile image associated with this customer. - **push_token** (string) - Optional - This customer's push token. - **status** (number) - Optional - The user's status (Free, Assigned, Started, Checked-In, Late). - **sub** (string) - Optional - The sub status of the user (max 255 chars). - **team_ids** (Array of numbers) - Optional - An array of numbers containing the Ids of all teams to which this user belongs. - **updated_at** (datetime) - Optional - The date and time this user was updated (UTC, %Y-%m-%dT%H:%M:%S%z). - **user_type_id** (number) - Optional - The Id of the user type. - **uuid** (UUID) - Optional - The universal unique Id of this customer. - **vehicle_type_id** (number) - Optional - The Id of the user's vehicle type. ### Response #### Success Response (200) - **uuid** (UUID) - The universal unique Id of the user. - **status** (number) - The current status of the user. #### Response Example { "uuid": "550e8400-e29b-41d4-a716-446655440000", "status": "Free", "phone": "+1234567890" } ``` -------------------------------- ### Start Shift with Completion Handler Source: https://developers.bringg.com/docs/shiftmanager Illustrates how to initiate a shift using the startShift method. It handles various error states, including device conflicts and scheduling restrictions, to provide appropriate feedback to the user. ```swift @objc private func startShiftButtonPressed(_ sender: UIButton) { activityIndicatorView.startAnimating() Bringg.shared.shiftManager.startShift { (error, shiftStateError) in self.activityIndicatorView.stopAnimating() if let error = error { self.showError("Error starting shift. (error)") return } switch shiftStateError { case .none: print("Started shift") self.setViewTextAndEnabledDependingOnIsOnShiftState() case .alreadyExists: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift already exists") case .alreadyExistsOnDifferentDevice: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift already exists on different device") case .notAllowedDueToDistanceFromHome: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to distance from home") case .notAllowedDueToScheduleTimeOfDay: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to schedule time of day") case .notAllowedDueToDistanceFromScheduleHomeAndTimeOfDay: self.handleShiftStartFailedDueToErrorWithForceStartOption(message: "Shift start not allowed due to schedule time of day and distance from home") } } } ``` -------------------------------- ### Initialize BringgTrackingClient in Objective-C Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Initializes the BringgTrackingClient with a developer token and a connection delegate. This is the first step in using the Bringg SDK. ```objectivec #define kBringgDeveloperToken @"YOUR_DEVELOPER_ACCESS_TOKEN" self.trackingClient = [BringgTrackingClient clientWithDeveloperToken:kBringgDeveloperToken connectionDelegate:self]; ``` -------------------------------- ### Force Start User Shift (Swift) Source: https://developers.bringg.com/docs/shiftmanager Starts a user shift, overriding any existing shift state. This is useful for scenarios where a shift needs to be initiated regardless of the current status, such as when a user is already on shift on another device. It returns an error if the operation fails. ```swift @objc func forceStartShift(completion: @escaping (_ error: Error?)->Void) ``` -------------------------------- ### Conforming to and Implementing UserEventsDelegate in Swift Source: https://developers.bringg.com/docs/loginmanager Demonstrates how to conform a UIViewController to the UserEventsDelegate protocol and implement the required userDidLogin and userDidlogout methods to handle authentication state changes. ```swift class ProfileViewController: UIViewController, UserEventsDelegate { func userDidLogin() { setChildViewControllerDependingOnLoginState() } func userDidlogout() { setChildViewControllerDependingOnLoginState() } } ``` -------------------------------- ### Shift Information API Source: https://developers.bringg.com/docs/bringg-driver-sdk-for-ios-resources Retrieve details about shifts, including their ID, start time, and end time. ```APIDOC ## GET /websites/developers_bringg/shift ### Description Retrieves information about shifts. ### Method GET ### Endpoint /websites/developers_bringg/shift ### Parameters #### Query Parameters - **Id** (Int) - Optional - The Id of the shift. - **startShift** (Date) - Optional - The date and time the current shift started. - **endShift** (Date) - Optional - The date and time the current shift ended. ### Response #### Success Response (200) - **Id** (Int) - The Id of the shift. - **startShift** (Date) - The date and time the current shift started. - **endShift** (Date) - The date and time the current shift ended. #### Response Example { "Id": 456, "startShift": "2023-10-27T09:00:00Z", "endShift": "2023-10-27T17:00:00Z" } ``` -------------------------------- ### startShift(completion:) Source: https://developers.bringg.com/docs/shiftmanager Initiates a user shift and returns status via a completion handler. ```APIDOC ## startShift(completion:) ### Description Use to start a user shift. If successful, this method returns nothing. If not successful, it returns a network error or a start shift error. ### Method Function Call ### Parameters None ### Response #### Success Response (200) - **networkError** (Error) - The error message if a network failure occurs. - **stateError** (StartShiftErrorType) - The error message if the shift could not be started due to state conflicts. ``` -------------------------------- ### GET /teams Source: https://developers.bringg.com/docs/teams-1 Retrieves a list of all teams available in the system. ```APIDOC ## GET /teams ### Description Gets detailed information for all teams. ### Method GET ### Endpoint /teams ### Parameters None. ### Response #### Success Response (200) - **Team** (Array of Objects) - An array of Team objects containing detailed team information for all teams. ### Response Example [ { "id": 123, "name": "Operations Team" } ] ``` -------------------------------- ### Configuration Parameters Reference Source: https://developers.bringg.com/docs/dashboard-sdk-resources A collection of configuration parameters used to define operational settings for drivers and delivery windows. ```APIDOC ## Configuration Parameters ### Description This reference outlines the configuration fields available for managing driver-related settings and delivery window constraints. ### Parameters - **driver_tip_enabled** (boolean) - Optional - Indicates if the driver tip feature is enabled. - **update_location_max_idle_time** (number) - Optional - Pending update configuration for location idle time. - **use_coc** (boolean) - Optional - Indicates whether to use chain of custody. - **use_time_windows** (boolean) - Optional - Indicates whether to use specific time windows for deliveries. - **voice_reminder_frequency** (number) - Optional - Time interval to repeat voice reminders for unaccepted tasks. - **voice_reminder_text** (string) - Optional - The text content for driver voice reminders. - **windows** (Array of Objects) - Optional - An array of OpeningPeriod objects defining operational hours. - **windows_mode** (boolean) - Optional - Indicates whether windows mode is enabled. ### Request Example { "driver_tip_enabled": true, "use_coc": false, "use_time_windows": true, "voice_reminder_frequency": 300, "voice_reminder_text": "Please accept your pending task.", "windows_mode": true } ### Response #### Success Response (200) - **status** (string) - Confirmation of configuration update. ``` -------------------------------- ### Monitor Order Lifecycle Events (Objective-C) Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Starts tracking an order by its UUID and sets a delegate to receive real-time updates on the order's status. This includes events like assignment, acceptance, start, arrival, completion, cancellation, and location updates. It's crucial to cache order IDs and UUIDs to recover state upon reconnection. ```objectivec // start tracking an order by UUID and set delegate to recieve order updates [self.trackerManager startWatchingOrderWithUUID:order.uuid delegate:self]; - (void)watchOrderFailForOrder:(GGOrder *)order error:(NSError *)error{ NSLog(@"Failed %@, error %@", order.uuid, error); } - (void)orderDidAssignWithOrder:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order assigned %@ for driver %@", order.uuid, driver.uuid) } - (void)orderDidAcceptWithOrder:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order accepted %@ for driver %@", order.uuid, driver.uuid); } - (void)orderDidStartWithOrder:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order started %@ for driver %@", order.uuid, driver.uuid); } - (void)orderDidArrive:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order arrived %@", order.uuid); } - (void)orderDidFinish:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order finished %@", order.uuid); } - (void)orderDidCancel:(GGOrder *)order withDriver:(GGDriver *)driver{ NSLog(@"Order canceled %@", order.uuid); } - (void)order:(nonnull GGOrder *)order didUpdateLocation:(nullable GGSharedLocation *)sharedLocation findMeConfiguration:(nullable GGFindMe *)findMeConfiguration{ NSLog(@"order with ID %ld did update shared location %@ find me configuration to %@", (long)order.orderid, sharedLocation.locationUUID , findMeConfiguration); } ``` -------------------------------- ### Merchant Configuration - Get and Update Source: https://developers.bringg.com/docs/merchantconfigurations Retrieve and update detailed merchant information. ```APIDOC ## Merchant Configuration - Get and Update ### Description Retrieve and update detailed merchant information. ### Method GET /merchantConfiguration ### Endpoint /merchantConfiguration ### Parameters #### Query Parameters - **merchantId** (integer) - Required - The ID of the merchant. ### Request Example ```json { "merchantId": 12345 } ``` ### Response #### Success Response (200) - **merchantInfo** (object) - Detailed information about the merchant. #### Response Example ```json { "merchantInfo": { "name": "Example Merchant", "address": "123 Main St", "phone": "555-1234" } } ``` ``` -------------------------------- ### Get All User Types with Bringg Dispatcher SDK Source: https://developers.bringg.com/docs/user-types Demonstrates how to retrieve an array of all user types using the `userType.getAll()` method of the Bringg Dispatcher SDK. This method returns detailed information for each user type. It utilizes a promise pattern for asynchronous operations, allowing for `.then()` to handle successful responses and `.catch()` for error handling. ```html ``` ```javascript const BringgDashboardSDK = require("bringg-dashboard-sdk"); BringgDashboardSDK.initWithAuthToken(region, authToken).then(bringgDashboardSDK => { bringgDashboardSDK.userType.getAll().then(console.log).catch(console.error); }); ``` ```typescript 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(); ``` -------------------------------- ### GET /users Source: https://developers.bringg.com/docs/users-2 Retrieves a list of all users, admins, or drivers within the system. ```APIDOC ## GET /users ### Description Retrieve lists of users based on specific endpoints. ### Methods - `users.getAll()`: Get an array of all users. - `users.getAllAdmins()`: Get an array of all admins. - `users.getAllDrivers()`: Get an array of all drivers. ### Response #### Success Response (200) - **Data** (Array of Objects) - An array of Users objects containing detailed information. #### Response Example [ { "id": 1, "name": "User 1" }, { "id": 2, "name": "User 2" } ] ``` -------------------------------- ### POST /inventory/create Source: https://developers.bringg.com/docs/bringg-driver-sdk-android-inventory-management Creates a new inventory record based on provided builder data and scan information. ```APIDOC ## POST /inventory/create ### Description Creates a new inventory entry in the system. ### Method POST ### Endpoint createInventory(inventoryBuilder: InventoryBuilder, scanData: ScanData) ### Parameters #### Request Body - **inventoryBuilder** (InventoryBuilder) - Required - Object containing the details for the new inventory item. - **scanData** (ScanData) - Required - The associated scan data. ``` -------------------------------- ### forceStartShift(completion:) Source: https://developers.bringg.com/docs/shiftmanager Forces a shift start regardless of the current shift state. ```APIDOC ## forceStartShift(completion:) ### Description Starts a shift for the current user, ignoring the current shift state (e.g., if the user is already on a shift on another device). ### Method Function Call ### Parameters None ### Response #### Success Response (200) - **error** (Error) - The error message if the forced start fails. ``` -------------------------------- ### GET /shared_locations/{id} Source: https://developers.bringg.com/docs/dashboard-sdk-resources Retrieves the details of a specific shared location, including its SMS forwarding status and associated waypoint ID. ```APIDOC ## GET /shared_locations/{id} ### Description Retrieves the configuration and association details for a specific shared location. ### Method GET ### Endpoint /shared_locations/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier of the shared location. ### Request Example GET /shared_locations/12345 ### Response #### Success Response (200) - **sms_forwarded** (boolean) - Indicates whether the SMS for this shared location was forwarded. - **way_point_id** (number) - The Id of the way point with which this shared location is associated. #### Response Example { "sms_forwarded": true, "way_point_id": 98765 } ``` -------------------------------- ### Watch Order Methods (Objective-C) Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Demonstrates how to start watching an order using the BringgTrackingClient class. Requires order UUID and either a share UUID or a customer access token, along with a delegate for callbacks. These methods replaced older versions in v1.14.0. ```objective-c (void)startWatchingOrderWithUUID: shareUUID: delegate:; (void)startWatchingOrderWithUUID:uuid customerAccessToken: delegate:; ``` -------------------------------- ### Configure Build Settings for Framework Modules Source: https://developers.bringg.com/docs/bringg-sdk-for-ios Sets the 'Allow Non-modular Includes In Framework Modules' build setting to 'Yes'. This resolves the 'Include of non-modular header inside framework module' error. ```text Target Build Settings -> Build Options -> Allow Non-modular Includes In Framework Modules -> Yes ```