Constructor
new FetchEngine()
Creates a new FetchEngine
instance.
Source
Members
configFetchEngine
Type
Source
dataMap.<String, Array>
Type
-
Map.<String, Array>
Source
Methods
configure(config)
Parameters
-
config
FetchEngine
The configuration object for the storage engine.
Source
delete(request) → {Promise.<module:response~Response>}
Parameters
-
request
DeleteRequest
The DELETE request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were deleted with the request criteria.
Source
get(request) → {Promise.<module:response~Response>}
Parameters
-
request
GetRequest
The GET request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage matching request criteria.
Source
options(request) → {Promise.<module:response~Response>}
Parameters
-
request
OptionsRequest
The OPTIONS request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns a response with a single data object- the dynamically created model configuration.
Source
patch(request) → {Promise.<module:response~Response>}
Parameters
-
request
PatchRequest
The PATCH request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns a response with the total number of the objects affected in storage. No data objects are typically returned with this request.
Source
post(request) → {Promise.<module:response~Response>}
Parameters
-
request
PostRequest
The POST request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were created with the request criteria.
Source
put(request) → {Promise.<module:response~Response>}
Parameters
-
request
PutRequest
The PUT request to send to the storage engine.
Returns
-
Promise.<module:response~Response>
Returns the data objects from storage that were updated with the request criteria. This may not exactly match the objects requested to be updated, as some may have been deleted from storage or some may not match the key criteria.
Source
resources() → {Promise.<Array.<String>>}
Returns
-
Promise.<Array.<String>>
Source
Type Definitions
Configuration
Properties
-
root
String
<optional>
The root URI of each fetch request. If specified, will be prefixed to each resource.
-
path
String
<optional>
"/api"
The path to the URI endpoint. This is prefixed before each resource, but after the
root
(if specified). -
trailingSlash
Boolean
<optional>
false
Sets whether a slash will be added at the end of the generated URI.
-
omitResource
Boolean
<optional>
false
Omits
to
andfrom
properties and values from the request payload sent over fetch. This may help force endpoints to ensure the resource is determined on their end instead of by the requestor. -
model
FetchEngine
<optional>
-
fetch
RequestInit
<optional>
Optional fetch defaults to apply before request-specific configuration is set.
Source
ModelConfiguration
Properties
-
pathProperty
String
<optional>
"resource"
Instructs StashKu which property from the
$stashku
object on a model type to populate the resource (to
orfrom
) on a request. Can be"name"
,"slug"
,"plural.name"
,"plural.slug"
, or"resource"
(default). -
header
Boolean
<optional>
false
Determines whether the fetch request to the HTTP endpoint will include the model header when
STASHKU_MODEL_HEADER
is enabled. By default this is disabled and the headermodel
property will not be sent. Setting this flag totrue
will forward themodel
header of the StashKu request.