<commit_before>'use strict';

const pluralize = require('pluralize');
const qs = require('qs');

/**
 * Base class for resources that have no relationships with other resources.
 *
 * @private
 */
class Base {
  /**
   * Creates a base object.
   *
   * @param {Shopify} shopify Reference to the Shopify instance
   */
  constructor(shopify) {
    this.shopify = shopify;
  }

  /**
   * Gets all records.
   *
   * @param {Object} params Query parameters
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  all(params) {
    const url = this.buildUrl(undefined, params);
    return this.shopify.request(url, 'GET', pluralize(this.key));
  }

  /**
   * Counts the number of records.
   *
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  count() {
    const key = 'count';
    return this.shopify.request(this.buildUrl(key), 'GET', key);
  }

  /**
   * Get a single record by its ID.
   *
   * @param {Number} id Record ID
   * @param {Object} [params] Query parameters
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  get(id, params) {
    return this.shopify.request(this.buildUrl(id, params), 'GET', this.key);
  }

  /**
   * Creates a new record.
   *
   * @param {Object} params Record properties
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  create(params) {
    return this.shopify.request(this.buildUrl(), 'POST', this.key, params);
  }<commit_msg>[minor] Add ability to pass query parameters to the count method<commit_after>'use strict';

const pluralize = require('pluralize');
const qs = require('qs');

/**
 * Base class for resources that have no relationships with other resources.
 *
 * @private
 */
class Base {
  /**
   * Creates a base object.
   *
   * @param {Shopify} shopify Reference to the Shopify instance
   */
  constructor(shopify) {
    this.shopify = shopify;
  }

  /**
   * Gets all records.
   *
   * @param {Object} params Query parameters
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  all(params) {
    const url = this.buildUrl(undefined, params);
    return this.shopify.request(url, 'GET', pluralize(this.key));
  }

  /**
   * Counts the number of records.
   *
   * @param {Object} [params] Query parameters
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  count(params) {
    const key = 'count';
    return this.shopify.request(this.buildUrl(key, params), 'GET', key);
  }

  /**
   * Get a single record by its ID.
   *
   * @param {Number} id Record ID
   * @param {Object} [params] Query parameters
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  get(id, params) {
    return this.shopify.request(this.buildUrl(id, params), 'GET', this.key);
  }

  /**
   * Creates a new record.
   *
   * @param {Object} params Record properties
   * @return {Promise} Promise that resolves with the result
   * @public
   */
  create(params) {
    return this.shopify.request(this.buildUrl(), 'POST', this.key, params);
  }
{'fraction_non_alphanumeric': 0.13292367399741267, 'fraction_numerical': 0.0, 'mean_word_length': 2.950191570881226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2924218', 'n_tokens_mistral': 979, 'n_tokens_neox': 965, 'n_words': 300}