poe-api-manager 1.0.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/CI_CD.yml +53 -0
- package/Changelog.md +11 -0
- package/README.md +25 -12
- package/index.js +2 -0
- package/lib/Utils.js +15 -0
- package/lib/WatchAPI.js +1 -33
- package/lib/modules/poe.ninja/currency/CurrencyBaseClass.js +47 -0
- package/lib/modules/poe.ninja/currency/CurrencyWievModule.js +2 -27
- package/lib/modules/poe.ninja/currency/currencyFetch/fetchCurrency.js +5 -4
- package/lib/modules/poe.ninja/currency/currencySubmodules/subModules/CurrencyModule.js +33 -40
- package/lib/modules/poe.ninja/currency/currencySubmodules/subModules/FragmentModule.js +8 -52
- package/lib/modules/poe.ninja/currency/currencyUrlGenerator/CurrencyUrlGenerator.js +9 -0
- package/lib/modules/poe.ninja/currency/{currencySubmodules/functions → methods}/getData.js +4 -4
- package/lib/modules/poe.ninja/currency/methods/getQuickCurrency.js +28 -0
- package/lib/modules/poe.ninja/item/ItemBaseClass.js +40 -0
- package/lib/modules/poe.ninja/item/ItemWievModule.js +27 -52
- package/lib/modules/poe.ninja/item/itemFetch/fetchItem.js +5 -10
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BaseTypeModule.js +8 -48
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BeastModule.js +11 -46
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BlightRavagedMapModule.js +9 -54
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BlightedMapModule.js +7 -49
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ClusterJewelModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/DeliriumOrbsModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/DivinationCardModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/EssenceModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/FossilModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/HelmetEnchantModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/IncubatorModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/InvitationModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/MapModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/MemoryModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/OilModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/OmenModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ResonatorModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ScarabModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/SkillGemModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueAccessoryModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueArmourModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueFlaskModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueJewelModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueMapModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueRelicModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueWeaponModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemSubmodules/subModules/VialsModule.js +7 -52
- package/lib/modules/poe.ninja/item/itemUrlGenerator/ItemUrlGenerator.js +9 -0
- package/lib/modules/poe.ninja/item/{itemSubmodules/functions → methods}/getData.js +5 -11
- package/lib/modules/poe.watch/allModules/WatchBaseClass.js +45 -0
- package/lib/modules/poe.watch/allModules/fetch/fetch.js +1 -4
- package/lib/modules/poe.watch/allModules/submodules/AccessoryModule.js +19 -62
- package/lib/modules/poe.watch/allModules/submodules/ArmourModule.js +19 -60
- package/lib/modules/poe.watch/allModules/submodules/BaseModule.js +19 -59
- package/lib/modules/poe.watch/allModules/submodules/BeastModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/CurrencyModule.js +13 -43
- package/lib/modules/poe.watch/allModules/submodules/DeliriumOrbModule.js +20 -42
- package/lib/modules/poe.watch/allModules/submodules/DivsModule.js +14 -43
- package/lib/modules/poe.watch/allModules/submodules/EssenceModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/FlaskModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/FossilModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/FragmentModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/GemModule.js +19 -61
- package/lib/modules/poe.watch/allModules/submodules/InscribedModule.js +13 -44
- package/lib/modules/poe.watch/allModules/submodules/InvitationModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/JewelModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/MapModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/OilModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/ScarabModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/SextantModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/UniqueMapsModule.js +13 -42
- package/lib/modules/poe.watch/allModules/submodules/WeaponModule.js +19 -59
- package/lib/modules/poe.watch/allModules/watchUrlGenerator/urlGenerator.js +9 -0
- package/package.json +4 -2
- package/lib/config/poeNinja/url.js +0 -12
- package/lib/config/poeWatch/url.js +0 -12
- /package/lib/modules/poe.watch/allModules/{functions → methods}/getCategory.js +0 -0
- /package/lib/modules/poe.watch/allModules/{functions → methods}/getData.js +0 -0
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing invitation data.
|
|
7
6
|
*/
|
|
8
|
-
class InvitationModule {
|
|
7
|
+
class InvitationModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for invitation data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of InvitationModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (invitation).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Invitation data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Invitation data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Invitation data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Invitation data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "invitation";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the InvitationModule class
|
|
59
30
|
module.exports = InvitationModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing jewel data.
|
|
7
6
|
*/
|
|
8
|
-
class JewelModule {
|
|
7
|
+
class JewelModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for jewel data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of JewelModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (jewel).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Jewel data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Jewel data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Jewel data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Jewel data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "jewel";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the JewelModule class
|
|
59
30
|
module.exports = JewelModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing map data.
|
|
7
6
|
*/
|
|
8
|
-
class MapModule {
|
|
7
|
+
class MapModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for map data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of MapModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (map).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Map data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Map data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Map data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Map data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "map";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the MapModule class
|
|
59
30
|
module.exports = MapModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing oil data.
|
|
7
6
|
*/
|
|
8
|
-
class OilModule {
|
|
7
|
+
class OilModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for oil data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of OilModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (oil).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Oil data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Oil data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Oil data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Oil data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "oil";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the OilModule class
|
|
59
30
|
module.exports = OilModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing scarab data.
|
|
7
6
|
*/
|
|
8
|
-
class ScarabModule {
|
|
7
|
+
class ScarabModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for scarab data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of ScarabModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (scarab).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Scarab data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Scarab data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Scarab data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Scarab data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "scarab";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the ScarabModule class
|
|
59
30
|
module.exports = ScarabModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing sextant data.
|
|
7
6
|
*/
|
|
8
|
-
class SextantModule {
|
|
7
|
+
class SextantModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for sextant data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of SextantModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (sextants).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Sextant data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Sextant data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Sextant data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Sextant data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "sextants";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the SextantModule class
|
|
59
30
|
module.exports = SextantModule;
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
5
|
+
* Subclass of WatchBaseClass for accessing unique maps data.
|
|
7
6
|
*/
|
|
8
|
-
class UniqueMapsModule {
|
|
7
|
+
class UniqueMapsModule extends WatchBaseClass {
|
|
9
8
|
/**
|
|
10
|
-
* The query URL for
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
9
|
+
* The query URL for unique maps data.
|
|
13
10
|
* @type {string}
|
|
11
|
+
* @private
|
|
14
12
|
*/
|
|
15
13
|
#queryUrl;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
* Creates
|
|
19
|
-
*
|
|
20
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
16
|
+
* Creates a new instance of UniqueMapsModule.
|
|
17
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
21
18
|
*/
|
|
22
|
-
constructor(
|
|
19
|
+
constructor(league) {
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
21
|
+
* The type of data being accessed (uniqueMaps).
|
|
27
22
|
* @type {string}
|
|
28
23
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Asynchronously retrieves Unique Maps data based on the specified properties.
|
|
34
|
-
*
|
|
35
|
-
* @async
|
|
36
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
38
|
-
*/
|
|
39
|
-
async getData(requestedProperties) {
|
|
40
|
-
try {
|
|
41
|
-
/**
|
|
42
|
-
* Calls the getData function to fetch Unique Maps data.
|
|
43
|
-
*
|
|
44
|
-
* @type {Promise<Array<Object>>}
|
|
45
|
-
*/
|
|
46
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
/**
|
|
49
|
-
* Throws an error if there's an issue fetching or processing the Unique Maps data.
|
|
50
|
-
*
|
|
51
|
-
* @throws {Error}
|
|
52
|
-
*/
|
|
53
|
-
throw new Error(`Error fetching Unique Maps data: ${error.message}`);
|
|
54
|
-
}
|
|
24
|
+
const type = "uniqueMaps";
|
|
25
|
+
super(league, type);
|
|
26
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
55
27
|
}
|
|
56
28
|
}
|
|
57
29
|
|
|
58
|
-
// Export the UniqueMapsModule class
|
|
59
30
|
module.exports = UniqueMapsModule;
|
|
@@ -1,87 +1,47 @@
|
|
|
1
|
-
const
|
|
2
|
-
const getCategory = require("../
|
|
1
|
+
const WatchBaseClass = require("../WatchBaseClass");
|
|
2
|
+
const getCategory = require("../methods/getCategory");
|
|
3
|
+
const urlGenerator = require("../watchUrlGenerator/urlGenerator");
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @class
|
|
6
|
+
* Subclass of WatchBaseClass for accessing weapon data.
|
|
8
7
|
*/
|
|
9
|
-
class WeaponModule {
|
|
8
|
+
class WeaponModule extends WatchBaseClass {
|
|
10
9
|
/**
|
|
11
|
-
* The query URL for
|
|
12
|
-
*
|
|
13
|
-
* @private
|
|
10
|
+
* The query URL for weapon data.
|
|
14
11
|
* @type {string}
|
|
12
|
+
* @private
|
|
15
13
|
*/
|
|
16
14
|
#queryUrl;
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
|
-
* Creates
|
|
20
|
-
*
|
|
21
|
-
* @param {string} leagueUrl - The league URL to fetch data from.
|
|
17
|
+
* Creates a new instance of WeaponModule.
|
|
18
|
+
* @param {string} league - The league from which the data will be fetched.
|
|
22
19
|
*/
|
|
23
|
-
constructor(
|
|
20
|
+
constructor(league) {
|
|
24
21
|
/**
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
* @private
|
|
22
|
+
* The type of data being accessed (weapon).
|
|
28
23
|
* @type {string}
|
|
29
24
|
*/
|
|
30
|
-
|
|
25
|
+
const type = "weapon";
|
|
26
|
+
super(league, type);
|
|
27
|
+
this.#queryUrl = urlGenerator(league, type);
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @async
|
|
37
|
-
* @param {Array<string>} requestedProperties - An array of properties to retrieve.
|
|
38
|
-
* @returns {Promise<Object>} A promise that resolves to the retrieved data.
|
|
39
|
-
*/
|
|
40
|
-
async getData(requestedProperties) {
|
|
41
|
-
try {
|
|
42
|
-
/**
|
|
43
|
-
* Calls the getData function to fetch Weapon data.
|
|
44
|
-
*
|
|
45
|
-
* @type {Promise<Array<Object>>}
|
|
46
|
-
*/
|
|
47
|
-
return getData(this.#queryUrl, requestedProperties);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
/**
|
|
50
|
-
* Throws an error if there's an issue fetching or processing the Weapon data.
|
|
51
|
-
*
|
|
52
|
-
* @throws {Error}
|
|
53
|
-
*/
|
|
54
|
-
throw new Error(`Error fetching Weapon data: ${error.message}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Asynchronously retrieves weapon data based on the specified category name.
|
|
59
|
-
*
|
|
31
|
+
* Retrieves category data for weapons.
|
|
60
32
|
* @async
|
|
61
33
|
* @param {string} categoryName - The name of the category to retrieve.
|
|
62
34
|
* * Possible values: "twohandswords", "fishingrods", "onehandswords", "twohandaxes", "staves", "warstaff", "daggers", "scepters".
|
|
63
|
-
* @returns {Promise<Array<Object>>} - A
|
|
64
|
-
* @throws {Error} - Throws
|
|
65
|
-
*
|
|
35
|
+
* @returns {Promise<Array<Object>>} - A Promise containing data for the specified category.
|
|
36
|
+
* @throws {Error} - Throws errors encountered while fetching data.
|
|
66
37
|
*/
|
|
67
38
|
async getCategory(categoryName) {
|
|
68
39
|
try {
|
|
69
|
-
|
|
70
|
-
* Calls the getCategory function to fetch weapon data based on category name.
|
|
71
|
-
*
|
|
72
|
-
* @type {Promise<Array<Object>>}
|
|
73
|
-
*/
|
|
74
|
-
return getCategory(this.#queryUrl, categoryName);
|
|
40
|
+
return await getCategory(this.#queryUrl, categoryName);
|
|
75
41
|
} catch (error) {
|
|
76
|
-
|
|
77
|
-
* Throws an error if there's an issue fetching or processing the weapon data for the specified category.
|
|
78
|
-
*
|
|
79
|
-
* @throws {Error}
|
|
80
|
-
*/
|
|
81
|
-
throw new Error(`Error fetching data Weapon Category: ${error.message}`);
|
|
42
|
+
throw new Error(`Error fetching Weapon data: ${error.message}`);
|
|
82
43
|
}
|
|
83
44
|
}
|
|
84
45
|
}
|
|
85
46
|
|
|
86
|
-
// Export the WeaponModule class
|
|
87
47
|
module.exports = WeaponModule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a URL based on league and type. poe.watch API is used.
|
|
3
|
+
* @param {string} league - The league for which the URL is generated.
|
|
4
|
+
* @param {string} type - The type of data for which the URL is generated.
|
|
5
|
+
* @returns {string} - The generated URL.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = function urlGenerator(league, type) {
|
|
8
|
+
return `https://api.poe.watch/get?category=${type}&league=${league}`;
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-api-manager",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "API management for poe.ninja and poe.watch",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"poe economy api",
|
|
24
24
|
"path of exile api",
|
|
25
25
|
"poe.watch api",
|
|
26
|
-
"poe.ninja api"
|
|
26
|
+
"poe.ninja api",
|
|
27
|
+
"backend",
|
|
28
|
+
"frontend"
|
|
27
29
|
],
|
|
28
30
|
"author": "Ayberk Gezer",
|
|
29
31
|
"license": "MIT",
|
|
File without changes
|