function request
request(
device: Device,
path: string,
): Promise<Response>

Sends one request to a path and returns the response as is.

Parameters

device: Device

Where the device is and how to log in.

path: string

The path, starting with /.

optional
init: RequestInit

Extra request options, passed to fetch.

Return Type

Promise<Response>

The response, whatever its status.

request<T>(
device: Device,
resource: Resource<T>,
): Promise<T>

Reads one resource from a device.

Type Parameters

The decoded value.

Parameters

device: Device

Where the device is and how to log in.

resource: Resource<T>

What to read and how to decode it.

optional
init: RequestInit

Extra request options, passed to fetch.

Return Type

Promise<T>

The decoded document.

Throws

IsapiError

When the request fails: a status outside 2xx, or a failing <ResponseStatus> on any status.