<commit_before>function ajaxWithSession(params) {
  params.xhrFields = {withCredentials: true};
  params.dataType = "json";
  
  // params.beforeSend = function(xhr) {
  //   xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
  // };
  console.log( params.url );
  return $.ajax(params);
}
export default class IetopiaApi {
  constructor() {
    this.API_BASE_URL = global.config.API_BASE_URL + "/api";
    this.url = this.API_BASE_URL;
  }
  setApiUrlSufix(sufix) {
    this.API_URL_SUFIX += sufix;
    this.url = this.API_BASE_URL + this.API_URL_SUFIX;
  }
  request(params={}, method="GET", url) {
    return ajaxWithSession({
      url: url || this.url,
      method: method,
      data: params,
    });
  }
  static login(uuid) {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/login",
      data: { uuid: uuid, },
    });
  }
  static isloggedIn() {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/is_logged_in",
    });
  }
  static logout() {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/logout",
    });
  }
}
class IetopiaMasterApiBase extends IetopiaApi {
  constructor() {
    super();
    this.API_URL_SUFIX = "/master";
  }
}
export class StationApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/station");
  }
}
export class MadoriApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/madori");
  }
}
export class TikunensuApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/tikunensu");
  }
}
export class EkitohoApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/ekitoho");
  }
}
export class MensekiApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/menseki");
  }
}
export class RosenApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/rosen");
  }
}
export class KodawariJokenApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/kodawari_joken");
  }
}
class IetopiaUserApiBase extends IetopiaApi {
  constructor() {
    super();
    this.API_URL_SUFIX = "/user";
  }
}
class IetopiaMeApiBase extends IetopiaUserApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/me");
  }
}
export class MeApi extends IetopiaMeApiBase {
  
}
export class SearchHistoryApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/search_history");
  }
  get() {
    return this.request().then( data => JSON.parse(data.params_json) );
  }
  save(params_json="{}") {
    var url = this.url + "/save";
    return this.request({params_json}, "POST", url);
  }
}
export class RoomHistoryApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/room_history");
  }
}
export class FavoriteApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/favorite");
  }
}<commit_msg>fix params_json<commit_after>function ajaxWithSession(params) {
  params.xhrFields = {withCredentials: true};
  params.dataType = "json";
  
  // params.beforeSend = function(xhr) {
  //   xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
  // };
  console.log( params.url );
  return $.ajax(params);
}
export default class IetopiaApi {
  constructor() {
    this.API_BASE_URL = global.config.API_BASE_URL + "/api";
    this.url = this.API_BASE_URL;
  }
  setApiUrlSufix(sufix) {
    this.API_URL_SUFIX += sufix;
    this.url = this.API_BASE_URL + this.API_URL_SUFIX;
  }
  request(params={}, method="GET", url) {
    return ajaxWithSession({
      url: url || this.url,
      method: method,
      data: params,
    });
  }
  static login(uuid) {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/login",
      data: { uuid: uuid, },
    });
  }
  static isloggedIn() {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/is_logged_in",
    });
  }
  static logout() {
    return ajaxWithSession({
      url: global.config.API_BASE_URL + "/logout",
    });
  }
}
class IetopiaMasterApiBase extends IetopiaApi {
  constructor() {
    super();
    this.API_URL_SUFIX = "/master";
  }
}
export class StationApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/station");
  }
}
export class MadoriApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/madori");
  }
}
export class TikunensuApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/tikunensu");
  }
}
export class EkitohoApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/ekitoho");
  }
}
export class MensekiApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/menseki");
  }
}
export class RosenApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/rosen");
  }
}
export class KodawariJokenApi extends IetopiaMasterApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/kodawari_joken");
  }
}
class IetopiaUserApiBase extends IetopiaApi {
  constructor() {
    super();
    this.API_URL_SUFIX = "/user";
  }
}
class IetopiaMeApiBase extends IetopiaUserApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/me");
  }
}
export class MeApi extends IetopiaMeApiBase {
  
}
export class SearchHistoryApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/search_history");
  }
  get() {
    return this.request().then( data => {
      if ( data.params_json ) return JSON.parse(data.params_json);
      return {};
    } );
  }
  save(params_json="{}") {
    var url = this.url + "/save";
    return this.request({params_json}, "POST", url);
  }
}
export class RoomHistoryApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/room_history");
  }
}
export class FavoriteApi extends IetopiaMeApiBase {
  constructor() {
    super();
    this.setApiUrlSufix("/favorite");
  }
}
{'fraction_non_alphanumeric': 0.141379867506867, 'fraction_numerical': 0.0, 'mean_word_length': 3.4920174165457185, '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': '4073305', 'n_tokens_mistral': 2189, 'n_tokens_neox': 2135, 'n_words': 383}