CartServer

CartServer

Facilitates interaction with the cart server.

Constructor

new CartServer(sdk, serverUrl, opts)

Create a new cart server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

cart 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.

withCredentials boolean <optional>

Indicates whether or not cross-site Access-Control requests should be made using credentials.

responseType string <optional>
'json'

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

Methods

(async) createRequest(opts) → {Promise.<JsonApiResponse>}

Create request.

Source:
Parameters:
Name Type Description
opts string
Name Type Attributes Description
service string

Service name.

accountId string <optional>

Account ID of requestor.

token string <optional>

Request token. The meaning of token is specific for each service.

lotId Number <optional>

ID of the lot that service is requested for.

email string <optional>

Email (for unauthorized users).

details Object <optional>

Request details.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) createService(name, price) → {Promise.<JsonApiResponse>}

Create service.

Source:
Parameters:
Name Type Description
name string

Service name.

price Number

Service price.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) deleteService(name) → {Promise.<JsonApiResponse>}

Delete service.

Source:
Parameters:
Name Type Description
name string

Service name.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) get(id) → {Promise.<JsonApiResponse>}

Get request by ID.

Source:
Parameters:
Name Type Description
id Number

Request ID.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) getCarfaxReportsCount(vin) → {Promise.<JsonApiResponse>}

Get carfax reports count.

Source:
Parameters:
Name Type Description
vin string

Vin code.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) getPage(queryopt) → {Promise.<JsonApiResponse>}

Get requests.

Source:
Parameters:
Name Type Attributes Description
query object <optional>

Request options.

Name Type Attributes Description
accountId string <optional>

Account ID of the requestor.

service string <optional>

Name of the service.

lotId Number <optional>

ID of the lot that service is requested for.

page.number Number <optional>

Page number.

page.size Number <optional>

Page size.

search string <optional>

Search by 'token' field.

sort string <optional>

Sort. Default '-created_at'.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

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

Get services.

Source:
Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) setDocuments(id, documents) → {Promise.<JsonApiResponse>}

Set documents.

Source:
Parameters:
Name Type Description
id Number

Request ID.

documents Array.<string>

Document IDs.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

Set links.

Source:
Parameters:
Name Type Description
id Number

Request ID.

links Array.<string>

Links to documents.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.

(async) updateService(name, price) → {Promise.<JsonApiResponse>}

Update service.

Source:
Parameters:
Name Type Description
name string

Service name.

price Number

Service price.

Returns:
Type:
Promise.<JsonApiResponse>

Cart response.