<commit_before>const ApiProvider = require('./internal/ApiProvider');
const ExtendableFunction = require('./internal/ExtendableFunction');
const _names = require('./internal/names');

const Characters = require('./api/character/Characters');

const Agents = require('./api/universe/Agents');
const Bloodlines = require('./api/universe/Bloodlines');
const Constellations = require('./api/universe/Constellations');
const Factions = require('./api/universe/Factions');
const Freeports = require('./api/universe/Freeports');
const Industry = require('./api/universe/Industry');
const Insurance = require('./api/universe/Insurance');
const Moons = require('./api/universe/Moons');
const Planets = require('./api/universe/Planets');
const PlanetaryInteraction = require('./api/universe/PlanetaryInteraction');
const Races = require('./api/universe/Races');
const Regions = require('./api/universe/Regions');
const SolarSystems = require('./api/universe/SolarSystems');
const Stargates = require('./api/universe/Stargates');
const Stations = require('./api/universe/Stations');
const Types = require('./api/universe/Types');
const Wormholes = require('./api/universe/Wormholes');

const Alliances = require('./api/Alliances');
const Corporations = require('./api/Corporations');
const Incursions = require('./api/Incursions');
const Killmail = require('./api/Killmail');
const Search = require('./api/Search');
const Sovereignty = require('./api/Sovereignty');
const Wars = require('./api/Wars');

/**
 * Api creates a shared, internal ApiProvider and then lazily instantiates all
 * specific modules as needed. The Api instance is also a function that can
 * be invoked to create a new Api instance with a different configuration.
 *
 * @see https://esi.tech.ccp.is/latest
 */
class Api extends ExtendableFunction {
  /**
   * Create a new Api with the given configuration provided in a single
   * object map. If no argument is provided, the defaults are used.
   *
   * @param service {String} URL to the ESI service, defaults to
   *     `'https://esi.tech.ccp.is/latest'`.
   * @param source {String} Data source used, defaults to `tranquility`.
   * @param agent {String} Custom user agent string to send with each request,
   *     which defaults to this project but really should be set for your app
   * @param language {String} Language character code, defaults to `en-us`
   * @param timeout {Number} Request timeout in milliseconds, defaults to `6000`
   * @constructor
   */
  constructor({
      service: service = 'https://esi.tech.ccp.is/latest', source: source = 'tranquility', agent: agent = 'eve-swagger-js / https://github.com/lhkbob/eve-swagger-js', language: language = 'en-us', timeout: timeout = 6000
  } = {}) {
    super(config => new Api(config));
    this._api = new ApiProvider({
      service: service,
      source: source,
      agent: agent,
      language: language,
      timeout: timeout
    });

    this._char = null;

    this._agent = null;
    this._blood = null;
    this._const = null;
    this._faction = null;
    this._freeport = null;
    this._gate = null;
    this._indy = null;
    this._insurance = null;
    this._moon = null;
    this._pi = null;
    this._planet = null;
    this._race = null;
    this._region = null;
    this._system = null;
    this._station = null;
    this._type = null;
    this._worm = null;

    this._alliance = null;
    this._corp = null;
    this._incursion = null;
    this._km = null;
    this._search = null;
    this._sov = null;
    this._wars = null;
  }

  /**
   * An instance of Characters using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Characters}
   */
  get characters() {
    if (!this._char) {
      this._char = new Characters(this._api);
    }
    return this._char;
  }

  /**
   * An instance of Agents using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Agents}
   */
  get agents() {
    if (!this._agent) {
      this._agent = new Agents(this._api);
    }
    return this._agent;
  }

  /**
   * An instance of Bloodlines using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Bloodlines}
   */
  get bloodlines() {
    if (!this._blood) {
      this._blood = new Bloodlines(this._api);
    }
    return this._blood;
  }

  /**
   * An instance of Constellations using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Constellations}
   */
  get constellations() {
    if (!this._const) {
      this._const = new Constellations(this._api);
    }
    return this._const;
  }

  /**
   * An instance of Factions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Factions}
   */
  get factions() {
    if (!this._faction) {
      this._faction = new Factions(this._api);
    }
    return this._faction;
  }

  /**
   * An instance of Freeports using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Freeports}
   */
  get freeports() {
    if (!this._freeport) {
      this._freeport = new Freeports(this._api);
    }
    return this._freeport;
  }

  /**
   * An instance of Industry using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Industry}
   */
  get industry() {
    if (!this._indy) {
      this._indy = new Industry(this._api);
    }
    return this._indy;
  }

  /**
   * An instance of Insurance using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Insurance}
   */
  get insurance() {
    if (!this._insurance) {
      this._insurance = new Insurance(this._api);
    }
    return this._insurance;
  }

  /**
   * An instance of Moons using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Moons}
   */
  get moons() {
    if (!this._moon) {
      this._moon = new Moons(this._api);
    }
    return this._moon;
  }

  /**
   * An instance of Planets using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Planets}
   */
  get planets() {
    if (!this._planet) {
      this._planet = new Planets(this._api);
    }
    return this._planet;
  }

  /**
   * An instance of PlanetaryInteraction using a shared ApiProvider configured
   * based on the Api's initialization options.
   *
   * @type {PlanetaryInteraction}
   */
  get pi() {
    if (!this._pi) {
      this._pi = new PlanetaryInteraction(this._api);
    }
    return this._pi;
  }

  /**
   * An instance of Races using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Races}
   */
  get races() {
    if (!this._race) {
      this._race = new Races(this._api);
    }
    return this._race;
  }

  /**
   * An instance of Regions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Regions}
   */
  get regions() {
    if (!this._region) {
      this._region = new Regions(this._api);
    }
    return this._region;
  }

  /**
   * An instance of SolarSystems using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {SolarSystems}
   */
  get solarSystems() {
    if (!this._system) {
      this._system = new SolarSystems(this._api);
    }
    return this._system;
  }

  /**
   * An instance of Stargates using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Stargates}
   */
  get stargates() {
    if (!this._gate) {
      this._gate = new Stargates(this._api);
    }
    return this._gate;
  }

  /**
   * An instance of Stations using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Stations}
   */
  get stations() {
    if (!this._station) {
      this._station = new Stations(this._api);
    }
    return this._station;
  }

  /**
   * An instance of Types using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Types}
   */
  get types() {
    if (!this._type) {
      this._type = new Types(this._api);
    }
    return this._type;
  }

  /**
   * An instance of Wormholes using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Wormholes}
   */
  get wormholes() {
    if (!this._worm) {
      this._worm = new Wormholes(this._api);
    }
    return this._worm;
  }

  /**
   * An instance of Alliances using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Alliances}
   */
  get alliances() {
    if (!this._alliance) {
      this._alliance = new Alliances(this._api);
    }
    return this._alliance;
  }

  /**
   * An instance of Corporations using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Corporations}
   */
  get corporations() {
    if (!this._corp) {
      this._corp = new Corporations(this._api);
    }
    return this._corp;
  }

  /**
   * An instance of Incursions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Incursions}
   */
  get incursions() {
    if (!this._incursion) {
      this._incursion = new Incursions(this._api);
    }
    return this._incursion;
  }

  /**
   * An instance of Killmail using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Killmail}
   */
  get killmail() {
    if (!this._km) {
      this._km = new Killmail(this._api);
    }
    return this._km;
  }

  /**
   * An instance of Sovereignty using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Sovereignty}
   */
  get sovereignty() {
    if (!this._sov) {
      this._sov = new Sovereignty(this._api);
    }
    return this._sov;
  }

  /**
   * An instance of Wars using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Wars}
   */
  get wars() {
    if (!this._wars) {
      this._wars = new Wars(this._api);
    }
    return this._wars;
  }

  /**
   * An instance of Search using a shared ApiProvider configured based on
   * the Api's initialization options. This Search instance is configured to
   * use all categories and is not tied to a character.
   *
   * @type {Search}
   */
  get search() {
    if (!this._search) {
      this._search = new Search(this._api);
    }
    return this._search;
  }

  /**
   * Query names of a given set of `ids`. These ids can be of mixed types, and
   * each entry has its category reported. This makes an HTTP POST request to
   * [`/universe/names/`](https://esi.tech.ccp.is/latest/#!/Universe/post_universe_names).
   *
   * The request is returned as an asynchronous Promise that resolves to an
   * object parsed from the response JSON model. An example value looks like:
   *
   * ```
   * [
   *   {
   *     "id": 95465499,
   *     "name": "<NAME>",
   *     "category": "character"
   *   },
   *   {
   *     "id": 30000142,
   *     "name": "Jita",
   *     "category": "solar_system"
   *   }
   * ]
   * ```
   *
   * @param ids {Array.<Number>} Ids to look up
   * @type {Promise}
   * @private
   */
  names(ids) {
    return _names(this._api, 'all', ids);
  }
}

module.exports = Api;<commit_msg>Update primary Api module to use the ESIAgent class instead of ApiProvider<commit_after>const ESIAgent = require('./internal/ESIAgent');
const ExtendableFunction = require('./internal/ExtendableFunction');
const _names = require('./internal/names');

const Characters = require('./api/character/Characters');

const Agents = require('./api/universe/Agents');
const Bloodlines = require('./api/universe/Bloodlines');
const Constellations = require('./api/universe/Constellations');
const Factions = require('./api/universe/Factions');
const Freeports = require('./api/universe/Freeports');
const Industry = require('./api/universe/Industry');
const Insurance = require('./api/universe/Insurance');
const Moons = require('./api/universe/Moons');
const Planets = require('./api/universe/Planets');
const PlanetaryInteraction = require('./api/universe/PlanetaryInteraction');
const Races = require('./api/universe/Races');
const Regions = require('./api/universe/Regions');
const SolarSystems = require('./api/universe/SolarSystems');
const Stargates = require('./api/universe/Stargates');
const Stations = require('./api/universe/Stations');
const Types = require('./api/universe/Types');
const Wormholes = require('./api/universe/Wormholes');

const Alliances = require('./api/Alliances');
const Corporations = require('./api/Corporations');
const Incursions = require('./api/Incursions');
const Killmail = require('./api/Killmail');
const Search = require('./api/Search');
const Sovereignty = require('./api/Sovereignty');
const Wars = require('./api/Wars');

/**
 * Api creates a shared, internal ApiProvider and then lazily instantiates all
 * specific modules as needed. The Api instance is also a function that can
 * be invoked to create a new Api instance with a different configuration.
 *
 * @see https://esi.tech.ccp.is/latest
 */
class Api extends ExtendableFunction {
  /**
   * Create a new Api with the given configuration provided in a single
   * object map. If no argument is provided, the defaults are used.
   *
   * @param service {String} URL to the ESI service, defaults to
   *     `'https://esi.tech.ccp.is/latest'`.
   * @param source {String} Data source used, defaults to `tranquility`.
   * @param agent {String} Custom user agent string to send with each request,
   *     which defaults to this project but really should be set for your app
   * @param language {String} Language character code, defaults to `en-us`
   * @param timeout {Number} Request timeout in milliseconds, defaults to
   *     `6000`
   * @param maxConcurrent {Number} Maximum number of requests running at once,
   *     defaults to 0 (unlimited)
   * @param minTime {Number} Minimum time before launching another request (in
   *     milliseconds), defaults to 0 (no rate limiting)
   * @constructor
   */
  constructor({
      service: service = 'https://esi.tech.ccp.is/latest', source: source = 'tranquility', agent: agent = 'eve-swagger-js / https://github.com/lhkbob/eve-swagger-js', language: language = 'en-us', timeout: timeout = 6000, maxConcurrent: maxConcurrent = 0, minTime: minTime = 0
  } = {}) {
    super(config => new Api(config));
    this._esiAgent = new ESIAgent({
      service,
      source,
      agent,
      language,
      timeout,
      maxConcurrent,
      minTime
    });

    this._char = null;

    this._agent = null;
    this._blood = null;
    this._const = null;
    this._faction = null;
    this._freeport = null;
    this._gate = null;
    this._indy = null;
    this._insurance = null;
    this._moon = null;
    this._pi = null;
    this._planet = null;
    this._race = null;
    this._region = null;
    this._system = null;
    this._station = null;
    this._type = null;
    this._worm = null;

    this._alliance = null;
    this._corp = null;
    this._incursion = null;
    this._km = null;
    this._search = null;
    this._sov = null;
    this._wars = null;
  }

  /**
   * An instance of Characters using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Characters}
   */
  get characters() {
    if (!this._char) {
      this._char = new Characters(this._esiAgent);
    }
    return this._char;
  }

  /**
   * An instance of Agents using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Agents}
   */
  get agents() {
    if (!this._agent) {
      this._agent = new Agents(this._esiAgent);
    }
    return this._agent;
  }

  /**
   * An instance of Bloodlines using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Bloodlines}
   */
  get bloodlines() {
    if (!this._blood) {
      this._blood = new Bloodlines(this._esiAgent);
    }
    return this._blood;
  }

  /**
   * An instance of Constellations using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Constellations}
   */
  get constellations() {
    if (!this._const) {
      this._const = new Constellations(this._esiAgent);
    }
    return this._const;
  }

  /**
   * An instance of Factions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Factions}
   */
  get factions() {
    if (!this._faction) {
      this._faction = new Factions(this._esiAgent);
    }
    return this._faction;
  }

  /**
   * An instance of Freeports using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Freeports}
   */
  get freeports() {
    if (!this._freeport) {
      this._freeport = new Freeports(this._esiAgent);
    }
    return this._freeport;
  }

  /**
   * An instance of Industry using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Industry}
   */
  get industry() {
    if (!this._indy) {
      this._indy = new Industry(this._esiAgent);
    }
    return this._indy;
  }

  /**
   * An instance of Insurance using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Insurance}
   */
  get insurance() {
    if (!this._insurance) {
      this._insurance = new Insurance(this._esiAgent);
    }
    return this._insurance;
  }

  /**
   * An instance of Moons using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Moons}
   */
  get moons() {
    if (!this._moon) {
      this._moon = new Moons(this._esiAgent);
    }
    return this._moon;
  }

  /**
   * An instance of Planets using a shared ApiProvider configured based
   * on the Api's initialization options.
   *
   * @type {Planets}
   */
  get planets() {
    if (!this._planet) {
      this._planet = new Planets(this._esiAgent);
    }
    return this._planet;
  }

  /**
   * An instance of PlanetaryInteraction using a shared ApiProvider configured
   * based on the Api's initialization options.
   *
   * @type {PlanetaryInteraction}
   */
  get pi() {
    if (!this._pi) {
      this._pi = new PlanetaryInteraction(this._esiAgent);
    }
    return this._pi;
  }

  /**
   * An instance of Races using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Races}
   */
  get races() {
    if (!this._race) {
      this._race = new Races(this._esiAgent);
    }
    return this._race;
  }

  /**
   * An instance of Regions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Regions}
   */
  get regions() {
    if (!this._region) {
      this._region = new Regions(this._esiAgent);
    }
    return this._region;
  }

  /**
   * An instance of SolarSystems using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {SolarSystems}
   */
  get solarSystems() {
    if (!this._system) {
      this._system = new SolarSystems(this._esiAgent);
    }
    return this._system;
  }

  /**
   * An instance of Stargates using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Stargates}
   */
  get stargates() {
    if (!this._gate) {
      this._gate = new Stargates(this._esiAgent);
    }
    return this._gate;
  }

  /**
   * An instance of Stations using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Stations}
   */
  get stations() {
    if (!this._station) {
      this._station = new Stations(this._esiAgent);
    }
    return this._station;
  }

  /**
   * An instance of Types using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Types}
   */
  get types() {
    if (!this._type) {
      this._type = new Types(this._esiAgent);
    }
    return this._type;
  }

  /**
   * An instance of Wormholes using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Wormholes}
   */
  get wormholes() {
    if (!this._worm) {
      this._worm = new Wormholes(this._esiAgent);
    }
    return this._worm;
  }

  /**
   * An instance of Alliances using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Alliances}
   */
  get alliances() {
    if (!this._alliance) {
      this._alliance = new Alliances(this._esiAgent);
    }
    return this._alliance;
  }

  /**
   * An instance of Corporations using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Corporations}
   */
  get corporations() {
    if (!this._corp) {
      this._corp = new Corporations(this._esiAgent);
    }
    return this._corp;
  }

  /**
   * An instance of Incursions using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Incursions}
   */
  get incursions() {
    if (!this._incursion) {
      this._incursion = new Incursions(this._esiAgent);
    }
    return this._incursion;
  }

  /**
   * An instance of Killmail using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Killmail}
   */
  get killmail() {
    if (!this._km) {
      this._km = new Killmail(this._esiAgent);
    }
    return this._km;
  }

  /**
   * An instance of Sovereignty using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Sovereignty}
   */
  get sovereignty() {
    if (!this._sov) {
      this._sov = new Sovereignty(this._esiAgent);
    }
    return this._sov;
  }

  /**
   * An instance of Wars using a shared ApiProvider configured based on
   * the Api's initialization options.
   *
   * @type {Wars}
   */
  get wars() {
    if (!this._wars) {
      this._wars = new Wars(this._esiAgent);
    }
    return this._wars;
  }

  /**
   * An instance of Search using a shared ApiProvider configured based on
   * the Api's initialization options. This Search instance is configured to
   * use all categories and is not tied to a character.
   *
   * @type {Search}
   */
  get search() {
    if (!this._search) {
      this._search = new Search(this._esiAgent);
    }
    return this._search;
  }

  /**
   * Query names of a given set of `ids`. These ids can be of mixed types, and
   * each entry has its category reported. This makes an HTTP POST request to
   * [`/universe/names/`](https://esi.tech.ccp.is/latest/#!/Universe/post_universe_names).
   *
   * The request is returned as an asynchronous Promise that resolves to an
   * object parsed from the response JSON model. An example value looks like:
   *
   * ```
   * [
   *   {
   *     "id": 95465499,
   *     "name": "<NAME>",
   *     "category": "character"
   *   },
   *   {
   *     "id": 30000142,
   *     "name": "Jita",
   *     "category": "solar_system"
   *   }
   * ]
   * ```
   *
   * @param ids {Array.<Number>} Ids to look up
   * @type {Promise}
   * @private
   */
  names(ids) {
    return _names(this._esiAgent, 'all', ids);
  }
}

module.exports = Api;
{'fraction_non_alphanumeric': 0.1232158834306165, 'fraction_numerical': 0.0022154999786971157, 'mean_word_length': 2.6709415076634344, 'pattern_counts': {'":': 12, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 10, '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': '1909631', 'n_tokens_mistral': 7428, 'n_tokens_neox': 7309, 'n_words': 2136}