Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/datastore/src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,16 @@ DatastoreRequest.prototype.get = function(keys, options, callback) {

/**
* Maps to {module:datastore#save}, forcing the method to be `insert`.
*
* @param {object|object[]} entities - Datastore key object(s).
* @param {Key} entities.key - Datastore key object.
* @param {object|object[]} entities.data - Data to save with the provided key.
* If you provide an array of objects, you must use the explicit syntax:
* `name` for the name of the property and `value` for its value. You may
* also specify an `excludeFromIndexes` property, set to `true` or `false`.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {object} callback.apiResponse - The full API response.
*/
DatastoreRequest.prototype.insert = function(entities, callback) {
entities = arrify(entities)
Expand Down Expand Up @@ -990,6 +1000,16 @@ DatastoreRequest.prototype.save = function(entities, callback) {

/**
* Maps to {module:datastore#save}, forcing the method to be `update`.
*
* @param {object|object[]} entities - Datastore key object(s).
* @param {Key} entities.key - Datastore key object.
* @param {object|object[]} entities.data - Data to save with the provided key.
* If you provide an array of objects, you must use the explicit syntax:
* `name` for the name of the property and `value` for its value. You may
* also specify an `excludeFromIndexes` property, set to `true` or `false`.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {object} callback.apiResponse - The full API response.
*/
DatastoreRequest.prototype.update = function(entities, callback) {
entities = arrify(entities)
Expand All @@ -1001,6 +1021,16 @@ DatastoreRequest.prototype.update = function(entities, callback) {

/**
* Maps to {module:datastore#save}, forcing the method to be `upsert`.
*
* @param {object|object[]} entities - Datastore key object(s).
* @param {Key} entities.key - Datastore key object.
* @param {object|object[]} entities.data - Data to save with the provided key.
* If you provide an array of objects, you must use the explicit syntax:
* `name` for the name of the property and `value` for its value. You may
* also specify an `excludeFromIndexes` property, set to `true` or `false`.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {object} callback.apiResponse - The full API response.
*/
DatastoreRequest.prototype.upsert = function(entities, callback) {
entities = arrify(entities)
Expand Down