<commit_before>const stacks = {};

/**
 * ### Stacks
 *
 * @module stacks
 */
export default (state) => {
  /**
   * Get a list of available stacks.
   *
   * ```js
   * rokka.stacks.list('myorg')
   * 	 .then(function(result) {})
   * 	 .catch(function(err) {});
   * ```
   *
   * @authenticated
   * @param  {string}  organization  name
   * @param  {number}  [limit=null]
   * @param  {number}  [offset=null]
   * @return {Promise}
   */
  stacks.list = (organization, limit=null, offset=null) => {
    const queryParams = {};

    if(limit !== null) {
      queryParams.limit = limit;
    }
    if(offset !== null) {
      queryParams.offset = offset;
    }

    return state.request('GET', `stacks/${organization}`, null, queryParams);
  };

  /**
   * Get details about a stack.
   *
   * @authenticated
   * @param  {string}  organization name
   * @param  {string}  name         stack name
   * @return {Promise}
   */
  stacks.get = (organization, name) => {
    return state.request('GET', `stacks/${organization}/${name}`);
  };

  /**
   * Create a new stack.
   *
   * ```js
   * var operations = [
   *   rokka.operations.rotate(45),
   *   rokka.operations.resize(100, 100)
   * ];
   *
   * rokka.stacks.create('myorg', 'mystack', operations)
   * 	 .then(function(result) {
   * 	   // ...
   *   })
   *   .catch(function(err) {
   *   	 console.error(err);
   *   });
   * ```
   *
   * @authenticated<commit_msg>minor doc fixes<commit_after>const stacks = {};

/**
 * ### Stacks
 *
 * @module stacks
 */
export default (state) => {
  /**
   * Get a list of available stacks.
   *
   * ```js
   * rokka.stacks.list('myorg')
   * 	 .then(function(result) {})
   * 	 .catch(function(err) {});
   * ```
   *
   * @authenticated
   * @param  {string}  organization  name
   * @param  {number}  [limit=null]
   * @param  {number}  [offset=null]
   * @return {Promise}
   */
  stacks.list = (organization, limit=null, offset=null) => {
    const queryParams = {};

    if(limit !== null) {
      queryParams.limit = limit;
    }
    if(offset !== null) {
      queryParams.offset = offset;
    }

    return state.request('GET', `stacks/${organization}`, null, queryParams);
  };

  /**
   * Get details about a stack.
   *
   * @authenticated
   * @param  {string}  organization name
   * @param  {string}  name         stack name
   * @return {Promise}
   */
  stacks.get = (organization, name) => {
    return state.request('GET', `stacks/${organization}/${name}`);
  };

  /**
   * Create a new stack.
   *
   * ```js
   * var operations = [
   *   rokka.operations.rotate(45),
   *   rokka.operations.resize(100, 100)
   * ];
   *
   * rokka.stacks.create('myorg', 'mystack', operations)
   * 	 .then(function(result) {})
   *   .catch(function(err) {});
   * ```
   *
   * @authenticated
{'fraction_non_alphanumeric': 0.1856074100463128, 'fraction_numerical': 0.0057000356252226575, 'mean_word_length': 2.391304347826087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6025646', 'n_tokens_mistral': 1029, 'n_tokens_neox': 996, 'n_words': 180}