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 |
|
18 | exports.areas = () => __awaiter(void 0, void 0, void 0, function* () {
|
19 | try {
|
20 | return yield got_1.default(configs_1.runescape.bestiary.endpoints.areas).json();
|
21 | }
|
22 | catch (error) {
|
23 | console.log(error.response.body);
|
24 |
|
25 | }
|
26 | });
|
27 | exports.beast = (beastid) => __awaiter(void 0, void 0, void 0, function* () {
|
28 | try {
|
29 | return yield got_1.default(configs_1.runescape.bestiary.endpoints.beast, {
|
30 | searchParams: {
|
31 | beastid,
|
32 | },
|
33 | }).json();
|
34 | }
|
35 | catch (error) {
|
36 | console.log(error.response.body);
|
37 |
|
38 | }
|
39 | });
|
40 | exports.beastSearch = (search, method = "terms") => __awaiter(void 0, void 0, void 0, function* () {
|
41 | try {
|
42 |
|
43 | if (method === "terms") {
|
44 |
|
45 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastTerm, {
|
46 | searchParams: {
|
47 | term: search,
|
48 | },
|
49 | }).json();
|
50 | return response;
|
51 | }
|
52 |
|
53 | if (method === "firstLetter") {
|
54 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastLetter, {
|
55 | searchParams: {
|
56 | letter: search,
|
57 | },
|
58 | }).json();
|
59 | return response;
|
60 | }
|
61 |
|
62 | if (method === "area") {
|
63 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastArea, {
|
64 | searchParams: {
|
65 | identifier: search,
|
66 | },
|
67 | }).json();
|
68 | return response;
|
69 | }
|
70 |
|
71 | if (method === "slayerCategory") {
|
72 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastSlayer, {
|
73 | searchParams: {
|
74 | identifier: search,
|
75 | },
|
76 | }).json();
|
77 | return response;
|
78 | }
|
79 |
|
80 | if (method === "weakness") {
|
81 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastWeakness, {
|
82 | searchParams: {
|
83 | identifier: search,
|
84 | },
|
85 | }).json();
|
86 | return response;
|
87 | }
|
88 |
|
89 | if (method === "levelRange") {
|
90 |
|
91 | const response = yield got_1.default(configs_1.runescape.bestiary.endpoints.beastLevel, {
|
92 | searchParams: {
|
93 | identifier: search,
|
94 | },
|
95 | }).json();
|
96 | return response;
|
97 | }
|
98 | }
|
99 | catch (error) {
|
100 | console.log(error.response.body);
|
101 |
|
102 | }
|
103 | });
|
104 | exports.slayerCategories = () => __awaiter(void 0, void 0, void 0, function* () {
|
105 | try {
|
106 | return yield got_1.default(configs_1.runescape.bestiary.endpoints.slayerCategories).json();
|
107 | }
|
108 | catch (error) {
|
109 | console.log(error.response.body);
|
110 |
|
111 | }
|
112 | });
|
113 | exports.weaknesses = () => __awaiter(void 0, void 0, void 0, function* () {
|
114 | try {
|
115 | return yield got_1.default(configs_1.runescape.bestiary.endpoints.weaknesses).json();
|
116 | }
|
117 | catch (error) {
|
118 | console.log(error.response.body);
|
119 |
|
120 | }
|
121 | });
|
122 |
|
\ | No newline at end of file |