1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4 | return new (P || (P = Promise))(function (resolve, reject) {
|
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9 | });
|
10 | };
|
11 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
12 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
13 | };
|
14 | Object.defineProperty(exports, "__esModule", { value: true });
|
15 | const got_1 = __importDefault(require("got"));
|
16 | const configs_1 = require("../configs");
|
17 | exports.profile = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
18 | try {
|
19 | const response = yield got_1.default(configs_1.runescape.runemetrics.endpoints.profile, {
|
20 | searchParams: {
|
21 | activities: 20,
|
22 | user: encodeURI(name),
|
23 | },
|
24 | }).json();
|
25 | return response;
|
26 | }
|
27 | catch (error) {
|
28 | console.log(error.response.body);
|
29 |
|
30 | }
|
31 | });
|
32 | exports.monthlyXp = (name, skillId) => __awaiter(void 0, void 0, void 0, function* () {
|
33 | try {
|
34 | const response = yield got_1.default(configs_1.runescape.runemetrics.endpoints.monthlyXp, {
|
35 | searchParams: {
|
36 | searchName: encodeURI(name),
|
37 | skillid: skillId,
|
38 | },
|
39 | }).json();
|
40 | return response;
|
41 | }
|
42 | catch (error) {
|
43 | console.log(error.response.body);
|
44 |
|
45 | }
|
46 | });
|
47 | exports.quests = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
48 | try {
|
49 | const response = yield got_1.default(configs_1.runescape.runemetrics.endpoints.quests, {
|
50 | searchParams: {
|
51 | user: encodeURI(name),
|
52 | },
|
53 | }).json();
|
54 | return response;
|
55 | }
|
56 | catch (error) {
|
57 | console.log(error.response.body);
|
58 |
|
59 | }
|
60 | });
|
61 |
|
\ | No newline at end of file |