poe-api-manager 0.2.2 → 0.2.8

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.
Files changed (69) hide show
  1. package/Changelog.md +17 -14
  2. package/README.md +31 -18
  3. package/lib/NinjaAPI.js +26 -4
  4. package/lib/WatchAPI.js +45 -1
  5. package/lib/config/poeNinja/url.js +9 -0
  6. package/lib/config/poeWatch/url.js +9 -0
  7. package/lib/modules/mainfunctions/filter/propertyFilter.js +18 -0
  8. package/lib/modules/poe.ninja/currency/CurrencyWievModule.js +39 -2
  9. package/lib/modules/poe.ninja/currency/currencyFetch/fetchCurrency.js +11 -3
  10. package/lib/modules/poe.ninja/currency/currencyFetch/merge/mergeData.js +7 -0
  11. package/lib/modules/poe.ninja/currency/currencySubmodules/functions/getData.js +23 -0
  12. package/lib/modules/poe.ninja/currency/currencySubmodules/subModules/CurrencyModule.js +45 -2
  13. package/lib/modules/poe.ninja/currency/currencySubmodules/subModules/FragmentModule.js +45 -2
  14. package/lib/modules/poe.ninja/item/ItemWievModule.js +135 -2
  15. package/lib/modules/poe.ninja/item/itemFetch/fetchItem.js +23 -2
  16. package/lib/modules/poe.ninja/item/itemSubmodules/functions/getData.js +19 -0
  17. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BaseTypeModule.js +41 -2
  18. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BeastModule.js +41 -2
  19. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BlightRavagedMapModule.js +46 -2
  20. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/BlightedMapModule.js +43 -2
  21. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ClusterJewelModule.js +46 -2
  22. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/DeliriumOrbsModule.js +46 -2
  23. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/DivinationCardModule.js +46 -2
  24. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/EssenceModule.js +46 -2
  25. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/FossilModule.js +46 -2
  26. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/HelmetEnchantModule.js +46 -2
  27. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/IncubatorModule.js +46 -2
  28. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/InvitationModule.js +46 -2
  29. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/MapModule.js +46 -2
  30. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/MemoryModule.js +46 -2
  31. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/OilModule.js +46 -2
  32. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/OmenModule.js +46 -2
  33. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ResonatorModule.js +46 -2
  34. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/ScarabModule.js +46 -2
  35. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/SkillGemModule.js +46 -2
  36. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueAccessoryModule.js +46 -2
  37. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueArmourModule.js +46 -2
  38. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueFlaskModule.js +46 -2
  39. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueJewelModule.js +46 -2
  40. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueMapModule.js +46 -2
  41. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueRelicModule.js +46 -2
  42. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/UniqueWeaponModule.js +46 -2
  43. package/lib/modules/poe.ninja/item/itemSubmodules/subModules/VialsModule.js +46 -2
  44. package/lib/modules/poe.watch/WatchWievModule.js +106 -4
  45. package/lib/modules/poe.watch/allModules/fetch/fetch.js +11 -2
  46. package/lib/modules/poe.watch/allModules/functions/getCategory.js +55 -0
  47. package/lib/modules/poe.watch/allModules/functions/getData.js +20 -1
  48. package/lib/modules/poe.watch/allModules/submodules/AccessoryModule.js +77 -1
  49. package/lib/modules/poe.watch/allModules/submodules/ArmourModule.js +75 -1
  50. package/lib/modules/poe.watch/allModules/submodules/BaseModule.js +75 -1
  51. package/lib/modules/poe.watch/allModules/submodules/BeastModule.js +47 -1
  52. package/lib/modules/poe.watch/allModules/submodules/CurrencyModule.js +49 -2
  53. package/lib/modules/poe.watch/allModules/submodules/DeliriumOrbModule.js +47 -1
  54. package/lib/modules/poe.watch/allModules/submodules/DivsModule.js +47 -1
  55. package/lib/modules/poe.watch/allModules/submodules/EssenceModule.js +47 -1
  56. package/lib/modules/poe.watch/allModules/submodules/FlaskModule.js +47 -1
  57. package/lib/modules/poe.watch/allModules/submodules/FossilModule.js +47 -1
  58. package/lib/modules/poe.watch/allModules/submodules/FragmentModule.js +47 -1
  59. package/lib/modules/poe.watch/allModules/submodules/GemModule.js +76 -1
  60. package/lib/modules/poe.watch/allModules/submodules/InscribedModule.js +49 -1
  61. package/lib/modules/poe.watch/allModules/submodules/InvitationModule.js +47 -1
  62. package/lib/modules/poe.watch/allModules/submodules/JewelModule.js +47 -1
  63. package/lib/modules/poe.watch/allModules/submodules/MapModule.js +47 -1
  64. package/lib/modules/poe.watch/allModules/submodules/OilModule.js +47 -1
  65. package/lib/modules/poe.watch/allModules/submodules/ScarabModule.js +47 -1
  66. package/lib/modules/poe.watch/allModules/submodules/SextantModule.js +47 -1
  67. package/lib/modules/poe.watch/allModules/submodules/UniqueMapsModule.js +47 -1
  68. package/lib/modules/poe.watch/allModules/submodules/WeaponModule.js +75 -1
  69. package/package.json +1 -1
@@ -1,44 +1,177 @@
1
1
  const itemSubmodules = require("./itemSubmodules/itemSubModules");
2
2
  const baseurl = require("../../../config/poeNinja/url");
3
3
 
4
- //itemwiev module
4
+ /**
5
+ * Represents a module for viewing item-related information in a specific Path of Exile league.
6
+ * @class
7
+ */
5
8
  class ItemWievModule {
6
9
  #league;
7
10
  #baseurl;
11
+
12
+ /**
13
+ * Creates a new instance of ItemWievModule.
14
+ * @constructor
15
+ * @param {string} league - The Path of Exile league for which the item information is retrieved.
16
+ */
8
17
  constructor(league) {
18
+ /**
19
+ * The Path of Exile league for which the item information is retrieved.
20
+ * @private
21
+ * @type {string}
22
+ */
9
23
  this.#league = league;
24
+
25
+ /**
26
+ * The base URL for the Path of Exile Ninja API.
27
+ * @private
28
+ * @type {string}
29
+ */
10
30
  this.#baseurl = baseurl.baseurl;
31
+
32
+ /**
33
+ * The complete URL for retrieving item information for the specified league.
34
+ * @private
35
+ * @type {string}
36
+ */
11
37
  const url = `${this.#baseurl}itemoverview?league=${this.#league}&type=`;
12
38
 
39
+ /**
40
+ * Represents a submodule for base type item information.
41
+ */
13
42
  this.baseType = new itemSubmodules.BaseTypeModule(url);
43
+
44
+ /**
45
+ * Represents a submodule for beast item information.
46
+ */
14
47
  this.beast = new itemSubmodules.BeastModule(url);
48
+
49
+ /**
50
+ * Represents a submodule for delirium orbs item information.
51
+ */
15
52
  this.deliriumOrbs = new itemSubmodules.DeliriumOrbsModule(url);
53
+
54
+ /**
55
+ * Represents a submodule for divination card item information.
56
+ */
16
57
  this.divinationCard = new itemSubmodules.DivinationCardModule(url);
58
+
59
+ /**
60
+ * Represents a submodule for essence item information.
61
+ */
17
62
  this.essence = new itemSubmodules.EssenceModule(url);
63
+
64
+ /**
65
+ * Represents a submodule for fossil item information.
66
+ */
18
67
  this.fossil = new itemSubmodules.FossilModule(url);
68
+
69
+ /**
70
+ * Represents a submodule for helmet enchant item information.
71
+ */
19
72
  this.helmetEnchant = new itemSubmodules.HelmetEnchantModule(url);
73
+
74
+ /**
75
+ * Represents a submodule for incubator item information.
76
+ */
20
77
  this.incubator = new itemSubmodules.IncubatorModule(url);
78
+
79
+ /**
80
+ * Represents a submodule for map item information.
81
+ */
21
82
  this.map = new itemSubmodules.MapModule(url);
83
+
84
+ /**
85
+ * Represents a submodule for oil item information.
86
+ */
22
87
  this.oil = new itemSubmodules.OilModule(url);
88
+
89
+ /**
90
+ * Represents a submodule for resonator item information.
91
+ */
23
92
  this.resonator = new itemSubmodules.ResonatorModule(url);
93
+
94
+ /**
95
+ * Represents a submodule for scarab item information.
96
+ */
24
97
  this.scarab = new itemSubmodules.ScarabModule(url);
98
+
99
+ /**
100
+ * Represents a submodule for skill gem item information.
101
+ */
25
102
  this.skillGem = new itemSubmodules.SkillGemModule(url);
103
+
104
+ /**
105
+ * Represents a submodule for unique accessory item information.
106
+ */
26
107
  this.uniqueAccessory = new itemSubmodules.UniqueAccessoryModule(url);
108
+
109
+ /**
110
+ * Represents a submodule for unique armour item information.
111
+ */
27
112
  this.uniqueArmour = new itemSubmodules.UniqueArmourModule(url);
113
+
114
+ /**
115
+ * Represents a submodule for unique flask item information.
116
+ */
28
117
  this.uniqueFlask = new itemSubmodules.UniqueFlaskModule(url);
118
+
119
+ /**
120
+ * Represents a submodule for unique jewel item information.
121
+ */
29
122
  this.uniqueJewel = new itemSubmodules.UniqueJewelModule(url);
123
+
124
+ /**
125
+ * Represents a submodule for unique map item information.
126
+ */
30
127
  this.uniqueMap = new itemSubmodules.UniqueMapModule(url);
128
+
129
+ /**
130
+ * Represents a submodule for unique weapon item information.
131
+ */
31
132
  this.uniqueWeapon = new itemSubmodules.UniqueWeaponModule(url);
133
+
134
+ /**
135
+ * Represents a submodule for vials item information.
136
+ */
32
137
  this.vials = new itemSubmodules.VialsModule(url);
138
+
139
+ /**
140
+ * Represents a submodule for omen item information.
141
+ */
33
142
  this.omen = new itemSubmodules.OmenModule(url);
143
+
144
+ /**
145
+ * Represents a submodule for memory item information.
146
+ */
34
147
  this.memory = new itemSubmodules.MemoryModule(url);
148
+
149
+ /**
150
+ * Represents a submodule for invitation item information.
151
+ */
35
152
  this.invitation = new itemSubmodules.InvitationModule(url);
153
+
154
+ /**
155
+ * Represents a submodule for unique relics item information.
156
+ */
36
157
  this.uniqueRelics = new itemSubmodules.UniqueRelicsModule(url);
158
+
159
+ /**
160
+ * Represents a submodule for cluster jewel item information.
161
+ */
37
162
  this.clusterJewel = new itemSubmodules.ClusterJewelModule(url);
163
+
164
+ /**
165
+ * Represents a submodule for blighted map item information.
166
+ */
38
167
  this.blightedMap = new itemSubmodules.BlightedMapModule(url);
168
+
169
+ /**
170
+ * Represents a submodule for blight ravaged map item information.
171
+ */
39
172
  this.blightRavagedMap = new itemSubmodules.BlightRavagedMapModule(url);
40
173
  }
41
174
  }
42
175
 
43
- //export ItemWievModule;
176
+ // Export the ItemWievModule class.
44
177
  module.exports = ItemWievModule;
@@ -1,20 +1,41 @@
1
1
  const axios = require("axios");
2
2
 
3
- // items for a specific fetch function
3
+ /**
4
+ * Asynchronously fetches data from a specified URL for item-related information.
5
+ *
6
+ * @param {string} baseurl - The base URL for the data fetch operation.
7
+ * @param {string} type - The specific type of item data to fetch.
8
+ * @returns {Promise<Array<Object>>} - A promise that resolves to the fetched item data.
9
+ * @throws {Error} - Throws an error if there's an issue fetching or processing the data.
10
+ */
4
11
  async function fetchData(baseurl, type) {
5
12
  try {
13
+ /**
14
+ * @type {string} url - The complete URL for fetching item-related data.
15
+ */
6
16
  const url = `${baseurl}${type}`;
17
+
18
+ /**
19
+ * @type {Object} response - The response object from the data fetch operation.
20
+ */
7
21
  const response = await axios.get(url);
8
22
 
9
23
  if (response.data && response.data.lines) {
24
+ /**
25
+ * @type {Array<Object>} lines - The array of objects containing item-related data.
26
+ */
10
27
  return response.data.lines;
11
28
  } else {
12
29
  throw new Error("Invalid response format from POE Ninja API Itemwiev");
13
30
  }
14
31
  } catch (error) {
32
+ /**
33
+ * Throws an error if there's an issue fetching or processing the item-related data.
34
+ * @throws {Error}
35
+ */
15
36
  throw new Error(`Error fetching data: ${error.message}`);
16
37
  }
17
38
  }
18
39
 
19
- // export fetchData;
40
+ // Export the fetchData function.
20
41
  module.exports = fetchData;
@@ -1,13 +1,28 @@
1
1
  const fetchData = require("../../itemFetch/fetchItem");
2
2
  const filterProperties = require("../../../../mainfunctions/filter/propertyFilter");
3
3
 
4
+ /**
5
+ * Asynchronously fetches and filters item-related data from a specified URL.
6
+ *
7
+ * @param {string} url - The URL to fetch item-related data from.
8
+ * @param {string} type - The type of item data to fetch.
9
+ * @param {Array<string>} [requestedProperties] - (Optional) An array of property names to include in the filtered result.
10
+ * @returns {Promise<Array<Object>|Object>} - A promise that resolves to the fetched or filtered item data.
11
+ * @throws {Error} - Throws an error if there's an issue fetching or processing the data.
12
+ */
4
13
  async function getData(url, type, requestedProperties) {
5
14
  try {
6
15
  // Fetch data using the fetchData function
16
+ /**
17
+ * @type {Array<Object>|Object} fetchedData - The fetched item data.
18
+ */
7
19
  const fetchedData = await fetchData(url, type);
8
20
 
9
21
  // If requestedProperties are specified, filter the data based on those properties
10
22
  if (requestedProperties) {
23
+ /**
24
+ * @type {Array<Object>|Object} result - The filtered item data based on requested properties.
25
+ */
11
26
  const result = filterProperties(fetchedData, requestedProperties);
12
27
  return result;
13
28
  } else {
@@ -15,6 +30,10 @@ async function getData(url, type, requestedProperties) {
15
30
  return fetchedData;
16
31
  }
17
32
  } catch (error) {
33
+ /**
34
+ * Throws an error if there's an issue fetching or processing the item data.
35
+ * @throws {Error}
36
+ */
18
37
  throw new Error(`Error fetching data: ${error.message}`);
19
38
  }
20
39
  }
@@ -1,17 +1,56 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Module for retrieving base type item information.
5
+ * @class
6
+ */
3
7
  class BaseTypeModule {
4
8
  #url;
5
9
  #type;
10
+ /**
11
+ * Creates a new instance of BaseTypeModule.
12
+ * @constructor
13
+ * @param {string} url - The URL for fetching base type item information.
14
+ */
6
15
  constructor(url) {
16
+ /**
17
+ * @type {string} #url - The URL for fetching base type item information.
18
+ * @private
19
+ */
7
20
  this.#url = url;
21
+
22
+ /**
23
+ * @type {string} #type - The type of item data (BaseType).
24
+ * @private
25
+ */
8
26
  this.#type = "BaseType";
9
27
  }
10
28
 
29
+ /**
30
+ * Asynchronously retrieves base type item information.
31
+ *
32
+ * @async
33
+ * @method
34
+ * @param {Array<string>} requestedProperties - An array of property names to include in the result.
35
+ * @returns {Promise<Array<Object>>} A promise that resolves to the fetched item data.
36
+ * @throws {Error} Throws an error if there's an issue with the data fetching process.
37
+ *
38
+ */
11
39
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
40
+ try {
41
+ /**
42
+ * Calls the getData function to fetch Base Type data.
43
+ * @type {Promise<Array<Object>>}
44
+ */
45
+ return getData(this.#url, this.#type, requestedProperties);
46
+ } catch (error) {
47
+ /**
48
+ * Throws an error if there's an issue fetching or processing the Base Type data.
49
+ * @throws {Error}
50
+ */
51
+ throw new Error(`Error fetching Base Type data: ${error.message}`);
52
+ }
13
53
  }
14
54
  }
15
55
 
16
- //export BaseTypeModule;
17
56
  module.exports = BaseTypeModule;
@@ -1,17 +1,56 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Module for retrieving information about beasts.
5
+ * @class
6
+ */
3
7
  class BeastModule {
4
8
  #url;
5
9
  #type;
10
+ /**
11
+ * Creates a new instance of BeastModule.
12
+ * @constructor
13
+ * @param {string} url - The URL for fetching beast information.
14
+ */
6
15
  constructor(url) {
16
+ /**
17
+ * @type {string} #url - The URL for fetching beast information.
18
+ * @private
19
+ */
7
20
  this.#url = url;
21
+
22
+ /**
23
+ * @type {string} #type - The type of data (Beast).
24
+ * @private
25
+ */
8
26
  this.#type = "Beast";
9
27
  }
10
28
 
29
+ /**
30
+ * Asynchronously retrieves beast information.
31
+ *
32
+ * @async
33
+ * @method
34
+ * @param {Array<string>} requestedProperties - An array of property names to include in the result.
35
+ * @returns {Promise<Array<Object>>} A promise that resolves to the fetched beast data.
36
+ * @throws {Error} Throws an error if there's an issue with the data fetching process.
37
+ *
38
+ */
11
39
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
40
+ try {
41
+ /**
42
+ * Calls the getData function to fetch Beast data.
43
+ * @type {Promise<Array<Object>>}
44
+ */
45
+ return getData(this.#url, this.#type, requestedProperties);
46
+ } catch (error) {
47
+ /**
48
+ * Throws an error if there's an issue fetching or processing the Beast data.
49
+ * @throws {Error}
50
+ */
51
+ throw new Error(`Error fetching Beast data: ${error.message}`);
52
+ }
13
53
  }
14
54
  }
15
55
 
16
- //export BeastModule;
17
56
  module.exports = BeastModule;
@@ -1,17 +1,61 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Represents a module for fetching data related to Blight Ravaged Maps.
5
+ *
6
+ * @class
7
+ */
3
8
  class BlightRavagedMapModule {
9
+ /**
10
+ * The URL for fetching data.
11
+ *
12
+ * @private
13
+ * @type {string}
14
+ */
4
15
  #url;
16
+
17
+ /**
18
+ * The type of data (BlightRavagedMap in this case).
19
+ *
20
+ * @private
21
+ * @type {string}
22
+ */
5
23
  #type;
24
+
25
+ /**
26
+ * Creates an instance of BlightRavagedMapModule.
27
+ *
28
+ * @param {string} url - The URL to fetch data from.
29
+ */
6
30
  constructor(url) {
7
31
  this.#url = url;
8
32
  this.#type = "BlightRavagedMap";
9
33
  }
10
34
 
35
+ /**
36
+ * Asynchronously retrieves data based on the specified properties.
37
+ *
38
+ * @async
39
+ * @param {Array<string>} requestedProperties - An array of properties to retrieve.
40
+ * @returns {Promise<Object>} A promise that resolves to the retrieved data.
41
+ */
11
42
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
43
+ try {
44
+ /**
45
+ * Calls the getData function to fetch BlightRavagedMap data.
46
+ *
47
+ * @type {Promise<Array<Object>>}
48
+ */
49
+ return getData(this.#url, this.#type, requestedProperties);
50
+ } catch (error) {
51
+ /**
52
+ * Throws an error if there's an issue fetching or processing the BlightRavagedMap data.
53
+ *
54
+ * @throws {Error}
55
+ */
56
+ throw new Error(`Error fetching BlightRavagedMap data: ${error.message}`);
57
+ }
13
58
  }
14
59
  }
15
60
 
16
- //export BlightRavagedMapModule;
17
61
  module.exports = BlightRavagedMapModule;
@@ -1,17 +1,58 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Represents a module for fetching data related to Blighted Maps.
5
+ *
6
+ * @class
7
+ */
3
8
  class BlightedMapModule {
9
+ /**
10
+ * The URL for fetching data.
11
+ *
12
+ * @private
13
+ * @type {string}
14
+ */
4
15
  #url;
16
+
17
+ /**
18
+ * The type of data (BlightedMap in this case).
19
+ *
20
+ * @private
21
+ * @type {string}
22
+ */
5
23
  #type;
24
+ /**
25
+ * Creates an instance of BlightedMapModule.
26
+ *
27
+ * @param {string} url - The URL to fetch data from.
28
+ */
6
29
  constructor(url) {
7
30
  this.#url = url;
8
31
  this.#type = "BlightedMap";
9
32
  }
10
33
 
34
+ /**
35
+ * Asynchronously retrieves data based on the specified properties.
36
+ *
37
+ * @async
38
+ * @param {Array<string>} requestedProperties - An array of properties to retrieve.
39
+ * @returns {Promise<Object>} A promise that resolves to the retrieved data.
40
+ */
11
41
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
42
+ try {
43
+ /**
44
+ * Calls the getData function to fetch BlightedMap data.
45
+ * @type {Promise<Array<Object>>}
46
+ */
47
+ return getData(this.#url, this.#type, requestedProperties);
48
+ } catch (error) {
49
+ /**
50
+ * Throws an error if there's an issue fetching or processing the BlightedMap data.
51
+ * @throws {Error}
52
+ */
53
+ throw new Error(`Error fetching BlightedMap data: ${error.message}`);
54
+ }
13
55
  }
14
56
  }
15
57
 
16
- //export BlightedMapModule;
17
58
  module.exports = BlightedMapModule;
@@ -1,17 +1,61 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Represents a module for fetching data related to Cluster Jewels.
5
+ *
6
+ * @class
7
+ */
3
8
  class ClusterJewelModule {
9
+ /**
10
+ * The URL for fetching data.
11
+ *
12
+ * @private
13
+ * @type {string}
14
+ */
4
15
  #url;
16
+
17
+ /**
18
+ * The type of data (ClusterJewel in this case).
19
+ *
20
+ * @private
21
+ * @type {string}
22
+ */
5
23
  #type;
24
+
25
+ /**
26
+ * Creates an instance of ClusterJewelModule.
27
+ *
28
+ * @param {string} url - The URL to fetch data from.
29
+ */
6
30
  constructor(url) {
7
31
  this.#url = url;
8
32
  this.#type = "ClusterJewel";
9
33
  }
10
34
 
35
+ /**
36
+ * Asynchronously retrieves data based on the specified properties.
37
+ *
38
+ * @async
39
+ * @param {Array<string>} requestedProperties - An array of properties to retrieve.
40
+ * @returns {Promise<Object>} A promise that resolves to the retrieved data.
41
+ */
11
42
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
43
+ try {
44
+ /**
45
+ * Calls the getData function to fetch ClusterJewel data.
46
+ *
47
+ * @type {Promise<Array<Object>>}
48
+ */
49
+ return getData(this.#url, this.#type, requestedProperties);
50
+ } catch (error) {
51
+ /**
52
+ * Throws an error if there's an issue fetching or processing the ClusterJewel data.
53
+ *
54
+ * @throws {Error}
55
+ */
56
+ throw new Error(`Error fetching ClusterJewel data: ${error.message}`);
57
+ }
13
58
  }
14
59
  }
15
60
 
16
- //export ClusterJewelModule;
17
61
  module.exports = ClusterJewelModule;
@@ -1,17 +1,61 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Represents a module for fetching data related to Delirium Orbs.
5
+ *
6
+ * @class
7
+ */
3
8
  class DeliriumOrbsModule {
9
+ /**
10
+ * The URL for fetching data.
11
+ *
12
+ * @private
13
+ * @type {string}
14
+ */
4
15
  #url;
16
+
17
+ /**
18
+ * The type of data (DeliriumOrb in this case).
19
+ *
20
+ * @private
21
+ * @type {string}
22
+ */
5
23
  #type;
24
+
25
+ /**
26
+ * Creates an instance of DeliriumOrbsModule.
27
+ *
28
+ * @param {string} url - The URL to fetch data from.
29
+ */
6
30
  constructor(url) {
7
31
  this.#url = url;
8
32
  this.#type = "DeliriumOrb";
9
33
  }
10
34
 
35
+ /**
36
+ * Asynchronously retrieves data based on the specified properties.
37
+ *
38
+ * @async
39
+ * @param {Array<string>} requestedProperties - An array of properties to retrieve.
40
+ * @returns {Promise<Object>} A promise that resolves to the retrieved data.
41
+ */
11
42
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
43
+ try {
44
+ /**
45
+ * Calls the getData function to fetch DeliriumOrb data.
46
+ *
47
+ * @type {Promise<Array<Object>>}
48
+ */
49
+ return getData(this.#url, this.#type, requestedProperties);
50
+ } catch (error) {
51
+ /**
52
+ * Throws an error if there's an issue fetching or processing the DeliriumOrb data.
53
+ *
54
+ * @throws {Error}
55
+ */
56
+ throw new Error(`Error fetching DeliriumOrb data: ${error.message}`);
57
+ }
13
58
  }
14
59
  }
15
60
 
16
- //export DeliriumOrbsModule;
17
61
  module.exports = DeliriumOrbsModule;
@@ -1,17 +1,61 @@
1
1
  const getData = require("../functions/getData");
2
2
 
3
+ /**
4
+ * Represents a module for fetching data related to Divination Cards.
5
+ *
6
+ * @class
7
+ */
3
8
  class DivinationCardModule {
9
+ /**
10
+ * The URL for fetching data.
11
+ *
12
+ * @private
13
+ * @type {string}
14
+ */
4
15
  #url;
16
+
17
+ /**
18
+ * The type of data (DivinationCard in this case).
19
+ *
20
+ * @private
21
+ * @type {string}
22
+ */
5
23
  #type;
24
+
25
+ /**
26
+ * Creates an instance of DivinationCardModule.
27
+ *
28
+ * @param {string} url - The URL to fetch data from.
29
+ */
6
30
  constructor(url) {
7
31
  this.#url = url;
8
32
  this.#type = "DivinationCard";
9
33
  }
10
34
 
35
+ /**
36
+ * Asynchronously retrieves data based on the specified properties.
37
+ *
38
+ * @async
39
+ * @param {Array<string>} requestedProperties - An array of properties to retrieve.
40
+ * @returns {Promise<Object>} A promise that resolves to the retrieved data.
41
+ */
11
42
  async getData(requestedProperties) {
12
- return getData(this.#url, this.#type, requestedProperties);
43
+ try {
44
+ /**
45
+ * Calls the getData function to fetch DivinationCard data.
46
+ *
47
+ * @type {Promise<Array<Object>>}
48
+ */
49
+ return getData(this.#url, this.#type, requestedProperties);
50
+ } catch (error) {
51
+ /**
52
+ * Throws an error if there's an issue fetching or processing the DivinationCard data.
53
+ *
54
+ * @throws {Error}
55
+ */
56
+ throw new Error(`Error fetching DivinationCard data: ${error.message}`);
57
+ }
13
58
  }
14
59
  }
15
60
 
16
- //export DivinationCardModule;
17
61
  module.exports = DivinationCardModule;