<commit_before>'use strict';

let AbstractAccessor = require('./AbstractAccessor');
let Group            = require('../Model/Group');

/**
 * Groups accessor
 */
class Groups extends AbstractAccessor {
  /**
   * Constructor
   *
   * @param {Client} client Client
   */
  constructor(client) {
    super(client);

    this.Group = Group;
  }

  /**
   * Get groups
   *
   * @return {Promise} Promise for chaining
   */
  getAll() {
    let GetGroups = require('../Command/Group/GetGroups');

    return this.client.invokeCommand(new GetGroups);
  }

  /**
   * Get group by id
   *
   * @param {string} id Group Id
   *
   * @return {Promise} Promise for chaining
   */
  getById(id) {
    let GetGroup = require('../Command/Group/GetGroup');

    return this.client.invokeCommand(new GetGroup(id));
  }

  /**
   * Create group
   *
   * @param {Group} group Group
   *
   * @return {Promise} Promise for chaining
   */
  create(group) {
    let CreateGroup = require('../Command/Group/CreateGroup');

    return this.client.invokeCommand(new CreateGroup(group));
  }

  /**
   * Save group
   *
   * @param {Group} group Group
   *
   * @return {Promise} Promise for chaining
   */
  save(group) {
    let SaveGroup      = require('../Command/Group/SaveGroup');
    let SaveGroupState = require('../Command/Group/SaveGroupState');

    return Promise.all([
      this.client.invokeCommand(new SaveGroup(group)),
      this.client.invokeCommand(new SaveGroupState(group))
    ]).then(() => {
      return group;
    });
  }

  /**
   * Delete group
   *
   * @param {Group} group Group object or group Id
   *
   * @return {Promise} Promise for chaining
   */
  delete(group) {
    let DeleteGroup = require('../Command/Group/DeleteGroup');

    return this.client.invokeCommand(new DeleteGroup(group));
  }
}

module.exports = Groups;<commit_msg>GitHub #14 - Import commands<commit_after>'use strict';

let AbstractAccessor = require('./AbstractAccessor');
let Group            = require('../Model/Group');
let GetGroups        = require('../Command/Group/GetGroups');
let GetGroup         = require('../Command/Group/GetGroup');
let CreateGroup      = require('../Command/Group/CreateGroup');
let SaveGroup        = require('../Command/Group/SaveGroup');
let SaveGroupState   = require('../Command/Group/SaveGroupState');
let DeleteGroup      = require('../Command/Group/DeleteGroup');

/**
 * Groups accessor
 */
class Groups extends AbstractAccessor {
  /**
   * Constructor
   *
   * @param {Client} client Client
   */
  constructor(client) {
    super(client);

    this.Group = Group;
  }

  /**
   * Get groups
   *
   * @return {Promise} Promise for chaining
   */
  getAll() {
    return this.client.invokeCommand(new GetGroups);
  }

  /**
   * Get group by id
   *
   * @param {string} id Group Id
   *
   * @return {Promise} Promise for chaining
   */
  getById(id) {
    return this.client.invokeCommand(new GetGroup(id));
  }

  /**
   * Create group
   *
   * @param {Group} group Group
   *
   * @return {Promise} Promise for chaining
   */
  create(group) {
    return this.client.invokeCommand(new CreateGroup(group));
  }

  /**
   * Save group
   *
   * @param {Group} group Group
   *
   * @return {Promise} Promise for chaining
   */
  save(group) {
    return Promise.all([
      this.client.invokeCommand(new SaveGroup(group)),
      this.client.invokeCommand(new SaveGroupState(group))
    ]).then(() => {
      return group;
    });
  }

  /**
   * Delete group
   *
   * @param {Group} group Group object or group Id
   *
   * @return {Promise} Promise for chaining
   */
  delete(group) {
    return this.client.invokeCommand(new DeleteGroup(group));
  }
}

module.exports = Groups;
{'fraction_non_alphanumeric': 0.14697173620457604, 'fraction_numerical': 0.0005383580080753701, 'mean_word_length': 2.6792079207920794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5593299', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1128, 'n_words': 256}