File tree Expand file tree Collapse file tree 3 files changed +3
-12
lines changed Expand file tree Collapse file tree 3 files changed +3
-12
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
.DS_Store
3
- xivapi-key.txt
4
3
data /cached /* .json
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const Progress = require('cli-progress');
4
4
const urls = require ( './xivapi/urls' ) ;
5
5
6
6
module . exports = class APICrawler {
7
- constructor ( config = { } , apiKey = '' ) {
7
+ constructor ( config = { } ) {
8
8
if ( ! config || typeof config !== 'object' ) {
9
9
throw new Error ( 'Config passed to APICrawler as first argument must be an object.' ) ;
10
10
}
@@ -15,12 +15,7 @@ module.exports = class APICrawler {
15
15
) ;
16
16
}
17
17
18
- if ( ! apiKey || typeof apiKey !== 'string' ) {
19
- throw new Error ( 'API key passed to APICrawler as second argument must be a string.' ) ;
20
- }
21
-
22
18
this . apiCallCount = 0 ;
23
- this . apiKey = apiKey ;
24
19
this . config = config ;
25
20
this . cumulativeSuccessfulCalls = 0 ;
26
21
this . errors = 0 ;
@@ -79,7 +74,6 @@ module.exports = class APICrawler {
79
74
const apiPath = urls [ `${ name . charAt ( 0 ) . toLowerCase ( ) } ${ name . substr ( 1 ) } ` ] ( ) ;
80
75
81
76
const queryStringParts = [
82
- `apiKey=${ this . apiKey } ` ,
83
77
`limit=${ limit } `
84
78
] ;
85
79
@@ -247,7 +241,6 @@ module.exports = class APICrawler {
247
241
const apiPath = urls . search ( ) ;
248
242
249
243
const queryStringParts = [
250
- `apiKey=${ this . apiKey } ` ,
251
244
`page=${ page === - 1 ? 1 : page } `
252
245
] ;
253
246
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const listAPI = require('./parsers/listAPI');
4
4
5
5
class API {
6
6
async crawl ( config ) {
7
- return await new APICrawler ( config , this . apiKey ) [ config . method ] ( ) ;
7
+ return await new APICrawler ( config ) [ config . method ] ( ) ;
8
8
}
9
9
10
10
async init ( optionsIn ) {
@@ -59,8 +59,7 @@ class API {
59
59
console . info ( `Valid options include: '${ validOptions . join ( '\', \'' ) } '` ) ;
60
60
return ;
61
61
}
62
-
63
- this . apiKey = await fs . readFileSync ( './xivapi-key.txt' , 'utf-8' ) ;
62
+
64
63
this . options = options ;
65
64
}
66
65
You can’t perform that action at this time.
0 commit comments