# all files / kayn/dist/lib/ Kayn.js

92.38% Statements 97/105
60% Branches 12/20
83.33% Functions 5/6
98.96% Lines 95/96

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    1×

    32×

    1×

    1×

    1×

    1×
    1×
    1×

    1×

    1×

    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×
    1×

    1×
    1×
    1×

    1×

     'use strict';

    var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

    var _ParameterHelper = require('./Utils/ParameterHelper');

    var _ParameterHelper2 = _interopRequireDefault(_ParameterHelper);

    var _Errors = require('./Errors');

    var _Errors2 = _interopRequireDefault(_Errors);

    var _ChallengerEndpoint = require('./Endpoints/LeagueEndpoint/ChallengerEndpoint');

    var _ChallengerEndpoint2 = _interopRequireDefault(_ChallengerEndpoint);

    var _ChampionEndpoint = require('./Endpoints/ChampionEndpoint');

    var _ChampionEndpoint2 = _interopRequireDefault(_ChampionEndpoint);

    var _ChampionMasteryEndpoint = require('./Endpoints/ChampionMasteryEndpoint');

    var _ChampionMasteryEndpoint2 = _interopRequireDefault(_ChampionMasteryEndpoint);

    var _CurrentGameEndpoint = require('./Endpoints/SpectatorEndpoint/CurrentGameEndpoint');

    var _CurrentGameEndpoint2 = _interopRequireDefault(_CurrentGameEndpoint);

    var _FeaturedGamesEndpoint = require('./Endpoints/SpectatorEndpoint/FeaturedGamesEndpoint');

    var _FeaturedGamesEndpoint2 = _interopRequireDefault(_FeaturedGamesEndpoint);

    var _LeagueEndpoint = require('./Endpoints/LeagueEndpoint/LeagueEndpoint');

    var _LeagueEndpoint2 = _interopRequireDefault(_LeagueEndpoint);

    var _LeaguePositionsEndpoint = require('./Endpoints/LeagueEndpoint/LeaguePositionsEndpoint');

    var _LeaguePositionsEndpoint2 = _interopRequireDefault(_LeaguePositionsEndpoint);

    var _LeaguesEndpoint = require('./Endpoints/LeagueEndpoint/LeaguesEndpoint');

    var _LeaguesEndpoint2 = _interopRequireDefault(_LeaguesEndpoint);

    var _MasterEndpoint = require('./Endpoints/LeagueEndpoint/MasterEndpoint');

    var _MasterEndpoint2 = _interopRequireDefault(_MasterEndpoint);

    var _MasteriesEndpoint = require('./Endpoints/MasteriesEndpoint');

    var _MasteriesEndpoint2 = _interopRequireDefault(_MasteriesEndpoint);

    var _MatchEndpoint = require('./Endpoints/MatchEndpoint/MatchEndpoint');

    var _MatchEndpoint2 = _interopRequireDefault(_MatchEndpoint);

    var _MatchlistEndpoint = require('./Endpoints/MatchEndpoint/MatchlistEndpoint');

    var _MatchlistEndpoint2 = _interopRequireDefault(_MatchlistEndpoint);

    var _RunesEndpoint = require('./Endpoints/RunesEndpoint');

    var _RunesEndpoint2 = _interopRequireDefault(_RunesEndpoint);

    var _StaticChampionEndpoint = require('./Endpoints/StaticEndpoints/StaticChampionEndpoint');

    var _StaticChampionEndpoint2 = _interopRequireDefault(_StaticChampionEndpoint);

    var _StaticItemEndpoint = require('./Endpoints/StaticEndpoints/StaticItemEndpoint');

    var _StaticItemEndpoint2 = _interopRequireDefault(_StaticItemEndpoint);

    var _StaticLanguageStringsEndpoint = require('./Endpoints/StaticEndpoints/StaticLanguageStringsEndpoint');

    var _StaticLanguageStringsEndpoint2 = _interopRequireDefault(_StaticLanguageStringsEndpoint);

    var _StaticLanguageEndpoint = require('./Endpoints/StaticEndpoints/StaticLanguageEndpoint');

    var _StaticLanguageEndpoint2 = _interopRequireDefault(_StaticLanguageEndpoint);

    var _StaticMapEndpoint = require('./Endpoints/StaticEndpoints/StaticMapEndpoint');

    var _StaticMapEndpoint2 = _interopRequireDefault(_StaticMapEndpoint);

    var _StaticMasteryEndpoint = require('./Endpoints/StaticEndpoints/StaticMasteryEndpoint');

    var _StaticMasteryEndpoint2 = _interopRequireDefault(_StaticMasteryEndpoint);

    var _StaticProfileIconEndpoint = require('./Endpoints/StaticEndpoints/StaticProfileIconEndpoint');

    var _StaticProfileIconEndpoint2 = _interopRequireDefault(_StaticProfileIconEndpoint);

    var _StaticRealmEndpoint = require('./Endpoints/StaticEndpoints/StaticRealmEndpoint');

    var _StaticRealmEndpoint2 = _interopRequireDefault(_StaticRealmEndpoint);

    var _StaticRuneEndpoint = require('./Endpoints/StaticEndpoints/StaticRuneEndpoint');

    var _StaticRuneEndpoint2 = _interopRequireDefault(_StaticRuneEndpoint);

    var _StaticSummonerSpellEndpoint = require('./Endpoints/StaticEndpoints/StaticSummonerSpellEndpoint.js');

    var _StaticSummonerSpellEndpoint2 = _interopRequireDefault(_StaticSummonerSpellEndpoint);

    var _StaticVersionEndpoint = require('./Endpoints/StaticEndpoints/StaticVersionEndpoint');

    var _StaticVersionEndpoint2 = _interopRequireDefault(_StaticVersionEndpoint);

    var _StatusEndpoint = require('./Endpoints/StatusEndpoint');

    var _StatusEndpoint2 = _interopRequireDefault(_StatusEndpoint);

    var _SummonerEndpoint = require('./Endpoints/SummonerEndpoint');

    var _SummonerEndpoint2 = _interopRequireDefault(_SummonerEndpoint);

    var _regions = require('./Enums/regions');

    var _regions2 = _interopRequireDefault(_regions);

    var _methodNames = require('./Enums/method-names');

    var _methodNames2 = _interopRequireDefault(_methodNames);

    var _BasicJSCache = require('./Caches/BasicJSCache');

    var _BasicJSCache2 = _interopRequireDefault(_BasicJSCache);

    var _RedisCache = require('./Caches/RedisCache');

    var _RedisCache2 = _interopRequireDefault(_RedisCache);

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

    function _classCallCheck(instance, Constructor) { if (I!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

    require('dotenv').config();

    var defaultConfig = {
      region: 'na',
      debugOptions: {
        isEnabled: true,
        showKey: false
      },
      requestOptions: {
        shouldRetry: true,
        numberOfRetriesBeforeAbort: 3,
        delayBeforeRetry: 1000
      },
      cacheOptions: {
        cache: null,
        ttls: {}
      }
    };

    var Kayn = function Kayn() {
      var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : process.env.RIOT_LOL_API_KEY;
      var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;

      _classCallCheck(this, Kayn);

      if (I!_ParameterHelper2.default.isKeyValid(key)) {
        throw new Error('Failed to initialize Kayn');
      }

      this.config = _extends({}, defaultConfig, config, {
        key: key
      });

      // Set up interfaces
      this.Challenger = new _ChallengerEndpoint2.default(this.config);
      this.Champion = new _ChampionEndpoint2.default(this.config);
      this.ChampionMastery = new _ChampionMasteryEndpoint2.default(this.config);
      this.CurrentGame = new _CurrentGameEndpoint2.default(this.config);
      this.FeaturedGames = new _FeaturedGamesEndpoint2.default(this.config);
      this.League = new _LeagueEndpoint2.default(this.config);
      this.LeaguePositions = new _LeaguePositionsEndpoint2.default(this.config);
      this.Leagues = new _LeaguesEndpoint2.default(this.config);
      this.Master = new _MasterEndpoint2.default(this.config);
      this.Masteries = new _MasteriesEndpoint2.default(this.config);
      this.Match = new _MatchEndpoint2.default(this.config);
      this.Matchlist = new _MatchlistEndpoint2.default(this.config);
      this.Runes = new _RunesEndpoint2.default(this.config);
      this.Static = {
        Champion: new _StaticChampionEndpoint2.default(this.config),
        Item: new _StaticItemEndpoint2.default(this.config),
        LanguageString: new _StaticLanguageStringsEndpoint2.default(this.config),
        Language: new _StaticLanguageEndpoint2.default(this.config),
        Map: new _StaticMapEndpoint2.default(this.config),
        Mastery: new _StaticMasteryEndpoint2.default(this.config),
        ProfileIcon: new _StaticProfileIconEndpoint2.default(this.config),
        Realm: new _StaticRealmEndpoint2.default(this.config),
        Rune: new _StaticRuneEndpoint2.default(this.config),
        SummonerSpell: new _StaticSummonerSpellEndpoint2.default(this.config),
        Version: new _StaticVersionEndpoint2.default(this.config)
      };
      this.Summoner = new _SummonerEndpoint2.default(this.config);
      this.Status = new _StatusEndpoint2.default(this.config);
    };

    var init = function init(key) {
      return function (config) {
        return new Kayn(key, config);
      };
    };

    module.exports = {
      Kayn: init,
      REGIONS: _regions2.default,
      METHOD_NAMES: _methodNames2.default,
      BasicJSCache: _BasicJSCache2.default,
      RedisCache: _RedisCache2.default
    };