<commit_before>'use strict';
const config = require('../config.js');
const default_headers = require('../comum/default_headers.js');
const request = require('../comum/tago_request.js');

class RunUser {
  constructor(token) {
    this.token = token;
    this.default_options = {
      'json': true,
      'headers': default_headers(this)
    };
  }

  /** User info
   * @return {Promise}
   */
  info(tagoRunURL) {
    const url = `${config.api_url}/run/${tagoRunURL}/info`;
    const method = 'GET';

    const options = Object.assign({}, this.default_options, { url, method });
    return request(options);
  }

   /** Edit User Info
   * @return {Promise}
   */
  editInfo(tagoRunURL, changes = {}) {
    const url = `${config.api_url}/run/${tagoRunURL}/info`;
    const method = 'PUT';
    const data = changes;

    const options = Object.assign({}, this.default_options, { url, method, data });
    return request(options);
  }

  /** Create new TagoIO Run User (Anonymous)
   * @return {Promise}
   */
  static create(tagoRunURL, newUserObj) {
    const url = `${config.api_url}/run/${tagoRunURL}/signup`;
    const method = 'POST';
    const data = newUserObj;

    const headers = default_headers();
    const options = { url, method, headers, data };
    return request(options);
  }

  /** Login at TagoIO Run User (Anonymous)
 * @return {Promise}
 */
  static login(tagoRunURL, { email, password }) {
    const url = `${config.api_url}/run/${tagoRunURL}/login`;
    const method = 'POST';
    const data = {
      email, password,
    };

    const headers = default_headers();
    const options = { url, method, headers, data };
    return request(options);
  }

  /** Confirm User on TagoIO Run (Anonymous)
 * @return {Promise}
 */
  static confirmUser(tagoRunURL, token) {
    const url    = `${config.api_url}/run/${tagoRunURL}/confirm/${token}`;
    const method = 'GET';

    const headers = default_headers();
    const options = {url, method, headers};
    return request(options);
  }
}


module.exports = RunUser;<commit_msg>feat: added reset and change password methods on run_user<commit_after>'use strict';
const config = require('../config.js');
const default_headers = require('../comum/default_headers.js');
const request = require('../comum/tago_request.js');

class RunUser {
  constructor(token) {
    this.token = token;
    this.default_options = {
      'json': true,
      'headers': default_headers(this)
    };
  }

  /** User info
   * @return {Promise}
   */
  info(tagoRunURL) {
    const url = `${config.api_url}/run/${tagoRunURL}/info`;
    const method = 'GET';

    const options = Object.assign({}, this.default_options, { url, method });
    return request(options);
  }

   /** Edit User Info
   * @return {Promise}
   */
  editInfo(tagoRunURL, changes = {}) {
    const url = `${config.api_url}/run/${tagoRunURL}/info`;
    const method = 'PUT';
    const data = changes;

    const options = Object.assign({}, this.default_options, { url, method, data });
    return request(options);
  }

  /** Create new TagoIO Run User (Anonymous)
   * @return {Promise}
   */
  static create(tagoRunURL, newUserObj) {
    const url = `${config.api_url}/run/${tagoRunURL}/signup`;
    const method = 'POST';
    const data = newUserObj;

    const headers = default_headers();
    const options = { url, method, headers, data };
    return request(options);
  }

  /** Login at TagoIO Run User (Anonymous)
 * @return {Promise}
 */
  static login(tagoRunURL, { email, password }) {
    const url = `${config.api_url}/run/${tagoRunURL}/login`;
    const method = 'POST';
    const data = {
      email, password,
    };

    const headers = default_headers();
    const options = { url, method, headers, data };
    return request(options);
  }

  /** Confirm User on TagoIO Run (Anonymous)
 * @return {Promise}
 */
  static confirmUser(tagoRunURL, token) {
    const url    = `${config.api_url}/run/${tagoRunURL}/confirm/${token}`;
    const method = 'GET';

    const headers = default_headers();
    const options = {url, method, headers};
    return request(options);
  }

  /**
   * Sends a password recover e-mail.
   * @param  {String} tagoRunURL - the url of tago run.
   * @param  {String} email - email of the account.
   * @return {Promise}
   */
  static passwordRecover(tagoRunURL, email) {
    const url    = `${config.api_url}/run/${tagoRunURL}/passwordreset/${email}`;
    const method = 'GET';

    const headers = default_headers();
    const options = {url, method, headers};
    return request(options);
  }

  /**
   * Change password using token of the password recover.
   * @param  {string} password - <PASSWORD>
   * @return {Promise}
   */
  passwordChange(tagoRunURL, password) {
    const data   = { password };
    const url    = `${config.api_url}/run/${tagoRunURL}/passwordreset`;
    const method = 'POST';

    const options = Object.assign({}, this.default_options, {url, method, data});
    return request(options);
  }
}


module.exports = RunUser;
{'fraction_non_alphanumeric': 0.15401474397290296, 'fraction_numerical': 0.0, 'mean_word_length': 3.138499587798846, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '303571', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1591, 'n_words': 398}