Skip to content

Commit db9e01b

Browse files
committed
#1 Removed redundant API key handler.
1 parent 6133743 commit db9e01b

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
.DS_Store
3-
xivapi-key.txt
43
data/cached/*.json

src/APICrawler.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Progress = require('cli-progress');
44
const urls = require('./xivapi/urls');
55

66
module.exports = class APICrawler {
7-
constructor(config = {}, apiKey = '') {
7+
constructor(config = {}) {
88
if (!config || typeof config !== 'object') {
99
throw new Error('Config passed to APICrawler as first argument must be an object.');
1010
}
@@ -15,12 +15,7 @@ module.exports = class APICrawler {
1515
);
1616
}
1717

18-
if (!apiKey || typeof apiKey !== 'string') {
19-
throw new Error('API key passed to APICrawler as second argument must be a string.');
20-
}
21-
2218
this.apiCallCount = 0;
23-
this.apiKey = apiKey;
2419
this.config = config;
2520
this.cumulativeSuccessfulCalls = 0;
2621
this.errors = 0;
@@ -79,7 +74,6 @@ module.exports = class APICrawler {
7974
const apiPath = urls[`${name.charAt(0).toLowerCase()}${name.substr(1)}`]();
8075

8176
const queryStringParts = [
82-
`apiKey=${this.apiKey}`,
8377
`limit=${limit}`
8478
];
8579

@@ -247,7 +241,6 @@ module.exports = class APICrawler {
247241
const apiPath = urls.search();
248242

249243
const queryStringParts = [
250-
`apiKey=${this.apiKey}`,
251244
`page=${page === -1 ? 1 : page}`
252245
];
253246

src/update.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const listAPI = require('./parsers/listAPI');
44

55
class API {
66
async crawl(config) {
7-
return await new APICrawler(config, this.apiKey)[config.method]();
7+
return await new APICrawler(config)[config.method]();
88
}
99

1010
async init(optionsIn) {
@@ -59,8 +59,7 @@ class API {
5959
console.info(`Valid options include: '${validOptions.join('\', \'')}'`);
6060
return;
6161
}
62-
63-
this.apiKey = await fs.readFileSync('./xivapi-key.txt', 'utf-8');
62+
6463
this.options = options;
6564
}
6665

0 commit comments

Comments
 (0)