Constructor
new PutRequest(pkopt, …objectsopt)
Creates a new PutRequest
instance. A PUT request instructs StashKu to update existing objects in storage.
Parameters
-
pk
Array.<String>
<optional>
The property name(s) that are used to uniquely identify each object.
-
objects
M
<optional>
<repeatable>
Spread of objects to create in update in storage.
Source
Members
methodString
Type
-
String
Source
Methods
clear() → {module:requests/put-request~PutRequest.<M>}
Clears all configured metadata on the request, resetting it to a default state.
Returns
Source
count(enabledopt) → {module:requests/put-request~PutRequest.<M>}
Requests that the response return count numbers (total, affected, returned, etc.) but not objects.
This will result in a Response
with an empty data
array and may result in faster query execution if you
only need the resulting numbers.
Calling this function without an argument enables the flag.
Parameters
-
enabled
Boolean
<optional>
trueA
true
enables the count-only result. Afalse
disables it.
Returns
Source
headers(dictionary) → {module:requests/put-request~PutRequest.<M>}
Sets or clears headers on the request that can be used to set engine-specific options for the request.
If a null
value is passed, the headers are cleared.
Parameters
-
dictionary
Object
|Map.<String, *>
A map or object defining the headers and values.
Returns
Throws
-
Error when the dictionary argument uses a non-string key.
-
Error when the dictionary argument is not an object, null, or a Map.
Source
objects(…objectsopt) → {module:requests/put-request~PutRequest.<M>}
Adds objects to the PUT request. If any object has already been added to the request, it is skipped.
If a single null
value is passed, all objects are cleared from the request.
Parameters
-
objects
M
<optional>
<repeatable>
Spread of objects to update in data storage, as matched by
pk
property values.
Returns
Source
pk(…primaryKeys) → {module:requests/put-request~PutRequest.<M>}
Defines the primary key property name(s) used to uniquely identify each object defined in the request and storage
resource.
If a null
value is passed, all PKs are cleared from the request.
Parameters
-
primaryKeys
String
|Array.<(String|Modeling.PropertyDefinition)>
<repeatable>
Spread of property names used to uniquely identify each object.
Returns
Source
to(name) → {module:requests/put-request~PutRequest.<M>}
Sets the target resource name for the request, optionally specifying an alias for use with specifying properties across joins.
Parameters
-
name
String
The name of the target resource in data storage.
Returns
Throws
Error if the "name" argument value is not a string or null.
Source
toJSON() → {*}
Returns the metadata object to be utilized for stringifying into JSON.
Returns
-
*