blob: 4e01ebb2cc74e44b268fad34fb53afc56d75beec (
plain)
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
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const Constants_1 = require("./Constants");
const Utils_1 = require("./Utils");
const Requester_1 = require("./Requester");
const Client_1 = require("./Artists/Client");
const Client_2 = require("./Songs/Client");
class Client {
constructor(key, config = {}) {
var _a;
this.key = key;
this.config = config;
if (!["string", "undefined"].includes(typeof key)) {
throw new Error(Constants_1.Constants.INV_TOKEN);
}
if (!(0, Utils_1.checkConfig)(config)) {
throw new Error(Constants_1.Constants.INV_CONFIG_OBJ);
}
this.songs = new Client_2.SongsClient(this);
this.artists = new Client_1.ArtistsClient(this);
this.api = new Requester_1.Requester(((_a = this.config.origin) === null || _a === void 0 ? void 0 : _a.api) || Constants_1.Constants.BASE_URL, {
headers: {
"User-Agent": Constants_1.Constants.DEF_USER_AGENT,
Authorization: `Bearer ${this.key}`,
},
});
}
}
exports.Client = Client;
|