search(params) {
    return this.list(params)
      .then(response => {
        if (response.list.length === 0) {
          return Bluebird.reject(new Error('Not Found')); // reject if no results
        }
        if (response.list.length === 1) {
          response.element = response.list[0];
          return Bluebird.resolve(response); // simulate search one
        }
        return Bluebird.resolve(response);
      });
  }
/**
   * Like list but rejects if no results, and adds a body member if there is only one result
   * @param {Object} params
   * @returns {Promise<Object>}
   */
Like list but rejects if no results, and adds a body member if there is only one result
@param {Object} params
@returns {Promise}
Like list but rejects if no results and adds a body member if there is only one result @param { Object } params @returns { Promise }
search(params) {
    return this.list(params)
      .then(response => {
        if (response.list.length === 0) {
          return Bluebird.reject(new Error('Not Found')); 
        }
        if (response.list.length === 1) {
          response.element = response.list[0];
          return Bluebird.resolve(response); 
        }
        return Bluebird.resolve(response);
      });
  }
search ( params ) { return this . list ( params ) . then ( response => { if ( response . list . length === 0 ) { return Bluebird . reject ( new Error ( 'Not Found' ) ) ; } if ( response . list . length === 1 ) { response . element = response . list [ 0 ] ; return Bluebird . resolve ( response ) ; } return Bluebird . resolve ( response ) ; } ) ; }
Like list but rejects if no results, and adds a body member if there is only one result
 @param {Object} params
 @returns {Promise<Object>}
Like list but rejects if no results and adds a body member if there is only one result @param { Object } params @returns { Promise<Object > }
// reject if no results // simulate search one