Commit 98521286 authored by Patricio Bruna's avatar Patricio Bruna

Update Readme with BatchRequest onError

parent 43653e37
......@@ -177,6 +177,9 @@ var allDomains = zimbraApi.getAllDomains();
zimbraApi.makeBatchRequest([allAccounts, allDomains], callback);
// Object {SearchDirectoryResponse: Array[2], _jsns: "urn:zimbra"}
// SearchDirectoryResponse[0].account, SearchDirectoryResponse[1].domain
zimbraApi.makeBatchRequest([allAccounts, allDomains], callback, {onError: 'continue'});
// By default is {onError: 'stop'}
```
......
......@@ -195,12 +195,11 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'makeBatchRequest',
value: function makeBatchRequest(request_data_array, callback) {
var batchOnError = arguments.length <= 2 || arguments[2] === undefined ? 'continue' : arguments[2];
var error = arguments.length <= 2 || arguments[2] === undefined ? { onError: 'stop' } : arguments[2];
var that = this;
var onError = batchOnError;
if (request_data_array.length === 0) return;
var request_object = this.buildRequest({ isBatch: true, batchOnError: onError });
var request_object = this.buildRequest({ isBatch: true, batchOnError: error.onError });
request_data_array.forEach(function (request_data) {
request_object.addRequest(request_data.params, function (err, reqid) {
if (err) return that.handleError(err);
This diff is collapsed.
......@@ -98,11 +98,10 @@ export default class ZimbraAdminApi {
return request;
}
makeBatchRequest(request_data_array, callback, batchOnError = 'continue') {
makeBatchRequest(request_data_array, callback, error = {onError: 'stop'}) {
const that = this;
const onError = batchOnError;
if (request_data_array.length === 0) return;
let request_object = this.buildRequest({isBatch: true, batchOnError: onError});
let request_object = this.buildRequest({isBatch: true, batchOnError: error.onError});
request_data_array.forEach((request_data) => {
request_object.addRequest(request_data.params, function(err, reqid){
if (err) return that.handleError(err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment