src/modules/qbAddressBook.js
function(isCompactOrCallback, callback) {
    var self = this;
    var isCompact, cb;

    if(isFunction(isCompactOrCallback)) {
      cb = isCompactOrCallback;
    } else {
      isCompact = isCompactOrCallback;
      cb = callback;
    }

    if(!isFunction(cb)) {
      throw new Error('The QB.addressbook.get accept callback function is required.');
    }

    var ajaxParams = {
      'type': 'GET',
      'url': Utils.getUrl(config.urls.addressbookRegistered),
      'contentType': 'application/json; charset=utf-8'
    };

    if(isCompact) {
      ajaxParams.data = {'compact': 1};
    }

    this.service.ajax(ajaxParams, function(err, res) {
      if (err) {
        // Don't ask me why.
        // Thanks to backend developers for this
        var isFakeErrorEmptyAddressBook = self._isFakeErrorEmptyAddressBook(err);

        if(isFakeErrorEmptyAddressBook) {
          cb(null, []);
        } else {
          cb(err, null);
        }
      } else {
        cb(null, res);
      }
    });
  }
function(isCompactOrCallback, callback) {
    var self = this;
    var isCompact, cb;

    if(isFunction(isCompactOrCallback)) {
      cb = isCompactOrCallback;
    } else {
      isCompact = isCompactOrCallback;
      cb = callback;
    }

    if(!isFunction(cb)) {
      throw new Error('The QB.addressbook.get accept callback function is required.');
    }

    var ajaxParams = {
      'type': 'GET',
      'url': Utils.getUrl(config.urls.addressbookRegistered),
      'contentType': 'application/json; charset=utf-8'
    };

    if(isCompact) {
      ajaxParams.data = {'compact': 1};
    }

    this.service.ajax(ajaxParams, function(err, res) {
      if (err) {
        // Don't ask me why.
        // Thanks to backend developers for this
        var isFakeErrorEmptyAddressBook = self._isFakeErrorEmptyAddressBook(err);

        if(isFakeErrorEmptyAddressBook) {
          cb(null, []);
        } else {
          cb(err, null);
        }
      } else {
        cb(null, res);
      }
    });
  }
function ( isCompactOrCallback , callback ) { var self = this ; var isCompact , cb ; if ( isFunction ( isCompactOrCallback ) ) { cb = isCompactOrCallback ; } else { isCompact = isCompactOrCallback ; cb = callback ; } if ( ! isFunction ( cb ) ) { throw new Error ( 'The QB.addressbook.get accept callback function is required.' ) ; } var ajaxParams = { 'type' : 'GET' , 'url' : Utils . getUrl ( config . urls . addressbookRegistered ) , 'contentType' : 'application/json; charset=utf-8' } ; if ( isCompact ) { ajaxParams . data = { 'compact' : 1 } ; } this . service . ajax ( ajaxParams , function ( err , res ) { if ( err ) { // Don't ask me why. // Thanks to backend developers for this var isFakeErrorEmptyAddressBook = self . _isFakeErrorEmptyAddressBook ( err ) ; if ( isFakeErrorEmptyAddressBook ) { cb ( null , [ ] ) ; } else { cb ( err , null ) ; } } else { cb ( null , res ) ; } } ) ; }
Retrieve QuickBlox users that have phone numbers from your address book.
The methods accepts 1 or 2 parameters.
@memberof QB.addressbook
@param {boolean|function} udidOrCallback - You can pass isCompact parameter or callback object. If isCompact is passed then only user's id and phone fields will be returned from server. Otherwise - all standard user's fields will be returned.
@param {function} [callback] - Callback function is useв as 2nd parameter if you pass `isCompact` as 1st parameter.
This callback takes 2 arguments: an error and a response.
Retrieve QuickBlox users that have phone numbers from your address book . The methods accepts 1 or 2 parameters .