Commit 391f3ada authored by Patricio Bruna's avatar Patricio Bruna

getAllXxxs() change order of params, first its query_object

parent 6d6d770d
......@@ -108,9 +108,9 @@ A successful response will always return a `Object` named after the `Resource` y
### GetAll and Search
You have the following functions:
* `getAllAccounts(callback, query_object)`,
* `getAllDomains(callback, query_object)`,
* `getAllDistributionLists(callback, query_object)`,
* `getAllAccounts(query_object, callback)`,
* `getAllDomains(query_object, callback)`,
* `getAllDistributionLists(query_object, callback)`,
`query_object` is an **optional** `Object` that accept the following attributes:
......@@ -176,7 +176,7 @@ zimbraApi.getAllAccounts(callback);
```javascript
var query_object = { domain: 'example.com' }
zimbraApi.getAllDistributionLists(callback, query_object);
zimbraApi.getAllDistributionLists(query_object, callback);
// Object {total: 6, more: false, dl: Array[6]}
```
......@@ -184,7 +184,7 @@ zimbraApi.getAllDistributionLists(callback, query_object);
```javascript
var query_object = { query: 'mail=*basic*' }
zimbraApi.getAllAccounts(callback, query_object);
zimbraApi.getAllAccounts(query_object, callback);
// Object {total: 29, more: false, account: Array[29]}
```
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "zimbra-admin-api-js",
"version": "0.3.0",
"version": "0.3.1",
"main": "src/index.js",
"dependencies": {
"crypto-browserify": "^3.11.0",
......
......@@ -368,25 +368,41 @@ class ZimbraAdminApi {
return this.performRequest(request_data);
}
getAllDomains(callback, query_object) {
getAllDomains(query_object, callback) {
if (arguments.length === 1) {
callback = query_object;
query_object = null;
}
query_object = query_object || {};
query_object.types = 'domains';
return this.directorySearch(query_object, callback);
}
getAllAccounts(callback, query_object) {
getAllAccounts(query_object, callback) {
if (arguments.length === 1) {
callback = query_object;
query_object = null;
}
query_object = query_object || {};
query_object.types = 'accounts';
return this.directorySearch(query_object, callback);
}
getAllDistributionLists(callback, query_object) {
getAllDistributionLists(query_object, callback) {
if (arguments.length === 1) {
callback = query_object;
query_object = null;
}
query_object = query_object || {};
query_object.types = 'distributionlists';
return this.directorySearch(query_object, callback);
}
getAllAliases(callback, query_object) {
getAllAliases(query_object, callback) {
if (arguments.length === 1) {
callback = query_object;
query_object = null;
}
query_object = query_object || {};
query_object.types = 'aliases';
return this.directorySearch(query_object, callback);
......
......@@ -91,7 +91,7 @@ class Domain extends Zimbra {
const that = this;
const admins_ids = this.getAdminsIdsFromGrants(this.attrs.zimbraACE);
const query = this.makeAdminIdsQuery(admins_ids);
return this.api.getAllAccounts(callback, {query: query});
return this.api.getAllAccounts({query: query}, callback);
}
// Return the ZimbraId if the grantee have the domainAdminRights right
......@@ -107,11 +107,11 @@ class Domain extends Zimbra {
getAllDistributionLists(callback) {
let query_object = { domain: this.name };
this.api.getAllDistributionLists(function(e,d){
this.api.getAllDistributionLists(query_object, function(e,d){
if (e) return callback(e);
if (d.total === 0) return callback(null, []);
return callback(null, d.dl);
}, query_object);
});
}
checkMxRecord(callback) {
......
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