Skip to content

Commit b06f404

Browse files
author
Matt Willer
authored
Deprecate methods related to Batch API (#433)
1 parent 72acfa8 commit b06f404

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

lib/box-client.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,16 +612,27 @@ BoxClient.prototype.upload = function(path, params, formData, callback) {
612612
/**
613613
* Puts the client into batch mode, which will queue calls instead of
614614
* immediately making the API request.
615+
*
616+
* DEPRECATED: Batch API is not supported and should not be used; make calls in parallel instead.
617+
*
615618
* @returns {BoxClient} Current client object
616619
*/
617-
BoxClient.prototype.batch = function() {
618-
620+
BoxClient.prototype.batch = util.deprecate(function() {
621+
/* eslint-disable no-invalid-this */
619622
this._batch = [];
620623
return this;
621-
};
622-
623-
BoxClient.prototype.batchExec = function(callback) {
624+
/* eslint-enable no-invalid-this */
625+
}, 'Batch API is not supported and should not be used; make calls in parallel instead.');
624626

627+
/**
628+
* Executes a batch of requests.
629+
*
630+
* DEPRECATED: Batch API is not supported and should not be used; make calls in parallel instead.
631+
*
632+
* @returns {Promise<Object>} Promise resolving to the collection of batch responses
633+
*/
634+
BoxClient.prototype.batchExec = util.deprecate(function(callback) {
635+
/* eslint-disable no-invalid-this */
625636
if (!this._batch) {
626637
return Promise.reject(new Error('Must start a batch before executing'))
627638
.asCallback(callback);
@@ -652,7 +663,8 @@ BoxClient.prototype.batchExec = function(callback) {
652663
throw err;
653664
})
654665
.asCallback(callback);
655-
};
666+
/* eslint-enable no-invalid-this */
667+
}, 'Batch API is not supported and should not be used; make calls in parallel instead.');
656668

657669
/**
658670
* Build the 'BoxApi' Header used for authenticating access to a shared item

0 commit comments

Comments
 (0)