diff --git a/book/en/SUMMARY.md b/book/en/SUMMARY.md
index 985a7d6..3c034c7 100644
--- a/book/en/SUMMARY.md
+++ b/book/en/SUMMARY.md
@@ -40,8 +40,9 @@
* [AddressBookV5](code/AddressBookV5.md)
* [AutomaticTerritories](code/AutomaticTerritories.md)
- * [Schedules](code/Schedules.md)
+ * [OrdersV5](code/OrdersV5.md)
* [PodWorkflow](code/PodWorkflow.md)
+ * [Schedules](code/Schedules.md)
* [TeamManagement](code/TeamManagement.md)
* [VehiclesV5](code/VehiclesV5.md)
diff --git a/book/en/code/Orders.md b/book/en/code/Orders.md
index aa9a167..47a12cd 100644
--- a/book/en/code/Orders.md
+++ b/book/en/code/Orders.md
@@ -79,56 +79,56 @@ Create an Order
### orders.get(id, [callback])
-Get an Order Details
+Get an Order Details by ID or by UUID
**See**: [https://route4me.io/docs/#get-an-order-details](https://route4me.io/docs/#get-an-order-details)
-**Since**: 0.1.11
+**Since**: 1.1.0
| Param | Type | Description |
| --- | --- | --- |
-| id | number | Order ID |
+| id | number \| string | Order ID as number or order UUID as HEX-string |
| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Order> | |
### orders.list([ids], [callback])
-Get all the orders created under the specific Route4Me account
+Get all the orders created under the specific Route4Me account by IDs or by UUIDs
**See**: [https://route4me.io/docs/#get-orders-with-details](https://route4me.io/docs/#get-orders-with-details)
-**Since**: 0.1.11
+**Since**: 1.1.0
| Param | Type | Description |
| --- | --- | --- |
-| [ids] | number \| string \| Array.<number> \| Array.<string> | Order IDs in one of the following form: * CSV-string * one ID as string * one ID as number * array of strings * array of numbers If you want to load all Orders: * **Don't pass** this parameter * **OR** pass `ids=undefined` * **OR** pass `ids=false` |
+| [ids] | number \| string \| Array.<number> \| Array.<string> | Order IDs or order UUIDs in one of the following form: * one UUID as HEX-string * UUIDs as CSV-HEX-string * UUIDs as array of HEX-strings * one ID as number * IDs as array of numbers If you want to load all Orders: * **Don't pass** this parameter * **OR** pass `ids=undefined` * **OR** pass `ids=false` |
| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Orders> | [callback] |
### orders.remove(ids, [callback])
-Remove an Order
+Remove Orders by ID or by UUID
**See**: [https://route4me.io/docs/#remove-an-order](https://route4me.io/docs/#remove-an-order)
-**Since**: 0.1.11
+**Since**: 1.1.0
| Param | Type | Description |
| --- | --- | --- |
-| ids | number \| string \| Array.<number> \| Array.<string> | Order ID/IDs to remove in one of the following form: * CSV-string * one ID as string * one ID as number * array of strings * array of numbers |
+| ids | number \| string \| Array.<number> \| Array.<string> | Order IDs or order UUIDs in one of the following form: * one UUID as HEX-string * UUIDs as CSV-HEX-string * UUIDs as array of HEX-strings * one ID as number * IDs as array of numbers |
| [callback] | module:route4me-node~RequestCallback | |
### orders.update(id, data, [callback])
-Update an Order
+Update an Order by ID or by UUID
**See**: [https://route4me.io/docs/#update-an-order](https://route4me.io/docs/#update-an-order)
-**Since**: 0.1.11
+**Since**: 1.1.0
| Param | Type | Description |
| --- | --- | --- |
-| id | number | Order ID |
+| id | number \| string | Order ID as number or order UUID as HEX-string |
| data | jsonschema:Orders.Order | Order data |
| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Order> | |
diff --git a/book/en/code/OrdersV5.md b/book/en/code/OrdersV5.md
new file mode 100644
index 0000000..0591a17
--- /dev/null
+++ b/book/en/code/OrdersV5.md
@@ -0,0 +1,402 @@
+
+
+## OrdersV5 ℗
+
+Orders facility
+
+**Category**: OrdersV5
+**Access**: private
+**See**: [https://route4me.io/docs/#orders](https://route4me.io/docs/#orders)
+**Since**: 1.1.0
+
+* [OrdersV5](#OrdersV5) ℗
+ * [new OrdersV5(requestManager)](#new_OrdersV5_new)
+ * [.create(data, [callback])](#OrdersV5+create)
+ * [.get(id, [callback])](#OrdersV5+get)
+ * [.update(id, data, [callback])](#OrdersV5+update)
+ * [.remove(id, [callback])](#OrdersV5+remove)
+ * [.search(data, [callback])](#OrdersV5+search)
+ * [.batchUpdateByFilters(params, [callback])](#OrdersV5+batchUpdateByFilters)
+ * [.batchRemove(orderIds, [callback])](#OrdersV5+batchRemove)
+ * [.batchUpdate(orderIds, data, [callback])](#OrdersV5+batchUpdate)
+ * [.batchCreate(orders, [callback])](#OrdersV5+batchCreate)
+ * [.getOrderCustomFields([callback])](#OrdersV5+getOrderCustomFields)
+ * [.createOrderCustomField(data, [callback])](#OrdersV5+createOrderCustomField)
+ * [.updateOrderCustomField(uuid, data, [callback])](#OrdersV5+updateOrderCustomField)
+ * [.removeOrderCustomField(uuid, [callback])](#OrdersV5+removeOrderCustomField)
+
+
+
+### new OrdersV5(requestManager)
+
+Constructor
+
+**Returns**: Orders - - Orders facility
+
+| Param | Type | Description |
+| --- | --- | --- |
+| requestManager | RequestManager | Request Manager |
+
+
+
+### ordersV5.create(data, [callback])
+
+Create single order
+
+**See**: [https://route4me.io/docs/#create-an-order](https://route4me.io/docs/#create-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| data | Object | Parameters of order to create |
+| [data.member_id] | Number | Order owner ID. |
+| [data.address_1] | String | The order Address line 1. |
+| [data.address_2] | String | The order Address line 2. |
+| [data.address_alias] | String | Address alias. |
+| [data.address_city] | String | The city the address is located in. |
+| [data.address_state] | String | The state the address is located in. |
+| [data.address_zip] | String | The zip code the address is located in. |
+| [data.address_country] | String | The country the address is located in. |
+| data.address_geo | Object | GPS coords of address. |
+| [data.address_geo.lat] | Number | Latitude. |
+| [data.address_geo.lng] | Number | Longitude. |
+| data.curbside_geo | Object | Curbside GPS coords of address. |
+| [data.curbside_geo.lat] | Number | Curbside latitude. |
+| [data.curbside_geo.lng] | Number | Curbside longitude. |
+| [data.date_scheduled_for] | String | Date scheduled. Possible formats: YY-MM-DD, YYMMDD, ISO 8601 |
+| [data.order_status_id] | Number | Order status ID. |
+| [data.is_pending] | Boolean | If true, the order is pending. |
+| [data.is_accepted] | Boolean | If true, the order is accepted. |
+| [data.is_started] | Boolean | If true, the order is started. |
+| [data.is_completed] | Boolean | If true, the order is completed. |
+| [data.is_validated] | Boolean | If true, the order is validated. |
+| [data.phone] | String | The phone number. |
+| [data.first_name] | String | The first name. |
+| [data.last_name] | String | The last name. |
+| [data.email] | String | E-mail. |
+| [data.custom_data] | Object | Order custom data. |
+| [data.custom_data.barcode] | String | Tracking number for order. |
+| [data.custom_data.airbillno] | String | Additional tracking number for order. |
+| [data.custom_data.sorted_on_date] | String | Datetime String with "T" delimiter, ISO 8601. |
+| [data.custom_data.sorted_on_utc] | Number | Timestamp only; replaced data in `sorted_on_date` property. |
+| data.local_time_windows | Array.<Object> | Array of Time Window objects. |
+| data.local_time_windows.start | Number | Start of Time Window, unix timestamp. |
+| data.local_time_windows.end | Number | End of Time Window, unix timestamp. |
+| [data.local_timezone_string] | String | Local timezone String |
+| [data.service_time] | Number | Consumed service time. |
+| [data.color] | String | Color of an address, e.g., 'FF0000'. |
+| [data.tracking_number] | String | Tracking number |
+| [data.address_stop_type] | String | The type of stop that this is one of 'DELIVERY', 'PICKUP', 'BREAK', 'MEETUP', 'SERVICE', 'VISIT' or 'DRIVEBY'. |
+| [data.last_status] | Number | |
+| [data.weight] | Number | Weight of the cargo. |
+| [data.cost] | Number | Cost of the cargo. |
+| [data.revenue] | Number | The total revenue for the order. |
+| [data.cube] | Number | The cubic volume of the cargo. |
+| [data.pieces] | Number | The item quantity of the cargo. |
+| [data.group] | String | The group. |
+| data.address_priority | Number | Priority of address 0 is the highest priority, n has higher priority than n + 1 |
+| data.address_customer_po | String | The customer purchase order for the address, length <= 50. |
+| data.custom_fields | Array.<Object> | Array of Custom Fields objects. |
+| data.custom_fields.order_custom_field_uuid | String | HEX-String. |
+| data.custom_fields.order_custom_field_value | String | Value of Custom Fields. |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Order> | |
+
+**Example** *(Sample input)*
+```javascript
+
+ const data = {
+ "address_1": "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ "address_alias": "Auto test address",
+ "address_city": "Philadelphia",
+ "address_geo": {
+ "lat": "48.335991",
+ "lng": "31.18287",
+ },
+ "phone": "380380380380",
+ "first_name": "Igor",
+ "last_name": "Progman",
+ "email": "progman@gmail.com",
+ "custom_data": {
+ "barcode": "12345678901",
+ "sorted_on_utc": "1702744115"
+ }
+ };
+```
+
+
+### ordersV5.get(id, [callback])
+
+Show single order by its id
+
+**See**: [https://route4me.io/docs/#get-an-order-details](https://route4me.io/docs/#get-an-order-details)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | String | Order ID, HEX-String |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Order> | |
+
+
+
+### ordersV5.update(id, data, [callback])
+
+Update single order by its id
+
+**See**: [https://route4me.io/docs/#update-an-order](https://route4me.io/docs/#update-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | String | Order ID, HEX-String |
+| data | Object | Parameters of order to update, look for more information in create() |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Order> | |
+
+**Example** *(Sample input)*
+```javascript
+
+const id = "CCCCCA90F77841C693C656123F346AAA";
+const data = {
+ "first_name": "John",
+ "last_name": "Doe",
+ "email": "John@company.com",
+};
+```
+
+
+### ordersV5.remove(id, [callback])
+
+Delete (soft) single order by its id
+
+**See**: [https://route4me.io/docs/#remove-an-order](https://route4me.io/docs/#remove-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | String | Order ID, HEX-String |
+| [callback] | module:route4me-node~RequestCallback | |
+
+
+
+### ordersV5.search(data, [callback])
+
+Search orders in ElasticSearch storage or in Spanner database
+
+**See**: [https://route4me.io/docs/#search-orders](https://route4me.io/docs/#search-orders)
+**Since**: 1.1.0
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| data | Object | | Search and filter parameters. |
+| [data.order_ids] | Array.<String> | | Array of order ids, HEX-Strings. |
+| data.return_provided_fields_as_map | Boolean | | |
+| data.orderBy | Array.<Object> | | Sort and direction parameters. |
+| orderBy.0 | String | | The name of the sort field, this is one of 'address_alias', 'first_name', 'last_name', 'phone', 'is_pending', 'is_validated', 'is_accepted', 'is_completed', 'scheduled_for', 'day_added' |
+| [orderBy.1] | String | 'asc' | Sorting direction, this is one of 'asc', 'ASC', 'desc', 'DESC' |
+| data.limit | Number | | = 30 - The number of orders per page. |
+| data.offset | Number | | = 0 - The requested page. |
+| data.fields | Array.<String> | | An array of returned fields, this is one of 'order_uuid', 'member_id', 'address_1', 'address_2', 'address_alias', 'address_city', 'address_state', 'address_zip', 'address_country', 'coordinates', 'curbside_coordinates', 'updated_timestamp', 'created_timestamp', 'day_added', 'scheduled_for', 'order_status_id', 'is_pending', 'is_started', 'is_completed', 'is_validated', 'phone', 'first_name', 'last_name', 'email', 'custom_data', 'local_time_windows', 'local_timezone', 'service_time', 'color', 'icon', 'last_visited_timestamp', 'visited_count', 'in_route_count', 'last_routed_timestamp', 'tracking_number', 'organization_id', 'root_member_id', 'address_stop_type', 'last_status', 'sorted_day_id', 'weight', 'cost', 'revenue', 'cube', 'pieces', 'done_day_id', 'possession_day_id', 'group', 'workflow_uuid', 'address_priority' |
+| data.addition | Array.<String> | | An array of additional returned fields, this is one of 'territory_ids', 'aggregation_ids' |
+| [data.search] | Object | | Search parameters. |
+| [data.search.query] | String | | The string to query to ElasticSearch. If set the `matches` and `terms` sections will be ignored. |
+| [data.search.matches] | Object | | The object to query to ElasticSearch. |
+| [data.search.matches.custom_data] | Object | | Order custom data. |
+| [data.search.matches.custom_data.barcode] | String | | Tracking number for order. |
+| [data.search.matches.custom_data.airbillno] | String | | Additional tracking number for order. |
+| [data.search.matches.custom_data.sorted_on_date] | String | | Datetime String with "T" delimiter, ISO 8601. |
+| [data.search.matches.custom_data.sorted_on_utc] | Number | | Timestamp only; replaced data in `sorted_on_date` property. |
+| [data.search.matches.first_name] | String | | The first name. |
+| [data.search.matches.last_name] | String | | The last name. |
+| [data.search.matches.email] | String | | E-mail. |
+| [data.search.matches.phone] | String | | The phone number. |
+| [data.search.matches.address_1] | String | | The order Address line 1. |
+| [data.search.matches.address_alias] | String | | Address alias. |
+| [data.search.matches.address_zip] | String | | The zip code of the address. |
+| [data.search.terms] | Object | | The object to query to ElasticSearch. |
+| [data.search.terms.custom_data] | Object | | Order custom data. |
+| [data.search.terms.custom_data.barcode] | String | | Tracking number for order. |
+| [data.search.terms.custom_data.airbillno] | String | | Additional tracking number for order. |
+| [data.search.terms.custom_data.sorted_on_date] | String | | Datetime String with "T" delimiter, ISO 8601. |
+| [data.search.terms.custom_data.sorted_on_utc] | Number | | Timestamp only; replaced data in `sorted_on_date` property. |
+| [data.search.terms.first_name] | String | | The first name. |
+| [data.search.terms.last_name] | String | | The last name. |
+| [data.search.terms.email] | String | | E-mail. |
+| [data.search.terms.phone] | String | | The phone number. |
+| [data.search.terms.address_1] | String | | The order Address line 1. |
+| [data.search.terms.address_alias] | String | | Address alias. |
+| [data.search.terms.address_zip] | String | | The zip code the address is located in. |
+| [data.filters] | Object | | Filter parameters. |
+| [data.filters.order_ids] | Array.<String> | | Array of included order ids, HEX-Strings. |
+| [data.filters.excluded_ids] | Array.<String> | | Array of excluded order ids, HEX-Strings. |
+| [data.filters.tracking_numbers] | Array.<String> | | Array of tracking number of orders. |
+| [data.filters.only_geocoded] | Boolean | | |
+| [data.filters.updated_timestamp] | Number \| String \| Object | | Can be unix timestamp or ISO 8601 or Object {"start": "timestamp or ISO 8601", "end": "timestamp or ISO 8601"}. |
+| [data.filters.created_timestamp] | Number \| String \| Object | | Can be unix timestamp or ISO 8601 or Object {"start": "timestamp or ISO 8601", "end": "timestamp or ISO 8601"}. |
+| [data.filters.scheduled_for] | Number \| String \| Object | | Can be unix timestamp or ISO 8601 or Object {"start": "timestamp or ISO 8601", "end": "timestamp or ISO 8601"}. |
+| [data.filters.only_unscheduled] | Boolean | | |
+| [data.filters.day_added] | Number \| String \| Object | | Can be unix timestamp or ISO 8601 or Object {"start": "timestamp or ISO 8601", "end": "timestamp or ISO 8601"}. |
+| [data.filters.sorted_on] | Number \| String \| Object | | Can be unix timestamp or ISO 8601 or Object {"start": "timestamp or ISO 8601", "end": "timestamp or ISO 8601"}. |
+| [data.filters.address_stop_types] | Array.<String> | | Array of stop type names, possible values 'DELIVERY', 'PICKUP', 'BREAK', 'MEETUP', 'SERVICE', 'VISIT' or 'DRIVEBY'. |
+| [data.filters.last_statuses] | Array.<Number> | | Array of statuses. |
+| [data.filters.territory_ids] | Array.<Number> | | Array of territory ids. |
+| [data.filters.done_day] | String | | |
+| [data.filters.possession_day] | String | | |
+| [data.filters.groups] | Array.<String> | | |
+| [data.filters.display] | String | 'all' | Filtering by the in_route_count field, is one of 'routed', 'unrouted', 'all' |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.List> | | |
+
+**Example** *(Sample input)*
+```javascript
+
+ const data = {
+ filters: {
+ order_ids: [
+ "CCCCCA90F77841C693C656123F346AAA",
+ "BBB8CA90F77841C693C656123F346AAA"
+ ]
+ }
+ };
+```
+
+
+### ordersV5.batchUpdateByFilters(params, [callback])
+
+Update the batch of orders (asynchronous, by filters)
+
+**See**: [https://route4me.io/docs/#update-an-order](https://route4me.io/docs/#update-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| params | Object | Batch update parameters. |
+| params.data | Object | Order values for batch update, look for more information in create() |
+| params.search | Object | Search parameters for batch update, look for more information in search() |
+| params.filters | Object | Filter parameters for batch update, look for more information in search() |
+| [callback] | module:route4me-node~RequestCallback | |
+
+
+
+### ordersV5.batchRemove(orderIds, [callback])
+
+Delete the batch of orders
+
+**See**: [https://route4me.io/docs/#remove-an-order](https://route4me.io/docs/#remove-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| orderIds | Array.<String> | Array of Order IDs, HEX-Strings. |
+| [callback] | module:route4me-node~RequestCallback | |
+
+
+
+### ordersV5.batchUpdate(orderIds, data, [callback])
+
+Update the batch of orders by ids
+
+**See**: [https://route4me.io/docs/#update-an-order](https://route4me.io/docs/#update-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| orderIds | Array.<String> | Array of Order IDs, HEX-Strings. |
+| data | Object | Order values for batch update, look for more information in create() |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.List> | |
+
+
+
+### ordersV5.batchCreate(orders, [callback])
+
+Create the batch of orders
+
+**See**: [https://route4me.io/docs/#update-an-order](https://route4me.io/docs/#update-an-order)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| orders | Array.<Object> | Array of Order values for batch create, look for more information in create() |
+| [callback] | module:route4me-node~RequestCallback | |
+
+
+
+### ordersV5.getOrderCustomFields([callback])
+
+Get a list of Order Custom Fields
+
+**See**: [https://route4me.io/docs/#get-an-order-details](https://route4me.io/docs/#get-an-order-details)
+**Since**: 1.1.0
+
+| Param | Type |
+| --- | --- |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Response> |
+
+
+
+### ordersV5.createOrderCustomField(data, [callback])
+
+Create one Order Custom Field
+
+**See**: [https://route4me.io/docs/#create-an-order-custom-fields](https://route4me.io/docs/#create-an-order-custom-fields)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| data | Object | Params of Order custom field |
+| data.order_custom_field_name | String | Name, max 128 characters. |
+| data.order_custom_field_type | String | Type, max 128 characters. |
+| data.order_custom_field_label | String | Label, max 128 characters. |
+| data.order_custom_field_type_info | Object | Info, as JSON Object max 4096 characters. |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Response> | |
+
+**Example** *(Sample input)*
+```javascript
+
+ const orderTypeCheckbox = {
+ order_custom_field_name: "CustomField4",
+ order_custom_field_label: "Custom Field 4",
+ order_custom_field_type: "checkbox",
+ order_custom_field_type_info: { short_label: "cFl4" }
+ }
+
+ const = orderTypeDropdown = {
+ order_custom_field_name: "TEST",
+ order_custom_field_label: "MENU",
+ order_custom_field_type: "dropdown",
+ order_custom_field_short_caption: "MENU",
+ order_custom_field_type_info: {
+ short_caption: "MENU",
+ allowed_values: ["10", "30", "50", “100”]
+ }
+ }
+```
+
+
+### ordersV5.updateOrderCustomField(uuid, data, [callback])
+
+Update one Order Custom Fields
+
+**See**: [https://route4me.io/docs/#update-an-order-custom-fields](https://route4me.io/docs/#update-an-order-custom-fields)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| uuid | Number | OrderCustomField ID, HEX-string. |
+| data | Object | Params of Order custom field |
+| data.order_custom_field_type | String | Type, max 128 characters. |
+| data.order_custom_field_label | String | Label, max 128 characters. |
+| data.order_custom_field_type_info | Object | Info, as JSON Object max 4096 characters. |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Response> | |
+
+
+
+### ordersV5.removeOrderCustomField(uuid, [callback])
+
+Remove an Order Custom Fields
+
+**See**: [https://route4me.io/docs/#remove-user-custom-field](https://route4me.io/docs/#remove-user-custom-field)
+**Since**: 1.1.0
+
+| Param | Type | Description |
+| --- | --- | --- |
+| uuid | Number | OrderCustomField ID, HEX-string. |
+| [callback] | module:route4me-node~RequestCallback.<jsonschema:Orders.Response> | |
+
diff --git a/book/en/code/Route4Me.md b/book/en/code/Route4Me.md
index 5ff07c9..dfe6c95 100644
--- a/book/en/code/Route4Me.md
+++ b/book/en/code/Route4Me.md
@@ -96,6 +96,7 @@ Main members of the instanse of `Route4Me` class:
* [Notes ](Notes)
* [Optimizations ](Optimizations)
* [Orders ](Orders)
+* [OrdersV5 ](OrdersV5)
* [OrderCustomFields ](OrderCustomFields)
* [PodWorkflow ](PodWorkflow)
* [Routes ](Routes)
@@ -140,6 +141,7 @@ For most use cases it is necessary:
* [.Notes](#Route4Me+Notes) : Notes
* [.Optimizations](#Route4Me+Optimizations) : Optimizations
* [.Orders](#Route4Me+Orders) : Orders
+ * [.OrdersV5](#Route4Me+OrdersV5) : OrdersV5
* [.PodWorkflow](#Route4Me+PodWorkflow) : PodWorkflow
* [.Routes](#Route4Me+Routes) : Routes
* [.Schedules](#Route4Me+Schedules) : Schedules
@@ -248,6 +250,13 @@ Create new API client
**Orders** related API calls
**Since**: 0.1.11
+
+
+### route4Me.OrdersV5 : OrdersV5
+
+**OrdersV5** related API calls
+
+**Since**: 1.1.0
### route4Me.PodWorkflow : PodWorkflow
diff --git a/examples/Orders/get-order-by-uuid-promise.js b/examples/Orders/get-order-by-uuid-promise.js
new file mode 100644
index 0000000..934b06c
--- /dev/null
+++ b/examples/Orders/get-order-by-uuid-promise.js
@@ -0,0 +1,88 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true })
+
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ EXT_FIELD_first_name: "John",
+ EXT_FIELD_last_name: "Doe",
+ EXT_FIELD_email: "some@company.com",
+ EXT_FIELD_phone: "380380380380"
+ };
+
+ let order_uuid = undefined;
+ let order_by_id = undefined;
+
+ // create Order
+ route4me.Orders.create(data)
+ .then(data => {
+ expect(data).exist
+
+ const order_id = data.order_id;
+ order_uuid = data.order_uuid;
+ console.log(`Create Order with id='${order_id}' and uuid='${order_uuid}'`);
+
+ // get Order by ID
+ return route4me.Orders.get(order_id)
+ }).then(data => {
+ order_by_id = data;
+ console.log(`Read Order by id, id='${order_by_id.order_id}' and uuid='${order_by_id.order_uuid}`);
+
+ // get Order by UUID
+ return route4me.Orders.get(order_uuid)
+ }).then(order_by_uuid => {
+ console.log(`Read Order by uuid, id='${order_by_uuid.order_id}' and uuid='${order_by_uuid.order_uuid}`);
+
+ // compare Orders
+ if(JSON.stringify(order_by_id) == JSON.stringify(order_by_uuid)) {
+ console.log("The Orders are equal.");
+ } else {
+ console.log("The Orders are not equal.");
+ }
+
+ // delete Order by UUID
+ return route4me.Orders.remove(order_uuid)
+ }).then(data => {
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ }).catch(err => {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(order_uuid) {
+ route4me.Orders.remove(order_uuid)
+ .then(data => {
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not cleaned up.`);
+ }
+ }).catch(err => {
+ console.log("Error: cleanup, " + err);
+ });
+ }
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/Orders/get-order-by-uuid-sync.js b/examples/Orders/get-order-by-uuid-sync.js
new file mode 100644
index 0000000..b7894ea
--- /dev/null
+++ b/examples/Orders/get-order-by-uuid-sync.js
@@ -0,0 +1,85 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true });
+
+ (async () => {
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ EXT_FIELD_first_name: "John",
+ EXT_FIELD_last_name: "Doe",
+ EXT_FIELD_email: "some@company.com",
+ EXT_FIELD_phone: "380380380380"
+ };
+
+ let order_uuid = undefined;
+
+ try {
+ // create Order
+ const order = await route4me.Orders.create(data);
+ expect(order).exist
+
+ const order_id = order.order_id;
+ order_uuid = order.order_uuid;
+ console.log(`Create Order with id='${order_id}' and uuid='${order_uuid}'`);
+
+ // get Order by ID
+ const order_by_id = await route4me.Orders.get(order_id);
+ console.log(`Read Order by id, id='${order_by_id.order_id}' and uuid='${order_by_id.order_uuid}`);
+
+ // get Order by UUID
+ const order_by_uuid = await route4me.Orders.get(order_uuid);
+ console.log(`Read Order by uuid, id='${order_by_uuid.order_id}' and uuid='${order_by_uuid.order_uuid}`);
+
+ // compare Orders
+ if(JSON.stringify(order_by_id) == JSON.stringify(order_by_uuid)) {
+ console.log("The Orders are equal.");
+ } else {
+ console.log("The Orders are not equal.");
+ }
+
+ // delete Order by UUID
+ if(await route4me.Orders.remove(order_uuid)) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ }
+ catch(err) {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(order_uuid) {
+ try {
+ if(await route4me.Orders.remove(order_uuid)) {
+ console.log(`Order with uuid=${order_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not cleaned up.`);
+ }
+ }
+ catch(err) {
+ console.log("Error: cleanup, " + err);
+ }
+ }
+ }
+ })();
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/Orders/get-order-by-uuid.js b/examples/Orders/get-order-by-uuid.js
new file mode 100644
index 0000000..f743ae9
--- /dev/null
+++ b/examples/Orders/get-order-by-uuid.js
@@ -0,0 +1,103 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+ const route4me = new Route4Me(apiKey)
+
+ function cleanup(err, cleanup_uuid) {
+ debug("error ", err)
+ expect(err).exist
+
+ if(cleanup_uuid) {
+ route4me.Orders.remove(cleanup_uuid, (err, data) => {
+ if(err) {
+ console.log("Error: cleanup, " + err);
+ return;
+ }
+ if(data) {
+ console.log(`Order with uuid=${cleanup_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${cleanup_uuid} was not cleaned up.`);
+ }
+ });
+ }
+ }
+
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ EXT_FIELD_first_name: "John",
+ EXT_FIELD_last_name: "Doe",
+ EXT_FIELD_email: "some@company.com",
+ EXT_FIELD_phone: "380380380380"
+ };
+
+ // create order
+ route4me.Orders.create(data, (err, data) => {
+ debug("error ", err)
+ expect(err).is.null
+ expect(res).exist
+
+ if(err) {
+ cleanup(err);
+ return;
+ }
+
+ const order_id = data.order_id;
+ const order_uuid = data.order_uuid;
+ console.log(`Create Order with id='${order_id}' and uuid='${order_uuid}'`);
+
+ // get Order by ID
+ route4me.Orders.get(order_id, (err, order_by_id) => {
+ if(err) {
+ cleanup(err, order_by_id.order_id);
+ return;
+ }
+ console.log(`Read Order by id, id='${order_by_id.order_id}' and uuid='${order_by_id.order_uuid}`);
+
+ // get Order by UUID
+ route4me.Orders.get(order_uuid, (err, order_by_uuid) => {
+ if(err) {
+ cleanup(err, order_by_uuid.order_id);
+ return;
+ }
+ console.log(`Read Order by uuid, id='${order_by_uuid.order_id}' and uuid='${order_by_uuid.order_uuid}`);
+
+ // compare Orders
+ if(JSON.stringify(order_by_id) == JSON.stringify(order_by_uuid)) {
+ console.log("The Orders are equal.");
+ } else {
+ console.log("The Orders are not equal.");
+ }
+
+ // delete Order by UUID
+ route4me.Orders.remove(order_uuid, (err, data) => {
+ if(err) {
+ cleanup(err);
+ return;
+ }
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ });
+ });
+ });
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/custom-fields-promise.js b/examples/OrdersV5/custom-fields-promise.js
new file mode 100644
index 0000000..4869e8d
--- /dev/null
+++ b/examples/OrdersV5/custom-fields-promise.js
@@ -0,0 +1,75 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true })
+
+ const data = {
+ order_custom_field_name: "CustomField_15",
+ order_custom_field_label: "Custom Field 15",
+ order_custom_field_type: "checkbox",
+ order_custom_field_type_info: { short_label: "cFl_15" }
+ };
+
+ let ocf_uuid = undefined;
+
+ // create CustomUserField
+ route4me.OrdersV5.createOrderCustomField(data)
+ .then(data => {
+ expect(data).exist
+ ocf_uuid = data.data.order_custom_field_uuid;
+ console.log(`Create CustomUserField with uuid='${ocf_uuid}'`);
+
+ // read list of CustomUserFields
+ return route4me.OrdersV5.getOrderCustomFields();
+ }).then(data => {
+ console.log(`Read CustomUserFields list the length is '${data.data.length}'`);
+
+ const found_res = data.data.find(item => item.order_custom_field_uuid === ocf_uuid);
+ if(found_res) {
+ console.log(`Found CustomUserField with uuid ${ocf_uuid} label is '${found_res.order_custom_field_label}'`);
+
+ // update CustomUserFields
+ const { order_custom_field_uuid, ...update_ocf } = found_res;
+ update_ocf.order_custom_field_label = "Custom Field 16";
+ return route4me.OrdersV5.updateOrderCustomField(ocf_uuid, update_ocf);
+ } else {
+ throw new Error(`CustomUserField with uuid ${ocf_uuid} not found.'`);
+ }
+ }).then(data => {
+ console.log(`Update CustomUserField label is '${data.data.order_custom_field_label}'`);
+
+ // delete CustomUserFields
+ return route4me.OrdersV5.removeOrderCustomField(ocf_uuid);
+ }).then(data => {
+ console.log(`CustomUserField with uuid=${ocf_uuid} was deleted successful.`);
+ }).catch(err => {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(ocf_uuid) {
+ route4me.OrdersV5.removeOrderCustomField(ocf_uuid)
+ .then(data => {
+ console.log(`CustomUserField with uuid=${ocf_uuid} was cleaned up successful.`);
+ }).catch(err => {
+ console.log("Error: cleanup, " + err);
+ })
+ }
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/custom-fields-sync.js b/examples/OrdersV5/custom-fields-sync.js
new file mode 100644
index 0000000..3124bdd
--- /dev/null
+++ b/examples/OrdersV5/custom-fields-sync.js
@@ -0,0 +1,77 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true });
+
+ (async () => {
+ let ocf_uuid = undefined;
+
+ const data = {
+ order_custom_field_name: "CustomField_15",
+ order_custom_field_label: "Custom Field 15",
+ order_custom_field_type: "checkbox",
+ order_custom_field_type_info: { short_label: "cFl_15" }
+ };
+
+ try {
+ // create CustomUserField
+ const custom_field = await route4me.OrdersV5.createOrderCustomField(data);
+ expect(custom_field).exist
+
+ ocf_uuid = custom_field.data.order_custom_field_uuid;
+ console.log(`Create CustomUserField with uuid='${ocf_uuid}'`);
+
+ // read list of CustomUserFields
+ const custom_fields = await route4me.OrdersV5.getOrderCustomFields();
+ console.log(`Read CustomUserFields list the length is '${custom_fields.data.length}'`);
+
+ const found_res = custom_fields.data.find(item => item.order_custom_field_uuid === ocf_uuid);
+ if(found_res) {
+ console.log(`Found CustomUserField with uuid ${ocf_uuid} label is '${found_res.order_custom_field_label}'`);
+
+ // update CustomUserFields
+ const { order_custom_field_uuid, ...update_ocf } = found_res;
+ update_ocf.order_custom_field_label = "Custom Field 16";
+ const update_field = await route4me.OrdersV5.updateOrderCustomField(ocf_uuid, update_ocf);
+ console.log(`Update CustomUserField label is '${update_field.data.order_custom_field_label}'`);
+
+ // delete CustomUserFields
+ await route4me.OrdersV5.removeOrderCustomField(ocf_uuid);
+ console.log(`CustomUserField with uuid=${ocf_uuid} was deleted successful.`);
+ } else {
+ console.log(`CustomUserField with uuid ${ocf_uuid} not found.'`);
+ }
+ }
+ catch(err) {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(ocf_uuid) {
+ try {
+ await route4me.OrdersV5.removeOrderCustomField(ocf_uuid);
+ console.log(`CustomUserField with uuid=${ocf_uuid} was cleaned up successful.`);
+ }
+ catch(err) {
+ console.log("Error: cleanup, " + err);
+ }
+ }
+ }
+ })();
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/custom-fields.js b/examples/OrdersV5/custom-fields.js
new file mode 100644
index 0000000..33e71d5
--- /dev/null
+++ b/examples/OrdersV5/custom-fields.js
@@ -0,0 +1,97 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+ const route4me = new Route4Me(apiKey)
+
+ function cleanup(err, cleanup_uuid) {
+ debug("error ", err)
+ expect(err).exist
+
+ if(cleanup_uuid) {
+ route4me.OrdersV5.removeOrderCustomField(cleanup_uuid, (err, data) => {
+ if(err) {
+ console.log("Error: cleanup, " + err);
+ return;
+ }
+ if(data) {
+ console.log(`CustomUserField with uuid=${cleanup_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`CustomUserField with uuid=${cleanup_uuid} was not cleaned up.`);
+ }
+ });
+ }
+ }
+
+ const data = {
+ order_custom_field_name: "CustomField_15",
+ order_custom_field_label: "Custom Field 15",
+ order_custom_field_type: "checkbox",
+ order_custom_field_type_info: { short_label: "cFl_15" }
+ };
+
+ // create CustomUserField
+ route4me.OrdersV5.createOrderCustomField(data, (err, data) => {
+ debug("error ", err)
+ expect(err).is.null
+ expect(res).exist
+
+ if(err) {
+ cleanup(err);
+ return;
+ }
+
+ const ocf_uuid = data.data.order_custom_field_uuid;
+ console.log(`Create CustomUserField with uuid='${ocf_uuid}'`);
+
+ // read list of CustomUserFields
+ route4me.OrdersV5.getOrderCustomFields((err, data) => {
+ if(err) {
+ cleanup(err, ocf_uuid);
+ return;
+ }
+ console.log(`Read CustomUserFields list the length is '${data.data.length}'`);
+
+ const found_res = data.data.find(item => item.order_custom_field_uuid === ocf_uuid);
+ if(found_res) {
+ console.log(`Found CustomUserField with uuid ${ocf_uuid} label is '${found_res.order_custom_field_label}'`);
+
+ // update CustomUserFields
+ const { order_custom_field_uuid, ...update_ocf } = found_res;
+ update_ocf.order_custom_field_label = "Custom Field 16";
+ route4me.OrdersV5.updateOrderCustomField(ocf_uuid, update_ocf, (err, data) => {
+ if(err) {
+ cleanup(err, ocf_uuid);
+ return;
+ }
+ console.log(`Update CustomUserField label is '${data.data.order_custom_field_label}'`);
+
+ // delete CustomUserFields
+ route4me.OrdersV5.removeOrderCustomField(ocf_uuid, (err, data) => {
+ if(err) {
+ cleanup(err);
+ return;
+ }
+ console.log(`CustomUserField with uuid=${ocf_uuid} was deleted successful.`);
+ });
+ });
+ } else {
+ console.log(`CustomUserField with uuid ${ocf_uuid} not found.'`);
+ }
+ });
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/full-flow-promise.js b/examples/OrdersV5/full-flow-promise.js
new file mode 100644
index 0000000..4684332
--- /dev/null
+++ b/examples/OrdersV5/full-flow-promise.js
@@ -0,0 +1,84 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true })
+
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ address_geo: {
+ lat: "48.335991",
+ lng: "31.18287",
+ },
+ phone: "380380380380",
+ first_name: "John",
+ last_name: "Doe",
+ email: "some@company.com"
+ };
+
+ let order_uuid = undefined;
+
+ // create order
+ route4me.OrdersV5.create(data)
+ .then(data => {
+ expect(data).exist
+ order_uuid = data.order_uuid;
+ console.log(`Create Order with uuid='${order_uuid}'`);
+
+ // read order
+ return route4me.OrdersV5.get(order_uuid);
+ }).then(data => {
+ console.log(`Read Order first_name is '${data.first_name}'`);
+
+ // update order
+ const order_data = {
+ first_name: "Jane"
+ };
+ return route4me.OrdersV5.update(order_uuid, order_data);
+ }).then(data => {
+ console.log(`Update Order first_name is '${data.first_name}'`);
+
+ // delete order
+ return route4me.OrdersV5.remove(order_uuid);
+ }).then(data => {
+ expect(data).exist
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ }).catch(err => {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(order_uuid) {
+ route4me.OrdersV5.remove(order_uuid).then(data => {
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not cleaned up.`);
+ }
+ }).catch(err => {
+ console.log("Error: cleanup, " + err);
+ });
+ }
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/full-flow-sync.js b/examples/OrdersV5/full-flow-sync.js
new file mode 100644
index 0000000..4a93fa5
--- /dev/null
+++ b/examples/OrdersV5/full-flow-sync.js
@@ -0,0 +1,84 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+
+ // To use the Promise style instead of the Callback style send promise=true as an option.
+ const route4me = new Route4Me(apiKey, { promise: true });
+
+ (async () => {
+ let order_uuid = undefined;
+
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ address_geo: {
+ lat: "48.335991",
+ lng: "31.18287",
+ },
+ phone: "380380380380",
+ first_name: "John",
+ last_name: "Doe",
+ email: "some@company.com"
+ };
+
+ try {
+ // create order
+ const order = await route4me.OrdersV5.create(data);
+ expect(order).exist
+
+ order_uuid = order.order_uuid;
+ console.log(`Create Order with uuid='${order_uuid}'`);
+
+ // read order
+ const read_order = await route4me.OrdersV5.get(order_uuid);
+ console.log(`Read Order first_name is '${read_order.first_name}'`);
+
+ // update order
+ const order_data = {
+ first_name: "Jane"
+ };
+ const update_order = await route4me.OrdersV5.update(order_uuid, order_data);
+ console.log(`Update Order first_name is '${update_order.first_name}'`);
+
+ // delete order
+ if(await route4me.OrdersV5.remove(order_uuid)) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ }
+ catch(err) {
+ expect(err).exist
+ // console.log("Error ", err);
+
+ if(order_uuid) {
+ try {
+ if(await route4me.OrdersV5.remove(order_uuid)) {
+ console.log(`Order with uuid=${order_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not cleaned up.`);
+ }
+ }
+ catch(err) {
+ console.log("Error: cleanup, " + err);
+ }
+ }
+ }
+ })();
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/examples/OrdersV5/full-flow.js b/examples/OrdersV5/full-flow.js
new file mode 100644
index 0000000..74f9522
--- /dev/null
+++ b/examples/OrdersV5/full-flow.js
@@ -0,0 +1,102 @@
+"use strict"
+
+const path = require("path")
+const chai = require("chai")
+const debug = require("debug")("route4me-node:examples")
+require("../init-examples-suite")
+const helper = require("../../test/helper")
+
+helper.describeIntegration(helper.toSuiteName(__filename), function T() {
+ this.timeout(5000)
+ this.slow(3000)
+ it(path.basename(__filename), (done) => {
+ const expect = chai.expect
+ const apiKey = "11111111111111111111111111111111"
+ const route4me = new Route4Me(apiKey)
+
+ function cleanup(err, cleanup_uuid) {
+ debug("error ", err)
+ expect(err).exist
+
+ if(cleanup_uuid) {
+ route4me.OrdersV5.remove(cleanup_uuid, (err, data) => {
+ if(err) {
+ console.log("Error: cleanup, " + err);
+ return;
+ }
+ if(data) {
+ console.log(`Order with uuid=${cleanup_uuid} was cleaned up successful.`);
+ } else {
+ console.log(`Order with uuid=${cleanup_uuid} was not cleaned up.`);
+ }
+ });
+ }
+ }
+
+ const data = {
+ address_1: "1358 E Luzerne St, Philadelphia, PA 19124, US",
+ address_alias: "Auto test address",
+ address_city: "Philadelphia",
+ address_geo: {
+ lat: "48.335991",
+ lng: "31.18287",
+ },
+ phone: "380380380380",
+ first_name: "John",
+ last_name: "Doe",
+ email: "some@company.com"
+ };
+
+ // create order
+ route4me.OrdersV5.create(data, (err, data) => {
+ debug("error ", err)
+ expect(err).is.null
+ expect(res).exist
+
+ if(err) {
+ cleanup(err);
+ return;
+ }
+
+ const order_uuid = data.order_uuid;
+ console.log(`Create Order with uuid='${order_uuid}'`);
+
+ // read order
+ route4me.OrdersV5.get(order_uuid, (err, data) => {
+ if(err) {
+ cleanup(err, order_uuid);
+ return;
+ }
+ console.log(`Read Order first_name is '${data.first_name}'`);
+
+ // update order
+ const order_data = {
+ first_name: "Jane"
+ };
+ route4me.OrdersV5.update(order_uuid, order_data, (err, data) => {
+ if(err) {
+ cleanup(err, order_uuid);
+ return;
+ }
+ console.log(`Update Order first_name is '${data.first_name}'`);
+
+ // delete order
+ route4me.OrdersV5.remove(order_uuid, (err, data) => {
+ if(err) {
+ cleanup(err);
+ return;
+ }
+ if(data) {
+ console.log(`Order with uuid=${order_uuid} was deleted successful.`);
+ } else {
+ console.log(`Order with uuid=${order_uuid} was not deleted.`);
+ }
+ });
+ });
+ });
+ });
+
+ // TODO: remove `done` call from examples
+ done()
+ })
+})
diff --git a/package.json b/package.json
index 108e37e..79e9c02 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "route4me-nodejs-sdk",
- "version": "1.0.28",
+ "version": "1.1.0",
"description": "Access Route4Me's logistics-as-a-service API using our Node.js SDK",
"main": "src/index.js",
"browser": "src/route4me.js",
diff --git a/src/request-manager.js b/src/request-manager.js
index 1ef5752..d5c0d37 100644
--- a/src/request-manager.js
+++ b/src/request-manager.js
@@ -252,7 +252,7 @@ class RequestManager {
if (form) {
req.type("multipart/form-data")
.field(form)
- } else {
+ } else if (body) {
req.type("application/json")
.send(body)
}
diff --git a/src/resources/orders-v5.js b/src/resources/orders-v5.js
new file mode 100644
index 0000000..7463f4a
--- /dev/null
+++ b/src/resources/orders-v5.js
@@ -0,0 +1,516 @@
+"use strict"
+
+const utils = require("./../utils")
+
+/**
+ * Orders facility
+ *
+ * @category OrdersV5
+ */
+class OrdersV5 {
+ /**
+ * Constructor
+ *
+ * @see {@link https://route4me.io/docs/#orders}
+ * @since 1.1.0
+ * @private
+ *
+ * @param {RequestManager} requestManager - Request Manager
+ * @return {Orders} - Orders facility
+ */
+ constructor(requestManager) {
+ this.r = requestManager
+ }
+
+ /**
+ * Create single order
+ *
+ * @example