function (path) {
    var url = 'https://api.dropboxapi.com/2/files/list_folder';
    var revCache = this._revCache;
    var self = this;

    var processResponse = function (resp) {
      var body, listing;

      if (resp.status !== 200 && resp.status !== 409) {
        return Promise.reject('Unexpected response status: ' + resp.status);
      }

      try {
        body = JSON.parse(resp.responseText);
      } catch (e) {
        return Promise.reject(e);
      }

      if (resp.status === 409) {
        if (compareApiError(body, ['path', 'not_found'])) {
          // if the folder is not found, handle it as an empty folder
          return Promise.resolve({});
        }

        return Promise.reject(new Error('API returned an error: ' + body.error_summary));
      }

      listing = body.entries.reduce(function (map, item) {
        var isDir = item['.tag'] === 'folder';
        var itemName = item.path_lower.split('/').slice(-1)[0] + (isDir ? '/' : '');
        if (isDir){
          map[itemName] = { ETag: revCache.get(path+itemName) };
        } else {
          map[itemName] = { ETag: item.rev };
          self._revCache.set(path+itemName, item.rev);
        }
        return map;
      }, {});

      if (body.has_more) {
        return loadNext(body.cursor).then(function (nextListing) {
          return Object.assign(listing, nextListing);
        });
      }

      return Promise.resolve(listing);
    };

    const loadNext = function (cursor) {
      const continueURL = 'https://api.dropboxapi.com/2/files/list_folder/continue';
      const params = {
        body: { cursor: cursor }
      };

      return self._request('POST', continueURL, params).then(processResponse);
    };

    return this._request('POST', url, {
      body: {
        path: getDropboxPath(path)
      }
    }).then(processResponse).then(function (listing) {
      return Promise.resolve({
        statusCode: 200,
        body: listing,
        contentType: 'application/json; charset=UTF-8',
        revision: revCache.get(path)
      });
    });
  }
function (path) {
    var url = 'https:
    var revCache = this._revCache;
    var self = this;

    var processResponse = function (resp) {
      var body, listing;

      if (resp.status !== 200 && resp.status !== 409) {
        return Promise.reject('Unexpected response status: ' + resp.status);
      }

      try {
        body = JSON.parse(resp.responseText);
      } catch (e) {
        return Promise.reject(e);
      }

      if (resp.status === 409) {
        if (compareApiError(body, ['path', 'not_found'])) {
          
          return Promise.resolve({});
        }

        return Promise.reject(new Error('API returned an error: ' + body.error_summary));
      }

      listing = body.entries.reduce(function (map, item) {
        var isDir = item['.tag'] === 'folder';
        var itemName = item.path_lower.split('/').slice(-1)[0] + (isDir ? '/' : '');
        if (isDir){
          map[itemName] = { ETag: revCache.get(path+itemName) };
        } else {
          map[itemName] = { ETag: item.rev };
          self._revCache.set(path+itemName, item.rev);
        }
        return map;
      }, {});

      if (body.has_more) {
        return loadNext(body.cursor).then(function (nextListing) {
          return Object.assign(listing, nextListing);
        });
      }

      return Promise.resolve(listing);
    };

    const loadNext = function (cursor) {
      const continueURL = 'https:
      const params = {
        body: { cursor: cursor }
      };

      return self._request('POST', continueURL, params).then(processResponse);
    };

    return this._request('POST', url, {
      body: {
        path: getDropboxPath(path)
      }
    }).then(processResponse).then(function (listing) {
      return Promise.resolve({
        statusCode: 200,
        body: listing,
        contentType: 'application/json; charset=UTF-8',
        revision: revCache.get(path)
      });
    });
  }
function ( path ) { var url = 'https://api.dropboxapi.com/2/files/list_folder' ; var revCache = this . _revCache ; var self = this ; var processResponse = function ( resp ) { var body , listing ; if ( resp . status !== 200 && resp . status !== 409 ) { return Promise . reject ( 'Unexpected response status: ' + resp . status ) ; } try { body = JSON . parse ( resp . responseText ) ; } catch ( e ) { return Promise . reject ( e ) ; } if ( resp . status === 409 ) { if ( compareApiError ( body , [ 'path' , 'not_found' ] ) ) { // if the folder is not found, handle it as an empty folder return Promise . resolve ( { } ) ; } return Promise . reject ( new Error ( 'API returned an error: ' + body . error_summary ) ) ; } listing = body . entries . reduce ( function ( map , item ) { var isDir = item [ '.tag' ] === 'folder' ; var itemName = item . path_lower . split ( '/' ) . slice ( - 1 ) [ 0 ] + ( isDir ? '/' : '' ) ; if ( isDir ) { map [ itemName ] = { ETag : revCache . get ( path + itemName ) } ; } else { map [ itemName ] = { ETag : item . rev } ; self . _revCache . set ( path + itemName , item . rev ) ; } return map ; } , { } ) ; if ( body . has_more ) { return loadNext ( body . cursor ) . then ( function ( nextListing ) { return Object . assign ( listing , nextListing ) ; } ) ; } return Promise . resolve ( listing ) ; } ; const loadNext = function ( cursor ) { const continueURL = 'https://api.dropboxapi.com/2/files/list_folder/continue' ; const params = { body : { cursor : cursor } } ; return self . _request ( 'POST' , continueURL , params ) . then ( processResponse ) ; } ; return this . _request ( 'POST' , url , { body : { path : getDropboxPath ( path ) } } ) . then ( processResponse ) . then ( function ( listing ) { return Promise . resolve ( { statusCode : 200 , body : listing , contentType : 'application/json; charset=UTF-8' , revision : revCache . get ( path ) } ) ; } ) ; }
Get all items in a folder.

@param path {string} - path of the folder to get, with leading slash
@return {Object}
statusCode - HTTP status code
body - array of the items found
contentType - 'application/json; charset=UTF-8'
revision - revision of the folder

@private
Get all items in a folder .