<commit_before>import coreLibrary from '../coreLibrary';

/**
 * Module with methods to request data from the offering API
 * The offering API has information concerning events (matches, competations) and their respective betoffers as well as live data if available
 * All methods in this module return Promises that are resolved when the data is ready and throws errors (that can be handled with .catch()) on failure
 * @module offeringModule
 */

export default {

   /**
    * Get group events
    * @param {number|string} groupId Group id
    * @returns {Promise}
    */
   getGroupEvents (groupId) {
      var requesPath = '/event/group/' + groupId + '.json';
      return this.doRequest(requesPath);
   },

   /**
    * Get group information.
    * @param {Number|String} groupId Group id
    * @returns {Promise}
    */
   getGroup (groupId) {
      var requesPath = '/group/' + groupId + '.json';
      return this.doRequest(requesPath);
   },

   /**
    * Get events by filter, only returns the main betoffer for the event. To get all betoffers use getEvent() or getLiveEvent()
    * @param {String} filter Filter string, eg: football
    * @param {Object} params Request relevant parameters
    * @returns {Promise}
    */
   getEventsByFilter (filter, params) {
      // Todo: Update this method once documentation is available
      var requestPath = '/listView/' + filter;
      return this.doRequest(requestPath, params, 'v3');
   },

   /**
    * Normalizes v2 api betoffers
    * @param {Object} betOffer Betoffer object we get from api
    * @private
    */
   adaptV2BetOffer (betOffer) {<commit_msg>getEventsByFilter now removes #/ at the start of the filter if present<commit_after>import coreLibrary from '../coreLibrary';

/**
 * Module with methods to request data from the offering API
 * The offering API has information concerning events (matches, competations) and their respective betoffers as well as live data if available
 * All methods in this module return Promises that are resolved when the data is ready and throws errors (that can be handled with .catch()) on failure
 * @module offeringModule
 */

export default {

   /**
    * Get group events
    * @param {number|string} groupId Group id
    * @returns {Promise}
    */
   getGroupEvents (groupId) {
      var requesPath = '/event/group/' + groupId + '.json';
      return this.doRequest(requesPath);
   },

   /**
    * Get group information.
    * @param {Number|String} groupId Group id
    * @returns {Promise}
    */
   getGroup (groupId) {
      var requesPath = '/group/' + groupId + '.json';
      return this.doRequest(requesPath);
   },

   /**
    * Get events by filter, only returns the main betoffer for the event. To get all betoffers use getEvent() or getLiveEvent()
    * @param {String} filter Filter string, eg: football
    * @param {Object} params Request relevant parameters
    * @returns {Promise}
    */
   getEventsByFilter (filter, params) {
      // Todo: Update this method once documentation is available
      filter = filter.replace(/^#?\/?/, ''); // removes #/ at the start of the string if present
      var requestPath = '/listView/' + filter;
      return this.doRequest(requestPath, params, 'v3');
   },

   /**
    * Normalizes v2 api betoffers
    * @param {Object} betOffer Betoffer object we get from api
    * @private
    */
   adaptV2BetOffer (betOffer) {
{'fraction_non_alphanumeric': 0.10377358490566038, 'fraction_numerical': 0.001768867924528302, 'mean_word_length': 3.039285714285714, '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': '1978788', 'n_tokens_mistral': 946, 'n_tokens_neox': 927, 'n_words': 365}