TransportationServer

TransportationServer

Facilitates interaction with the Transportation server.

Constructor

new TransportationServer(sdk, serverUrl, opts)

Create a new Transportation server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

Transportation URL.

opts Object
Name Type Attributes Default Description
allowHttp boolean <optional>

Allow connecting to http servers, default: false. This must be set to false in production deployments!

proxy Object <optional>

Proxy configuration. Look axios docs for more info

httpBasicAuth Object <optional>

HTTP basic auth credentials. Look axios docs for more info.

customHeaders Object <optional>

Custom headers for request.

responseType string <optional>
'json'

Indicates the type of data that the server will respond with options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'.

Classes

TransportationServer

Members

v2

TransportationV2.

Source:

Methods

(async) getCities() → {Promise.<JsonApiResponse>}

Get available cities.

Source:
Returns:
Type:
Promise.<JsonApiResponse>

Transportation response.

(async) getPrice(query) → {JsonApiResponse}

Get transportation price.

Source:
Parameters:
Name Type Description
query object

Request options.

Name Type Attributes Description
cityId number <optional>

City ID.

lotType string <optional>

Lot type.

city string <optional>

City.

zip string <optional>

ZIP code.

state string <optional>

State code. E.g. "CA"

destination string <optional>

Destination country ISO code.

Returns:
Type:
JsonApiResponse

(async) getPriceBulk(cities) → {JsonApiResponse}

Calculate multiple transportation prices.

Source:
Parameters:
Name Type Attributes Description
cities Array.<object>

Array of cities data.

Name Type Attributes Description
id Number <optional>

City ID.

zip string <optional>

City zip code.

name string <optional>

City name.

state string <optional>

City state.

lotId Number <optional>

Lot ID. Will be returned in response just for frontend mapping purposes.

destination string <optional>

Destination country ISO code.

query.lotType string <optional>

Lot type.

Returns:
Type:
JsonApiResponse