Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions book/en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## Code

### V4

* [Route4Me](code/Route4Me.md#Route4Me)
* [ActivityFeed](code/ActivityFeed.md)
* [AddressBarcodes](code/AddressBarcodes.md)
Expand All @@ -34,6 +36,10 @@
* [Route4MeValidationError](code/Errors.md#Route4MeValidationError)
* [Other](code/Uncategorized.md)

### V5

* [AddressBookV5](code/AddressBookV5.md)

{% include "code/index.md" %}

## Examples
Expand Down
27 changes: 15 additions & 12 deletions book/en/code/AddressBook.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ AddressBook facility
* [new AddressBook(requestManager)](#new_AddressBook_new)
* [.create(data, [callback])](#AddressBook+create)
* [.getMany(ids, [callback])](#AddressBook+getMany)
* [.list(options, [callback])](#AddressBook+list)
* [.search(query, options, [callback])](#AddressBook+search)
* [.list(ids, [options], [callback])](#AddressBook+list)
* [.search(query, [options], [callback])](#AddressBook+search)
* [.update(id, data, [callback])](#AddressBook+update)
* [.remove(ids, [callback])](#AddressBook+remove)

Expand Down Expand Up @@ -65,7 +65,7 @@ GET locations from an address book by a specified list of locations IDs.

<a id="AddressBook+list" name="AddressBook+list"></a>

### addressBook.list(options, [callback])
### addressBook.list(ids, [options], [callback])

GET all locations from a user’s address book.

Expand All @@ -74,18 +74,21 @@ GET all locations from a user’s address book.
**Todo**

- [ ] TODO: Parse response
- [ ] TODO: Describe ALL options (in one place, list+search)
- [ ] TODO: convert options to optional


| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | List-parameters |
| ids | <code>String</code> \| <code>Number</code> \| <code>Array.&lt;String&gt;</code> \| <code>Array.&lt;Number&gt;</code> | Order IDs |
| [options] | <code>Object</code> | List-parameters |
| [options.offset] | <code>Number</code> | List offset |
| [options.limit] | <code>Number</code> | List limit |
| [options.fields] | <code>String</code> | String of comma separated fields to return |
| [options.routed] | <code>Boolean</code> | Return routed or unrouted records |
| [callback] | <code>module:route4me-node~RequestCallback.&lt;jsonschema:AddressBook.AddressBookSearchResult&gt;</code> | |

<a id="AddressBook+search" name="AddressBook+search"></a>

### addressBook.search(query, options, [callback])
### addressBook.search(query, [options], [callback])

Search an address book location by containing specified text in any
field/defined fields.
Expand All @@ -98,19 +101,19 @@ field/defined fields.
**Since**: 0.1.8
**Todo**

- [ ] TODO: convert options to optional
- [ ] TODO: Parse response
- [ ] TODO: Describe ALL options (in one place, list+search)
- [ ] TODO: Handle the diffrerent format of the output (when fields are set,
see https://github.com/route4me/route4me-nodejs-sdk/issues/38)


| Param | Type | Description |
| --- | --- | --- |
| query | <code>string</code> | Searched text |
| options | <code>Object</code> | List-parameters |
| [options.limit] | <code>number</code> | List limit |
| [options.offset] | <code>number</code> | List offset |
| [options] | <code>Object</code> | List-parameters |
| [options.offset] | <code>Number</code> | List offset |
| [options.limit] | <code>Number</code> | List limit |
| [options.fields] | <code>String</code> | String of comma separated fields to return |
| [options.routed] | <code>Boolean</code> | Return routed or unrouted records |
| [callback] | <code>module:route4me-node~RequestCallback.&lt;jsonschema:AddressBook.AddressBookSearchResult&gt;</code> | |

<a id="AddressBook+update" name="AddressBook+update"></a>
Expand Down
505 changes: 505 additions & 0 deletions book/en/code/AddressBookV5.md

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion book/en/code/Route4Me.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Main members of the instanse of `Route4Me` class:
* [ActivityFeed ](ActivityFeed)
* [Addresses ](Addresses)
* [AddressBook ](AddressBook)
* [AddressBookV5 ](AddressBookV5)
* [AddressBarcodes ](AddressBarcodes)
* [AvoidanceZones ](AvoidanceZones)
* [Geocoding ](Geocoding)
Expand Down Expand Up @@ -125,6 +126,7 @@ For most use cases it is necessary:
* _instance_
* [.ActivityFeed](#Route4Me+ActivityFeed) : <code>ActivityFeed</code>
* [.AddressBook](#Route4Me+AddressBook) : <code>AddressBook</code>
* [.AddressBookV5](#Route4Me+AddressBookV5) : <code>AddressBookV5</code>
* [.AddressBarcodes](#Route4Me+AddressBarcodes) : <code>AddressBarcodes</code>
* [.Addresses](#Route4Me+Addresses) : <code>Addresses</code>
* [.AvoidanceZones](#Route4Me+AvoidanceZones) : <code>AvoidanceZones</code>
Expand Down Expand Up @@ -157,7 +159,7 @@ Create new API client
| [options.baseUrl] | <code>string</code> | <code>&quot;https://api.route4me.com&quot;</code> | Base URL for sending requests |
| [options.baseUrl5] | <code>string</code> | <code>&quot;https://wh.route4me.com/modules&quot;</code> | Base URL for sending requests to backend API v.5 |
| [options.logger] | [<code>ILogger</code>](#ILogger) | <code></code> | Logger facility |
| [options.promise] | <code>boolean/function</code> | <code>false</code> | Use promises instead of callbacks. Usage: * `false` means _no promises, use callbacks_; * `true` means _use global `Promise`_ as promises' constructor; * `constructor (function)` forces to use explicit Promise library. See also Examples section of this documentation. |
| [options.promise] | <code>boolean</code> \| <code>function</code> | <code>false</code> | Use promises instead of callbacks. Usage: * `false` means _no promises, use callbacks_; * `true` means _use global `Promise`_ as promises' constructor; * `constructor (function)` forces to use explicit Promise library. See also Examples section of this documentation. |
| [options.validate] | <code>module:route4me-node~ValidationCallback</code> | <code>false</code> | Validator for input and output parameters of the API methods. Set **falsey** value to skip autovalidation (in favor of manual check). |

<a id="Route4Me+ActivityFeed" name="Route4Me+ActivityFeed"></a>
Expand All @@ -173,6 +175,13 @@ Create new API client

**AddressBook** related API calls

**Since**: 0.1.8
<a id="Route4Me+AddressBookV5" name="Route4Me+AddressBookV5"></a>

### route4Me.AddressBookV5 : <code>AddressBookV5</code>

**AddressBookV5** related API calls

**Since**: 0.1.8
<a id="Route4Me+AddressBarcodes" name="Route4Me+AddressBarcodes"></a>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "route4me-node",
"version": "1.0.10",
"version": "1.0.11",
"description": "Access Route4Me's logistics-as-a-service API using our Node.js SDK",
"main": "./dist/",
"browser": "./dist/browser/route4me.js",
Expand Down
5 changes: 2 additions & 3 deletions src/request-manager.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict"

const request = require("superagent")

const errors = require("./errors")
const request = require("superagent")
const errors = require("./errors")

class ResponseHandler {
constructor(PromiseConstructor, logger, validate, validateContext, callback) {
Expand Down
Loading