Class: LinoClient

LinoClient(baseUrl, optionsopt)

A client for a service that speaks Links Notation.

Constructor

new LinoClient(baseUrl, optionsopt)

Parameters:
Name Type Attributes Description
baseUrl string

Base URL of the service

options object <optional>

Client options

Properties
Name Type Attributes Description
accept string <optional>

Accept header sent with every request

contentType string <optional>

Representation used for request bodies

headers object <optional>

Headers sent with every request

fetch function <optional>

fetch implementation to use

Source:

Classes

LinoClient

Methods

delete(path, optionsopt) → {Promise.<object>}

DELETE a resource.

Parameters:
Name Type Attributes Description
path string

Path

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

(async) describe() → {Promise.<object>}

Fetch the service description of specification ยง9.

Source:
Returns:

Description document

Type
Promise.<object>

get(path, optionsopt) → {Promise.<object>}

GET a resource.

Parameters:
Name Type Attributes Description
path string

Path

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

HEAD a resource.

Parameters:
Name Type Attributes Description
path string

Path

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

(async) list(path, queryopt, optionsopt) → {Promise.<{items: Array.<object>, page: object}>}

List a collection, returning the decoded envelope.

Parameters:
Name Type Attributes Description
path string

Collection path

query object <optional>

Collection query parameters

options object <optional>

Request options

Source:
Returns:

Collection envelope

Type
Promise.<{items: Array.<object>, page: object}>

(async) options(path, optionsopt) → {Promise.<Array.<string>>}

OPTIONS a path, returning the advertised methods.

Parameters:
Name Type Attributes Description
path string

Path

options object <optional>

Request options

Source:
Returns:

Methods listed in Allow

Type
Promise.<Array.<string>>

patch(path, body, optionsopt) → {Promise.<object>}

PATCH a representation.

Parameters:
Name Type Attributes Description
path string

Path

body *

Value to send

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

post(path, body, optionsopt) → {Promise.<object>}

POST to a collection.

Parameters:
Name Type Attributes Description
path string

Path

body *

Value to send

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

put(path, body, optionsopt) → {Promise.<object>}

PUT a representation.

Parameters:
Name Type Attributes Description
path string

Path

body *

Value to send

options object <optional>

Request options

Source:
Returns:

Decoded response

Type
Promise.<object>

(async) request(method, path, optionsopt) → {Promise.<{status: number, headers: Headers, data: *, etag: (string|null), location: (string|null), response: Response}>}

Perform a request and decode the response.

Parameters:
Name Type Attributes Description
method string

HTTP method

path string

Path, appended to the base URL

options object <optional>

Request options

Properties
Name Type Attributes Description
body * <optional>

Value to encode as the request body

query object <optional>

Query parameters

headers object <optional>

Extra request headers

accept string <optional>

Override the Accept header

ifMatch string <optional>

If-Match precondition

ifNoneMatch string <optional>

If-None-Match precondition

signal AbortSignal <optional>

Abort signal

Source:
Throws:

For any 4xx or 5xx response

Type
LinoClientError
Returns:

Decoded response

Type
Promise.<{status: number, headers: Headers, data: *, etag: (string|null), location: (string|null), response: Response}>