index.js
function listRecords(options) {
    return getZone(options.domain).then(function (zone) {
      return self.cloudflareClient.findRecord(zone.id, {page: 1, per_page: self.perPage})
        .then(function (response) {
          let promises = [Promise.resolve(response)];
          for (let i = 2; i <= response.data['result_info']['total_pages']; i++) {
            promises.push(self.cloudflareClient.findRecord(zone.id, {page: i, per_page: self.perPage}));
          }
          return Promise.all(promises);
        });
    }).then(function (responses) {
      let rows = [];
      _.each(responses, function (response) {
        _.each(response.data.result, function (item) {
          item.ttl = (item.ttl === 1) ? 'Auto' : item.ttl;
          rows.push(item);
        });
      });
      return new Result(rows);
    });
  }
function listRecords(options) {
    return getZone(options.domain).then(function (zone) {
      return self.cloudflareClient.findRecord(zone.id, {page: 1, per_page: self.perPage})
        .then(function (response) {
          let promises = [Promise.resolve(response)];
          for (let i = 2; i <= response.data['result_info']['total_pages']; i++) {
            promises.push(self.cloudflareClient.findRecord(zone.id, {page: i, per_page: self.perPage}));
          }
          return Promise.all(promises);
        });
    }).then(function (responses) {
      let rows = [];
      _.each(responses, function (response) {
        _.each(response.data.result, function (item) {
          item.ttl = (item.ttl === 1) ? 'Auto' : item.ttl;
          rows.push(item);
        });
      });
      return new Result(rows);
    });
  }
function listRecords ( options ) { return getZone ( options . domain ) . then ( function ( zone ) { return self . cloudflareClient . findRecord ( zone . id , { page : 1 , per_page : self . perPage } ) . then ( function ( response ) { let promises = [ Promise . resolve ( response ) ] ; for ( let i = 2 ; i <= response . data [ 'result_info' ] [ 'total_pages' ] ; i ++ ) { promises . push ( self . cloudflareClient . findRecord ( zone . id , { page : i , per_page : self . perPage } ) ) ; } return Promise . all ( promises ) ; } ) ; } ) . then ( function ( responses ) { let rows = [ ] ; _ . each ( responses , function ( response ) { _ . each ( response . data . result , function ( item ) { item . ttl = ( item . ttl === 1 ) ? 'Auto' : item . ttl ; rows . push ( item ) ; } ) ; } ) ; return new Result ( rows ) ; } ) ; }
List records for given domain
@param options
@returns {Promise}
List records for given domain