@fnlb-project/fnbr 4.0.0

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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/dist/enums/Enums.d.ts +251 -0
  4. package/dist/enums/Enums.js +202 -0
  5. package/dist/enums/Enums.js.map +1 -0
  6. package/dist/index.d.ts +92 -0
  7. package/dist/index.js +194 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/resources/AuthClients.d.ts +39 -0
  10. package/dist/resources/AuthClients.js +41 -0
  11. package/dist/resources/AuthClients.js.map +1 -0
  12. package/dist/resources/BaseItemRating.json +5203 -0
  13. package/dist/resources/Endpoints.d.ts +58 -0
  14. package/dist/resources/Endpoints.js +71 -0
  15. package/dist/resources/Endpoints.js.map +1 -0
  16. package/dist/resources/HomebaseRatingMapping.json +255 -0
  17. package/dist/resources/PowerLevelCurves.d.ts +111 -0
  18. package/dist/resources/PowerLevelCurves.js +21 -0
  19. package/dist/resources/PowerLevelCurves.js.map +1 -0
  20. package/dist/resources/SurvivorItemRating.json +9343 -0
  21. package/dist/resources/constants.d.ts +2 -0
  22. package/dist/resources/constants.js +11 -0
  23. package/dist/resources/constants.js.map +1 -0
  24. package/dist/resources/defaultPartyMemberMeta.json +28 -0
  25. package/dist/resources/defaultPartyMeta.json +38 -0
  26. package/dist/resources/enums.d.ts +12 -0
  27. package/dist/resources/enums.js +18 -0
  28. package/dist/resources/enums.js.map +1 -0
  29. package/dist/resources/httpResponses.d.ts +773 -0
  30. package/dist/resources/httpResponses.js +3 -0
  31. package/dist/resources/httpResponses.js.map +1 -0
  32. package/dist/resources/structs.d.ts +1310 -0
  33. package/dist/resources/structs.js +3 -0
  34. package/dist/resources/structs.js.map +1 -0
  35. package/dist/src/Base.d.ts +15 -0
  36. package/dist/src/Base.js +15 -0
  37. package/dist/src/Base.js.map +1 -0
  38. package/dist/src/Client.d.ts +341 -0
  39. package/dist/src/Client.js +1043 -0
  40. package/dist/src/Client.js.map +1 -0
  41. package/dist/src/auth/Auth.d.ts +66 -0
  42. package/dist/src/auth/Auth.js +249 -0
  43. package/dist/src/auth/Auth.js.map +1 -0
  44. package/dist/src/auth/AuthSession.d.ts +41 -0
  45. package/dist/src/auth/AuthSession.js +25 -0
  46. package/dist/src/auth/AuthSession.js.map +1 -0
  47. package/dist/src/auth/EOSAuthSession.d.ts +19 -0
  48. package/dist/src/auth/EOSAuthSession.js +80 -0
  49. package/dist/src/auth/EOSAuthSession.js.map +1 -0
  50. package/dist/src/auth/FortniteAuthSession.d.ts +53 -0
  51. package/dist/src/auth/FortniteAuthSession.js +107 -0
  52. package/dist/src/auth/FortniteAuthSession.js.map +1 -0
  53. package/dist/src/auth/FortniteClientCredentialsAuthSession.d.ts +18 -0
  54. package/dist/src/auth/FortniteClientCredentialsAuthSession.js +88 -0
  55. package/dist/src/auth/FortniteClientCredentialsAuthSession.js.map +1 -0
  56. package/dist/src/auth/LauncherAuthSession.d.ts +23 -0
  57. package/dist/src/auth/LauncherAuthSession.js +120 -0
  58. package/dist/src/auth/LauncherAuthSession.js.map +1 -0
  59. package/dist/src/exceptions/AuthenticationMissingError.d.ts +15 -0
  60. package/dist/src/exceptions/AuthenticationMissingError.js +18 -0
  61. package/dist/src/exceptions/AuthenticationMissingError.js.map +1 -0
  62. package/dist/src/exceptions/CreativeIslandNotFoundError.d.ts +14 -0
  63. package/dist/src/exceptions/CreativeIslandNotFoundError.js +18 -0
  64. package/dist/src/exceptions/CreativeIslandNotFoundError.js.map +1 -0
  65. package/dist/src/exceptions/CreatorCodeNotFoundError.d.ts +14 -0
  66. package/dist/src/exceptions/CreatorCodeNotFoundError.js +18 -0
  67. package/dist/src/exceptions/CreatorCodeNotFoundError.js.map +1 -0
  68. package/dist/src/exceptions/DuplicateFriendshipError.d.ts +14 -0
  69. package/dist/src/exceptions/DuplicateFriendshipError.js +18 -0
  70. package/dist/src/exceptions/DuplicateFriendshipError.js.map +1 -0
  71. package/dist/src/exceptions/EpicgamesAPIError.d.ts +42 -0
  72. package/dist/src/exceptions/EpicgamesAPIError.js +27 -0
  73. package/dist/src/exceptions/EpicgamesAPIError.js.map +1 -0
  74. package/dist/src/exceptions/EventTimeoutError.d.ts +19 -0
  75. package/dist/src/exceptions/EventTimeoutError.js +20 -0
  76. package/dist/src/exceptions/EventTimeoutError.js.map +1 -0
  77. package/dist/src/exceptions/FriendNotFoundError.d.ts +14 -0
  78. package/dist/src/exceptions/FriendNotFoundError.js +18 -0
  79. package/dist/src/exceptions/FriendNotFoundError.js.map +1 -0
  80. package/dist/src/exceptions/FriendshipRequestAlreadySentError.d.ts +14 -0
  81. package/dist/src/exceptions/FriendshipRequestAlreadySentError.js +18 -0
  82. package/dist/src/exceptions/FriendshipRequestAlreadySentError.js.map +1 -0
  83. package/dist/src/exceptions/InviteeFriendshipRequestLimitExceededError.d.ts +14 -0
  84. package/dist/src/exceptions/InviteeFriendshipRequestLimitExceededError.js +18 -0
  85. package/dist/src/exceptions/InviteeFriendshipRequestLimitExceededError.js.map +1 -0
  86. package/dist/src/exceptions/InviteeFriendshipSettingsError.d.ts +14 -0
  87. package/dist/src/exceptions/InviteeFriendshipSettingsError.js +18 -0
  88. package/dist/src/exceptions/InviteeFriendshipSettingsError.js.map +1 -0
  89. package/dist/src/exceptions/InviteeFriendshipsLimitExceededError.d.ts +14 -0
  90. package/dist/src/exceptions/InviteeFriendshipsLimitExceededError.js +18 -0
  91. package/dist/src/exceptions/InviteeFriendshipsLimitExceededError.js.map +1 -0
  92. package/dist/src/exceptions/InviterFriendshipsLimitExceededError.d.ts +14 -0
  93. package/dist/src/exceptions/InviterFriendshipsLimitExceededError.js +18 -0
  94. package/dist/src/exceptions/InviterFriendshipsLimitExceededError.js.map +1 -0
  95. package/dist/src/exceptions/MatchNotFoundError.d.ts +14 -0
  96. package/dist/src/exceptions/MatchNotFoundError.js +18 -0
  97. package/dist/src/exceptions/MatchNotFoundError.js.map +1 -0
  98. package/dist/src/exceptions/OfferNotFoundError.d.ts +14 -0
  99. package/dist/src/exceptions/OfferNotFoundError.js +18 -0
  100. package/dist/src/exceptions/OfferNotFoundError.js.map +1 -0
  101. package/dist/src/exceptions/PartyAlreadyJoinedError.d.ts +7 -0
  102. package/dist/src/exceptions/PartyAlreadyJoinedError.js +14 -0
  103. package/dist/src/exceptions/PartyAlreadyJoinedError.js.map +1 -0
  104. package/dist/src/exceptions/PartyInvitationExpiredError.d.ts +7 -0
  105. package/dist/src/exceptions/PartyInvitationExpiredError.js +14 -0
  106. package/dist/src/exceptions/PartyInvitationExpiredError.js.map +1 -0
  107. package/dist/src/exceptions/PartyMaxSizeReachedError.d.ts +7 -0
  108. package/dist/src/exceptions/PartyMaxSizeReachedError.js +14 -0
  109. package/dist/src/exceptions/PartyMaxSizeReachedError.js.map +1 -0
  110. package/dist/src/exceptions/PartyMemberNotFoundError.d.ts +14 -0
  111. package/dist/src/exceptions/PartyMemberNotFoundError.js +18 -0
  112. package/dist/src/exceptions/PartyMemberNotFoundError.js.map +1 -0
  113. package/dist/src/exceptions/PartyNotFoundError.d.ts +7 -0
  114. package/dist/src/exceptions/PartyNotFoundError.js +14 -0
  115. package/dist/src/exceptions/PartyNotFoundError.js.map +1 -0
  116. package/dist/src/exceptions/PartyPermissionError.d.ts +7 -0
  117. package/dist/src/exceptions/PartyPermissionError.js +14 -0
  118. package/dist/src/exceptions/PartyPermissionError.js.map +1 -0
  119. package/dist/src/exceptions/SendMessageError.d.ts +27 -0
  120. package/dist/src/exceptions/SendMessageError.js +21 -0
  121. package/dist/src/exceptions/SendMessageError.js.map +1 -0
  122. package/dist/src/exceptions/StatsPrivacyError.d.ts +14 -0
  123. package/dist/src/exceptions/StatsPrivacyError.js +18 -0
  124. package/dist/src/exceptions/StatsPrivacyError.js.map +1 -0
  125. package/dist/src/exceptions/StompConnectionError.d.ts +14 -0
  126. package/dist/src/exceptions/StompConnectionError.js +18 -0
  127. package/dist/src/exceptions/StompConnectionError.js.map +1 -0
  128. package/dist/src/exceptions/UserNotFoundError.d.ts +14 -0
  129. package/dist/src/exceptions/UserNotFoundError.js +18 -0
  130. package/dist/src/exceptions/UserNotFoundError.js.map +1 -0
  131. package/dist/src/exceptions/XMPPConnectionError.d.ts +19 -0
  132. package/dist/src/exceptions/XMPPConnectionError.js +19 -0
  133. package/dist/src/exceptions/XMPPConnectionError.js.map +1 -0
  134. package/dist/src/exceptions/XMPPConnectionTimeoutError.d.ts +14 -0
  135. package/dist/src/exceptions/XMPPConnectionTimeoutError.js +18 -0
  136. package/dist/src/exceptions/XMPPConnectionTimeoutError.js.map +1 -0
  137. package/dist/src/http/HTTP.d.ts +40 -0
  138. package/dist/src/http/HTTP.js +124 -0
  139. package/dist/src/http/HTTP.js.map +1 -0
  140. package/dist/src/managers/ChatManager.d.ts +27 -0
  141. package/dist/src/managers/ChatManager.js +71 -0
  142. package/dist/src/managers/ChatManager.js.map +1 -0
  143. package/dist/src/managers/FriendManager.d.ts +66 -0
  144. package/dist/src/managers/FriendManager.js +175 -0
  145. package/dist/src/managers/FriendManager.js.map +1 -0
  146. package/dist/src/managers/STWManager.d.ts +29 -0
  147. package/dist/src/managers/STWManager.js +80 -0
  148. package/dist/src/managers/STWManager.js.map +1 -0
  149. package/dist/src/managers/TournamentManager.d.ts +51 -0
  150. package/dist/src/managers/TournamentManager.js +182 -0
  151. package/dist/src/managers/TournamentManager.js.map +1 -0
  152. package/dist/src/managers/UserManager.d.ts +78 -0
  153. package/dist/src/managers/UserManager.js +216 -0
  154. package/dist/src/managers/UserManager.js.map +1 -0
  155. package/dist/src/stomp/EOSConnect.d.ts +43 -0
  156. package/dist/src/stomp/EOSConnect.js +175 -0
  157. package/dist/src/stomp/EOSConnect.js.map +1 -0
  158. package/dist/src/structures/Avatar.d.ts +27 -0
  159. package/dist/src/structures/Avatar.js +22 -0
  160. package/dist/src/structures/Avatar.js.map +1 -0
  161. package/dist/src/structures/BaseMessage.d.ts +34 -0
  162. package/dist/src/structures/BaseMessage.js +22 -0
  163. package/dist/src/structures/BaseMessage.js.map +1 -0
  164. package/dist/src/structures/CreatorCode.d.ts +31 -0
  165. package/dist/src/structures/CreatorCode.js +22 -0
  166. package/dist/src/structures/CreatorCode.js.map +1 -0
  167. package/dist/src/structures/EpicgamesServerStatus.d.ts +52 -0
  168. package/dist/src/structures/EpicgamesServerStatus.js +31 -0
  169. package/dist/src/structures/EpicgamesServerStatus.js.map +1 -0
  170. package/dist/src/structures/EpicgamesServerStatusComponent.d.ts +67 -0
  171. package/dist/src/structures/EpicgamesServerStatusComponent.js +37 -0
  172. package/dist/src/structures/EpicgamesServerStatusComponent.js.map +1 -0
  173. package/dist/src/structures/EpicgamesServerStatusIncident.d.ts +58 -0
  174. package/dist/src/structures/EpicgamesServerStatusIncident.js +36 -0
  175. package/dist/src/structures/EpicgamesServerStatusIncident.js.map +1 -0
  176. package/dist/src/structures/EpicgamesServerStatusScheduledMainteance.d.ts +21 -0
  177. package/dist/src/structures/EpicgamesServerStatusScheduledMainteance.js +20 -0
  178. package/dist/src/structures/EpicgamesServerStatusScheduledMainteance.js.map +1 -0
  179. package/dist/src/structures/EventTokens.d.ts +32 -0
  180. package/dist/src/structures/EventTokens.js +45 -0
  181. package/dist/src/structures/EventTokens.js.map +1 -0
  182. package/dist/src/structures/FortniteServerStatus.d.ts +46 -0
  183. package/dist/src/structures/FortniteServerStatus.js +26 -0
  184. package/dist/src/structures/FortniteServerStatus.js.map +1 -0
  185. package/dist/src/structures/GlobalProfile.d.ts +36 -0
  186. package/dist/src/structures/GlobalProfile.js +25 -0
  187. package/dist/src/structures/GlobalProfile.js.map +1 -0
  188. package/dist/src/structures/Image.d.ts +36 -0
  189. package/dist/src/structures/Image.js +38 -0
  190. package/dist/src/structures/Image.js.map +1 -0
  191. package/dist/src/structures/NewsMessage.d.ts +56 -0
  192. package/dist/src/structures/NewsMessage.js +45 -0
  193. package/dist/src/structures/NewsMessage.js.map +1 -0
  194. package/dist/src/structures/NewsMessageVideo.d.ts +47 -0
  195. package/dist/src/structures/NewsMessageVideo.js +32 -0
  196. package/dist/src/structures/NewsMessageVideo.js.map +1 -0
  197. package/dist/src/structures/RadioStation.d.ts +31 -0
  198. package/dist/src/structures/RadioStation.js +33 -0
  199. package/dist/src/structures/RadioStation.js.map +1 -0
  200. package/dist/src/structures/Stats.d.ts +45 -0
  201. package/dist/src/structures/Stats.js +109 -0
  202. package/dist/src/structures/Stats.js.map +1 -0
  203. package/dist/src/structures/Tournament.d.ts +86 -0
  204. package/dist/src/structures/Tournament.js +64 -0
  205. package/dist/src/structures/Tournament.js.map +1 -0
  206. package/dist/src/structures/TournamentWindow.d.ts +124 -0
  207. package/dist/src/structures/TournamentWindow.js +52 -0
  208. package/dist/src/structures/TournamentWindow.js.map +1 -0
  209. package/dist/src/structures/friend/BaseFriendMessage.d.ts +32 -0
  210. package/dist/src/structures/friend/BaseFriendMessage.js +28 -0
  211. package/dist/src/structures/friend/BaseFriendMessage.js.map +1 -0
  212. package/dist/src/structures/friend/BasePendingFriend.d.ts +22 -0
  213. package/dist/src/structures/friend/BasePendingFriend.js +22 -0
  214. package/dist/src/structures/friend/BasePendingFriend.js.map +1 -0
  215. package/dist/src/structures/friend/Friend.d.ts +106 -0
  216. package/dist/src/structures/friend/Friend.js +97 -0
  217. package/dist/src/structures/friend/Friend.js.map +1 -0
  218. package/dist/src/structures/friend/FriendPresence.d.ts +84 -0
  219. package/dist/src/structures/friend/FriendPresence.js +48 -0
  220. package/dist/src/structures/friend/FriendPresence.js.map +1 -0
  221. package/dist/src/structures/friend/IncomingPendingFriend.d.ts +27 -0
  222. package/dist/src/structures/friend/IncomingPendingFriend.js +36 -0
  223. package/dist/src/structures/friend/IncomingPendingFriend.js.map +1 -0
  224. package/dist/src/structures/friend/OutgoingPendingFriend.d.ts +17 -0
  225. package/dist/src/structures/friend/OutgoingPendingFriend.js +24 -0
  226. package/dist/src/structures/friend/OutgoingPendingFriend.js.map +1 -0
  227. package/dist/src/structures/friend/ReceivedFriendMessage.d.ts +27 -0
  228. package/dist/src/structures/friend/ReceivedFriendMessage.js +27 -0
  229. package/dist/src/structures/friend/ReceivedFriendMessage.js.map +1 -0
  230. package/dist/src/structures/friend/SentFriendMessage.d.ts +21 -0
  231. package/dist/src/structures/friend/SentFriendMessage.js +19 -0
  232. package/dist/src/structures/friend/SentFriendMessage.js.map +1 -0
  233. package/dist/src/structures/party/BasePartyInvitation.d.ts +48 -0
  234. package/dist/src/structures/party/BasePartyInvitation.js +33 -0
  235. package/dist/src/structures/party/BasePartyInvitation.js.map +1 -0
  236. package/dist/src/structures/party/BasePartyJoinRequest.d.ts +37 -0
  237. package/dist/src/structures/party/BasePartyJoinRequest.js +30 -0
  238. package/dist/src/structures/party/BasePartyJoinRequest.js.map +1 -0
  239. package/dist/src/structures/party/ClientParty.d.ts +162 -0
  240. package/dist/src/structures/party/ClientParty.js +412 -0
  241. package/dist/src/structures/party/ClientParty.js.map +1 -0
  242. package/dist/src/structures/party/ClientPartyMember.d.ts +144 -0
  243. package/dist/src/structures/party/ClientPartyMember.js +463 -0
  244. package/dist/src/structures/party/ClientPartyMember.js.map +1 -0
  245. package/dist/src/structures/party/ClientPartyMemberMeta.d.ts +18 -0
  246. package/dist/src/structures/party/ClientPartyMemberMeta.js +54 -0
  247. package/dist/src/structures/party/ClientPartyMemberMeta.js.map +1 -0
  248. package/dist/src/structures/party/ClientPartyMeta.d.ts +23 -0
  249. package/dist/src/structures/party/ClientPartyMeta.js +59 -0
  250. package/dist/src/structures/party/ClientPartyMeta.js.map +1 -0
  251. package/dist/src/structures/party/Party.d.ts +95 -0
  252. package/dist/src/structures/party/Party.js +200 -0
  253. package/dist/src/structures/party/Party.js.map +1 -0
  254. package/dist/src/structures/party/PartyChat.d.ts +73 -0
  255. package/dist/src/structures/party/PartyChat.js +76 -0
  256. package/dist/src/structures/party/PartyChat.js.map +1 -0
  257. package/dist/src/structures/party/PartyMember.d.ts +139 -0
  258. package/dist/src/structures/party/PartyMember.js +201 -0
  259. package/dist/src/structures/party/PartyMember.js.map +1 -0
  260. package/dist/src/structures/party/PartyMemberConfirmation.d.ts +43 -0
  261. package/dist/src/structures/party/PartyMemberConfirmation.js +53 -0
  262. package/dist/src/structures/party/PartyMemberConfirmation.js.map +1 -0
  263. package/dist/src/structures/party/PartyMemberMeta.d.ts +76 -0
  264. package/dist/src/structures/party/PartyMemberMeta.js +145 -0
  265. package/dist/src/structures/party/PartyMemberMeta.js.map +1 -0
  266. package/dist/src/structures/party/PartyMessage.d.ts +30 -0
  267. package/dist/src/structures/party/PartyMessage.js +28 -0
  268. package/dist/src/structures/party/PartyMessage.js.map +1 -0
  269. package/dist/src/structures/party/PartyMeta.d.ts +24 -0
  270. package/dist/src/structures/party/PartyMeta.js +43 -0
  271. package/dist/src/structures/party/PartyMeta.js.map +1 -0
  272. package/dist/src/structures/party/PresenceParty.d.ts +66 -0
  273. package/dist/src/structures/party/PresenceParty.js +49 -0
  274. package/dist/src/structures/party/PresenceParty.js.map +1 -0
  275. package/dist/src/structures/party/ReceivedPartyInvitation.d.ts +33 -0
  276. package/dist/src/structures/party/ReceivedPartyInvitation.js +54 -0
  277. package/dist/src/structures/party/ReceivedPartyInvitation.js.map +1 -0
  278. package/dist/src/structures/party/ReceivedPartyJoinRequest.d.ts +26 -0
  279. package/dist/src/structures/party/ReceivedPartyJoinRequest.js +31 -0
  280. package/dist/src/structures/party/ReceivedPartyJoinRequest.js.map +1 -0
  281. package/dist/src/structures/party/SentPartyInvitation.d.ts +27 -0
  282. package/dist/src/structures/party/SentPartyInvitation.js +39 -0
  283. package/dist/src/structures/party/SentPartyInvitation.js.map +1 -0
  284. package/dist/src/structures/party/SentPartyJoinRequest.d.ts +19 -0
  285. package/dist/src/structures/party/SentPartyJoinRequest.js +22 -0
  286. package/dist/src/structures/party/SentPartyJoinRequest.js.map +1 -0
  287. package/dist/src/structures/stw/STWHero.d.ts +61 -0
  288. package/dist/src/structures/stw/STWHero.js +38 -0
  289. package/dist/src/structures/stw/STWHero.js.map +1 -0
  290. package/dist/src/structures/stw/STWHeroLoadout.d.ts +44 -0
  291. package/dist/src/structures/stw/STWHeroLoadout.js +34 -0
  292. package/dist/src/structures/stw/STWHeroLoadout.js.map +1 -0
  293. package/dist/src/structures/stw/STWItem.d.ts +31 -0
  294. package/dist/src/structures/stw/STWItem.js +23 -0
  295. package/dist/src/structures/stw/STWItem.js.map +1 -0
  296. package/dist/src/structures/stw/STWLocker.d.ts +32 -0
  297. package/dist/src/structures/stw/STWLocker.js +26 -0
  298. package/dist/src/structures/stw/STWLocker.js.map +1 -0
  299. package/dist/src/structures/stw/STWMeleeWeaponSchematic.d.ts +14 -0
  300. package/dist/src/structures/stw/STWMeleeWeaponSchematic.js +15 -0
  301. package/dist/src/structures/stw/STWMeleeWeaponSchematic.js.map +1 -0
  302. package/dist/src/structures/stw/STWNewsMessage.d.ts +42 -0
  303. package/dist/src/structures/stw/STWNewsMessage.js +27 -0
  304. package/dist/src/structures/stw/STWNewsMessage.js.map +1 -0
  305. package/dist/src/structures/stw/STWProfile.d.ts +132 -0
  306. package/dist/src/structures/stw/STWProfile.js +283 -0
  307. package/dist/src/structures/stw/STWProfile.js.map +1 -0
  308. package/dist/src/structures/stw/STWRangedWeaponSchematic.d.ts +14 -0
  309. package/dist/src/structures/stw/STWRangedWeaponSchematic.js +15 -0
  310. package/dist/src/structures/stw/STWRangedWeaponSchematic.js.map +1 -0
  311. package/dist/src/structures/stw/STWResource.d.ts +27 -0
  312. package/dist/src/structures/stw/STWResource.js +22 -0
  313. package/dist/src/structures/stw/STWResource.js.map +1 -0
  314. package/dist/src/structures/stw/STWSchematic.d.ts +72 -0
  315. package/dist/src/structures/stw/STWSchematic.js +40 -0
  316. package/dist/src/structures/stw/STWSchematic.js.map +1 -0
  317. package/dist/src/structures/stw/STWStats.d.ts +103 -0
  318. package/dist/src/structures/stw/STWStats.js +85 -0
  319. package/dist/src/structures/stw/STWStats.js.map +1 -0
  320. package/dist/src/structures/stw/STWSurvivor.d.ts +104 -0
  321. package/dist/src/structures/stw/STWSurvivor.js +76 -0
  322. package/dist/src/structures/stw/STWSurvivor.js.map +1 -0
  323. package/dist/src/structures/stw/STWTeamPerk.d.ts +19 -0
  324. package/dist/src/structures/stw/STWTeamPerk.js +20 -0
  325. package/dist/src/structures/stw/STWTeamPerk.js.map +1 -0
  326. package/dist/src/structures/stw/STWTrapSchematic.d.ts +15 -0
  327. package/dist/src/structures/stw/STWTrapSchematic.js +16 -0
  328. package/dist/src/structures/stw/STWTrapSchematic.js.map +1 -0
  329. package/dist/src/structures/stw/STWWeaponSchematic.d.ts +15 -0
  330. package/dist/src/structures/stw/STWWeaponSchematic.js +16 -0
  331. package/dist/src/structures/stw/STWWeaponSchematic.js.map +1 -0
  332. package/dist/src/structures/user/BlockedUser.d.ts +13 -0
  333. package/dist/src/structures/user/BlockedUser.js +19 -0
  334. package/dist/src/structures/user/BlockedUser.js.map +1 -0
  335. package/dist/src/structures/user/ClientUser.d.ts +78 -0
  336. package/dist/src/structures/user/ClientUser.js +34 -0
  337. package/dist/src/structures/user/ClientUser.js.map +1 -0
  338. package/dist/src/structures/user/User.d.ts +98 -0
  339. package/dist/src/structures/user/User.js +130 -0
  340. package/dist/src/structures/user/User.js.map +1 -0
  341. package/dist/src/structures/user/UserSearchResult.d.ts +31 -0
  342. package/dist/src/structures/user/UserSearchResult.js +23 -0
  343. package/dist/src/structures/user/UserSearchResult.js.map +1 -0
  344. package/dist/src/util/AsyncLock.d.ts +28 -0
  345. package/dist/src/util/AsyncLock.js +44 -0
  346. package/dist/src/util/AsyncLock.js.map +1 -0
  347. package/dist/src/util/BinaryWriter.d.ts +79 -0
  348. package/dist/src/util/BinaryWriter.js +136 -0
  349. package/dist/src/util/BinaryWriter.js.map +1 -0
  350. package/dist/src/util/CurveTable.d.ts +24 -0
  351. package/dist/src/util/CurveTable.js +37 -0
  352. package/dist/src/util/CurveTable.js.map +1 -0
  353. package/dist/src/util/Meta.d.ts +41 -0
  354. package/dist/src/util/Meta.js +73 -0
  355. package/dist/src/util/Meta.js.map +1 -0
  356. package/dist/src/util/Util.d.ts +162 -0
  357. package/dist/src/util/Util.js +539 -0
  358. package/dist/src/util/Util.js.map +1 -0
  359. package/dist/src/xmpp/XMPP.d.ts +100 -0
  360. package/dist/src/xmpp/XMPP.js +702 -0
  361. package/dist/src/xmpp/XMPP.js.map +1 -0
  362. package/dist/tsconfig.tsbuildinfo +1 -0
  363. package/package.json +66 -0
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const collection_1 = require("@discordjs/collection");
5
+ const Friend_1 = tslib_1.__importDefault(require("../structures/friend/Friend"));
6
+ const FriendNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/FriendNotFoundError"));
7
+ const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
8
+ const UserNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/UserNotFoundError"));
9
+ const DuplicateFriendshipError_1 = tslib_1.__importDefault(require("../exceptions/DuplicateFriendshipError"));
10
+ const FriendshipRequestAlreadySentError_1 = tslib_1.__importDefault(require("../exceptions/FriendshipRequestAlreadySentError"));
11
+ const InviteeFriendshipsLimitExceededError_1 = tslib_1.__importDefault(require("../exceptions/InviteeFriendshipsLimitExceededError"));
12
+ const InviteeFriendshipRequestLimitExceededError_1 = tslib_1.__importDefault(require("../exceptions/InviteeFriendshipRequestLimitExceededError"));
13
+ const InviteeFriendshipSettingsError_1 = tslib_1.__importDefault(require("../exceptions/InviteeFriendshipSettingsError"));
14
+ const OfferNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/OfferNotFoundError"));
15
+ const SentFriendMessage_1 = tslib_1.__importDefault(require("../structures/friend/SentFriendMessage"));
16
+ const BasePendingFriend_1 = tslib_1.__importDefault(require("../structures/friend/BasePendingFriend"));
17
+ const Base_1 = tslib_1.__importDefault(require("../Base"));
18
+ const enums_1 = require("../../resources/enums");
19
+ const EpicgamesAPIError_1 = tslib_1.__importDefault(require("../exceptions/EpicgamesAPIError"));
20
+ class FriendManager extends Base_1.default {
21
+ constructor(constr) {
22
+ super(constr);
23
+ this.list = new collection_1.Collection();
24
+ this.pendingList = new collection_1.Collection();
25
+ }
26
+ resolve(friend) {
27
+ if (friend instanceof Friend_1.default) {
28
+ return this.list.get(friend.id);
29
+ }
30
+ if (friend.length === 32) {
31
+ return this.list.get(friend);
32
+ }
33
+ return this.list.find((f) => f.displayName === friend);
34
+ }
35
+ resolvePending(pendingFriend) {
36
+ if (pendingFriend instanceof BasePendingFriend_1.default) {
37
+ return this.pendingList.get(pendingFriend.id);
38
+ }
39
+ if (pendingFriend.length === 32) {
40
+ return this.pendingList.get(pendingFriend);
41
+ }
42
+ return this.pendingList.find((f) => f.displayName === pendingFriend);
43
+ }
44
+ /**
45
+ * Sends a friendship request to a user or accepts an existing request
46
+ * @param friend The id or display name of the user to add
47
+ * @throws {UserNotFoundError} The user wasn't found
48
+ * @throws {DuplicateFriendshipError} The user is already friends with the client
49
+ * @throws {FriendshipRequestAlreadySentError} A friendship request has already been sent to the user
50
+ * @throws {InviterFriendshipsLimitExceededError} The client's friendship limit is reached
51
+ * @throws {InviteeFriendshipsLimitExceededError} The user's friendship limit is reached
52
+ * @throws {InviteeFriendshipSettingsError} The user disabled friend requests
53
+ * @throws {InviteeFriendshipRequestLimitExceededError} The user's incoming friend request limit is reached
54
+ * @throws {EpicgamesAPIError}
55
+ */
56
+ async add(friend) {
57
+ const userID = await this.client.user.resolveId(friend);
58
+ if (!userID)
59
+ throw new UserNotFoundError_1.default(friend);
60
+ try {
61
+ await this.client.http.epicgamesRequest({
62
+ method: 'POST',
63
+ url: `${Endpoints_1.default.FRIEND_ADD}/${this.client.user.self.id}/${userID}`,
64
+ }, enums_1.AuthSessionStoreKey.Fortnite);
65
+ }
66
+ catch (e) {
67
+ if (e instanceof EpicgamesAPIError_1.default) {
68
+ switch (e.code) {
69
+ case 'errors.com.epicgames.friends.duplicate_friendship':
70
+ throw new DuplicateFriendshipError_1.default(friend);
71
+ case 'errors.com.epicgames.friends.friend_request_already_sent':
72
+ throw new FriendshipRequestAlreadySentError_1.default(friend);
73
+ case 'errors.com.epicgames.friends.inviter_friendships_limit_exceeded':
74
+ throw new InviteeFriendshipsLimitExceededError_1.default(friend);
75
+ case 'errors.com.epicgames.friends.invitee_friendships_limit_exceeded':
76
+ throw new InviteeFriendshipsLimitExceededError_1.default(friend);
77
+ case 'errors.com.epicgames.friends.incoming_friendships_limit_exceeded':
78
+ throw new InviteeFriendshipRequestLimitExceededError_1.default(friend);
79
+ case 'errors.com.epicgames.friends.cannot_friend_due_to_target_settings':
80
+ throw new InviteeFriendshipSettingsError_1.default(friend);
81
+ case 'errors.com.epicgames.friends.account_not_found':
82
+ throw new UserNotFoundError_1.default(friend);
83
+ }
84
+ }
85
+ throw e;
86
+ }
87
+ }
88
+ /**
89
+ * Removes a friend from the client's friend list or declines / aborts a pending friendship request
90
+ * @param friend The id or display name of the friend
91
+ * @throws {FriendNotFoundError} The user does not exist or is not friends with the client
92
+ * @throws {EpicgamesAPIError}
93
+ */
94
+ async remove(friend) {
95
+ var _a;
96
+ const resolvedFriend = (_a = this.resolve(friend)) !== null && _a !== void 0 ? _a : this.resolvePending(friend);
97
+ if (!resolvedFriend)
98
+ throw new FriendNotFoundError_1.default(friend);
99
+ await this.client.http.epicgamesRequest({
100
+ method: 'DELETE',
101
+ url: `${Endpoints_1.default.FRIEND_DELETE}/${this.client.user.self.id}/friends/${resolvedFriend.id}`,
102
+ }, enums_1.AuthSessionStoreKey.Fortnite);
103
+ }
104
+ /**
105
+ * Fetches the friends the client shares with a friend
106
+ * @param friend The id or display name of the friend
107
+ * @throws {FriendNotFoundError} The user does not exist or is not friends with the client
108
+ * @throws {EpicgamesAPIError}
109
+ */
110
+ async getMutual(friend) {
111
+ const resolvedFriend = this.resolve(friend);
112
+ if (!resolvedFriend)
113
+ throw new FriendNotFoundError_1.default(friend);
114
+ const mutualFriends = await this.client.http.epicgamesRequest({
115
+ method: 'GET',
116
+ url: `${Endpoints_1.default.FRIENDS}/${this.client.user.self.id}/friends/${resolvedFriend.id}/mutual`,
117
+ }, enums_1.AuthSessionStoreKey.Fortnite);
118
+ return mutualFriends
119
+ .map((f) => this.list.get(f))
120
+ .filter((f) => !!f);
121
+ }
122
+ /**
123
+ * Checks whether a friend owns a specific offer
124
+ * @param friend The id or display name of the friend
125
+ * @param offerId The offer id
126
+ * @throws {OfferNotFoundError} The offer does not exist or is not in the current storefront catalog
127
+ * @throws {FriendNotFoundError} The user does not exist or is not friends with the client
128
+ * @throws {EpicgamesAPIError}
129
+ */
130
+ async checkOfferOwnership(friend, offerId) {
131
+ const resolvedFriend = this.resolve(friend);
132
+ if (!resolvedFriend)
133
+ throw new FriendNotFoundError_1.default(friend);
134
+ try {
135
+ await this.client.http.epicgamesRequest({
136
+ method: 'GET',
137
+ url: `${Endpoints_1.default.BR_GIFT_ELIGIBILITY}/recipient/${resolvedFriend.id}/offer/${encodeURIComponent(offerId)}`,
138
+ }, enums_1.AuthSessionStoreKey.Fortnite);
139
+ return false;
140
+ }
141
+ catch (e) {
142
+ if (e instanceof EpicgamesAPIError_1.default) {
143
+ if (e.code === 'errors.com.epicgames.modules.gamesubcatalog.catalog_out_of_date') {
144
+ throw new OfferNotFoundError_1.default(offerId);
145
+ }
146
+ if (e.code === 'errors.com.epicgames.modules.gamesubcatalog.purchase_not_allowed') {
147
+ return true;
148
+ }
149
+ }
150
+ throw e;
151
+ }
152
+ }
153
+ /**
154
+ * Sends a message to a friend
155
+ * @param friend The id or display name of the friend
156
+ * @param content The message that will be sent
157
+ * @throws {FriendNotFoundError} The user does not exist or is not friends with the client
158
+ * @throws {SendMessageError} The messant could not be sent
159
+ */
160
+ async sendMessage(friend, content) {
161
+ const resolvedFriend = this.resolve(friend);
162
+ if (!resolvedFriend) {
163
+ throw new FriendNotFoundError_1.default(friend);
164
+ }
165
+ const messageId = await this.client.chat.whisperUser(resolvedFriend.id, { body: content });
166
+ return new SentFriendMessage_1.default(this.client, {
167
+ author: this.client.user.self,
168
+ content,
169
+ id: messageId,
170
+ sentAt: new Date(),
171
+ });
172
+ }
173
+ }
174
+ exports.default = FriendManager;
175
+ //# sourceMappingURL=FriendManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FriendManager.js","sourceRoot":"","sources":["../../../src/managers/FriendManager.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,iFAAiD;AACjD,oGAAoE;AACpE,kFAAkD;AAClD,gGAAgE;AAChE,8GAA8E;AAC9E,gIAAgG;AAChG,sIAAsG;AACtG,kJAAkH;AAClH,0HAA0F;AAC1F,kGAAkE;AAClE,uGAAuE;AACvE,uGAAuE;AACvE,2DAA2B;AAC3B,iDAA4D;AAC5D,gGAAgE;AAKhE,MAAM,aAAc,SAAQ,cAAI;IAW9B,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,uBAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAU,EAAE,CAAC;IACtC,CAAC;IAEM,OAAO,CAAC,MAAuB;QACpC,IAAI,MAAM,YAAY,gBAAM,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC;IACzD,CAAC;IAEM,cAAc,CAAC,aAAyC;QAC7D,IAAI,aAAa,YAAY,2BAAiB,EAAE,CAAC;YAC/C,OAAO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;QACtD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE5C,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,6BAAmB,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAE3F,OAAO,IAAI,2BAAiB,CAAC,IAAI,CAAC,MAAM,EAAE;YACxC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAK;YAC9B,OAAO;YACP,EAAE,EAAE,SAAS;YACb,MAAM,EAAE,IAAI,IAAI,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,29 @@
1
+ import Base from '../Base';
2
+ import STWProfile from '../structures/stw/STWProfile';
3
+ import STWNewsMessage from '../structures/stw/STWNewsMessage';
4
+ import type { STWWorldInfoData } from '../../resources/structs';
5
+ /**
6
+ * Represents the client's STW manager
7
+ */
8
+ declare class STWManager extends Base {
9
+ /**
10
+ * Fetches the Save The World profile for a players
11
+ * @param user The id or display name of the user
12
+ * @throws {UserNotFoundError} The user wasn't found
13
+ * @throws {EpicgamesAPIError}
14
+ */
15
+ getProfile(user: string): Promise<STWProfile>;
16
+ /**
17
+ * Fetches the current Save The World news
18
+ * @param language The language of the news
19
+ * @throws {EpicgamesAPIError}
20
+ */
21
+ getNews(language?: import("../../resources/structs").Language): Promise<STWNewsMessage[]>;
22
+ /**
23
+ * Fetches the current Save The World world info
24
+ * @param language The language of the world info
25
+ * @throws {EpicgamesAPIError}
26
+ */
27
+ getWorldInfo(language?: import("../../resources/structs").Language): Promise<STWWorldInfoData>;
28
+ }
29
+ export default STWManager;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const Base_1 = tslib_1.__importDefault(require("../Base"));
5
+ const UserNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/UserNotFoundError"));
6
+ const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
7
+ const enums_1 = require("../../resources/enums");
8
+ const EpicgamesAPIError_1 = tslib_1.__importDefault(require("../exceptions/EpicgamesAPIError"));
9
+ const STWProfile_1 = tslib_1.__importDefault(require("../structures/stw/STWProfile"));
10
+ const STWNewsMessage_1 = tslib_1.__importDefault(require("../structures/stw/STWNewsMessage"));
11
+ /**
12
+ * Represents the client's STW manager
13
+ */
14
+ class STWManager extends Base_1.default {
15
+ /**
16
+ * Fetches the Save The World profile for a players
17
+ * @param user The id or display name of the user
18
+ * @throws {UserNotFoundError} The user wasn't found
19
+ * @throws {EpicgamesAPIError}
20
+ */
21
+ async getProfile(user) {
22
+ const resolvedUser = await this.client.user.fetch(user);
23
+ if (!resolvedUser)
24
+ throw new UserNotFoundError_1.default(user);
25
+ let queryProfileResponse;
26
+ try {
27
+ queryProfileResponse = await this.client.http.epicgamesRequest({
28
+ method: 'POST',
29
+ url: `${Endpoints_1.default.MCP}/${resolvedUser.id}/public/QueryPublicProfile?profileId=campaign`,
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ },
33
+ data: {},
34
+ }, enums_1.AuthSessionStoreKey.Fortnite);
35
+ }
36
+ catch (e) {
37
+ if (e instanceof EpicgamesAPIError_1.default && e.code === 'errors.com.epicgames.modules.profiles.profile_not_found') {
38
+ throw new UserNotFoundError_1.default(user);
39
+ }
40
+ throw e;
41
+ }
42
+ return new STWProfile_1.default(this.client, queryProfileResponse.profileChanges[0].profile, resolvedUser);
43
+ }
44
+ /**
45
+ * Fetches the current Save The World news
46
+ * @param language The language of the news
47
+ * @throws {EpicgamesAPIError}
48
+ */
49
+ async getNews(language = this.client.config.language) {
50
+ const newsResponse = await this.client.http.epicgamesRequest({
51
+ method: 'GET',
52
+ url: `${Endpoints_1.default.BR_NEWS}/savetheworldnews?lang=${language}`,
53
+ headers: {
54
+ 'Accept-Language': language,
55
+ },
56
+ }, enums_1.AuthSessionStoreKey.Fortnite);
57
+ return newsResponse.news.messages.map((m) => new STWNewsMessage_1.default(this.client, m));
58
+ }
59
+ /**
60
+ * Fetches the current Save The World world info
61
+ * @param language The language of the world info
62
+ * @throws {EpicgamesAPIError}
63
+ */
64
+ async getWorldInfo(language = this.client.config.language) {
65
+ const worldInfoResponse = await this.client.http.epicgamesRequest({
66
+ method: 'GET',
67
+ url: Endpoints_1.default.STW_WORLD_INFO,
68
+ headers: {
69
+ 'Accept-Language': language,
70
+ },
71
+ }, enums_1.AuthSessionStoreKey.Fortnite);
72
+ return {
73
+ theaters: worldInfoResponse.theaters,
74
+ missions: worldInfoResponse.missions,
75
+ missionAlerts: worldInfoResponse.missionAlerts,
76
+ };
77
+ }
78
+ }
79
+ exports.default = STWManager;
80
+ //# sourceMappingURL=STWManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STWManager.js","sourceRoot":"","sources":["../../../src/managers/STWManager.ts"],"names":[],"mappings":";;;AAAA,2DAA2B;AAC3B,gGAAgE;AAChE,kFAAkD;AAClD,iDAA4D;AAC5D,gGAAgE;AAChE,sFAAsD;AACtD,8FAA8D;AAG9D;;GAEG;AACH,MAAM,UAAW,SAAQ,cAAI;IAC3B;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,IAAY;QAClC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,2BAAiB,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,oBAAoB,CAAC;QACzB,IAAI,CAAC;YACH,oBAAoB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAC7D,MAAM,EAA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AAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAChE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,mBAAS,CAAC,cAAc;YAC7B,OAAO,EAAE;gBACP,iBAAiB,EAAE,QAAQ;aAC5B;SACF,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO;YACL,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,aAAa,EAAE,iBAAiB,CAAC,aAAa;SAC/C,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,51 @@
1
+ import Base from '../Base';
2
+ import EventTokens from '../structures/EventTokens';
3
+ import Tournament from '../structures/Tournament';
4
+ import type { FullPlatform, Region, TournamentSessionMetadata } from '../../resources/structs';
5
+ import type { TournamentWindowResults } from '../../resources/httpResponses';
6
+ /**
7
+ * Represent's the client's tournament manager.
8
+ */
9
+ declare class TournamentManager extends Base {
10
+ /**
11
+ * Downloads a file from the CDN (used for replays)
12
+ * @param url The URL of the file to download
13
+ * @param responseType The response type
14
+ */
15
+ private downloadReplayCDNFile;
16
+ /**
17
+ * Fetches the event tokens for an account.
18
+ * This can be used to check if a user is eligible to play a certain tournament window
19
+ * or to check a user's arena division in any season
20
+ * @param user The id(s) or display name(s) of the user(s)
21
+ * @throws {UserNotFoundError} The user wasn't found
22
+ * @throws {EpicgamesAPIError}
23
+ */
24
+ getEventTokens(user: string | string[]): Promise<EventTokens[]>;
25
+ /**
26
+ * Fetches the current and past Battle Royale tournaments
27
+ * @param region The region
28
+ * @param platform The platform
29
+ * @throws {EpicgamesAPIError}
30
+ */
31
+ get(region?: Region, platform?: FullPlatform): Promise<Tournament[]>;
32
+ getData(): Promise<Tournament[]>;
33
+ /**
34
+ * Fetches a tournament session's metadata
35
+ * @param sessionId The session ID
36
+ * @throws {MatchNotFoundError} The match wasn't found
37
+ * @throws {EpicgamesAPIError}
38
+ * @throws {AxiosError}
39
+ */
40
+ getSessionMetadata(sessionId: string): Promise<TournamentSessionMetadata>;
41
+ /**
42
+ * Fetches the results for a tournament window
43
+ * @param eventId The tournament's ID
44
+ * @param eventWindowId The tournament window's ID
45
+ * @param showLiveSessions Whether to show live sessions
46
+ * @param page The results page index
47
+ * @throws {EpicgamesAPIError}
48
+ */
49
+ getWindowResults(eventId: string, eventWindowId: string, showLiveSessions?: boolean, page?: number): Promise<TournamentWindowResults>;
50
+ }
51
+ export default TournamentManager;
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const axios_1 = require("axios");
5
+ const Endpoints_1 = tslib_1.__importDefault(require("../../resources/Endpoints"));
6
+ const Base_1 = tslib_1.__importDefault(require("../Base"));
7
+ const MatchNotFoundError_1 = tslib_1.__importDefault(require("../exceptions/MatchNotFoundError"));
8
+ const EventTokens_1 = tslib_1.__importDefault(require("../structures/EventTokens"));
9
+ const Tournament_1 = tslib_1.__importDefault(require("../structures/Tournament"));
10
+ const enums_1 = require("../../resources/enums");
11
+ /**
12
+ * Represent's the client's tournament manager.
13
+ */
14
+ class TournamentManager extends Base_1.default {
15
+ /**
16
+ * Downloads a file from the CDN (used for replays)
17
+ * @param url The URL of the file to download
18
+ * @param responseType The response type
19
+ */
20
+ async downloadReplayCDNFile(url, responseType) {
21
+ const fileLocationInfo = await this.client.http.epicgamesRequest({
22
+ method: 'GET',
23
+ url,
24
+ }, enums_1.AuthSessionStoreKey.Fortnite);
25
+ const file = await this.client.http.request({
26
+ method: 'GET',
27
+ url: Object.values(fileLocationInfo.files)[0].readLink,
28
+ responseType,
29
+ });
30
+ return file;
31
+ }
32
+ /**
33
+ * Fetches the event tokens for an account.
34
+ * This can be used to check if a user is eligible to play a certain tournament window
35
+ * or to check a user's arena division in any season
36
+ * @param user The id(s) or display name(s) of the user(s)
37
+ * @throws {UserNotFoundError} The user wasn't found
38
+ * @throws {EpicgamesAPIError}
39
+ */
40
+ async getEventTokens(user) {
41
+ const users = typeof user === 'string' ? [user] : user;
42
+ const resolvedUsers = await this.client.user.fetchMultiple(users);
43
+ const userChunks = resolvedUsers.map((u) => u.id).reduce((resArr, usr, i) => {
44
+ const chunkIndex = Math.floor(i / 16);
45
+ // eslint-disable-next-line no-param-reassign
46
+ if (!resArr[chunkIndex])
47
+ resArr[chunkIndex] = [];
48
+ resArr[chunkIndex].push(usr);
49
+ return resArr;
50
+ }, []);
51
+ const statsResponses = await Promise.all(userChunks.map((c) => this.client.http.epicgamesRequest({
52
+ method: 'GET',
53
+ url: `${Endpoints_1.default.BR_TOURNAMENT_TOKENS}?teamAccountIds=${c.join(',')}`,
54
+ }, enums_1.AuthSessionStoreKey.Fortnite)));
55
+ return statsResponses.map((r) => r.accounts).flat(1)
56
+ .map((r) => new EventTokens_1.default(this.client, r.tokens, resolvedUsers.find((u) => u.id === r.accountId)));
57
+ }
58
+ /**
59
+ * Fetches the current and past Battle Royale tournaments
60
+ * @param region The region
61
+ * @param platform The platform
62
+ * @throws {EpicgamesAPIError}
63
+ */
64
+ async get(region = 'EU', platform = 'Windows') {
65
+ const [tournaments, tournamentsInfo] = await Promise.all([
66
+ this.client.http.epicgamesRequest({
67
+ method: 'GET',
68
+ url: `${Endpoints_1.default.BR_TOURNAMENTS_DOWNLOAD}/${this.client.user.self.id}?region=${region}`
69
+ + `&platform=${platform}&teamAccountIds=${this.client.user.self.id}`,
70
+ }, enums_1.AuthSessionStoreKey.Fortnite),
71
+ this.client.http.epicgamesRequest({
72
+ method: 'GET',
73
+ url: `${Endpoints_1.default.BR_NEWS}/tournamentinformation`,
74
+ }, enums_1.AuthSessionStoreKey.Fortnite),
75
+ ]);
76
+ const constuctedTournaments = [];
77
+ tournaments.events.forEach((t) => {
78
+ var _a, _b, _c;
79
+ let tournamentDisplayData = (_b = (_a = tournamentsInfo.tournament_info) === null || _a === void 0 ? void 0 : _a.tournaments) === null || _b === void 0 ? void 0 : _b.find((td) => td.tournament_display_id === t.displayDataId);
80
+ if (!tournamentDisplayData) {
81
+ tournamentDisplayData = (_c = Object.values(tournamentsInfo)
82
+ .find((tdr) => { var _a; return ((_a = tdr.tournament_info) === null || _a === void 0 ? void 0 : _a.tournament_display_id) === t.displayDataId; })) === null || _c === void 0 ? void 0 : _c.tournament_info;
83
+ }
84
+ if (!tournamentDisplayData) {
85
+ return;
86
+ }
87
+ const templates = [];
88
+ t.eventWindows.forEach((w) => {
89
+ const template = tournaments.templates
90
+ .find((tt) => tt.eventTemplateId === w.eventTemplateId);
91
+ if (template)
92
+ templates.push({ windowId: w.eventWindowId, templateData: template });
93
+ });
94
+ constuctedTournaments.push(new Tournament_1.default(this.client, t, tournamentDisplayData, templates));
95
+ });
96
+ return constuctedTournaments;
97
+ }
98
+ async getData() {
99
+ const tournaments = await this.client.http.epicgamesRequest({
100
+ method: 'GET',
101
+ url: `${Endpoints_1.default.BR_TOURNAMENTS}/${this.client.user.self.id}`,
102
+ }, enums_1.AuthSessionStoreKey.Fortnite);
103
+ const tournamentsInfo = await this.client.http.epicgamesRequest({
104
+ method: 'GET',
105
+ url: `${Endpoints_1.default.BR_NEWS}/tournamentinformation`,
106
+ }, enums_1.AuthSessionStoreKey.Fortnite);
107
+ const constuctedTournaments = [];
108
+ tournaments.events.forEach((t) => {
109
+ var _a, _b, _c;
110
+ let tournamentDisplayData = (_b = (_a = tournamentsInfo.tournament_info) === null || _a === void 0 ? void 0 : _a.tournaments) === null || _b === void 0 ? void 0 : _b.find((td) => td.tournament_display_id === t.displayDataId);
111
+ if (!tournamentDisplayData) {
112
+ tournamentDisplayData = (_c = Object.values(tournamentsInfo)
113
+ .find((tdr) => { var _a; return ((_a = tdr.tournament_info) === null || _a === void 0 ? void 0 : _a.tournament_display_id) === t.displayDataId; })) === null || _c === void 0 ? void 0 : _c.tournament_info;
114
+ }
115
+ if (!tournamentDisplayData) {
116
+ return;
117
+ }
118
+ const templates = [];
119
+ t.eventWindows.forEach((w) => {
120
+ const template = tournaments.templates
121
+ .find((tt) => tt.eventTemplateId === w.eventTemplateId);
122
+ if (template)
123
+ templates.push({ windowId: w.eventWindowId, templateData: template });
124
+ });
125
+ constuctedTournaments.push(new Tournament_1.default(this.client, t, tournamentDisplayData, templates));
126
+ });
127
+ return constuctedTournaments;
128
+ }
129
+ /**
130
+ * Fetches a tournament session's metadata
131
+ * @param sessionId The session ID
132
+ * @throws {MatchNotFoundError} The match wasn't found
133
+ * @throws {EpicgamesAPIError}
134
+ * @throws {AxiosError}
135
+ */
136
+ async getSessionMetadata(sessionId) {
137
+ var _a, _b;
138
+ let replayMetadataResponse;
139
+ try {
140
+ replayMetadataResponse = await this.downloadReplayCDNFile(`${Endpoints_1.default.BR_REPLAY_METADATA}%2F${sessionId}.json`, 'json');
141
+ }
142
+ catch (e) {
143
+ if (e instanceof axios_1.AxiosError && typeof ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === 'string'
144
+ && ((_b = e.response) === null || _b === void 0 ? void 0 : _b.data.includes('<Message>The specified key does not exist.</Message>'))) {
145
+ throw new MatchNotFoundError_1.default(sessionId);
146
+ }
147
+ throw e;
148
+ }
149
+ return {
150
+ changelist: replayMetadataResponse.Changelist,
151
+ checkpoints: replayMetadataResponse.Checkpoints,
152
+ dataChunks: replayMetadataResponse.DataChunks,
153
+ desiredDelayInSeconds: replayMetadataResponse.DesiredDelayInSeconds,
154
+ events: replayMetadataResponse.Events,
155
+ friendlyName: replayMetadataResponse.FriendlyName,
156
+ lengthInMS: replayMetadataResponse.LengthInMS,
157
+ networkVersion: replayMetadataResponse.NetworkVersion,
158
+ replayName: replayMetadataResponse.ReplayName,
159
+ timestamp: new Date(replayMetadataResponse.Timestamp),
160
+ isCompressed: replayMetadataResponse.bCompressed,
161
+ isLive: replayMetadataResponse.bIsLive,
162
+ };
163
+ }
164
+ /**
165
+ * Fetches the results for a tournament window
166
+ * @param eventId The tournament's ID
167
+ * @param eventWindowId The tournament window's ID
168
+ * @param showLiveSessions Whether to show live sessions
169
+ * @param page The results page index
170
+ * @throws {EpicgamesAPIError}
171
+ */
172
+ async getWindowResults(eventId, eventWindowId, showLiveSessions = false, page = 0) {
173
+ const window = await this.client.http.epicgamesRequest({
174
+ method: 'GET',
175
+ url: `${Endpoints_1.default.BR_TOURNAMENT_WINDOW}/${eventId}/${eventWindowId}/`
176
+ + `${this.client.user.self.id}?page=${page}&rank=0&teamAccountIds=&appId=Fortnite&showLiveSessions=${showLiveSessions}`,
177
+ }, enums_1.AuthSessionStoreKey.Fortnite);
178
+ return window;
179
+ }
180
+ }
181
+ exports.default = TournamentManager;
182
+ //# sourceMappingURL=TournamentManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TournamentManager.js","sourceRoot":"","sources":["../../../src/managers/TournamentManager.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,kFAAkD;AAClD,2DAA2B;AAC3B,kGAAkE;AAClE,oFAAoD;AACpD,kFAAkD;AAClD,iDAA4D;AAS5D;;GAEG;AACH,MAAM,iBAAkB,SAAQ,cAAI;IAClC;;;;OAIG;IACK,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,YAA0B;QACzE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC/D,MAAM,EAAE,KAAK;YACb,GAAG;SACJ,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QAEjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YAC1C,MAAM,EAAE,KAAK;YACb,GAAG,EAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAS,CAAC,QAAQ;YAC/D,YAAY;SACb,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,cAAc,CAAC,IAAuB;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IACI,KAAK,CAAC,gBAAgB,CAC3B,OAAe,EACf,aAAqB,EACrB,gBAAgB,GAAG,KAAK,EACxB,IAAI,GAAG,CAAC;QAER,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC;YACrD,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,mBAAS,CAAC,oBAAoB,IAAI,OAAO,IAAI,aAAa,GAAG;kBACjE,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAK,CAAC,EAAE,SAAS,IAAI,2DAA2D,gBAAgB,EAAE;SAC3H,EAAE,2BAAmB,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { Collection } from '@discordjs/collection';
2
+ import Base from '../Base';
3
+ import UserSearchResult from '../structures/user/UserSearchResult';
4
+ import User from '../structures/user/User';
5
+ import Avatar from '../structures/Avatar';
6
+ import GlobalProfile from '../structures/GlobalProfile';
7
+ import ClientUser from '../structures/user/ClientUser';
8
+ import type BlockedUser from '../structures/user/BlockedUser';
9
+ import type { UserSearchPlatform } from '../../resources/structs';
10
+ import type Client from '../Client';
11
+ declare class UserManager extends Base {
12
+ /**
13
+ * The client's blocklist
14
+ */
15
+ blocklist: Collection<string, BlockedUser>;
16
+ /**
17
+ * The client's user cache
18
+ * @private
19
+ */
20
+ cache: Collection<string, User & {
21
+ cachedAt: number;
22
+ }>;
23
+ /**
24
+ * The client's user
25
+ */
26
+ self?: ClientUser;
27
+ constructor(client: Client);
28
+ /**
29
+ * Resolves a user's ID from the cache or via the API
30
+ * @param idOrDisplayName The user's ID or display name
31
+ */
32
+ resolveId(idOrDisplayName: string): Promise<string>;
33
+ fetch(idOrDisplayName: string): Promise<User>;
34
+ fetchMultiple(idsOrDisplayNames: string[]): Promise<User[]>;
35
+ fetchSelf(): Promise<void>;
36
+ search(prefix: string, platform?: UserSearchPlatform): Promise<UserSearchResult[]>;
37
+ /**
38
+ * Fetches the avatar of a user
39
+ * @param user The id or display name of the user
40
+ * @throws {EpicgamesAPIError}
41
+ * @throws {UserNotFoundError} The user wasn't found
42
+ */
43
+ fetchAvatar(idOrDisplayName: string): Promise<Avatar>;
44
+ /**
45
+ * Fetches the avatar of multiple users
46
+ * @param user The ids and/or display names of the users
47
+ * @throws {EpicgamesAPIError}
48
+ */
49
+ fetchAvatarMultiple(idsOrDisplayNames: string[]): Promise<Avatar[]>;
50
+ /**
51
+ * Fetches the global profile of a user
52
+ * @param user The id or display name of the user
53
+ * @throws {EpicgamesAPIError}
54
+ * @throws {UserNotFoundError} The user wasn't found
55
+ */
56
+ fetchGlobalProfile(idOrDisplayName: string): Promise<GlobalProfile>;
57
+ /**
58
+ * Fetches the global profile for multiple users
59
+ * @param user The ids and/or display names of the users
60
+ * @throws {EpicgamesAPIError}
61
+ */
62
+ fetchGlobalProfileMultiple(idsOrDisplayNames: string[]): Promise<GlobalProfile[]>;
63
+ /**
64
+ * Blocks a user
65
+ * @param user The id or display name of the user
66
+ * @throws {UserNotFoundError} The user wasn't found
67
+ * @throws {EpicgamesAPIError}
68
+ */
69
+ block(user: string): Promise<void>;
70
+ /**
71
+ * Unblocks a user
72
+ * @param user The id or display name of the user
73
+ * @throws {UserNotFoundError} The user wasn't found
74
+ * @throws {EpicgamesAPIError}
75
+ */
76
+ unblock(user: string): Promise<void>;
77
+ }
78
+ export default UserManager;