-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
46 lines (35 loc) · 1.27 KB
/
index.js
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
'use strict';
var createApiRequest = require('./lib/apiRequest');
var initNonNSMethods = require('./lib/baseMethods');
var initUnrestrictNS = require('./lib/unrestrict');
var initTrafficNS = require('./lib/traffic');
var initStreamingNS = require('./lib/streaming');
var initDownloadsNS = require('./lib/downloads');
var initTorrentsNS = require('./lib/torrents');
var initHostsNS = require('./lib/hosts');
var initForumNS = require('./lib/forum');
var initSettingsNS = require('./lib/settings');
function initRealDebridAPI(apiKey) {
var apiRequest = createApiRequest(apiKey);
var api = initNonNSMethods(apiRequest);
api.user = initUserNS(apiRequest);
api.unrestrict = initUnrestrictNS(apiRequest);
api.traffic = initTrafficNS(apiRequest);
api.streaming = initStreamingNS(apiRequest);
api.downloads = initDownloadsNS(apiRequest);
api.torrents = initTorrentsNS(apiRequest);
api.hosts = initHostsNS(apiRequest);
api.forum = initForumNS(apiRequest);
api.settings = initSettingsNS(apiRequest);
return api;
}
/**
* Creates a new RealDebrid instance
*/
function realDebrid(apiKey) {
if (!APIKey) {
throw new Error('APIKey is required to use the Real-debrid API');
}
return initRealDebridAPI(apiKey);
}
module.exports = realDebrid;