FetchService

FetchService Class.

Provides a wrapper around the native fetch API with integrated logging. It logs the start, completion, and any errors for each API request.

Constructor

new FetchService(options)

Creates an instance of FetchService.

Creates an instance of FetchService.

Parameters:
NameTypeDescription
optionsFetchServiceOptions

Configuration options for the fetch service.

Methods

(async) delete(url, optionsopt) → {Promise.<Response>}

Performs a DELETE request.

Performs a DELETE request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the DELETE request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) delete(url, optionsopt) → {Promise.<Response>}

Performs a DELETE request.

Performs a DELETE request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the DELETE request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) get(url, optionsopt) → {Promise.<Response>}

Performs a GET request.

Performs a GET request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the GET request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) get(url, optionsopt) → {Promise.<Response>}

Performs a GET request.

Performs a GET request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the GET request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) post(url, body, optionsopt) → {Promise.<Response>}

Performs a POST request.

Performs a POST request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the POST request.

optionsRequestInit<optional>

Additional fetch options for the POST request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) post(url, body, optionsopt) → {Promise.<Response>}

Performs a POST request.

Performs a POST request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the POST request.

optionsRequestInit<optional>

Additional fetch options for the POST request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) put(url, body, optionsopt) → {Promise.<Response>}

Performs a PUT request.

Performs a PUT request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the PUT request.

optionsRequestInit<optional>

Additional fetch options for the PUT request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) put(url, body, optionsopt) → {Promise.<Response>}

Performs a PUT request.

Performs a PUT request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the PUT request.

optionsRequestInit<optional>

Additional fetch options for the PUT request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) request(url, optionsopt) → {Promise.<Response>}

Performs a fetch request and logs the process.

Performs a fetch request and logs the process.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Options for the fetch request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) request(url, optionsopt) → {Promise.<Response>}

Performs a fetch request and logs the process.

Performs a fetch request and logs the process.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Options for the fetch request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

FetchService

FetchService Class.

Provides a wrapper around the native fetch API with integrated logging. It logs the start, completion, and any errors for each API request.

Constructor

new FetchService(options)

Creates an instance of FetchService.

Creates an instance of FetchService.

Parameters:
NameTypeDescription
optionsFetchServiceOptions

Configuration options for the fetch service.

Methods

(async) delete(url, optionsopt) → {Promise.<Response>}

Performs a DELETE request.

Performs a DELETE request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the DELETE request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) delete(url, optionsopt) → {Promise.<Response>}

Performs a DELETE request.

Performs a DELETE request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the DELETE request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) get(url, optionsopt) → {Promise.<Response>}

Performs a GET request.

Performs a GET request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the GET request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) get(url, optionsopt) → {Promise.<Response>}

Performs a GET request.

Performs a GET request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Additional fetch options for the GET request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) post(url, body, optionsopt) → {Promise.<Response>}

Performs a POST request.

Performs a POST request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the POST request.

optionsRequestInit<optional>

Additional fetch options for the POST request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) post(url, body, optionsopt) → {Promise.<Response>}

Performs a POST request.

Performs a POST request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the POST request.

optionsRequestInit<optional>

Additional fetch options for the POST request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) put(url, body, optionsopt) → {Promise.<Response>}

Performs a PUT request.

Performs a PUT request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the PUT request.

optionsRequestInit<optional>

Additional fetch options for the PUT request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) put(url, body, optionsopt) → {Promise.<Response>}

Performs a PUT request.

Performs a PUT request.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

body*

The payload to send with the PUT request.

optionsRequestInit<optional>

Additional fetch options for the PUT request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) request(url, optionsopt) → {Promise.<Response>}

Performs a fetch request and logs the process.

Performs a fetch request and logs the process.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Options for the fetch request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>

(async) request(url, optionsopt) → {Promise.<Response>}

Performs a fetch request and logs the process.

Performs a fetch request and logs the process.

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request.

optionsRequestInit<optional>

Options for the fetch request.

Returns:

A promise that resolves to the fetch response.

Type: 
Promise.<Response>