Class: Transport

Transport

Handles fetching.

This class should not be used directly, but should instead be obtained from ServiceDescriptor#resourcefulEndpoint or ServiceDescriptor#businessEndpoint


new Transport(options, encodeUri)

Parameters:
Name Type Argument Description
options TransportDefaults <nullable>

The options to use with all fetch requests

encodeUri string <nullable>

Indicate whether to encode request URIs generated. Defaults false

Properties:
Name Type Argument Description
defaults TransportDefaults <nullable>

Stored from the initial 'options' parameter merged with the standard defaults

Source:
Example
import Transport from '@pikselpalette/sequoia-js-client-sdk/lib/transport';

const transport = new Transport({method: 'POST'});
transport.fetchWithDefaults('someurl').then((response) => console.log(response);

Methods


destroy(url, options)

Performs an HTTP DELETE request

Parameters:
Name Type Description
url string

sequoia url

options object

fetch options

Source:
Returns:
Type
Promise

encodeUrl(url)

Encodes the request url if this.encodeUri is true.

Parameters:
Name Type Description
url string

the url to potentially encode

Source:

fetchWithDefaults(url, options)

Performs a fetch with the default options from Transport

Parameters:
Name Type Description
url string

sequoia url

options object

fetch options

Source:
Returns:
Type
Promise

get(url, options)

Performs an HTTP GET request

Parameters:
Name Type Description
url string

sequoia url

options object

fetch options

Source:
Returns:
Type
Promise

post(url, options)

Performs an HTTP POST request

Parameters:
Name Type Description
url string

sequoia url

options object

fetch options

Source:
Returns:
Type
Promise

put(url, options)

Performs an HTTP PUT request

Parameters:
Name Type Description
url string

sequoia url

options object

fetch options

Source:
Returns:
Type
Promise