@ughuuu/gamend 1.1.1404 → 1.1.1406

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 (408) hide show
  1. package/README.md +9 -9
  2. package/dist/ApiClient.js +2 -2
  3. package/dist/api/AdminAnalyticsApi.js +2 -2
  4. package/dist/api/AdminBansApi.js +2 -2
  5. package/dist/api/AdminChatApi.js +2 -2
  6. package/dist/api/AdminEconomyApi.js +2 -2
  7. package/dist/api/AdminGroupsApi.js +2 -2
  8. package/dist/api/AdminKVApi.js +2 -2
  9. package/dist/api/AdminLeaderboardsApi.js +2 -2
  10. package/dist/api/AdminLobbiesApi.js +2 -2
  11. package/dist/api/AdminMatchmakingApi.js +2 -2
  12. package/dist/api/AdminNotificationsApi.js +2 -2
  13. package/dist/api/AdminPushApi.js +2 -2
  14. package/dist/api/AdminQuestsApi.js +2 -2
  15. package/dist/api/AdminReadyChecksApi.js +2 -2
  16. package/dist/api/AdminResultsApi.js +14 -14
  17. package/dist/api/AdminRetentionApi.js +2 -2
  18. package/dist/api/AdminSessionsApi.js +2 -2
  19. package/dist/api/AdminStorageApi.js +2 -2
  20. package/dist/api/AdminTournamentsApi.js +2 -2
  21. package/dist/api/AdminUsersApi.js +2 -2
  22. package/dist/api/AuthenticationApi.js +2 -2
  23. package/dist/api/ChatApi.js +2 -2
  24. package/dist/api/ClientLogsApi.js +2 -2
  25. package/dist/api/EconomyApi.js +2 -2
  26. package/dist/api/FriendsApi.js +2 -2
  27. package/dist/api/GroupsApi.js +2 -2
  28. package/dist/api/HealthApi.js +2 -2
  29. package/dist/api/HooksApi.js +2 -2
  30. package/dist/api/KVApi.js +2 -2
  31. package/dist/api/LeaderboardsApi.js +2 -2
  32. package/dist/api/LobbiesApi.js +2 -2
  33. package/dist/api/MatchmakingApi.js +4 -4
  34. package/dist/api/NotificationsApi.js +2 -2
  35. package/dist/api/PartiesApi.js +2 -2
  36. package/dist/api/PaymentsApi.js +2 -2
  37. package/dist/api/PushApi.js +2 -2
  38. package/dist/api/QuestsApi.js +2 -2
  39. package/dist/api/ReadyChecksApi.js +2 -2
  40. package/dist/api/ReportsApi.js +2 -2
  41. package/dist/api/ResultsApi.js +14 -14
  42. package/dist/api/SignalingApi.js +2 -2
  43. package/dist/api/StatsApi.js +2 -2
  44. package/dist/api/TimeApi.js +2 -2
  45. package/dist/api/TournamentsApi.js +2 -2
  46. package/dist/api/UsersApi.js +2 -2
  47. package/dist/index.js +49 -49
  48. package/dist/model/AcceptPartyInviteRequest.js +2 -2
  49. package/dist/model/AccountBan.js +2 -2
  50. package/dist/model/ActivityStats.js +2 -2
  51. package/dist/model/AdminBan.js +2 -2
  52. package/dist/model/AdminBanPage.js +2 -2
  53. package/dist/model/AdminBanResponse.js +2 -2
  54. package/dist/model/AdminClaimQuestRequest.js +2 -2
  55. package/dist/model/AdminCreateBanRequest.js +2 -2
  56. package/dist/model/AdminCreateChatFilterWordRequest.js +2 -2
  57. package/dist/model/AdminCreateKvEntryRequest.js +2 -2
  58. package/dist/model/AdminCreateLeaderboardRequest.js +2 -2
  59. package/dist/model/AdminCreateNotificationRequest.js +2 -2
  60. package/dist/model/AdminCreateQuestRequest.js +2 -2
  61. package/dist/model/AdminCreateQuestRequestObjectivesInner.js +2 -2
  62. package/dist/model/AdminCreateQuestRequestRewardsInner.js +2 -2
  63. package/dist/model/AdminCreateTournamentRequest.js +2 -2
  64. package/dist/model/AdminGrantCurrencyRequest.js +2 -2
  65. package/dist/model/AdminGrantItemRequest.js +2 -2
  66. package/dist/model/AdminGrantQuestRequest.js +2 -2
  67. package/dist/model/AdminImportChatFilterWordsRequest.js +2 -2
  68. package/dist/model/AdminInventoryItem.js +2 -2
  69. package/dist/model/AdminInventoryItemPage.js +2 -2
  70. package/dist/model/AdminKvEntry.js +2 -2
  71. package/dist/model/AdminKvEntryPage.js +2 -2
  72. package/dist/model/AdminKvEntryResponse.js +2 -2
  73. package/dist/model/AdminLeaderboardIconUploadUrlRequest.js +2 -2
  74. package/dist/model/AdminLeaderboardRecord.js +2 -2
  75. package/dist/model/AdminLeaderboardRecordResponse.js +2 -2
  76. package/dist/model/AdminLedgerEntry.js +2 -2
  77. package/dist/model/AdminLedgerEntryPage.js +2 -2
  78. package/dist/model/AdminMatchmakingStats.js +2 -2
  79. package/dist/model/AdminMatchmakingStatsResponse.js +2 -2
  80. package/dist/model/AdminMatchmakingTicket.js +6 -17
  81. package/dist/model/AdminMatchmakingTicketPage.js +2 -2
  82. package/dist/model/AdminMatchmakingTicketResponse.js +2 -2
  83. package/dist/model/AdminPushToken.js +2 -2
  84. package/dist/model/AdminPushTokenPage.js +2 -2
  85. package/dist/model/AdminQuest.js +2 -2
  86. package/dist/model/AdminQuestClaim.js +2 -2
  87. package/dist/model/AdminQuestClaimResponse.js +2 -2
  88. package/dist/model/AdminQuestIconUploadUrlRequest.js +2 -2
  89. package/dist/model/AdminQuestPage.js +2 -2
  90. package/dist/model/AdminQuestProgress.js +2 -2
  91. package/dist/model/AdminQuestProgressPage.js +2 -2
  92. package/dist/model/AdminQuestProgressResponse.js +2 -2
  93. package/dist/model/AdminQuestResponse.js +2 -2
  94. package/dist/model/AdminReadyCheck.js +2 -2
  95. package/dist/model/AdminReadyCheckPage.js +2 -2
  96. package/dist/model/AdminReadyCheckResponse.js +2 -2
  97. package/dist/model/AdminResetQuestRequest.js +2 -2
  98. package/dist/model/AdminResolveChatReportRequest.js +2 -2
  99. package/dist/model/AdminResolveTournamentMatchRequest.js +2 -2
  100. package/dist/model/AdminSendPushRequest.js +2 -2
  101. package/dist/model/AdminSession.js +2 -2
  102. package/dist/model/AdminSessionPage.js +2 -2
  103. package/dist/model/AdminSetLeaderboardIconRequest.js +2 -2
  104. package/dist/model/AdminSetQuestIconRequest.js +2 -2
  105. package/dist/model/AdminSetTournamentIconRequest.js +2 -2
  106. package/dist/model/AdminSpendCurrencyRequest.js +2 -2
  107. package/dist/model/AdminSubmitLeaderboardScoreRequest.js +2 -2
  108. package/dist/model/AdminTestChatPhraseRequest.js +2 -2
  109. package/dist/model/AdminTournament.js +2 -2
  110. package/dist/model/AdminTournamentIconUploadUrlRequest.js +2 -2
  111. package/dist/model/AdminTournamentResponse.js +2 -2
  112. package/dist/model/AdminUpdateChatFilterWordRequest.js +2 -2
  113. package/dist/model/AdminUpdateGroupRequest.js +2 -2
  114. package/dist/model/AdminUpdateKvEntryRequest.js +2 -2
  115. package/dist/model/AdminUpdateLeaderboardRecordRequest.js +2 -2
  116. package/dist/model/AdminUpdateLeaderboardRequest.js +2 -2
  117. package/dist/model/AdminUpdateLobbyRequest.js +2 -2
  118. package/dist/model/AdminUpdateQuestRequest.js +2 -2
  119. package/dist/model/AdminUpdateTournamentRequest.js +2 -2
  120. package/dist/model/AdminUpdateUserRequest.js +2 -2
  121. package/dist/model/AdminUpsertKvRequest.js +2 -2
  122. package/dist/model/AdminUser.js +2 -2
  123. package/dist/model/AdminUserResponse.js +2 -2
  124. package/dist/model/AdminWallet.js +2 -2
  125. package/dist/model/AdminWalletPage.js +2 -2
  126. package/dist/model/AnalyticsCounts.js +2 -2
  127. package/dist/model/AnalyticsCountsResponse.js +2 -2
  128. package/dist/model/AnalyticsDaily.js +2 -2
  129. package/dist/model/AnalyticsDailyResponse.js +2 -2
  130. package/dist/model/AnalyticsDay.js +2 -2
  131. package/dist/model/AnalyticsEconomy.js +2 -2
  132. package/dist/model/AnalyticsEconomyResponse.js +2 -2
  133. package/dist/model/AnalyticsSummary.js +2 -2
  134. package/dist/model/AnalyticsSummaryResponse.js +2 -2
  135. package/dist/model/AuthProvidersResponse.js +2 -2
  136. package/dist/model/BlockedFriendship.js +2 -2
  137. package/dist/model/BlockedFriendshipPage.js +2 -2
  138. package/dist/model/CallHookRequest.js +2 -2
  139. package/dist/model/CancelPartyInviteRequest.js +2 -2
  140. package/dist/model/CancelledCount.js +2 -2
  141. package/dist/model/CancelledCountResponse.js +2 -2
  142. package/dist/model/ChatFilterHit.js +2 -2
  143. package/dist/model/ChatFilterLanguages.js +2 -2
  144. package/dist/model/ChatFilterLanguagesResponse.js +2 -2
  145. package/dist/model/ChatFilterTest.js +2 -2
  146. package/dist/model/ChatFilterTestResponse.js +2 -2
  147. package/dist/model/ChatFilterWord.js +2 -2
  148. package/dist/model/ChatFilterWordPage.js +2 -2
  149. package/dist/model/ChatFilterWordResponse.js +2 -2
  150. package/dist/model/ChatMessage.js +2 -2
  151. package/dist/model/ChatMessagePage.js +2 -2
  152. package/dist/model/ChatMessageResponse.js +2 -2
  153. package/dist/model/ChatMuteRecord.js +2 -2
  154. package/dist/model/ChatMuteRecordPage.js +2 -2
  155. package/dist/model/ChatMuteRecordResponse.js +2 -2
  156. package/dist/model/ChatReadCursor.js +2 -2
  157. package/dist/model/ChatReadCursorResponse.js +2 -2
  158. package/dist/model/ChatReport.js +2 -2
  159. package/dist/model/ChatReportPage.js +2 -2
  160. package/dist/model/ChatReportResponse.js +2 -2
  161. package/dist/model/ChatUnread.js +2 -2
  162. package/dist/model/ChatUnreadResponse.js +2 -2
  163. package/dist/model/ClientLogBatch.js +2 -2
  164. package/dist/model/ClientLogEntry.js +2 -2
  165. package/dist/model/ClientLogPolicy.js +2 -2
  166. package/dist/model/ClientLogPolicyResponse.js +2 -2
  167. package/dist/model/ClientLogResult.js +2 -2
  168. package/dist/model/ClientLogResultResponse.js +2 -2
  169. package/dist/model/ClientLogSession.js +2 -2
  170. package/dist/model/ConfirmRegistrationRequest.js +2 -2
  171. package/dist/model/CounterTotal.js +2 -2
  172. package/dist/model/CreateCurrentUserAvatarUploadUrlRequest.js +2 -2
  173. package/dist/model/CreateFriendRequestRequest.js +2 -2
  174. package/dist/model/CreateGroupIconUploadUrlRequest.js +2 -2
  175. package/dist/model/CreateGroupRequest.js +2 -2
  176. package/dist/model/CreateLobbyRequest.js +2 -2
  177. package/dist/model/CreatePartyRequest.js +2 -2
  178. package/dist/model/CurrentUser.js +2 -2
  179. package/dist/model/CurrentUserResponse.js +2 -2
  180. package/dist/model/DeclinePartyInviteRequest.js +2 -2
  181. package/dist/model/DeleteCurrentUserRequest.js +2 -2
  182. package/dist/model/DeleteNotificationsRequest.js +2 -2
  183. package/dist/model/DeletedCount.js +2 -2
  184. package/dist/model/DeletedCountResponse.js +2 -2
  185. package/dist/model/DemoteGroupMemberRequest.js +2 -2
  186. package/dist/model/DeviceLoginRequest.js +2 -2
  187. package/dist/model/EconomyFlowDay.js +2 -2
  188. package/dist/model/EconomyTotal.js +2 -2
  189. package/dist/model/Entitlement.js +2 -2
  190. package/dist/model/EntitlementPage.js +2 -2
  191. package/dist/model/ErrorResponse.js +2 -2
  192. package/dist/model/Friend.js +2 -2
  193. package/dist/model/FriendPage.js +2 -2
  194. package/dist/model/FriendRequest.js +2 -2
  195. package/dist/model/FriendRequestLists.js +2 -2
  196. package/dist/model/FriendRequestMeta.js +2 -2
  197. package/dist/model/FriendRequestResponse.js +2 -2
  198. package/dist/model/FriendRequestsResponse.js +2 -2
  199. package/dist/model/Group.js +2 -2
  200. package/dist/model/GroupInvite.js +2 -2
  201. package/dist/model/GroupInviteLink.js +2 -2
  202. package/dist/model/GroupInviteLinkPreview.js +2 -2
  203. package/dist/model/GroupInviteLinkPreviewResponse.js +2 -2
  204. package/dist/model/GroupInviteLinkResponse.js +2 -2
  205. package/dist/model/GroupInviteOutcome.js +2 -2
  206. package/dist/model/GroupInviteOutcomeResponse.js +2 -2
  207. package/dist/model/GroupInvitePage.js +2 -2
  208. package/dist/model/GroupJoinRequest.js +2 -2
  209. package/dist/model/GroupJoinRequestPage.js +2 -2
  210. package/dist/model/GroupJoinRequestResponse.js +2 -2
  211. package/dist/model/GroupMember.js +2 -2
  212. package/dist/model/GroupMemberPage.js +2 -2
  213. package/dist/model/GroupMemberResponse.js +2 -2
  214. package/dist/model/GroupPage.js +2 -2
  215. package/dist/model/GroupResponse.js +2 -2
  216. package/dist/model/Health.js +2 -2
  217. package/dist/model/HealthResponse.js +2 -2
  218. package/dist/model/HookCallResponse.js +2 -2
  219. package/dist/model/HookFunction.js +2 -2
  220. package/dist/model/HookFunctionPage.js +2 -2
  221. package/dist/model/HookSignature.js +2 -2
  222. package/dist/model/ImportedCount.js +2 -2
  223. package/dist/model/ImportedCountResponse.js +2 -2
  224. package/dist/model/InventoryResponse.js +2 -2
  225. package/dist/model/InviteToGroupRequest.js +2 -2
  226. package/dist/model/InviteToPartyRequest.js +2 -2
  227. package/dist/model/ItemQuantity.js +2 -2
  228. package/dist/model/ItemQuantityResponse.js +2 -2
  229. package/dist/model/JoinLobbyRequest.js +2 -2
  230. package/dist/model/KickGroupMemberRequest.js +2 -2
  231. package/dist/model/KickPartyMemberRequest.js +2 -2
  232. package/dist/model/KickUserRequest.js +2 -2
  233. package/dist/model/KvEntry.js +2 -2
  234. package/dist/model/KvEntryResponse.js +2 -2
  235. package/dist/model/Leaderboard.js +2 -2
  236. package/dist/model/LeaderboardKeys.js +2 -2
  237. package/dist/model/LeaderboardKeysResponse.js +2 -2
  238. package/dist/model/LeaderboardPage.js +2 -2
  239. package/dist/model/LeaderboardRecord.js +2 -2
  240. package/dist/model/LeaderboardRecordPage.js +2 -2
  241. package/dist/model/LeaderboardRecordResponse.js +2 -2
  242. package/dist/model/LeaderboardResponse.js +2 -2
  243. package/dist/model/LeaderboardsBySlugResponse.js +2 -2
  244. package/dist/model/LedgerEntry.js +2 -2
  245. package/dist/model/LedgerEntryPage.js +2 -2
  246. package/dist/model/LinkAppleIosRequest.js +2 -28
  247. package/dist/model/LinkDeviceRequest.js +2 -2
  248. package/dist/model/LinkGoogleIdTokenRequest.js +2 -2
  249. package/dist/model/LinkProviderRequest.js +2 -2
  250. package/dist/model/LinkedProviders.js +2 -2
  251. package/dist/model/Lobby.js +2 -2
  252. package/dist/model/LobbyPage.js +2 -2
  253. package/dist/model/LobbyResponse.js +2 -2
  254. package/dist/model/LobbyStats.js +2 -2
  255. package/dist/model/LobbyStatsResponse.js +2 -2
  256. package/dist/model/LoginRequest.js +2 -2
  257. package/dist/model/MarkChatReadRequest.js +2 -2
  258. package/dist/model/MatchmakingJoinRequest.js +2 -11
  259. package/dist/model/MatchmakingQueue.js +2 -2
  260. package/dist/model/MatchmakingStats.js +2 -2
  261. package/dist/model/MatchmakingStatsResponse.js +2 -2
  262. package/dist/model/MatchmakingTicket.js +6 -17
  263. package/dist/model/MatchmakingTicketResponse.js +2 -2
  264. package/dist/model/MuteGroupMemberRequest.js +2 -2
  265. package/dist/model/MuteLobbyMemberRequest.js +2 -2
  266. package/dist/model/MutePartyMemberRequest.js +2 -2
  267. package/dist/model/MyReadyChecks.js +2 -2
  268. package/dist/model/MyReadyChecksResponse.js +2 -2
  269. package/dist/model/Notification.js +2 -2
  270. package/dist/model/NotificationPage.js +2 -2
  271. package/dist/model/NotificationResponse.js +2 -2
  272. package/dist/model/OAuthAuthorization.js +2 -2
  273. package/dist/model/OAuthAuthorizationResponse.js +2 -2
  274. package/dist/model/OAuthSessionStatus.js +2 -2
  275. package/dist/model/OAuthSessionStatusResponse.js +2 -2
  276. package/dist/model/OauthApiCallbackRequest.js +2 -2
  277. package/dist/model/OauthCallbackApiAppleIosRequest.js +2 -28
  278. package/dist/model/OauthGoogleIdTokenRequest.js +2 -2
  279. package/dist/model/OkResponse.js +2 -2
  280. package/dist/model/OpenLobbyReadyCheckRequest.js +2 -2
  281. package/dist/model/OpenPartyReadyCheckRequest.js +2 -2
  282. package/dist/model/PageMeta.js +2 -2
  283. package/dist/model/Party.js +2 -2
  284. package/dist/model/PartyCreateLobbyRequest.js +2 -2
  285. package/dist/model/PartyInvite.js +2 -2
  286. package/dist/model/PartyInvitePage.js +2 -2
  287. package/dist/model/PartyJoinLobbyRequest.js +2 -2
  288. package/dist/model/PartyResponse.js +2 -2
  289. package/dist/model/PartyStats.js +2 -2
  290. package/dist/model/PartyStatsResponse.js +2 -2
  291. package/dist/model/PaymentCatalogEntry.js +2 -2
  292. package/dist/model/PaymentCatalogEntryPage.js +2 -2
  293. package/dist/model/PaymentProduct.js +2 -2
  294. package/dist/model/PaymentWebhookReceipt.js +2 -2
  295. package/dist/model/PaymentWebhookReceiptResponse.js +2 -2
  296. package/dist/model/PaymentsSteamCheckoutRequest.js +2 -2
  297. package/dist/model/PaymentsSteamFinalizeRequest.js +2 -2
  298. package/dist/model/PaymentsStripeCheckoutRequest.js +2 -2
  299. package/dist/model/{Result.js → PlayResult.js} +40 -40
  300. package/dist/model/{ResultEvent.js → PlayResultEvent.js} +26 -26
  301. package/dist/model/{ResultEvents.js → PlayResultEvents.js} +27 -27
  302. package/dist/model/{ResultEventsResponse.js → PlayResultEventsResponse.js} +27 -27
  303. package/dist/model/{ResultPage.js → PlayResultPage.js} +28 -28
  304. package/dist/model/{ResultResponse.js → PlayResultResponse.js} +27 -27
  305. package/dist/model/{ResultStat.js → PlayResultStat.js} +22 -22
  306. package/dist/model/PlayerStats.js +2 -2
  307. package/dist/model/PlayerStatsResponse.js +2 -2
  308. package/dist/model/PromoteGroupMemberRequest.js +2 -2
  309. package/dist/model/ProviderLinkStatus.js +2 -2
  310. package/dist/model/ProviderLinkStatusResponse.js +2 -2
  311. package/dist/model/PublicUser.js +2 -2
  312. package/dist/model/PublicUserPage.js +2 -2
  313. package/dist/model/PublicUserResponse.js +2 -2
  314. package/dist/model/Purchase.js +2 -2
  315. package/dist/model/PurchaseResponse.js +2 -2
  316. package/dist/model/PurchaseValidation.js +2 -2
  317. package/dist/model/PurchaseValidationResponse.js +2 -2
  318. package/dist/model/PushToken.js +2 -2
  319. package/dist/model/PushTokenPage.js +2 -2
  320. package/dist/model/PushTokenResponse.js +2 -2
  321. package/dist/model/Quest.js +2 -2
  322. package/dist/model/QuestClaim.js +2 -2
  323. package/dist/model/QuestClaimResponse.js +2 -2
  324. package/dist/model/QuestFunnelResponse.js +2 -2
  325. package/dist/model/QuestObjective.js +2 -2
  326. package/dist/model/QuestPage.js +2 -2
  327. package/dist/model/QuestProgress.js +2 -2
  328. package/dist/model/QuestReward.js +2 -2
  329. package/dist/model/QuestStats.js +2 -2
  330. package/dist/model/QuestStatsResponse.js +2 -2
  331. package/dist/model/QuickJoinRequest.js +2 -2
  332. package/dist/model/ReadyCheckOutcomesResponse.js +2 -2
  333. package/dist/model/ReadyCheckParticipant.js +2 -2
  334. package/dist/model/ReadyCheckState.js +2 -2
  335. package/dist/model/ReadyCheckStateResponse.js +2 -2
  336. package/dist/model/RefreshTokenRequest.js +2 -2
  337. package/dist/model/RegisterPushTokenRequest.js +2 -2
  338. package/dist/model/RegisterRequest.js +2 -2
  339. package/dist/model/Registration.js +2 -2
  340. package/dist/model/RegistrationResponse.js +2 -2
  341. package/dist/model/ReportChatMessageRequest.js +2 -2
  342. package/dist/model/ReportKind.js +2 -2
  343. package/dist/model/ReportKinds.js +2 -2
  344. package/dist/model/ReportKindsResponse.js +2 -2
  345. package/dist/model/ReportReceipt.js +2 -2
  346. package/dist/model/ReportReceiptResponse.js +2 -2
  347. package/dist/model/ReportRequest.js +2 -2
  348. package/dist/model/ResendConfirmationRequest.js +2 -2
  349. package/dist/model/ResolveLeaderboardSlugsRequest.js +2 -2
  350. package/dist/model/RespondReadyCheckRequest.js +2 -2
  351. package/dist/model/RetentionStatus.js +2 -2
  352. package/dist/model/RetentionStatusResponse.js +2 -2
  353. package/dist/model/SendChatMessageRequest.js +2 -2
  354. package/dist/model/SendNotificationRequest.js +2 -2
  355. package/dist/model/ServerStats.js +2 -2
  356. package/dist/model/ServerStatsResponse.js +2 -2
  357. package/dist/model/ServerTime.js +2 -2
  358. package/dist/model/ServerTimeResponse.js +2 -2
  359. package/dist/model/Session.js +2 -2
  360. package/dist/model/SessionResponse.js +2 -2
  361. package/dist/model/SetCurrentUserAvatarRequest.js +2 -2
  362. package/dist/model/SetGroupIconRequest.js +2 -2
  363. package/dist/model/SetLobbyStateRequest.js +2 -2
  364. package/dist/model/SignalingStats.js +2 -2
  365. package/dist/model/SignalingStatsResponse.js +2 -2
  366. package/dist/model/SteamCheckout.js +2 -2
  367. package/dist/model/SteamCheckoutResponse.js +2 -2
  368. package/dist/model/StorageObject.js +2 -2
  369. package/dist/model/StorageObjectPage.js +2 -2
  370. package/dist/model/StorageObjectResponse.js +2 -2
  371. package/dist/model/StorageUsage.js +2 -2
  372. package/dist/model/StorageUsageResponse.js +2 -2
  373. package/dist/model/StripeCheckout.js +2 -2
  374. package/dist/model/StripeCheckoutResponse.js +2 -2
  375. package/dist/model/Tournament.js +2 -2
  376. package/dist/model/TournamentBracket.js +2 -2
  377. package/dist/model/TournamentBracketPage.js +2 -2
  378. package/dist/model/TournamentEntry.js +2 -2
  379. package/dist/model/TournamentEntryPage.js +2 -2
  380. package/dist/model/TournamentEntryResponse.js +2 -2
  381. package/dist/model/TournamentMatch.js +2 -2
  382. package/dist/model/TournamentMatchCounts.js +2 -2
  383. package/dist/model/TournamentMatchResponse.js +2 -2
  384. package/dist/model/TournamentPage.js +2 -2
  385. package/dist/model/TournamentPlacement.js +2 -2
  386. package/dist/model/TournamentResponse.js +2 -2
  387. package/dist/model/TournamentStandings.js +2 -2
  388. package/dist/model/TournamentStandingsResponse.js +2 -2
  389. package/dist/model/TournamentStats.js +2 -2
  390. package/dist/model/UnmuteGroupMemberRequest.js +2 -2
  391. package/dist/model/UnmuteLobbyMemberRequest.js +2 -2
  392. package/dist/model/UnmutePartyMemberRequest.js +2 -2
  393. package/dist/model/UpdateChatMessageRequest.js +2 -2
  394. package/dist/model/UpdateCurrentUserDisplayNameRequest.js +2 -2
  395. package/dist/model/UpdateCurrentUserPasswordRequest.js +2 -2
  396. package/dist/model/UpdateCurrentUserUsernameRequest.js +2 -2
  397. package/dist/model/UpdateGroupRequest.js +2 -2
  398. package/dist/model/UpdateLobbyRequest.js +2 -2
  399. package/dist/model/UpdatePartyRequest.js +2 -2
  400. package/dist/model/UploadTicket.js +2 -2
  401. package/dist/model/UploadTicketResponse.js +2 -2
  402. package/dist/model/UserBrief.js +2 -2
  403. package/dist/model/UserBriefPage.js +2 -2
  404. package/dist/model/WalletBalance.js +2 -2
  405. package/dist/model/WalletBalanceResponse.js +2 -2
  406. package/dist/model/WalletBalancesResponse.js +2 -2
  407. package/dist/realtime.js +184 -5
  408. package/package.json +2 -2
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
- var _ResultStat = _interopRequireDefault(require("./ResultStat"));
8
+ var _PlayResultStat = _interopRequireDefault(require("./PlayResultStat"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
10
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
11
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
@@ -17,9 +17,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /**
19
19
  * Gamend API
20
- * API for Gamend. Provides HTTP REST API, real-time WebSocket channels, and WebRTC DataChannels for low-latency game data. Features authentication, users, lobbies, groups, parties, friends, chat, notifications, quests, leaderboards, tournaments, matchmaking, payments, server scripting, and admin portal. ## **1. Authentication** This API uses JWT (JSON Web Tokens) with access and refresh tokens: ### **1.1 Getting Tokens** - **Email/Password**: POST to `/api/v1/login` with email and password - **Device (SDK)**: POST to `/api/v1/login` with a `device_id` string (creates/returns a device user) - **Discord OAuth**: Use `/api/v1/auth/discord` flow - **Google OAuth**: Use `/api/v1/auth/google` flow - **Facebook OAuth**: Use `/api/v1/auth/facebook` flow - **GitHub OAuth**: Use `/api/v1/auth/github` flow - **Apple Sign In**: Use `/auth/apple` browser flow or apple sdk flow - **Steam (OpenID)**: Use `/api/v1/auth/steam` flow Both methods return: - `access_token` - Short-lived (15 min by default), use for API requests; `expires_in` gives its lifetime in seconds - `refresh_token` - Long-lived (30 days by default), use to get new access tokens ### **1.2 Using Tokens** Include the access token in the Authorization header: ``` Authorization: Bearer <access_token> ``` ### **1.3 Refreshing Tokens** When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token. ### **1.4 Banned Accounts** An admin or the game can ban an account for a while or for good. A banned account still signs in, refreshes and signs out, `GET /api/v1/me` answers with its `ban` (`expires_at`, null when permanent, and `reason`), and `DELETE /api/v1/me` deletes it. Every other authenticated call answers 403 `account_banned`. On the socket it joins only its own user channel, where `account_banned` and `account_unbanned` arrive, and a ban placed while it is connected closes the socket. ## **2. Users** Users endpoints cover the user lifecycle and profile features. Key highlights: - **Registration and login** (email/password, device token for SDKs, and OAuth providers) - **Profile metadata** (JSON blob per user) and editable profile fields - **Account lifecycle**: password reset, email confirmation, and account deletion - **Sessions & tokens**: both browser sessions and JWT-based API tokens are supported ## **3. Friends** The Friends domain offers lightweight social features: - **Friend requests** (send / accept / reject / block flows) - **Friend listing & pagination**, with basic privacy controls - **Domain helpers** to manage and query friend relationships from API or UI contexts ## **4. Lobbies** Lobbies provide matchmaking / room management primitives. Highlights: - **Create / list / update / delete** lobbies with rich metadata (mode, region, tags) - **Host-managed or hostless** modes (hostless allowed internally, not creatable via public API) - **Membership management**: join, leave, kick users, and automatic host transfer - **Controls & protection**: max users, hidden/locked states, and optional password protection - **Hidden lobbies** are excluded from public listings; public listing endpoints are paginated ## **5. Notifications** Persistent user-to-user notifications that survive across sessions: - **Send notifications** to accepted friends with a title, optional content, and optional metadata - **List own notifications** with pagination (ordered oldest-first) - **Delete notifications** by ID (single or batch) - **Real-time delivery** via the user WebSocket channel (`\"notification\"` events) - **Offline delivery**: undeleted notifications are replayed on WebSocket reconnect - **Push delivery**: notifications also fan out to the recipient's registered mobile devices (see Push notifications) ## **5b. Push notifications** Mobile/web push delivery to registered devices (FCM for Android/Web, APNs-direct for iOS): - **Register device tokens** via `POST /me/push_tokens` (`token`, `platform`, optional `provider`/`device_id`); re-registering a `device_id` rotates its token in place - **List/remove own devices** via `GET /me/push_tokens` and `DELETE /me/push_tokens/:id` - **Server-authoritative sending** — no public send endpoint; pushes originate from server hooks (`Gamend.Push.send_to_user/2`) or the admin API - **Per-token routing**: each token's `provider` (\"fcm\" | \"apns\") selects the delivery backend; unconfigured backends log instead of sending (dev-friendly) - **Reliability**: delivery rides the durable job queue with retries; dead tokens reported by the provider are disabled automatically ## **6. Groups** Groups provide persistent community management for players: - **Three group types**: `public` (anyone joins directly), `private` (users request to join, admins approve), `hidden` (invite-only, never listed) - **Membership roles**: `admin` and `member`, with promote/demote capabilities - **Join requests**: for private groups, users submit requests that admins approve or reject - **Invitations**: admins can invite users directly (blocked users are rejected) - **CRUD operations**: create, update, delete groups with metadata support - **Group chat**: integrated via the Chat API with `chat_type: \"group\"` ## **7. Parties** Ephemeral groups of users for short-lived sessions (e.g., matchmaking squads): - **Invite-only joining**: the party leader sends invites by user ID to friends or shared-group members - **Invite flow**: `POST /parties/invite` → recipient accepts via `POST /parties/invite/accept` or declines via `POST /parties/invite/decline`; leader can cancel via `POST /parties/invite/cancel` - **Invite visibility**: leader can list sent invites (`GET /parties/invitations/sent`); recipient can list received invites (`GET /parties/invitations`) - **Connection requirement**: invites can only be sent to users who are friends or share at least one group with the leader - **One party at a time**: a user can only be in one party; accepting an invite while already in a party is rejected - **Leader management**: the creator is the leader; leadership can be transferred - **Lobby integration**: parties can create or join lobbies as a group - **Party chat**: integrated via the Chat API with `chat_type: \"party\"` - **Real-time events** via the party WebSocket channel ## **8. Chat** Real-time messaging across multiple conversation types: - **Chat types**: `lobby` (within a lobby), `group` (within a group), `party` (within a party), `friend` (DMs between friends) - **Send messages** with content, optional metadata, and automatic access validation - **List messages** with pagination (newest first) - **Read tracking**: mark messages as read and get unread counts per conversation - **Real-time delivery** via PubSub and WebSocket channels - **Moderation is built in**: an admin-managed word filter (`block` / `mask` / `flag`, matched on a normalized form so leetspeak and padding do not slip through) and mutes are enforced before a message is stored or broadcast; the `before_chat_message` pipeline hook stays available for rules of your own - **Report a message**: `POST /chat/messages/:id/report` with an optional `reason` — one report per player per message, capped per day; reports the filter files itself have no reporter - **Scoped mutes** mirror kick: `POST /lobbies/mute` + `/lobbies/unmute` (lobby host), `POST /groups/:id/mute` + `/groups/:id/unmute` (group admin), `POST /parties/mute` + `/parties/unmute` (party leader), each with a paginated `.../mutes` listing for the same authority. Body is `{target_user_id, expires_at?, reason?}`; omitting `expires_at` mutes permanently - **Global mutes and the blocklist are server-authoritative** — no public endpoint; a mute is a chat ban on the admin bans API (`/api/v1/admin/bans`, `kind: \"chat\"`), the blocklist is on `/api/v1/admin/chat`, and a plugin calls `Gamend.Chat.mute_user/4` - **Real-time moderation events**: the muted player receives `chat_muted` / `chat_unmuted` on their user channel ## **9. Leaderboards** Server-managed ranked scoreboards: - **Multiple leaderboards**: create named leaderboards with configurable sort order - **Score submission**: submit scores with optional metadata - **Rankings**: retrieve paginated rankings with user details - **Reset support**: leaderboards can be reset periodically ## **10. Key-Value Storage** Per-user persistent key-value storage for game state, preferences, and settings: - **Get/set/delete** key-value pairs scoped to the authenticated user - **List keys** with optional prefix filtering - **Metadata support**: values can include arbitrary JSON metadata ## **11. Quests / Progression** One event-driven progression engine covering achievements, daily/weekly quests, time-boxed event quests, chains, and groups: - **Kinds**: `achievement` (permanent one-shot — the replacement for the old achievements system), `daily`/`weekly` (reset per UTC period), `event` (starts_at/ends_at window), `chain` (requires a prerequisite quest) - **Objectives**: each quest lists objectives `{event, target, params}`; server-side `report_event` advances every matching active quest — there is **no public endpoint to advance progress** (server-authoritative) - **Rewards**: currencies (Economy) and items (Inventory), paid **exactly once** per period via idempotent grants; `auto_claim` quests pay on completion, others via `POST /me/quests/:key/claim` - **My quests**: `GET /me/quests` returns active quests, per-period progress, and a claimable flag; hidden quests appear once completed - **Groups**: quests sharing a `group_key` collapse to one entry carrying `group_size`; `?group=<key>` lists that group's members in full - **Catalog**: `GET /quests` and per-user completions `GET /quests/user/:user_id` (gated by `GAMEND_FEATURES_LIST_QUESTS`) - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests` ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my_match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it - **The result is a push, not a poll**: matched players receive `match_found` (`lobby_id`, `match_params`) on their user channel, and `ticket_queued` / `ticket_cancelled` as their ticket goes in or out of the queue; closing your last socket cancels your tickets - **Inspect**: `GET /matchmaking/tickets/me` for your ticket, `GET /matchmaking/stats` for queue depths - **Admin management** over HTTP: list/filter tickets, force-cancel, and stats under `/api/v1/admin/matchmaking` ## **14. Ready checks** One primitive for \"everyone must answer before this proceeds\", with one client-facing surface: - **A player holds at most one check per lane** — the match lane (lobby ready-up or matchmaking accept) and the party lane (the party's standing board) — so answering needs no id: `GET /me/ready_check` returns `{\"lobby\": …, \"party\": …}` (each null when none) and `POST /me/ready_check` with `{\"ready\": true|false, \"scope\": \"lobby\"|\"party\"}` answers one (scope defaults to `lobby`) - **Two kinds.** `ready` (lobby/party board) is a toggle — a \"no\" just leaves the check open, and it lists every participant. `accept` (match confirmation) is final — one decline fails it for everyone — and returns counts plus your own state, so a pending match does not reveal who you were paired with - **Hosts open one** with `POST /lobbies/ready_check` (host-managed lobbies only; hostless matchmaking lobbies belong to the server), **party leaders** with `POST /parties/ready_check`; either call is a **reset** — it quietly replaces an already-open board with a fresh one over the current members, so the same endpoint serves \"ready check!\", \"force ready\" (with `timeout_ms`) and \"start over\". Call it off with `DELETE /lobbies/ready_check` / `DELETE /parties/ready_check`. The opener is pre-marked ready — clicking the button is their answer - **Failure does nothing on its own**: a declined or timed-out check kicks nobody, starts nothing, and moves no lobby state. It reports who did not answer, and the game (or the host, with the kick they already have) decides - **Live**: `ready_check_started` / `ready_check_updated` / `ready_check_passed` / `ready_check_failed` on the lobby channel, the party channel for a party board, or the user channel for an accept check - **Admin management** over HTTP: list/filter checks, force-cancel, and 24h outcome stats under `/api/v1/admin/ready_checks` ## **15. Real-time: WebSocket Channels** The server provides real-time communication via Phoenix WebSocket channels. Connect to the WebSocket endpoint and join topic-based channels for live updates. ### **15.1 Connection** Connect to `wss://your-server.com/socket` with your JWT token as a parameter: ``` const socket = new Socket(\"wss://your-server.com/socket\", { params: { token: \"<access_token>\" } }) socket.connect() ``` ### **15.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, quest progress/completions/claims, party/group invites, tournament events, chat mutes (`chat_muted` / `chat_unmuted`), account bans (`account_banned` / `account_unbanned`), KV subscriptions - **Lobby channel** (`lobby:<lobby_id>`): lobby member joins/leaves, lobby updates, lobby chat - **Lobbies channel** (`lobbies`): global lobby list changes (created, updated, deleted) - **Group channel** (`group:<group_id>`): group member changes, group updates, group chat - **Groups channel** (`groups`): global group list changes - **Party channel** (`party:<party_id>`): party member changes, party updates, party chat ### **15.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers. Open it from a `GamendSession`, which keeps the player signed in and gives the socket a valid token whenever it reconnects: ```javascript import { GamendSession, AuthenticationApi } from '@ughuuu/gamend' const gamend = new GamendSession('https://your-server.com') await new AuthenticationApi(gamend.client).login({ loginRequest: { email, password } }) const realtime = gamend.realtime() const userChannel = realtime.joinUserChannel(gamend.userId) userChannel.on('notification', payload => console.log(payload)) ``` `phoenix` ships as a dependency of the package, so no extra install is needed. ## **16. Real-time: WebRTC DataChannels** For low-latency game data, the server supports WebRTC DataChannels alongside WebSocket. The server acts as a WebRTC peer (not P2P between clients). ### **16.1 How It Works** 1. Client connects via WebSocket and joins the **User channel** 2. Client sends an SDP offer over the channel (`webrtc:offer` event) 3. Server responds with an SDP answer (`webrtc:answer` event) 4. ICE candidates are exchanged (`webrtc:ice` events) 5. Once connected, named DataChannels carry game data at low latency ### **16.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **16.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameWebRTC } from '@ughuuu/gamend' const realtime = gamend.realtime() // gamend: a signed-in GamendSession const userChannel = realtime.joinUserChannel(gamend.userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
20
+ * API for Gamend. Provides HTTP REST API, real-time WebSocket channels, and WebRTC DataChannels for low-latency game data. Features authentication, users, lobbies, groups, parties, friends, chat, notifications, quests, leaderboards, tournaments, matchmaking, payments, server scripting, and admin portal. ## **1. Authentication** This API uses JWT (JSON Web Tokens) with access and refresh tokens: ### **1.1 Getting Tokens** - **Email/Password**: POST to `/api/v1/login` with email and password - **Device (SDK)**: POST to `/api/v1/login` with a `device_id` string (creates/returns a device user) - **Discord OAuth**: Use `/api/v1/auth/discord` flow - **Google OAuth**: Use `/api/v1/auth/google` flow - **Facebook OAuth**: Use `/api/v1/auth/facebook` flow - **GitHub OAuth**: Use `/api/v1/auth/github` flow - **Apple Sign In**: Use `/auth/apple` browser flow or apple sdk flow - **Steam (OpenID)**: Use `/api/v1/auth/steam` flow Both methods return: - `access_token` - Short-lived (15 min by default), use for API requests; `expires_in` gives its lifetime in seconds - `refresh_token` - Long-lived (30 days by default), use to get new access tokens ### **1.2 Using Tokens** Include the access token in the Authorization header: ``` Authorization: Bearer <access_token> ``` ### **1.3 Refreshing Tokens** When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token. ### **1.4 Banned Accounts** An admin or the game can ban an account for a while or for good. A banned account still signs in, refreshes and signs out, `GET /api/v1/me` answers with its `ban` (`expires_at`, null when permanent, and `reason`), and `DELETE /api/v1/me` deletes it. Every other authenticated call answers 403 `account_banned`. On the socket it joins only its own user channel, where `account_banned` and `account_unbanned` arrive, and a ban placed while it is connected closes the socket. ## **2. Users** Users endpoints cover the user lifecycle and profile features. Key highlights: - **Registration and login** (email/password, device token for SDKs, and OAuth providers) - **Profile metadata** (JSON blob per user) and editable profile fields - **Account lifecycle**: password reset, email confirmation, and account deletion - **Sessions & tokens**: both browser sessions and JWT-based API tokens are supported ## **3. Friends** The Friends domain offers lightweight social features: - **Friend requests** (send / accept / reject / block flows) - **Friend listing & pagination**, with basic privacy controls - **Domain helpers** to manage and query friend relationships from API or UI contexts ## **4. Lobbies** Lobbies provide matchmaking / room management primitives. Highlights: - **Create / list / update / delete** lobbies with rich metadata (mode, region, tags) - **Host-managed or hostless** modes (hostless allowed internally, not creatable via public API) - **Membership management**: join, leave, kick users, and automatic host transfer - **Controls & protection**: max users, hidden/locked states, and optional password protection - **Hidden lobbies** are excluded from public listings; public listing endpoints are paginated ## **5. Notifications** Persistent user-to-user notifications that survive across sessions: - **Send notifications** to accepted friends with a title, optional content, and optional metadata - **List own notifications** with pagination (ordered oldest-first) - **Delete notifications** by ID (single or batch) - **Real-time delivery** via the user WebSocket channel (`\"notification\"` events) - **Offline delivery**: undeleted notifications are replayed on WebSocket reconnect - **Push delivery**: notifications also fan out to the recipient's registered mobile devices (see Push notifications) ## **5b. Push notifications** Mobile/web push delivery to registered devices (FCM for Android/Web, APNs-direct for iOS): - **Register device tokens** via `POST /me/push_tokens` (`token`, `platform`, optional `provider`/`device_id`); re-registering a `device_id` rotates its token in place - **List/remove own devices** via `GET /me/push_tokens` and `DELETE /me/push_tokens/:id` - **Server-authoritative sending** — no public send endpoint; pushes originate from server hooks (`Gamend.Push.send_to_user/2`) or the admin API - **Per-token routing**: each token's `provider` (\"fcm\" | \"apns\") selects the delivery backend; unconfigured backends log instead of sending (dev-friendly) - **Reliability**: delivery rides the durable job queue with retries; dead tokens reported by the provider are disabled automatically ## **6. Groups** Groups provide persistent community management for players: - **Three group types**: `public` (anyone joins directly), `private` (users request to join, admins approve), `hidden` (invite-only, never listed) - **Membership roles**: `admin` and `member`, with promote/demote capabilities - **Join requests**: for private groups, users submit requests that admins approve or reject - **Invitations**: admins can invite users directly (blocked users are rejected) - **CRUD operations**: create, update, delete groups with metadata support - **Group chat**: integrated via the Chat API with `chat_type: \"group\"` ## **7. Parties** Ephemeral groups of users for short-lived sessions (e.g., matchmaking squads): - **Invite-only joining**: the party leader sends invites by user ID to friends or shared-group members - **Invite flow**: `POST /parties/invite` → recipient accepts via `POST /parties/invite/accept` or declines via `POST /parties/invite/decline`; leader can cancel via `POST /parties/invite/cancel` - **Invite visibility**: leader can list sent invites (`GET /parties/invitations/sent`); recipient can list received invites (`GET /parties/invitations`) - **Connection requirement**: invites can only be sent to users who are friends or share at least one group with the leader - **One party at a time**: a user can only be in one party; accepting an invite while already in a party is rejected - **Leader management**: the creator is the leader; leadership can be transferred - **Lobby integration**: parties can create or join lobbies as a group - **Party chat**: integrated via the Chat API with `chat_type: \"party\"` - **Real-time events** via the party WebSocket channel ## **8. Chat** Real-time messaging across multiple conversation types: - **Chat types**: `lobby` (within a lobby), `group` (within a group), `party` (within a party), `friend` (DMs between friends) - **Send messages** with content, optional metadata, and automatic access validation - **List messages** with pagination (newest first) - **Read tracking**: mark messages as read and get unread counts per conversation - **Real-time delivery** via PubSub and WebSocket channels - **Moderation is built in**: an admin-managed word filter (`block` / `mask` / `flag`, matched on a normalized form so leetspeak and padding do not slip through) and mutes are enforced before a message is stored or broadcast; the `before_chat_message` pipeline hook stays available for rules of your own - **Report a message**: `POST /chat/messages/:id/report` with an optional `reason` — one report per player per message, capped per day; reports the filter files itself have no reporter - **Scoped mutes** mirror kick: `POST /lobbies/mute` + `/lobbies/unmute` (lobby host), `POST /groups/:id/mute` + `/groups/:id/unmute` (group admin), `POST /parties/mute` + `/parties/unmute` (party leader), each with a paginated `.../mutes` listing for the same authority. Body is `{target_user_id, expires_at?, reason?}`; omitting `expires_at` mutes permanently - **Global mutes and the blocklist are server-authoritative** — no public endpoint; a mute is a chat ban on the admin bans API (`/api/v1/admin/bans`, `kind: \"chat\"`), the blocklist is on `/api/v1/admin/chat`, and a plugin calls `Gamend.Chat.mute_user/4` - **Real-time moderation events**: the muted player receives `chat_muted` / `chat_unmuted` on their user channel ## **9. Leaderboards** Server-managed ranked scoreboards: - **Multiple leaderboards**: create named leaderboards with configurable sort order - **Score submission**: submit scores with optional metadata - **Rankings**: retrieve paginated rankings with user details - **Reset support**: leaderboards can be reset periodically ## **10. Key-Value Storage** Per-user persistent key-value storage for game state, preferences, and settings: - **Get/set/delete** key-value pairs scoped to the authenticated user - **List keys** with optional prefix filtering - **Metadata support**: values can include arbitrary JSON metadata ## **11. Quests / Progression** One event-driven progression engine covering achievements, daily/weekly quests, time-boxed event quests, chains, and groups: - **Kinds**: `achievement` (permanent one-shot — the replacement for the old achievements system), `daily`/`weekly` (reset per UTC period), `event` (starts_at/ends_at window), `chain` (requires a prerequisite quest) - **Objectives**: each quest lists objectives `{event, target, params}`; server-side `report_event` advances every matching active quest — there is **no public endpoint to advance progress** (server-authoritative) - **Rewards**: currencies (Economy) and items (Inventory), paid **exactly once** per period via idempotent grants; `auto_claim` quests pay on completion, others via `POST /me/quests/:key/claim` - **My quests**: `GET /me/quests` returns active quests, per-period progress, and a claimable flag; hidden quests appear once completed - **Groups**: quests sharing a `group_key` collapse to one entry carrying `group_size`; `?group=<key>` lists that group's members in full - **Catalog**: `GET /quests` and per-user completions `GET /quests/user/:user_id` (gated by `GAMEND_FEATURES_LIST_QUESTS`) - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests` ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my_match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it, unless the game's server hook seats the match elsewhere or asks its players to accept first - **The result is a push, not a poll**: matched players receive `match_found` (`lobby_id`, `match_params`) on their user channel, and `ticket_queued` / `ticket_cancelled` as their ticket goes in or out of the queue; closing your last socket cancels your tickets - **Inspect**: `GET /matchmaking/tickets/me` for your ticket, `GET /matchmaking/stats` for queue depths - **Admin management** over HTTP: list/filter tickets, force-cancel, and stats under `/api/v1/admin/matchmaking` ## **14. Ready checks** One primitive for \"everyone must answer before this proceeds\", with one client-facing surface: - **A player holds at most one check per lane** — the match lane (lobby ready-up or matchmaking accept) and the party lane (the party's standing board) — so answering needs no id: `GET /me/ready_check` returns `{\"lobby\": …, \"party\": …}` (each null when none) and `POST /me/ready_check` with `{\"ready\": true|false, \"scope\": \"lobby\"|\"party\"}` answers one (scope defaults to `lobby`) - **Two kinds.** `ready` (lobby/party board) is a toggle — a \"no\" just leaves the check open, and it lists every participant. `accept` (match confirmation) is final — one decline fails it for everyone — and returns counts plus your own state, so a pending match does not reveal who you were paired with - **Hosts open one** with `POST /lobbies/ready_check` (host-managed lobbies only; hostless matchmaking lobbies belong to the server), **party leaders** with `POST /parties/ready_check`; either call is a **reset** — it quietly replaces an already-open board with a fresh one over the current members, so the same endpoint serves \"ready check!\", \"force ready\" (with `timeout_ms`) and \"start over\". Call it off with `DELETE /lobbies/ready_check` / `DELETE /parties/ready_check`. The opener is pre-marked ready — clicking the button is their answer - **Failure does nothing on its own**: a declined or timed-out check kicks nobody, starts nothing, and moves no lobby state. It reports who did not answer, and the game (or the host, with the kick they already have) decides - **Live**: `ready_check_started` / `ready_check_updated` / `ready_check_passed` / `ready_check_failed` on the lobby channel, the party channel for a party board, or the user channel for an accept check - **Admin management** over HTTP: list/filter checks, force-cancel, and 24h outcome stats under `/api/v1/admin/ready_checks` ## **15. Real-time: WebSocket Channels** The server provides real-time communication via Phoenix WebSocket channels. Connect to the WebSocket endpoint and join topic-based channels for live updates. ### **15.1 Connection** Connect to `wss://your-server.com/socket` with your JWT token as a parameter: ``` const socket = new Socket(\"wss://your-server.com/socket\", { params: { token: \"<access_token>\" } }) socket.connect() ``` ### **15.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, quest progress/completions/claims, party/group invites, tournament events, chat mutes (`chat_muted` / `chat_unmuted`), account bans (`account_banned` / `account_unbanned`), KV subscriptions - **Lobby channel** (`lobby:<lobby_id>`): lobby member joins/leaves, lobby updates, lobby chat - **Lobbies channel** (`lobbies`): global lobby list changes (created, updated, deleted) - **Group channel** (`group:<group_id>`): group member changes, group updates, group chat - **Groups channel** (`groups`): global group list changes - **Party channel** (`party:<party_id>`): party member changes, party updates, party chat ### **15.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers. Open it from a `GamendSession`, which keeps the player signed in and gives the socket a valid token whenever it reconnects: ```javascript import { GamendSession, AuthenticationApi } from '@ughuuu/gamend' const gamend = new GamendSession('https://your-server.com') await new AuthenticationApi(gamend.client).login({ loginRequest: { email, password } }) const realtime = gamend.realtime() const userChannel = realtime.joinUserChannel(gamend.userId) userChannel.on('notification', payload => console.log(payload)) ``` `phoenix` ships as a dependency of the package, so no extra install is needed. ## **16. Real-time: WebRTC DataChannels** For low-latency game data, the server supports WebRTC DataChannels alongside WebSocket. The server acts as a WebRTC peer (not P2P between clients). ### **16.1 How It Works** 1. Client connects via WebSocket and joins the **User channel** 2. Client sends an SDP offer over the channel (`webrtc:offer` event) 3. Server responds with an SDP answer (`webrtc:answer` event) 4. ICE candidates are exchanged (`webrtc:ice` events) 5. Once connected, named DataChannels carry game data at low latency ### **16.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **16.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameWebRTC } from '@ughuuu/gamend' const realtime = gamend.realtime() // gamend: a signed-in GamendSession const userChannel = realtime.joinUserChannel(gamend.userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
21
21
  *
22
- * The version of the OpenAPI document: 1.1.1404
22
+ * The version of the OpenAPI document: 1.1.1406
23
23
  *
24
24
  *
25
25
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -28,28 +28,28 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
28
28
  *
29
29
  */
30
30
  /**
31
- * The Result model module.
32
- * @module model/Result
31
+ * The PlayResult model module.
32
+ * @module model/PlayResult
33
33
  * @version 1.0.0
34
34
  */
35
- var Result = /*#__PURE__*/function () {
35
+ var PlayResult = /*#__PURE__*/function () {
36
36
  /**
37
- * Constructs a new <code>Result</code>.
37
+ * Constructs a new <code>PlayResult</code>.
38
38
  * One play by one player, and its stats by event key
39
- * @alias module:model/Result
39
+ * @alias module:model/PlayResult
40
40
  * @param id {String}
41
41
  * @param kind {String} What was played
42
42
  * @param lobbyId {String} The lobby it ran in; empty when none
43
43
  * @param metadata {Object} What the play was: its settings
44
44
  * @param startedAt {Date}
45
- * @param stats {Object.<String, module:model/ResultStat>} By event key
46
- * @param status {module:model/Result.StatusEnum}
45
+ * @param stats {Object.<String, module:model/PlayResultStat>} By event key
46
+ * @param status {module:model/PlayResult.StatusEnum}
47
47
  * @param userId {String}
48
- * @param visibility {module:model/Result.VisibilityEnum}
48
+ * @param visibility {module:model/PlayResult.VisibilityEnum}
49
49
  */
50
- function Result(id, kind, lobbyId, metadata, startedAt, stats, status, userId, visibility) {
51
- _classCallCheck(this, Result);
52
- Result.initialize(this, id, kind, lobbyId, metadata, startedAt, stats, status, userId, visibility);
50
+ function PlayResult(id, kind, lobbyId, metadata, startedAt, stats, status, userId, visibility) {
51
+ _classCallCheck(this, PlayResult);
52
+ PlayResult.initialize(this, id, kind, lobbyId, metadata, startedAt, stats, status, userId, visibility);
53
53
  }
54
54
 
55
55
  /**
@@ -57,7 +57,7 @@ var Result = /*#__PURE__*/function () {
57
57
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
58
58
  * Only for internal use.
59
59
  */
60
- return _createClass(Result, null, [{
60
+ return _createClass(PlayResult, null, [{
61
61
  key: "initialize",
62
62
  value: function initialize(obj, id, kind, lobbyId, metadata, startedAt, stats, status, userId, visibility) {
63
63
  obj['id'] = id;
@@ -72,17 +72,17 @@ var Result = /*#__PURE__*/function () {
72
72
  }
73
73
 
74
74
  /**
75
- * Constructs a <code>Result</code> from a plain JavaScript object, optionally creating a new instance.
75
+ * Constructs a <code>PlayResult</code> from a plain JavaScript object, optionally creating a new instance.
76
76
  * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
77
77
  * @param {Object} data The plain JavaScript object bearing properties of interest.
78
- * @param {module:model/Result} obj Optional instance to populate.
79
- * @return {module:model/Result} The populated <code>Result</code> instance.
78
+ * @param {module:model/PlayResult} obj Optional instance to populate.
79
+ * @return {module:model/PlayResult} The populated <code>PlayResult</code> instance.
80
80
  */
81
81
  }, {
82
82
  key: "constructFromObject",
83
83
  value: function constructFromObject(data, obj) {
84
84
  if (data) {
85
- obj = obj || new Result();
85
+ obj = obj || new PlayResult();
86
86
  if (data.hasOwnProperty('ended_at')) {
87
87
  obj['ended_at'] = _ApiClient["default"].convertToType(data['ended_at'], 'Date');
88
88
  }
@@ -103,7 +103,7 @@ var Result = /*#__PURE__*/function () {
103
103
  }
104
104
  if (data.hasOwnProperty('stats')) {
105
105
  obj['stats'] = _ApiClient["default"].convertToType(data['stats'], {
106
- 'String': _ResultStat["default"]
106
+ 'String': _PlayResultStat["default"]
107
107
  });
108
108
  }
109
109
  if (data.hasOwnProperty('status')) {
@@ -120,15 +120,15 @@ var Result = /*#__PURE__*/function () {
120
120
  }
121
121
 
122
122
  /**
123
- * Validates the JSON data with respect to <code>Result</code>.
123
+ * Validates the JSON data with respect to <code>PlayResult</code>.
124
124
  * @param {Object} data The plain JavaScript object bearing properties of interest.
125
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>Result</code>.
125
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>PlayResult</code>.
126
126
  */
127
127
  }, {
128
128
  key: "validateJSON",
129
129
  value: function validateJSON(data) {
130
130
  // check to make sure all required properties are present in the JSON string
131
- var _iterator = _createForOfIteratorHelper(Result.RequiredProperties),
131
+ var _iterator = _createForOfIteratorHelper(PlayResult.RequiredProperties),
132
132
  _step;
133
133
  try {
134
134
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -170,68 +170,68 @@ var Result = /*#__PURE__*/function () {
170
170
  }
171
171
  }]);
172
172
  }();
173
- Result.RequiredProperties = ["id", "kind", "lobby_id", "metadata", "started_at", "stats", "status", "user_id", "visibility"];
173
+ PlayResult.RequiredProperties = ["id", "kind", "lobby_id", "metadata", "started_at", "stats", "status", "user_id", "visibility"];
174
174
 
175
175
  /**
176
176
  * @member {Date} ended_at
177
177
  */
178
- Result.prototype['ended_at'] = undefined;
178
+ PlayResult.prototype['ended_at'] = undefined;
179
179
 
180
180
  /**
181
181
  * @member {String} id
182
182
  */
183
- Result.prototype['id'] = undefined;
183
+ PlayResult.prototype['id'] = undefined;
184
184
 
185
185
  /**
186
186
  * What was played
187
187
  * @member {String} kind
188
188
  */
189
- Result.prototype['kind'] = undefined;
189
+ PlayResult.prototype['kind'] = undefined;
190
190
 
191
191
  /**
192
192
  * The lobby it ran in; empty when none
193
193
  * @member {String} lobby_id
194
194
  */
195
- Result.prototype['lobby_id'] = undefined;
195
+ PlayResult.prototype['lobby_id'] = undefined;
196
196
 
197
197
  /**
198
198
  * What the play was: its settings
199
199
  * @member {Object} metadata
200
200
  */
201
- Result.prototype['metadata'] = undefined;
201
+ PlayResult.prototype['metadata'] = undefined;
202
202
 
203
203
  /**
204
204
  * @member {Date} started_at
205
205
  */
206
- Result.prototype['started_at'] = undefined;
206
+ PlayResult.prototype['started_at'] = undefined;
207
207
 
208
208
  /**
209
209
  * By event key
210
- * @member {Object.<String, module:model/ResultStat>} stats
210
+ * @member {Object.<String, module:model/PlayResultStat>} stats
211
211
  */
212
- Result.prototype['stats'] = undefined;
212
+ PlayResult.prototype['stats'] = undefined;
213
213
 
214
214
  /**
215
- * @member {module:model/Result.StatusEnum} status
215
+ * @member {module:model/PlayResult.StatusEnum} status
216
216
  */
217
- Result.prototype['status'] = undefined;
217
+ PlayResult.prototype['status'] = undefined;
218
218
 
219
219
  /**
220
220
  * @member {String} user_id
221
221
  */
222
- Result.prototype['user_id'] = undefined;
222
+ PlayResult.prototype['user_id'] = undefined;
223
223
 
224
224
  /**
225
- * @member {module:model/Result.VisibilityEnum} visibility
225
+ * @member {module:model/PlayResult.VisibilityEnum} visibility
226
226
  */
227
- Result.prototype['visibility'] = undefined;
227
+ PlayResult.prototype['visibility'] = undefined;
228
228
 
229
229
  /**
230
230
  * Allowed values for the <code>status</code> property.
231
231
  * @enum {String}
232
232
  * @readonly
233
233
  */
234
- Result['StatusEnum'] = {
234
+ PlayResult['StatusEnum'] = {
235
235
  /**
236
236
  * value: "open"
237
237
  * @const
@@ -249,7 +249,7 @@ Result['StatusEnum'] = {
249
249
  * @enum {String}
250
250
  * @readonly
251
251
  */
252
- Result['VisibilityEnum'] = {
252
+ PlayResult['VisibilityEnum'] = {
253
253
  /**
254
254
  * value: "public"
255
255
  * @const
@@ -281,4 +281,4 @@ Result['VisibilityEnum'] = {
281
281
  */
282
282
  "server_only": "server_only"
283
283
  };
284
- var _default = exports["default"] = Result;
284
+ var _default = exports["default"] = PlayResult;
@@ -16,9 +16,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
16
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
17
  function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); } /**
18
18
  * Gamend API
19
- * API for Gamend. Provides HTTP REST API, real-time WebSocket channels, and WebRTC DataChannels for low-latency game data. Features authentication, users, lobbies, groups, parties, friends, chat, notifications, quests, leaderboards, tournaments, matchmaking, payments, server scripting, and admin portal. ## **1. Authentication** This API uses JWT (JSON Web Tokens) with access and refresh tokens: ### **1.1 Getting Tokens** - **Email/Password**: POST to `/api/v1/login` with email and password - **Device (SDK)**: POST to `/api/v1/login` with a `device_id` string (creates/returns a device user) - **Discord OAuth**: Use `/api/v1/auth/discord` flow - **Google OAuth**: Use `/api/v1/auth/google` flow - **Facebook OAuth**: Use `/api/v1/auth/facebook` flow - **GitHub OAuth**: Use `/api/v1/auth/github` flow - **Apple Sign In**: Use `/auth/apple` browser flow or apple sdk flow - **Steam (OpenID)**: Use `/api/v1/auth/steam` flow Both methods return: - `access_token` - Short-lived (15 min by default), use for API requests; `expires_in` gives its lifetime in seconds - `refresh_token` - Long-lived (30 days by default), use to get new access tokens ### **1.2 Using Tokens** Include the access token in the Authorization header: ``` Authorization: Bearer <access_token> ``` ### **1.3 Refreshing Tokens** When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token. ### **1.4 Banned Accounts** An admin or the game can ban an account for a while or for good. A banned account still signs in, refreshes and signs out, `GET /api/v1/me` answers with its `ban` (`expires_at`, null when permanent, and `reason`), and `DELETE /api/v1/me` deletes it. Every other authenticated call answers 403 `account_banned`. On the socket it joins only its own user channel, where `account_banned` and `account_unbanned` arrive, and a ban placed while it is connected closes the socket. ## **2. Users** Users endpoints cover the user lifecycle and profile features. Key highlights: - **Registration and login** (email/password, device token for SDKs, and OAuth providers) - **Profile metadata** (JSON blob per user) and editable profile fields - **Account lifecycle**: password reset, email confirmation, and account deletion - **Sessions & tokens**: both browser sessions and JWT-based API tokens are supported ## **3. Friends** The Friends domain offers lightweight social features: - **Friend requests** (send / accept / reject / block flows) - **Friend listing & pagination**, with basic privacy controls - **Domain helpers** to manage and query friend relationships from API or UI contexts ## **4. Lobbies** Lobbies provide matchmaking / room management primitives. Highlights: - **Create / list / update / delete** lobbies with rich metadata (mode, region, tags) - **Host-managed or hostless** modes (hostless allowed internally, not creatable via public API) - **Membership management**: join, leave, kick users, and automatic host transfer - **Controls & protection**: max users, hidden/locked states, and optional password protection - **Hidden lobbies** are excluded from public listings; public listing endpoints are paginated ## **5. Notifications** Persistent user-to-user notifications that survive across sessions: - **Send notifications** to accepted friends with a title, optional content, and optional metadata - **List own notifications** with pagination (ordered oldest-first) - **Delete notifications** by ID (single or batch) - **Real-time delivery** via the user WebSocket channel (`\"notification\"` events) - **Offline delivery**: undeleted notifications are replayed on WebSocket reconnect - **Push delivery**: notifications also fan out to the recipient's registered mobile devices (see Push notifications) ## **5b. Push notifications** Mobile/web push delivery to registered devices (FCM for Android/Web, APNs-direct for iOS): - **Register device tokens** via `POST /me/push_tokens` (`token`, `platform`, optional `provider`/`device_id`); re-registering a `device_id` rotates its token in place - **List/remove own devices** via `GET /me/push_tokens` and `DELETE /me/push_tokens/:id` - **Server-authoritative sending** — no public send endpoint; pushes originate from server hooks (`Gamend.Push.send_to_user/2`) or the admin API - **Per-token routing**: each token's `provider` (\"fcm\" | \"apns\") selects the delivery backend; unconfigured backends log instead of sending (dev-friendly) - **Reliability**: delivery rides the durable job queue with retries; dead tokens reported by the provider are disabled automatically ## **6. Groups** Groups provide persistent community management for players: - **Three group types**: `public` (anyone joins directly), `private` (users request to join, admins approve), `hidden` (invite-only, never listed) - **Membership roles**: `admin` and `member`, with promote/demote capabilities - **Join requests**: for private groups, users submit requests that admins approve or reject - **Invitations**: admins can invite users directly (blocked users are rejected) - **CRUD operations**: create, update, delete groups with metadata support - **Group chat**: integrated via the Chat API with `chat_type: \"group\"` ## **7. Parties** Ephemeral groups of users for short-lived sessions (e.g., matchmaking squads): - **Invite-only joining**: the party leader sends invites by user ID to friends or shared-group members - **Invite flow**: `POST /parties/invite` → recipient accepts via `POST /parties/invite/accept` or declines via `POST /parties/invite/decline`; leader can cancel via `POST /parties/invite/cancel` - **Invite visibility**: leader can list sent invites (`GET /parties/invitations/sent`); recipient can list received invites (`GET /parties/invitations`) - **Connection requirement**: invites can only be sent to users who are friends or share at least one group with the leader - **One party at a time**: a user can only be in one party; accepting an invite while already in a party is rejected - **Leader management**: the creator is the leader; leadership can be transferred - **Lobby integration**: parties can create or join lobbies as a group - **Party chat**: integrated via the Chat API with `chat_type: \"party\"` - **Real-time events** via the party WebSocket channel ## **8. Chat** Real-time messaging across multiple conversation types: - **Chat types**: `lobby` (within a lobby), `group` (within a group), `party` (within a party), `friend` (DMs between friends) - **Send messages** with content, optional metadata, and automatic access validation - **List messages** with pagination (newest first) - **Read tracking**: mark messages as read and get unread counts per conversation - **Real-time delivery** via PubSub and WebSocket channels - **Moderation is built in**: an admin-managed word filter (`block` / `mask` / `flag`, matched on a normalized form so leetspeak and padding do not slip through) and mutes are enforced before a message is stored or broadcast; the `before_chat_message` pipeline hook stays available for rules of your own - **Report a message**: `POST /chat/messages/:id/report` with an optional `reason` — one report per player per message, capped per day; reports the filter files itself have no reporter - **Scoped mutes** mirror kick: `POST /lobbies/mute` + `/lobbies/unmute` (lobby host), `POST /groups/:id/mute` + `/groups/:id/unmute` (group admin), `POST /parties/mute` + `/parties/unmute` (party leader), each with a paginated `.../mutes` listing for the same authority. Body is `{target_user_id, expires_at?, reason?}`; omitting `expires_at` mutes permanently - **Global mutes and the blocklist are server-authoritative** — no public endpoint; a mute is a chat ban on the admin bans API (`/api/v1/admin/bans`, `kind: \"chat\"`), the blocklist is on `/api/v1/admin/chat`, and a plugin calls `Gamend.Chat.mute_user/4` - **Real-time moderation events**: the muted player receives `chat_muted` / `chat_unmuted` on their user channel ## **9. Leaderboards** Server-managed ranked scoreboards: - **Multiple leaderboards**: create named leaderboards with configurable sort order - **Score submission**: submit scores with optional metadata - **Rankings**: retrieve paginated rankings with user details - **Reset support**: leaderboards can be reset periodically ## **10. Key-Value Storage** Per-user persistent key-value storage for game state, preferences, and settings: - **Get/set/delete** key-value pairs scoped to the authenticated user - **List keys** with optional prefix filtering - **Metadata support**: values can include arbitrary JSON metadata ## **11. Quests / Progression** One event-driven progression engine covering achievements, daily/weekly quests, time-boxed event quests, chains, and groups: - **Kinds**: `achievement` (permanent one-shot — the replacement for the old achievements system), `daily`/`weekly` (reset per UTC period), `event` (starts_at/ends_at window), `chain` (requires a prerequisite quest) - **Objectives**: each quest lists objectives `{event, target, params}`; server-side `report_event` advances every matching active quest — there is **no public endpoint to advance progress** (server-authoritative) - **Rewards**: currencies (Economy) and items (Inventory), paid **exactly once** per period via idempotent grants; `auto_claim` quests pay on completion, others via `POST /me/quests/:key/claim` - **My quests**: `GET /me/quests` returns active quests, per-period progress, and a claimable flag; hidden quests appear once completed - **Groups**: quests sharing a `group_key` collapse to one entry carrying `group_size`; `?group=<key>` lists that group's members in full - **Catalog**: `GET /quests` and per-user completions `GET /quests/user/:user_id` (gated by `GAMEND_FEATURES_LIST_QUESTS`) - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests` ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my_match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it - **The result is a push, not a poll**: matched players receive `match_found` (`lobby_id`, `match_params`) on their user channel, and `ticket_queued` / `ticket_cancelled` as their ticket goes in or out of the queue; closing your last socket cancels your tickets - **Inspect**: `GET /matchmaking/tickets/me` for your ticket, `GET /matchmaking/stats` for queue depths - **Admin management** over HTTP: list/filter tickets, force-cancel, and stats under `/api/v1/admin/matchmaking` ## **14. Ready checks** One primitive for \"everyone must answer before this proceeds\", with one client-facing surface: - **A player holds at most one check per lane** — the match lane (lobby ready-up or matchmaking accept) and the party lane (the party's standing board) — so answering needs no id: `GET /me/ready_check` returns `{\"lobby\": …, \"party\": …}` (each null when none) and `POST /me/ready_check` with `{\"ready\": true|false, \"scope\": \"lobby\"|\"party\"}` answers one (scope defaults to `lobby`) - **Two kinds.** `ready` (lobby/party board) is a toggle — a \"no\" just leaves the check open, and it lists every participant. `accept` (match confirmation) is final — one decline fails it for everyone — and returns counts plus your own state, so a pending match does not reveal who you were paired with - **Hosts open one** with `POST /lobbies/ready_check` (host-managed lobbies only; hostless matchmaking lobbies belong to the server), **party leaders** with `POST /parties/ready_check`; either call is a **reset** — it quietly replaces an already-open board with a fresh one over the current members, so the same endpoint serves \"ready check!\", \"force ready\" (with `timeout_ms`) and \"start over\". Call it off with `DELETE /lobbies/ready_check` / `DELETE /parties/ready_check`. The opener is pre-marked ready — clicking the button is their answer - **Failure does nothing on its own**: a declined or timed-out check kicks nobody, starts nothing, and moves no lobby state. It reports who did not answer, and the game (or the host, with the kick they already have) decides - **Live**: `ready_check_started` / `ready_check_updated` / `ready_check_passed` / `ready_check_failed` on the lobby channel, the party channel for a party board, or the user channel for an accept check - **Admin management** over HTTP: list/filter checks, force-cancel, and 24h outcome stats under `/api/v1/admin/ready_checks` ## **15. Real-time: WebSocket Channels** The server provides real-time communication via Phoenix WebSocket channels. Connect to the WebSocket endpoint and join topic-based channels for live updates. ### **15.1 Connection** Connect to `wss://your-server.com/socket` with your JWT token as a parameter: ``` const socket = new Socket(\"wss://your-server.com/socket\", { params: { token: \"<access_token>\" } }) socket.connect() ``` ### **15.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, quest progress/completions/claims, party/group invites, tournament events, chat mutes (`chat_muted` / `chat_unmuted`), account bans (`account_banned` / `account_unbanned`), KV subscriptions - **Lobby channel** (`lobby:<lobby_id>`): lobby member joins/leaves, lobby updates, lobby chat - **Lobbies channel** (`lobbies`): global lobby list changes (created, updated, deleted) - **Group channel** (`group:<group_id>`): group member changes, group updates, group chat - **Groups channel** (`groups`): global group list changes - **Party channel** (`party:<party_id>`): party member changes, party updates, party chat ### **15.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers. Open it from a `GamendSession`, which keeps the player signed in and gives the socket a valid token whenever it reconnects: ```javascript import { GamendSession, AuthenticationApi } from '@ughuuu/gamend' const gamend = new GamendSession('https://your-server.com') await new AuthenticationApi(gamend.client).login({ loginRequest: { email, password } }) const realtime = gamend.realtime() const userChannel = realtime.joinUserChannel(gamend.userId) userChannel.on('notification', payload => console.log(payload)) ``` `phoenix` ships as a dependency of the package, so no extra install is needed. ## **16. Real-time: WebRTC DataChannels** For low-latency game data, the server supports WebRTC DataChannels alongside WebSocket. The server acts as a WebRTC peer (not P2P between clients). ### **16.1 How It Works** 1. Client connects via WebSocket and joins the **User channel** 2. Client sends an SDP offer over the channel (`webrtc:offer` event) 3. Server responds with an SDP answer (`webrtc:answer` event) 4. ICE candidates are exchanged (`webrtc:ice` events) 5. Once connected, named DataChannels carry game data at low latency ### **16.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **16.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameWebRTC } from '@ughuuu/gamend' const realtime = gamend.realtime() // gamend: a signed-in GamendSession const userChannel = realtime.joinUserChannel(gamend.userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
19
+ * API for Gamend. Provides HTTP REST API, real-time WebSocket channels, and WebRTC DataChannels for low-latency game data. Features authentication, users, lobbies, groups, parties, friends, chat, notifications, quests, leaderboards, tournaments, matchmaking, payments, server scripting, and admin portal. ## **1. Authentication** This API uses JWT (JSON Web Tokens) with access and refresh tokens: ### **1.1 Getting Tokens** - **Email/Password**: POST to `/api/v1/login` with email and password - **Device (SDK)**: POST to `/api/v1/login` with a `device_id` string (creates/returns a device user) - **Discord OAuth**: Use `/api/v1/auth/discord` flow - **Google OAuth**: Use `/api/v1/auth/google` flow - **Facebook OAuth**: Use `/api/v1/auth/facebook` flow - **GitHub OAuth**: Use `/api/v1/auth/github` flow - **Apple Sign In**: Use `/auth/apple` browser flow or apple sdk flow - **Steam (OpenID)**: Use `/api/v1/auth/steam` flow Both methods return: - `access_token` - Short-lived (15 min by default), use for API requests; `expires_in` gives its lifetime in seconds - `refresh_token` - Long-lived (30 days by default), use to get new access tokens ### **1.2 Using Tokens** Include the access token in the Authorization header: ``` Authorization: Bearer <access_token> ``` ### **1.3 Refreshing Tokens** When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token. ### **1.4 Banned Accounts** An admin or the game can ban an account for a while or for good. A banned account still signs in, refreshes and signs out, `GET /api/v1/me` answers with its `ban` (`expires_at`, null when permanent, and `reason`), and `DELETE /api/v1/me` deletes it. Every other authenticated call answers 403 `account_banned`. On the socket it joins only its own user channel, where `account_banned` and `account_unbanned` arrive, and a ban placed while it is connected closes the socket. ## **2. Users** Users endpoints cover the user lifecycle and profile features. Key highlights: - **Registration and login** (email/password, device token for SDKs, and OAuth providers) - **Profile metadata** (JSON blob per user) and editable profile fields - **Account lifecycle**: password reset, email confirmation, and account deletion - **Sessions & tokens**: both browser sessions and JWT-based API tokens are supported ## **3. Friends** The Friends domain offers lightweight social features: - **Friend requests** (send / accept / reject / block flows) - **Friend listing & pagination**, with basic privacy controls - **Domain helpers** to manage and query friend relationships from API or UI contexts ## **4. Lobbies** Lobbies provide matchmaking / room management primitives. Highlights: - **Create / list / update / delete** lobbies with rich metadata (mode, region, tags) - **Host-managed or hostless** modes (hostless allowed internally, not creatable via public API) - **Membership management**: join, leave, kick users, and automatic host transfer - **Controls & protection**: max users, hidden/locked states, and optional password protection - **Hidden lobbies** are excluded from public listings; public listing endpoints are paginated ## **5. Notifications** Persistent user-to-user notifications that survive across sessions: - **Send notifications** to accepted friends with a title, optional content, and optional metadata - **List own notifications** with pagination (ordered oldest-first) - **Delete notifications** by ID (single or batch) - **Real-time delivery** via the user WebSocket channel (`\"notification\"` events) - **Offline delivery**: undeleted notifications are replayed on WebSocket reconnect - **Push delivery**: notifications also fan out to the recipient's registered mobile devices (see Push notifications) ## **5b. Push notifications** Mobile/web push delivery to registered devices (FCM for Android/Web, APNs-direct for iOS): - **Register device tokens** via `POST /me/push_tokens` (`token`, `platform`, optional `provider`/`device_id`); re-registering a `device_id` rotates its token in place - **List/remove own devices** via `GET /me/push_tokens` and `DELETE /me/push_tokens/:id` - **Server-authoritative sending** — no public send endpoint; pushes originate from server hooks (`Gamend.Push.send_to_user/2`) or the admin API - **Per-token routing**: each token's `provider` (\"fcm\" | \"apns\") selects the delivery backend; unconfigured backends log instead of sending (dev-friendly) - **Reliability**: delivery rides the durable job queue with retries; dead tokens reported by the provider are disabled automatically ## **6. Groups** Groups provide persistent community management for players: - **Three group types**: `public` (anyone joins directly), `private` (users request to join, admins approve), `hidden` (invite-only, never listed) - **Membership roles**: `admin` and `member`, with promote/demote capabilities - **Join requests**: for private groups, users submit requests that admins approve or reject - **Invitations**: admins can invite users directly (blocked users are rejected) - **CRUD operations**: create, update, delete groups with metadata support - **Group chat**: integrated via the Chat API with `chat_type: \"group\"` ## **7. Parties** Ephemeral groups of users for short-lived sessions (e.g., matchmaking squads): - **Invite-only joining**: the party leader sends invites by user ID to friends or shared-group members - **Invite flow**: `POST /parties/invite` → recipient accepts via `POST /parties/invite/accept` or declines via `POST /parties/invite/decline`; leader can cancel via `POST /parties/invite/cancel` - **Invite visibility**: leader can list sent invites (`GET /parties/invitations/sent`); recipient can list received invites (`GET /parties/invitations`) - **Connection requirement**: invites can only be sent to users who are friends or share at least one group with the leader - **One party at a time**: a user can only be in one party; accepting an invite while already in a party is rejected - **Leader management**: the creator is the leader; leadership can be transferred - **Lobby integration**: parties can create or join lobbies as a group - **Party chat**: integrated via the Chat API with `chat_type: \"party\"` - **Real-time events** via the party WebSocket channel ## **8. Chat** Real-time messaging across multiple conversation types: - **Chat types**: `lobby` (within a lobby), `group` (within a group), `party` (within a party), `friend` (DMs between friends) - **Send messages** with content, optional metadata, and automatic access validation - **List messages** with pagination (newest first) - **Read tracking**: mark messages as read and get unread counts per conversation - **Real-time delivery** via PubSub and WebSocket channels - **Moderation is built in**: an admin-managed word filter (`block` / `mask` / `flag`, matched on a normalized form so leetspeak and padding do not slip through) and mutes are enforced before a message is stored or broadcast; the `before_chat_message` pipeline hook stays available for rules of your own - **Report a message**: `POST /chat/messages/:id/report` with an optional `reason` — one report per player per message, capped per day; reports the filter files itself have no reporter - **Scoped mutes** mirror kick: `POST /lobbies/mute` + `/lobbies/unmute` (lobby host), `POST /groups/:id/mute` + `/groups/:id/unmute` (group admin), `POST /parties/mute` + `/parties/unmute` (party leader), each with a paginated `.../mutes` listing for the same authority. Body is `{target_user_id, expires_at?, reason?}`; omitting `expires_at` mutes permanently - **Global mutes and the blocklist are server-authoritative** — no public endpoint; a mute is a chat ban on the admin bans API (`/api/v1/admin/bans`, `kind: \"chat\"`), the blocklist is on `/api/v1/admin/chat`, and a plugin calls `Gamend.Chat.mute_user/4` - **Real-time moderation events**: the muted player receives `chat_muted` / `chat_unmuted` on their user channel ## **9. Leaderboards** Server-managed ranked scoreboards: - **Multiple leaderboards**: create named leaderboards with configurable sort order - **Score submission**: submit scores with optional metadata - **Rankings**: retrieve paginated rankings with user details - **Reset support**: leaderboards can be reset periodically ## **10. Key-Value Storage** Per-user persistent key-value storage for game state, preferences, and settings: - **Get/set/delete** key-value pairs scoped to the authenticated user - **List keys** with optional prefix filtering - **Metadata support**: values can include arbitrary JSON metadata ## **11. Quests / Progression** One event-driven progression engine covering achievements, daily/weekly quests, time-boxed event quests, chains, and groups: - **Kinds**: `achievement` (permanent one-shot — the replacement for the old achievements system), `daily`/`weekly` (reset per UTC period), `event` (starts_at/ends_at window), `chain` (requires a prerequisite quest) - **Objectives**: each quest lists objectives `{event, target, params}`; server-side `report_event` advances every matching active quest — there is **no public endpoint to advance progress** (server-authoritative) - **Rewards**: currencies (Economy) and items (Inventory), paid **exactly once** per period via idempotent grants; `auto_claim` quests pay on completion, others via `POST /me/quests/:key/claim` - **My quests**: `GET /me/quests` returns active quests, per-period progress, and a claimable flag; hidden quests appear once completed - **Groups**: quests sharing a `group_key` collapse to one entry carrying `group_size`; `?group=<key>` lists that group's members in full - **Catalog**: `GET /quests` and per-user completions `GET /quests/user/:user_id` (gated by `GAMEND_FEATURES_LIST_QUESTS`) - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests` ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my_match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it, unless the game's server hook seats the match elsewhere or asks its players to accept first - **The result is a push, not a poll**: matched players receive `match_found` (`lobby_id`, `match_params`) on their user channel, and `ticket_queued` / `ticket_cancelled` as their ticket goes in or out of the queue; closing your last socket cancels your tickets - **Inspect**: `GET /matchmaking/tickets/me` for your ticket, `GET /matchmaking/stats` for queue depths - **Admin management** over HTTP: list/filter tickets, force-cancel, and stats under `/api/v1/admin/matchmaking` ## **14. Ready checks** One primitive for \"everyone must answer before this proceeds\", with one client-facing surface: - **A player holds at most one check per lane** — the match lane (lobby ready-up or matchmaking accept) and the party lane (the party's standing board) — so answering needs no id: `GET /me/ready_check` returns `{\"lobby\": …, \"party\": …}` (each null when none) and `POST /me/ready_check` with `{\"ready\": true|false, \"scope\": \"lobby\"|\"party\"}` answers one (scope defaults to `lobby`) - **Two kinds.** `ready` (lobby/party board) is a toggle — a \"no\" just leaves the check open, and it lists every participant. `accept` (match confirmation) is final — one decline fails it for everyone — and returns counts plus your own state, so a pending match does not reveal who you were paired with - **Hosts open one** with `POST /lobbies/ready_check` (host-managed lobbies only; hostless matchmaking lobbies belong to the server), **party leaders** with `POST /parties/ready_check`; either call is a **reset** — it quietly replaces an already-open board with a fresh one over the current members, so the same endpoint serves \"ready check!\", \"force ready\" (with `timeout_ms`) and \"start over\". Call it off with `DELETE /lobbies/ready_check` / `DELETE /parties/ready_check`. The opener is pre-marked ready — clicking the button is their answer - **Failure does nothing on its own**: a declined or timed-out check kicks nobody, starts nothing, and moves no lobby state. It reports who did not answer, and the game (or the host, with the kick they already have) decides - **Live**: `ready_check_started` / `ready_check_updated` / `ready_check_passed` / `ready_check_failed` on the lobby channel, the party channel for a party board, or the user channel for an accept check - **Admin management** over HTTP: list/filter checks, force-cancel, and 24h outcome stats under `/api/v1/admin/ready_checks` ## **15. Real-time: WebSocket Channels** The server provides real-time communication via Phoenix WebSocket channels. Connect to the WebSocket endpoint and join topic-based channels for live updates. ### **15.1 Connection** Connect to `wss://your-server.com/socket` with your JWT token as a parameter: ``` const socket = new Socket(\"wss://your-server.com/socket\", { params: { token: \"<access_token>\" } }) socket.connect() ``` ### **15.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, quest progress/completions/claims, party/group invites, tournament events, chat mutes (`chat_muted` / `chat_unmuted`), account bans (`account_banned` / `account_unbanned`), KV subscriptions - **Lobby channel** (`lobby:<lobby_id>`): lobby member joins/leaves, lobby updates, lobby chat - **Lobbies channel** (`lobbies`): global lobby list changes (created, updated, deleted) - **Group channel** (`group:<group_id>`): group member changes, group updates, group chat - **Groups channel** (`groups`): global group list changes - **Party channel** (`party:<party_id>`): party member changes, party updates, party chat ### **15.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers. Open it from a `GamendSession`, which keeps the player signed in and gives the socket a valid token whenever it reconnects: ```javascript import { GamendSession, AuthenticationApi } from '@ughuuu/gamend' const gamend = new GamendSession('https://your-server.com') await new AuthenticationApi(gamend.client).login({ loginRequest: { email, password } }) const realtime = gamend.realtime() const userChannel = realtime.joinUserChannel(gamend.userId) userChannel.on('notification', payload => console.log(payload)) ``` `phoenix` ships as a dependency of the package, so no extra install is needed. ## **16. Real-time: WebRTC DataChannels** For low-latency game data, the server supports WebRTC DataChannels alongside WebSocket. The server acts as a WebRTC peer (not P2P between clients). ### **16.1 How It Works** 1. Client connects via WebSocket and joins the **User channel** 2. Client sends an SDP offer over the channel (`webrtc:offer` event) 3. Server responds with an SDP answer (`webrtc:answer` event) 4. ICE candidates are exchanged (`webrtc:ice` events) 5. Once connected, named DataChannels carry game data at low latency ### **16.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **16.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameWebRTC } from '@ughuuu/gamend' const realtime = gamend.realtime() // gamend: a signed-in GamendSession const userChannel = realtime.joinUserChannel(gamend.userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
20
20
  *
21
- * The version of the OpenAPI document: 1.1.1404
21
+ * The version of the OpenAPI document: 1.1.1406
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -27,24 +27,24 @@ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r;
27
27
  *
28
28
  */
29
29
  /**
30
- * The ResultEvent model module.
31
- * @module model/ResultEvent
30
+ * The PlayResultEvent model module.
31
+ * @module model/PlayResultEvent
32
32
  * @version 1.0.0
33
33
  */
34
- var ResultEvent = /*#__PURE__*/function () {
34
+ var PlayResultEvent = /*#__PURE__*/function () {
35
35
  /**
36
- * Constructs a new <code>ResultEvent</code>.
36
+ * Constructs a new <code>PlayResultEvent</code>.
37
37
  * One thing that happened in a play; ids are time-ordered
38
- * @alias module:model/ResultEvent
38
+ * @alias module:model/PlayResultEvent
39
39
  * @param elapsedMs {Number} Milliseconds since the play began
40
40
  * @param id {String}
41
41
  * @param key {String} What happened
42
42
  * @param metadata {Object}
43
43
  * @param resultId {String}
44
44
  */
45
- function ResultEvent(elapsedMs, id, key, metadata, resultId) {
46
- _classCallCheck(this, ResultEvent);
47
- ResultEvent.initialize(this, elapsedMs, id, key, metadata, resultId);
45
+ function PlayResultEvent(elapsedMs, id, key, metadata, resultId) {
46
+ _classCallCheck(this, PlayResultEvent);
47
+ PlayResultEvent.initialize(this, elapsedMs, id, key, metadata, resultId);
48
48
  }
49
49
 
50
50
  /**
@@ -52,7 +52,7 @@ var ResultEvent = /*#__PURE__*/function () {
52
52
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
53
53
  * Only for internal use.
54
54
  */
55
- return _createClass(ResultEvent, null, [{
55
+ return _createClass(PlayResultEvent, null, [{
56
56
  key: "initialize",
57
57
  value: function initialize(obj, elapsedMs, id, key, metadata, resultId) {
58
58
  obj['elapsed_ms'] = elapsedMs;
@@ -63,17 +63,17 @@ var ResultEvent = /*#__PURE__*/function () {
63
63
  }
64
64
 
65
65
  /**
66
- * Constructs a <code>ResultEvent</code> from a plain JavaScript object, optionally creating a new instance.
66
+ * Constructs a <code>PlayResultEvent</code> from a plain JavaScript object, optionally creating a new instance.
67
67
  * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
68
68
  * @param {Object} data The plain JavaScript object bearing properties of interest.
69
- * @param {module:model/ResultEvent} obj Optional instance to populate.
70
- * @return {module:model/ResultEvent} The populated <code>ResultEvent</code> instance.
69
+ * @param {module:model/PlayResultEvent} obj Optional instance to populate.
70
+ * @return {module:model/PlayResultEvent} The populated <code>PlayResultEvent</code> instance.
71
71
  */
72
72
  }, {
73
73
  key: "constructFromObject",
74
74
  value: function constructFromObject(data, obj) {
75
75
  if (data) {
76
- obj = obj || new ResultEvent();
76
+ obj = obj || new PlayResultEvent();
77
77
  if (data.hasOwnProperty('elapsed_ms')) {
78
78
  obj['elapsed_ms'] = _ApiClient["default"].convertToType(data['elapsed_ms'], 'Number');
79
79
  }
@@ -97,15 +97,15 @@ var ResultEvent = /*#__PURE__*/function () {
97
97
  }
98
98
 
99
99
  /**
100
- * Validates the JSON data with respect to <code>ResultEvent</code>.
100
+ * Validates the JSON data with respect to <code>PlayResultEvent</code>.
101
101
  * @param {Object} data The plain JavaScript object bearing properties of interest.
102
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>ResultEvent</code>.
102
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>PlayResultEvent</code>.
103
103
  */
104
104
  }, {
105
105
  key: "validateJSON",
106
106
  value: function validateJSON(data) {
107
107
  // check to make sure all required properties are present in the JSON string
108
- var _iterator = _createForOfIteratorHelper(ResultEvent.RequiredProperties),
108
+ var _iterator = _createForOfIteratorHelper(PlayResultEvent.RequiredProperties),
109
109
  _step;
110
110
  try {
111
111
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -135,37 +135,37 @@ var ResultEvent = /*#__PURE__*/function () {
135
135
  }
136
136
  }]);
137
137
  }();
138
- ResultEvent.RequiredProperties = ["elapsed_ms", "id", "key", "metadata", "result_id"];
138
+ PlayResultEvent.RequiredProperties = ["elapsed_ms", "id", "key", "metadata", "result_id"];
139
139
 
140
140
  /**
141
141
  * Milliseconds since the play began
142
142
  * @member {Number} elapsed_ms
143
143
  */
144
- ResultEvent.prototype['elapsed_ms'] = undefined;
144
+ PlayResultEvent.prototype['elapsed_ms'] = undefined;
145
145
 
146
146
  /**
147
147
  * @member {String} id
148
148
  */
149
- ResultEvent.prototype['id'] = undefined;
149
+ PlayResultEvent.prototype['id'] = undefined;
150
150
 
151
151
  /**
152
152
  * What happened
153
153
  * @member {String} key
154
154
  */
155
- ResultEvent.prototype['key'] = undefined;
155
+ PlayResultEvent.prototype['key'] = undefined;
156
156
 
157
157
  /**
158
158
  * @member {Object} metadata
159
159
  */
160
- ResultEvent.prototype['metadata'] = undefined;
160
+ PlayResultEvent.prototype['metadata'] = undefined;
161
161
 
162
162
  /**
163
163
  * @member {String} result_id
164
164
  */
165
- ResultEvent.prototype['result_id'] = undefined;
165
+ PlayResultEvent.prototype['result_id'] = undefined;
166
166
 
167
167
  /**
168
168
  * @member {Number} value
169
169
  */
170
- ResultEvent.prototype['value'] = undefined;
171
- var _default = exports["default"] = ResultEvent;
170
+ PlayResultEvent.prototype['value'] = undefined;
171
+ var _default = exports["default"] = PlayResultEvent;