Skip to main content

CotomyApi

HTTP client wrapper for calling Cotomy REST endpoints with consistent error handling.

Constructor

  • new CotomyApi(options?: ICotomyApiOptions) Creates a client with optional base URL, headers, and fetch settings.

Properties

PropertyTypeDescription
baseUrlstringBase URL used for relative paths.
headersRecord<string, string>Default request headers.
credentialsRequestCredentialsFetch credentials mode.
redirectRequestRedirectFetch redirect behavior.
cacheRequestCacheFetch cache behavior.
referrerPolicyReferrerPolicyFetch referrer policy.
modeRequestModeFetch mode (CORS, no-cors, etc.).
keepalivebooleanWhether to keep the request alive on page unload.
integritystringSubresource integrity value.
abortControllerAbortControllerController used for request cancellation.

Methods

MethodDescription
getAsync(path, parameters?)Sends a GET request with optional query parameters.
postAsync(path, body)Sends a POST request.
putAsync(path, body)Sends a PUT request.
patchAsync(path, body)Sends a PATCH request.
deleteAsync(path)Sends a DELETE request.
headAsync(path)Sends a HEAD request.
optionsAsync(path)Sends an OPTIONS request.
traceAsync(path)Sends a TRACE request.
connectAsync(path)Sends a CONNECT request.
submitAsync(form)Sends a request based on ICotomyRestSubmitForm.