<commit_before>import angular from 'angular';

class CRUDService {
  constructor($http, $q) {
    var vm = this;
    vm.$http = $http;
    vm.$q = $q;
    vm.base_url = '';
  }

  /*
  Set base URL if needed (ex. when testing)
   */
  setBaseURL(url) {
    var vm = this;
    vm.base_url = url;
  }

  /**
   * GET /api/read
   */
  read(params) {
    var vm = this;
    var deferred = vm.$q.defer();
    params.gui = 'ng';
    params.output = 'json';

    vm.$http
      .get(vm.base_url + "/api/read", {params: params})
      .then(function (response) {
        deferred.resolve(response);
      });
    return deferred.promise;
  }

  /**
   * GET /api/options
   */
  options(params) {
    var vm = this;
    var deferred = vm.$q.defer();
    params.gui = 'ng';<commit_msg>feat(crud.service[read]): allow to specify output to backend<commit_after>import angular from 'angular';

class CRUDService {
  constructor($http, $q) {
    var vm = this;
    vm.$http = $http;
    vm.$q = $q;
    vm.base_url = '';
  }

  /*
  Set base URL if needed (ex. when testing)
   */
  setBaseURL(url) {
    var vm = this;
    vm.base_url = url;
  }

  /**
   * GET /api/read
   */
  read(params) {
    var vm = this;
    var deferred = vm.$q.defer();
    params.gui = 'ng';
    params.output = params.output || 'json';

    vm.$http
      .get(vm.base_url + "/api/read", {params: params})
      .then(function (response) {
        deferred.resolve(response);
      });
    return deferred.promise;
  }

  /**
   * GET /api/options
   */
  options(params) {
    var vm = this;
    var deferred = vm.$q.defer();
    params.gui = 'ng';
{'fraction_non_alphanumeric': 0.16872682323856614, 'fraction_numerical': 0.0, 'mean_word_length': 2.1194605009633913, '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': '4308426', 'n_tokens_mistral': 594, 'n_tokens_neox': 580, 'n_words': 134}