@ughuuu/gamend 1.1.1530 → 1.1.1531

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 (447) hide show
  1. package/README.md +18 -2
  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 +2 -2
  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 +2 -2
  34. package/dist/api/NotificationsApi.js +187 -7
  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 +2 -2
  42. package/dist/api/SignalingApi.js +2 -2
  43. package/dist/api/StatsApi.js +2 -2
  44. package/dist/api/StorageApi.js +2 -2
  45. package/dist/api/TimeApi.js +2 -2
  46. package/dist/api/TournamentsApi.js +2 -2
  47. package/dist/api/UsersApi.js +4 -4
  48. package/dist/gamend_proto.js +6 -0
  49. package/dist/gamend_realtime.pb.js +105 -21
  50. package/dist/index.d.ts +96 -0
  51. package/dist/index.js +63 -0
  52. package/dist/model/AcceptPartyInviteRequest.js +2 -2
  53. package/dist/model/AccountBan.js +2 -2
  54. package/dist/model/ActivityStats.js +2 -2
  55. package/dist/model/AdminAnnounceNotificationRequest.js +2 -2
  56. package/dist/model/AdminBan.js +2 -2
  57. package/dist/model/AdminBanPage.js +2 -2
  58. package/dist/model/AdminBanResponse.js +2 -2
  59. package/dist/model/AdminClaimQuestRequest.js +2 -2
  60. package/dist/model/AdminCreateBanRequest.js +2 -2
  61. package/dist/model/AdminCreateChatFilterWordRequest.js +2 -2
  62. package/dist/model/AdminCreateKvEntryRequest.js +2 -2
  63. package/dist/model/AdminCreateLeaderboardRequest.js +2 -2
  64. package/dist/model/AdminCreateNotificationRequest.js +2 -2
  65. package/dist/model/AdminCreateQuestCodeRequest.js +2 -2
  66. package/dist/model/AdminCreateQuestRequest.js +2 -2
  67. package/dist/model/AdminCreateQuestRequestObjectivesInner.js +2 -2
  68. package/dist/model/AdminCreateQuestRequestRewardsInner.js +2 -2
  69. package/dist/model/AdminCreateTournamentRequest.js +2 -2
  70. package/dist/model/AdminGenerateQuestCodesRequest.js +2 -2
  71. package/dist/model/AdminGrantCurrencyRequest.js +2 -2
  72. package/dist/model/AdminGrantItemRequest.js +2 -2
  73. package/dist/model/AdminGrantQuestRequest.js +2 -2
  74. package/dist/model/AdminImportChatFilterWordsRequest.js +2 -2
  75. package/dist/model/AdminInventoryItem.js +2 -2
  76. package/dist/model/AdminInventoryItemPage.js +2 -2
  77. package/dist/model/AdminKvEntry.js +2 -2
  78. package/dist/model/AdminKvEntryPage.js +2 -2
  79. package/dist/model/AdminKvEntryResponse.js +2 -2
  80. package/dist/model/AdminLeaderboardIconUploadUrlRequest.js +2 -2
  81. package/dist/model/AdminLeaderboardRecord.js +2 -2
  82. package/dist/model/AdminLeaderboardRecordResponse.js +2 -2
  83. package/dist/model/AdminLedgerEntry.js +2 -2
  84. package/dist/model/AdminLedgerEntryPage.js +2 -2
  85. package/dist/model/AdminMatchmakingStats.js +2 -2
  86. package/dist/model/AdminMatchmakingStatsResponse.js +2 -2
  87. package/dist/model/AdminMatchmakingTicket.js +2 -2
  88. package/dist/model/AdminMatchmakingTicketPage.js +2 -2
  89. package/dist/model/AdminMatchmakingTicketResponse.js +2 -2
  90. package/dist/model/AdminPushToken.js +2 -2
  91. package/dist/model/AdminPushTokenPage.js +2 -2
  92. package/dist/model/AdminQuest.js +2 -2
  93. package/dist/model/AdminQuestClaim.js +2 -2
  94. package/dist/model/AdminQuestClaimResponse.js +2 -2
  95. package/dist/model/AdminQuestCode.js +2 -2
  96. package/dist/model/AdminQuestCodeBatch.js +2 -2
  97. package/dist/model/AdminQuestCodeBatchResponse.js +2 -2
  98. package/dist/model/AdminQuestCodePage.js +2 -2
  99. package/dist/model/AdminQuestCodeResponse.js +2 -2
  100. package/dist/model/AdminQuestIconUploadUrlRequest.js +2 -2
  101. package/dist/model/AdminQuestPage.js +2 -2
  102. package/dist/model/AdminQuestProgress.js +2 -2
  103. package/dist/model/AdminQuestProgressPage.js +2 -2
  104. package/dist/model/AdminQuestProgressResponse.js +2 -2
  105. package/dist/model/AdminQuestResponse.js +2 -2
  106. package/dist/model/AdminReadyCheck.js +2 -2
  107. package/dist/model/AdminReadyCheckPage.js +2 -2
  108. package/dist/model/AdminReadyCheckResponse.js +2 -2
  109. package/dist/model/AdminResetQuestRequest.js +2 -2
  110. package/dist/model/AdminResolveChatReportRequest.js +2 -2
  111. package/dist/model/AdminResolveTournamentMatchRequest.js +2 -2
  112. package/dist/model/AdminSendPushRequest.js +2 -2
  113. package/dist/model/AdminSession.js +2 -2
  114. package/dist/model/AdminSessionPage.js +2 -2
  115. package/dist/model/AdminSetLeaderboardIconRequest.js +2 -2
  116. package/dist/model/AdminSetQuestIconRequest.js +2 -2
  117. package/dist/model/AdminSetTournamentIconRequest.js +2 -2
  118. package/dist/model/AdminSpendCurrencyRequest.js +2 -2
  119. package/dist/model/AdminSubmitLeaderboardScoreRequest.js +2 -2
  120. package/dist/model/AdminTestChatPhraseRequest.js +2 -2
  121. package/dist/model/AdminTournament.js +2 -2
  122. package/dist/model/AdminTournamentIconUploadUrlRequest.js +2 -2
  123. package/dist/model/AdminTournamentResponse.js +2 -2
  124. package/dist/model/AdminUpdateChatFilterWordRequest.js +2 -2
  125. package/dist/model/AdminUpdateGroupRequest.js +2 -2
  126. package/dist/model/AdminUpdateKvEntryRequest.js +2 -2
  127. package/dist/model/AdminUpdateLeaderboardRecordRequest.js +2 -2
  128. package/dist/model/AdminUpdateLeaderboardRequest.js +2 -2
  129. package/dist/model/AdminUpdateLobbyRequest.js +2 -2
  130. package/dist/model/AdminUpdateQuestCodeRequest.js +2 -2
  131. package/dist/model/AdminUpdateQuestRequest.js +2 -2
  132. package/dist/model/AdminUpdateTournamentRequest.js +2 -2
  133. package/dist/model/AdminUpdateUserRequest.js +2 -2
  134. package/dist/model/AdminUpsertKvRequest.js +2 -2
  135. package/dist/model/AdminUser.js +2 -2
  136. package/dist/model/AdminUserResponse.js +2 -2
  137. package/dist/model/AdminWallet.js +2 -2
  138. package/dist/model/AdminWalletPage.js +2 -2
  139. package/dist/model/AnalyticsCounts.js +2 -2
  140. package/dist/model/AnalyticsCountsResponse.js +2 -2
  141. package/dist/model/AnalyticsDaily.js +2 -2
  142. package/dist/model/AnalyticsDailyResponse.js +2 -2
  143. package/dist/model/AnalyticsDay.js +2 -2
  144. package/dist/model/AnalyticsEconomy.js +2 -2
  145. package/dist/model/AnalyticsEconomyResponse.js +2 -2
  146. package/dist/model/AnalyticsSummary.js +2 -2
  147. package/dist/model/AnalyticsSummaryResponse.js +2 -2
  148. package/dist/model/Announcement.js +2 -2
  149. package/dist/model/AnnouncementResponse.js +2 -2
  150. package/dist/model/AuthProvidersResponse.js +2 -2
  151. package/dist/model/BlockedFriendship.js +2 -2
  152. package/dist/model/BlockedFriendshipPage.js +2 -2
  153. package/dist/model/CallHookRequest.js +2 -2
  154. package/dist/model/CancelPartyInviteRequest.js +2 -2
  155. package/dist/model/CancelledCount.js +2 -2
  156. package/dist/model/CancelledCountResponse.js +2 -2
  157. package/dist/model/ChatFilterHit.js +2 -2
  158. package/dist/model/ChatFilterLanguages.js +2 -2
  159. package/dist/model/ChatFilterLanguagesResponse.js +2 -2
  160. package/dist/model/ChatFilterTest.js +2 -2
  161. package/dist/model/ChatFilterTestResponse.js +2 -2
  162. package/dist/model/ChatFilterWord.js +2 -2
  163. package/dist/model/ChatFilterWordPage.js +2 -2
  164. package/dist/model/ChatFilterWordResponse.js +2 -2
  165. package/dist/model/ChatMessage.js +2 -2
  166. package/dist/model/ChatMessagePage.js +2 -2
  167. package/dist/model/ChatMessageResponse.js +2 -2
  168. package/dist/model/ChatMuteRecord.js +2 -2
  169. package/dist/model/ChatMuteRecordPage.js +2 -2
  170. package/dist/model/ChatMuteRecordResponse.js +2 -2
  171. package/dist/model/ChatReadCursor.js +2 -2
  172. package/dist/model/ChatReadCursorResponse.js +2 -2
  173. package/dist/model/ChatReport.js +2 -2
  174. package/dist/model/ChatReportPage.js +2 -2
  175. package/dist/model/ChatReportResponse.js +2 -2
  176. package/dist/model/ChatUnread.js +2 -2
  177. package/dist/model/ChatUnreadResponse.js +2 -2
  178. package/dist/model/ClientLogBatch.js +2 -2
  179. package/dist/model/ClientLogEntry.js +2 -2
  180. package/dist/model/ClientLogPolicy.js +2 -2
  181. package/dist/model/ClientLogPolicyResponse.js +2 -2
  182. package/dist/model/ClientLogResult.js +2 -2
  183. package/dist/model/ClientLogResultResponse.js +2 -2
  184. package/dist/model/ClientLogSession.js +2 -2
  185. package/dist/model/ConfirmRegistrationRequest.js +2 -2
  186. package/dist/model/CounterTotal.js +2 -2
  187. package/dist/model/CreateCurrentUserAvatarUploadUrlRequest.js +2 -2
  188. package/dist/model/CreateFriendRequestRequest.js +2 -2
  189. package/dist/model/CreateGroupIconUploadUrlRequest.js +2 -2
  190. package/dist/model/CreateGroupRequest.js +2 -2
  191. package/dist/model/CreateLobbyRequest.js +2 -2
  192. package/dist/model/CreatePartyRequest.js +2 -2
  193. package/dist/model/CurrentUser.js +2 -2
  194. package/dist/model/CurrentUserResponse.js +2 -2
  195. package/dist/model/DeclinePartyInviteRequest.js +2 -2
  196. package/dist/model/DeleteCurrentUserRequest.js +2 -2
  197. package/dist/model/DeleteNotificationsRequest.js +2 -2
  198. package/dist/model/DeletedCount.js +2 -2
  199. package/dist/model/DeletedCountResponse.js +2 -2
  200. package/dist/model/DemoteGroupMemberRequest.js +2 -2
  201. package/dist/model/DeviceLoginRequest.js +2 -2
  202. package/dist/model/EconomyFlowDay.js +2 -2
  203. package/dist/model/EconomyTotal.js +2 -2
  204. package/dist/model/Entitlement.js +2 -2
  205. package/dist/model/EntitlementPage.js +2 -2
  206. package/dist/model/ErrorResponse.js +2 -2
  207. package/dist/model/Friend.js +2 -2
  208. package/dist/model/FriendPage.js +2 -2
  209. package/dist/model/FriendRequest.js +2 -2
  210. package/dist/model/FriendRequestLists.js +2 -2
  211. package/dist/model/FriendRequestMeta.js +2 -2
  212. package/dist/model/FriendRequestResponse.js +2 -2
  213. package/dist/model/FriendRequestsResponse.js +2 -2
  214. package/dist/model/Group.js +2 -2
  215. package/dist/model/GroupInvite.js +2 -2
  216. package/dist/model/GroupInviteLink.js +2 -2
  217. package/dist/model/GroupInviteLinkPreview.js +2 -2
  218. package/dist/model/GroupInviteLinkPreviewResponse.js +2 -2
  219. package/dist/model/GroupInviteLinkResponse.js +2 -2
  220. package/dist/model/GroupInviteOutcome.js +2 -2
  221. package/dist/model/GroupInviteOutcomeResponse.js +2 -2
  222. package/dist/model/GroupInvitePage.js +2 -2
  223. package/dist/model/GroupJoinRequest.js +2 -2
  224. package/dist/model/GroupJoinRequestPage.js +2 -2
  225. package/dist/model/GroupJoinRequestResponse.js +2 -2
  226. package/dist/model/GroupMember.js +2 -2
  227. package/dist/model/GroupMemberPage.js +2 -2
  228. package/dist/model/GroupMemberResponse.js +2 -2
  229. package/dist/model/GroupPage.js +2 -2
  230. package/dist/model/GroupResponse.js +2 -2
  231. package/dist/model/Health.js +2 -2
  232. package/dist/model/HealthResponse.js +2 -2
  233. package/dist/model/HookCallResponse.js +2 -2
  234. package/dist/model/HookFunction.js +2 -2
  235. package/dist/model/HookFunctionPage.js +2 -2
  236. package/dist/model/HookSignature.js +2 -2
  237. package/dist/model/ImportedCount.js +2 -2
  238. package/dist/model/ImportedCountResponse.js +2 -2
  239. package/dist/model/InventoryResponse.js +2 -2
  240. package/dist/model/InviteToGroupRequest.js +2 -2
  241. package/dist/model/InviteToPartyRequest.js +2 -2
  242. package/dist/model/ItemQuantity.js +2 -2
  243. package/dist/model/ItemQuantityResponse.js +2 -2
  244. package/dist/model/JoinLobbyRequest.js +2 -2
  245. package/dist/model/KickGroupMemberRequest.js +2 -2
  246. package/dist/model/KickPartyMemberRequest.js +2 -2
  247. package/dist/model/KickUserRequest.js +2 -2
  248. package/dist/model/KvEntry.js +2 -2
  249. package/dist/model/KvEntryResponse.js +2 -2
  250. package/dist/model/Leaderboard.js +2 -2
  251. package/dist/model/LeaderboardAction.js +2 -2
  252. package/dist/model/LeaderboardKeys.js +2 -2
  253. package/dist/model/LeaderboardKeysResponse.js +2 -2
  254. package/dist/model/LeaderboardPage.js +2 -2
  255. package/dist/model/LeaderboardRecord.js +2 -2
  256. package/dist/model/LeaderboardRecordPage.js +2 -2
  257. package/dist/model/LeaderboardRecordResponse.js +2 -2
  258. package/dist/model/LeaderboardResponse.js +2 -2
  259. package/dist/model/LeaderboardsBySlugResponse.js +2 -2
  260. package/dist/model/LedgerEntry.js +2 -2
  261. package/dist/model/LedgerEntryPage.js +2 -2
  262. package/dist/model/LinkAppleIosRequest.js +2 -2
  263. package/dist/model/LinkDeviceRequest.js +2 -2
  264. package/dist/model/LinkGoogleIdTokenRequest.js +2 -2
  265. package/dist/model/LinkProviderRequest.js +2 -2
  266. package/dist/model/LinkedProviders.js +2 -2
  267. package/dist/model/Lobby.js +2 -2
  268. package/dist/model/LobbyPage.js +2 -2
  269. package/dist/model/LobbyResponse.js +2 -2
  270. package/dist/model/LobbyStats.js +2 -2
  271. package/dist/model/LobbyStatsResponse.js +2 -2
  272. package/dist/model/LoginRequest.js +2 -2
  273. package/dist/model/LoginWithCodeRequest.js +2 -2
  274. package/dist/model/MarkChatReadRequest.js +2 -2
  275. package/dist/model/MarkNotificationsReadRequest.js +113 -0
  276. package/dist/model/MatchmakingJoinRequest.js +2 -2
  277. package/dist/model/MatchmakingJoinRequestMatchParamsValue.js +2 -2
  278. package/dist/model/MatchmakingQueue.js +2 -2
  279. package/dist/model/MatchmakingStats.js +2 -2
  280. package/dist/model/MatchmakingStatsResponse.js +2 -2
  281. package/dist/model/MatchmakingTicket.js +2 -2
  282. package/dist/model/MatchmakingTicketResponse.js +2 -2
  283. package/dist/model/MuteGroupMemberRequest.js +2 -2
  284. package/dist/model/MuteLobbyMemberRequest.js +2 -2
  285. package/dist/model/MutePartyMemberRequest.js +2 -2
  286. package/dist/model/MyReadyChecks.js +2 -2
  287. package/dist/model/MyReadyChecksResponse.js +2 -2
  288. package/dist/model/Notification.js +17 -6
  289. package/dist/model/NotificationGroupSetting.js +157 -0
  290. package/dist/model/NotificationPage.js +2 -2
  291. package/dist/model/NotificationResponse.js +2 -2
  292. package/dist/model/NotificationSettings.js +205 -0
  293. package/dist/model/NotificationSettingsResponse.js +115 -0
  294. package/dist/model/NotificationsRead.js +121 -0
  295. package/dist/model/NotificationsReadResponse.js +115 -0
  296. package/dist/model/OAuthAuthorization.js +2 -2
  297. package/dist/model/OAuthAuthorizationResponse.js +2 -2
  298. package/dist/model/OAuthSessionStatus.js +2 -2
  299. package/dist/model/OAuthSessionStatusResponse.js +2 -2
  300. package/dist/model/OauthApiCallbackRequest.js +2 -2
  301. package/dist/model/OauthCallbackApiAppleIosRequest.js +2 -2
  302. package/dist/model/OauthGoogleIdTokenRequest.js +2 -2
  303. package/dist/model/OkResponse.js +2 -2
  304. package/dist/model/OpenLobbyReadyCheckRequest.js +2 -2
  305. package/dist/model/OpenPartyReadyCheckRequest.js +2 -2
  306. package/dist/model/PageMeta.js +2 -2
  307. package/dist/model/Party.js +2 -2
  308. package/dist/model/PartyCreateLobbyRequest.js +2 -2
  309. package/dist/model/PartyInvite.js +2 -2
  310. package/dist/model/PartyInvitePage.js +2 -2
  311. package/dist/model/PartyJoinLobbyRequest.js +2 -2
  312. package/dist/model/PartyResponse.js +2 -2
  313. package/dist/model/PartyStats.js +2 -2
  314. package/dist/model/PartyStatsResponse.js +2 -2
  315. package/dist/model/PaymentCatalogEntry.js +2 -2
  316. package/dist/model/PaymentCatalogEntryPage.js +2 -2
  317. package/dist/model/PaymentProduct.js +2 -2
  318. package/dist/model/PaymentWebhookReceipt.js +2 -2
  319. package/dist/model/PaymentWebhookReceiptResponse.js +2 -2
  320. package/dist/model/PaymentsSteamCheckoutRequest.js +2 -2
  321. package/dist/model/PaymentsSteamFinalizeRequest.js +2 -2
  322. package/dist/model/PaymentsStripeCheckoutRequest.js +2 -2
  323. package/dist/model/PlayResult.js +2 -2
  324. package/dist/model/PlayResultEvent.js +2 -2
  325. package/dist/model/PlayResultEvents.js +2 -2
  326. package/dist/model/PlayResultEventsResponse.js +2 -2
  327. package/dist/model/PlayResultPage.js +2 -2
  328. package/dist/model/PlayResultResponse.js +2 -2
  329. package/dist/model/PlayResultStat.js +2 -2
  330. package/dist/model/PlayerStats.js +2 -2
  331. package/dist/model/PlayerStatsResponse.js +2 -2
  332. package/dist/model/PromoteGroupMemberRequest.js +2 -2
  333. package/dist/model/ProviderLinkStatus.js +2 -2
  334. package/dist/model/ProviderLinkStatusResponse.js +2 -2
  335. package/dist/model/PublicUser.js +2 -2
  336. package/dist/model/PublicUserPage.js +2 -2
  337. package/dist/model/PublicUserResponse.js +2 -2
  338. package/dist/model/Purchase.js +2 -2
  339. package/dist/model/PurchaseResponse.js +2 -2
  340. package/dist/model/PurchaseValidation.js +2 -2
  341. package/dist/model/PurchaseValidationResponse.js +2 -2
  342. package/dist/model/PushToken.js +2 -2
  343. package/dist/model/PushTokenPage.js +2 -2
  344. package/dist/model/PushTokenResponse.js +2 -2
  345. package/dist/model/Quest.js +2 -2
  346. package/dist/model/QuestAction.js +2 -2
  347. package/dist/model/QuestClaim.js +2 -2
  348. package/dist/model/QuestClaimResponse.js +2 -2
  349. package/dist/model/QuestFunnelResponse.js +2 -2
  350. package/dist/model/QuestNote.js +2 -2
  351. package/dist/model/QuestNoteItemsInner.js +2 -2
  352. package/dist/model/QuestObjective.js +2 -2
  353. package/dist/model/QuestPage.js +2 -2
  354. package/dist/model/QuestProgress.js +2 -2
  355. package/dist/model/QuestReward.js +2 -2
  356. package/dist/model/QuestStats.js +2 -2
  357. package/dist/model/QuestStatsResponse.js +2 -2
  358. package/dist/model/QuickJoinRequest.js +2 -2
  359. package/dist/model/QuickJoinRequestMetadata.js +2 -2
  360. package/dist/model/ReadyCheckOutcomesResponse.js +2 -2
  361. package/dist/model/ReadyCheckParticipant.js +2 -2
  362. package/dist/model/ReadyCheckState.js +2 -2
  363. package/dist/model/ReadyCheckStateResponse.js +2 -2
  364. package/dist/model/RedeemQuestCodeRequest.js +2 -2
  365. package/dist/model/RefreshTokenRequest.js +2 -2
  366. package/dist/model/RegisterPushTokenRequest.js +2 -2
  367. package/dist/model/RegisterRequest.js +2 -2
  368. package/dist/model/Registration.js +2 -2
  369. package/dist/model/RegistrationResponse.js +2 -2
  370. package/dist/model/ReportChatMessageRequest.js +2 -2
  371. package/dist/model/ReportKind.js +2 -2
  372. package/dist/model/ReportKinds.js +2 -2
  373. package/dist/model/ReportKindsResponse.js +2 -2
  374. package/dist/model/ReportReceipt.js +2 -2
  375. package/dist/model/ReportReceiptResponse.js +2 -2
  376. package/dist/model/ReportRequest.js +2 -2
  377. package/dist/model/RequestLoginCodeRequest.js +2 -2
  378. package/dist/model/RequestPasswordResetRequest.js +2 -2
  379. package/dist/model/ResendConfirmationRequest.js +2 -2
  380. package/dist/model/ResetPasswordRequest.js +2 -2
  381. package/dist/model/ResolveLeaderboardSlugsRequest.js +2 -2
  382. package/dist/model/RespondReadyCheckRequest.js +2 -2
  383. package/dist/model/RetentionStatus.js +2 -2
  384. package/dist/model/RetentionStatusResponse.js +2 -2
  385. package/dist/model/SendChatMessageRequest.js +2 -2
  386. package/dist/model/SendNotificationRequest.js +2 -2
  387. package/dist/model/SentMessage.js +2 -2
  388. package/dist/model/SentMessagePage.js +2 -2
  389. package/dist/model/SentMessagePreview.js +2 -2
  390. package/dist/model/SentMessagePreviewResponse.js +2 -2
  391. package/dist/model/ServerStats.js +2 -2
  392. package/dist/model/ServerStatsResponse.js +2 -2
  393. package/dist/model/ServerTime.js +2 -2
  394. package/dist/model/ServerTimeResponse.js +2 -2
  395. package/dist/model/Session.js +2 -2
  396. package/dist/model/SessionResponse.js +2 -2
  397. package/dist/model/SetCurrentUserAvatarRequest.js +2 -2
  398. package/dist/model/SetGroupIconRequest.js +2 -2
  399. package/dist/model/SetLobbyStateRequest.js +2 -2
  400. package/dist/model/SignalingStats.js +2 -2
  401. package/dist/model/SignalingStatsResponse.js +2 -2
  402. package/dist/model/SteamCheckout.js +2 -2
  403. package/dist/model/SteamCheckoutResponse.js +2 -2
  404. package/dist/model/StorageObject.js +2 -2
  405. package/dist/model/StorageObjectPage.js +2 -2
  406. package/dist/model/StorageObjectResponse.js +2 -2
  407. package/dist/model/StorageUsage.js +2 -2
  408. package/dist/model/StorageUsageResponse.js +2 -2
  409. package/dist/model/StripeCheckout.js +2 -2
  410. package/dist/model/StripeCheckoutResponse.js +2 -2
  411. package/dist/model/Tournament.js +2 -2
  412. package/dist/model/TournamentBracket.js +2 -2
  413. package/dist/model/TournamentBracketPage.js +2 -2
  414. package/dist/model/TournamentEntry.js +2 -2
  415. package/dist/model/TournamentEntryPage.js +2 -2
  416. package/dist/model/TournamentEntryResponse.js +2 -2
  417. package/dist/model/TournamentMatch.js +2 -2
  418. package/dist/model/TournamentMatchCounts.js +2 -2
  419. package/dist/model/TournamentMatchResponse.js +2 -2
  420. package/dist/model/TournamentPage.js +2 -2
  421. package/dist/model/TournamentPlacement.js +2 -2
  422. package/dist/model/TournamentResponse.js +2 -2
  423. package/dist/model/TournamentStandings.js +2 -2
  424. package/dist/model/TournamentStandingsResponse.js +2 -2
  425. package/dist/model/TournamentStats.js +2 -2
  426. package/dist/model/UnmuteGroupMemberRequest.js +2 -2
  427. package/dist/model/UnmuteLobbyMemberRequest.js +2 -2
  428. package/dist/model/UnmutePartyMemberRequest.js +2 -2
  429. package/dist/model/UnreadCount.js +109 -0
  430. package/dist/model/UnreadCountResponse.js +115 -0
  431. package/dist/model/UpdateChatMessageRequest.js +2 -2
  432. package/dist/model/UpdateCurrentUserDisplayNameRequest.js +2 -2
  433. package/dist/model/UpdateCurrentUserPasswordRequest.js +2 -2
  434. package/dist/model/UpdateCurrentUserPreferenceRequest.js +2 -2
  435. package/dist/model/UpdateCurrentUserUsernameRequest.js +2 -2
  436. package/dist/model/UpdateGroupRequest.js +2 -2
  437. package/dist/model/UpdateLobbyRequest.js +2 -2
  438. package/dist/model/UpdateNotificationSettingsRequest.js +127 -0
  439. package/dist/model/UpdatePartyRequest.js +2 -2
  440. package/dist/model/UploadTicket.js +2 -2
  441. package/dist/model/UploadTicketResponse.js +2 -2
  442. package/dist/model/UserBrief.js +2 -2
  443. package/dist/model/UserBriefPage.js +2 -2
  444. package/dist/model/WalletBalance.js +2 -2
  445. package/dist/model/WalletBalanceResponse.js +2 -2
  446. package/dist/model/WalletBalancesResponse.js +2 -2
  447. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -224,6 +224,7 @@ export type SignalingChannelEvent =
224
224
  export type UserChannelEvent =
225
225
  "updated"
226
226
  | "notification_created"
227
+ | "notifications_read"
227
228
  | "friend_updated"
228
229
  | "kv_updated"
229
230
  | "kv_deleted"
@@ -2269,6 +2270,8 @@ export class Notification {
2269
2270
  inserted_at: Date;
2270
2271
  /** metadata the game defines */
2271
2272
  metadata: Record<string, any>;
2273
+ /** Whether the recipient has read it (`mark_notifications_read`) */
2274
+ read: boolean;
2272
2275
  recipient_id: string;
2273
2276
  /** Empty for a system notification */
2274
2277
  sender_id: string;
@@ -2276,6 +2279,21 @@ export class Notification {
2276
2279
  title: string;
2277
2280
  }
2278
2281
 
2282
+ /** Which channels a notification group reaches the user through */
2283
+ export class NotificationGroupSetting {
2284
+ constructor(...required: any[]);
2285
+ static constructFromObject(data: unknown, obj?: NotificationGroupSetting): NotificationGroupSetting;
2286
+ static validateJSON(data: unknown): boolean;
2287
+ /** The channels the user may change; the others keep their default */
2288
+ configurable: string[];
2289
+ /** Each channel (`in_app`, `email`, `push`): whether it is sent there */
2290
+ enabled: Record<string, boolean>;
2291
+ /** The group (`social`, `chat`, a host's) */
2292
+ key: string;
2293
+ /** Its name, in the user's language */
2294
+ label: string;
2295
+ }
2296
+
2279
2297
  /** A page of Notification rows */
2280
2298
  export class NotificationPage {
2281
2299
  constructor(...required: any[]);
@@ -2293,6 +2311,53 @@ export class NotificationResponse {
2293
2311
  data: Notification;
2294
2312
  }
2295
2313
 
2314
+ /** Which notifications the user gets, and where */
2315
+ export class NotificationSettings {
2316
+ constructor(...required: any[]);
2317
+ static constructFromObject(data: unknown, obj?: NotificationSettings): NotificationSettings;
2318
+ static validateJSON(data: unknown): boolean;
2319
+ /** The channels, in the order the settings page shows them */
2320
+ channels: string[];
2321
+ groups: NotificationGroupSetting[];
2322
+ /** Everything off */
2323
+ off_all: boolean;
2324
+ /** All email off */
2325
+ off_email: boolean;
2326
+ /** All phone notifications off */
2327
+ off_push: boolean;
2328
+ /** The user's IANA time zone, empty when unknown (UTC then) */
2329
+ timezone: string;
2330
+ /** Chosen by hand: a device's zone does not replace it */
2331
+ timezone_manual: boolean;
2332
+ }
2333
+
2334
+ /** NotificationSettings under `data` */
2335
+ export class NotificationSettingsResponse {
2336
+ constructor(...required: any[]);
2337
+ static constructFromObject(data: unknown, obj?: NotificationSettingsResponse): NotificationSettingsResponse;
2338
+ static validateJSON(data: unknown): boolean;
2339
+ data: NotificationSettings;
2340
+ }
2341
+
2342
+ /** Notifications marked read */
2343
+ export class NotificationsRead {
2344
+ constructor(...required: any[]);
2345
+ static constructFromObject(data: unknown, obj?: NotificationsRead): NotificationsRead;
2346
+ static validateJSON(data: unknown): boolean;
2347
+ /** How many were unread and are read now */
2348
+ marked: number;
2349
+ /** How many of the user's are unread */
2350
+ unread_count: number;
2351
+ }
2352
+
2353
+ /** NotificationsRead under `data` */
2354
+ export class NotificationsReadResponse {
2355
+ constructor(...required: any[]);
2356
+ static constructFromObject(data: unknown, obj?: NotificationsReadResponse): NotificationsReadResponse;
2357
+ static validateJSON(data: unknown): boolean;
2358
+ data: NotificationsRead;
2359
+ }
2360
+
2296
2361
  /** A started OAuth sign-in */
2297
2362
  export class OAuthAuthorization {
2298
2363
  constructor(...required: any[]);
@@ -3515,6 +3580,22 @@ export class TournamentStats {
3515
3580
  tournaments: Record<string, number>;
3516
3581
  }
3517
3582
 
3583
+ /** Unread notifications */
3584
+ export class UnreadCount {
3585
+ constructor(...required: any[]);
3586
+ static constructFromObject(data: unknown, obj?: UnreadCount): UnreadCount;
3587
+ static validateJSON(data: unknown): boolean;
3588
+ unread_count: number;
3589
+ }
3590
+
3591
+ /** UnreadCount under `data` */
3592
+ export class UnreadCountResponse {
3593
+ constructor(...required: any[]);
3594
+ static constructFromObject(data: unknown, obj?: UnreadCountResponse): UnreadCountResponse;
3595
+ static validateJSON(data: unknown): boolean;
3596
+ data: UnreadCount;
3597
+ }
3598
+
3518
3599
  /** Where and how to upload an object */
3519
3600
  export class UploadTicket {
3520
3601
  constructor(...required: any[]);
@@ -4426,15 +4507,30 @@ export class MatchmakingApi {
4426
4507
  export class NotificationsApi {
4427
4508
  constructor(apiClient?: ApiClient);
4428
4509
  apiClient: ApiClient;
4510
+ /** Count unread notifications */
4511
+ countUnreadNotifications(): Promise<UnreadCountResponse>;
4512
+ countUnreadNotificationsWithHttpInfo(): Promise<{ data: UnreadCountResponse; response: any }>;
4429
4513
  /** Delete notifications by IDs */
4430
4514
  deleteNotifications(opts?: { deleteNotificationsRequest?: { ids: string[] } }): Promise<DeletedCountResponse>;
4431
4515
  deleteNotificationsWithHttpInfo(opts?: { deleteNotificationsRequest?: { ids: string[] } }): Promise<{ data: DeletedCountResponse; response: any }>;
4516
+ /** Get own notification settings */
4517
+ getNotificationSettings(): Promise<NotificationSettingsResponse>;
4518
+ getNotificationSettingsWithHttpInfo(): Promise<{ data: NotificationSettingsResponse; response: any }>;
4432
4519
  /** List own notifications */
4433
4520
  listNotifications(opts?: { page?: number; pageSize?: number }): Promise<NotificationPage>;
4434
4521
  listNotificationsWithHttpInfo(opts?: { page?: number; pageSize?: number }): Promise<{ data: NotificationPage; response: any }>;
4522
+ /** Mark every notification read */
4523
+ markAllNotificationsRead(): Promise<NotificationsReadResponse>;
4524
+ markAllNotificationsReadWithHttpInfo(): Promise<{ data: NotificationsReadResponse; response: any }>;
4525
+ /** Mark notifications read by IDs */
4526
+ markNotificationsRead(opts?: { markNotificationsReadRequest?: { ids: string[] } }): Promise<NotificationsReadResponse>;
4527
+ markNotificationsReadWithHttpInfo(opts?: { markNotificationsReadRequest?: { ids: string[] } }): Promise<{ data: NotificationsReadResponse; response: any }>;
4435
4528
  /** Send a notification to a friend */
4436
4529
  sendNotification(opts?: { sendNotificationRequest?: { content?: string | null; icon_url?: string | null; metadata?: Record<string, any> | null; title: string; user_id: string } }): Promise<NotificationResponse>;
4437
4530
  sendNotificationWithHttpInfo(opts?: { sendNotificationRequest?: { content?: string | null; icon_url?: string | null; metadata?: Record<string, any> | null; title: string; user_id: string } }): Promise<{ data: NotificationResponse; response: any }>;
4531
+ /** Change own notification settings */
4532
+ updateNotificationSettings(opts?: { updateNotificationSettingsRequest?: { groups?: Record<string, Record<string, boolean>>; off_all?: boolean; off_email?: boolean; off_push?: boolean; timezone?: string } }): Promise<NotificationSettingsResponse>;
4533
+ updateNotificationSettingsWithHttpInfo(opts?: { updateNotificationSettingsRequest?: { groups?: Record<string, Record<string, boolean>>; off_all?: boolean; off_email?: boolean; off_push?: boolean; timezone?: string } }): Promise<{ data: NotificationSettingsResponse; response: any }>;
4438
4534
  }
4439
4535
 
4440
4536
  export class PartiesApi {
package/dist/index.js CHANGED
@@ -1545,6 +1545,12 @@ Object.defineProperty(exports, "MarkChatReadRequest", {
1545
1545
  return _MarkChatReadRequest["default"];
1546
1546
  }
1547
1547
  });
1548
+ Object.defineProperty(exports, "MarkNotificationsReadRequest", {
1549
+ enumerable: true,
1550
+ get: function get() {
1551
+ return _MarkNotificationsReadRequest["default"];
1552
+ }
1553
+ });
1548
1554
  Object.defineProperty(exports, "MatchmakingApi", {
1549
1555
  enumerable: true,
1550
1556
  get: function get() {
@@ -1629,6 +1635,12 @@ Object.defineProperty(exports, "Notification", {
1629
1635
  return _Notification["default"];
1630
1636
  }
1631
1637
  });
1638
+ Object.defineProperty(exports, "NotificationGroupSetting", {
1639
+ enumerable: true,
1640
+ get: function get() {
1641
+ return _NotificationGroupSetting["default"];
1642
+ }
1643
+ });
1632
1644
  Object.defineProperty(exports, "NotificationPage", {
1633
1645
  enumerable: true,
1634
1646
  get: function get() {
@@ -1641,12 +1653,36 @@ Object.defineProperty(exports, "NotificationResponse", {
1641
1653
  return _NotificationResponse["default"];
1642
1654
  }
1643
1655
  });
1656
+ Object.defineProperty(exports, "NotificationSettings", {
1657
+ enumerable: true,
1658
+ get: function get() {
1659
+ return _NotificationSettings["default"];
1660
+ }
1661
+ });
1662
+ Object.defineProperty(exports, "NotificationSettingsResponse", {
1663
+ enumerable: true,
1664
+ get: function get() {
1665
+ return _NotificationSettingsResponse["default"];
1666
+ }
1667
+ });
1644
1668
  Object.defineProperty(exports, "NotificationsApi", {
1645
1669
  enumerable: true,
1646
1670
  get: function get() {
1647
1671
  return _NotificationsApi["default"];
1648
1672
  }
1649
1673
  });
1674
+ Object.defineProperty(exports, "NotificationsRead", {
1675
+ enumerable: true,
1676
+ get: function get() {
1677
+ return _NotificationsRead["default"];
1678
+ }
1679
+ });
1680
+ Object.defineProperty(exports, "NotificationsReadResponse", {
1681
+ enumerable: true,
1682
+ get: function get() {
1683
+ return _NotificationsReadResponse["default"];
1684
+ }
1685
+ });
1650
1686
  Object.defineProperty(exports, "OAuthAuthorization", {
1651
1687
  enumerable: true,
1652
1688
  get: function get() {
@@ -2517,6 +2553,18 @@ Object.defineProperty(exports, "UnmutePartyMemberRequest", {
2517
2553
  return _UnmutePartyMemberRequest["default"];
2518
2554
  }
2519
2555
  });
2556
+ Object.defineProperty(exports, "UnreadCount", {
2557
+ enumerable: true,
2558
+ get: function get() {
2559
+ return _UnreadCount["default"];
2560
+ }
2561
+ });
2562
+ Object.defineProperty(exports, "UnreadCountResponse", {
2563
+ enumerable: true,
2564
+ get: function get() {
2565
+ return _UnreadCountResponse["default"];
2566
+ }
2567
+ });
2520
2568
  Object.defineProperty(exports, "UpdateChatMessageRequest", {
2521
2569
  enumerable: true,
2522
2570
  get: function get() {
@@ -2559,6 +2607,12 @@ Object.defineProperty(exports, "UpdateLobbyRequest", {
2559
2607
  return _UpdateLobbyRequest["default"];
2560
2608
  }
2561
2609
  });
2610
+ Object.defineProperty(exports, "UpdateNotificationSettingsRequest", {
2611
+ enumerable: true,
2612
+ get: function get() {
2613
+ return _UpdateNotificationSettingsRequest["default"];
2614
+ }
2615
+ });
2562
2616
  Object.defineProperty(exports, "UpdatePartyRequest", {
2563
2617
  enumerable: true,
2564
2618
  get: function get() {
@@ -2855,6 +2909,7 @@ var _LobbyStatsResponse = _interopRequireDefault(require("./model/LobbyStatsResp
2855
2909
  var _LoginRequest = _interopRequireDefault(require("./model/LoginRequest"));
2856
2910
  var _LoginWithCodeRequest = _interopRequireDefault(require("./model/LoginWithCodeRequest"));
2857
2911
  var _MarkChatReadRequest = _interopRequireDefault(require("./model/MarkChatReadRequest"));
2912
+ var _MarkNotificationsReadRequest = _interopRequireDefault(require("./model/MarkNotificationsReadRequest"));
2858
2913
  var _MatchmakingJoinRequest = _interopRequireDefault(require("./model/MatchmakingJoinRequest"));
2859
2914
  var _MatchmakingJoinRequestMatchParamsValue = _interopRequireDefault(require("./model/MatchmakingJoinRequestMatchParamsValue"));
2860
2915
  var _MatchmakingQueue = _interopRequireDefault(require("./model/MatchmakingQueue"));
@@ -2868,8 +2923,13 @@ var _MutePartyMemberRequest = _interopRequireDefault(require("./model/MutePartyM
2868
2923
  var _MyReadyChecks = _interopRequireDefault(require("./model/MyReadyChecks"));
2869
2924
  var _MyReadyChecksResponse = _interopRequireDefault(require("./model/MyReadyChecksResponse"));
2870
2925
  var _Notification = _interopRequireDefault(require("./model/Notification"));
2926
+ var _NotificationGroupSetting = _interopRequireDefault(require("./model/NotificationGroupSetting"));
2871
2927
  var _NotificationPage = _interopRequireDefault(require("./model/NotificationPage"));
2872
2928
  var _NotificationResponse = _interopRequireDefault(require("./model/NotificationResponse"));
2929
+ var _NotificationSettings = _interopRequireDefault(require("./model/NotificationSettings"));
2930
+ var _NotificationSettingsResponse = _interopRequireDefault(require("./model/NotificationSettingsResponse"));
2931
+ var _NotificationsRead = _interopRequireDefault(require("./model/NotificationsRead"));
2932
+ var _NotificationsReadResponse = _interopRequireDefault(require("./model/NotificationsReadResponse"));
2873
2933
  var _OAuthAuthorization = _interopRequireDefault(require("./model/OAuthAuthorization"));
2874
2934
  var _OAuthAuthorizationResponse = _interopRequireDefault(require("./model/OAuthAuthorizationResponse"));
2875
2935
  var _OAuthSessionStatus = _interopRequireDefault(require("./model/OAuthSessionStatus"));
@@ -3003,6 +3063,8 @@ var _TournamentStats = _interopRequireDefault(require("./model/TournamentStats")
3003
3063
  var _UnmuteGroupMemberRequest = _interopRequireDefault(require("./model/UnmuteGroupMemberRequest"));
3004
3064
  var _UnmuteLobbyMemberRequest = _interopRequireDefault(require("./model/UnmuteLobbyMemberRequest"));
3005
3065
  var _UnmutePartyMemberRequest = _interopRequireDefault(require("./model/UnmutePartyMemberRequest"));
3066
+ var _UnreadCount = _interopRequireDefault(require("./model/UnreadCount"));
3067
+ var _UnreadCountResponse = _interopRequireDefault(require("./model/UnreadCountResponse"));
3006
3068
  var _UpdateChatMessageRequest = _interopRequireDefault(require("./model/UpdateChatMessageRequest"));
3007
3069
  var _UpdateCurrentUserDisplayNameRequest = _interopRequireDefault(require("./model/UpdateCurrentUserDisplayNameRequest"));
3008
3070
  var _UpdateCurrentUserPasswordRequest = _interopRequireDefault(require("./model/UpdateCurrentUserPasswordRequest"));
@@ -3010,6 +3072,7 @@ var _UpdateCurrentUserPreferenceRequest = _interopRequireDefault(require("./mode
3010
3072
  var _UpdateCurrentUserUsernameRequest = _interopRequireDefault(require("./model/UpdateCurrentUserUsernameRequest"));
3011
3073
  var _UpdateGroupRequest = _interopRequireDefault(require("./model/UpdateGroupRequest"));
3012
3074
  var _UpdateLobbyRequest = _interopRequireDefault(require("./model/UpdateLobbyRequest"));
3075
+ var _UpdateNotificationSettingsRequest = _interopRequireDefault(require("./model/UpdateNotificationSettingsRequest"));
3013
3076
  var _UpdatePartyRequest = _interopRequireDefault(require("./model/UpdatePartyRequest"));
3014
3077
  var _UploadTicket = _interopRequireDefault(require("./model/UploadTicket"));
3015
3078
  var _UploadTicketResponse = _interopRequireDefault(require("./model/UploadTicketResponse"));
@@ -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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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 })) ```
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) - **Read state**: mark some or all read, the unread count, and `notifications_read` on every connection of the user - **Settings**: the groups and channels a user turns on and off, the switches, and the time zone reminders follow (`/me/notification_settings`) - **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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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.1530
21
+ * The version of the OpenAPI document: 1.1.1531
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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 })) ```
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) - **Read state**: mark some or all read, the unread count, and `notifications_read` on every connection of the user - **Settings**: the groups and channels a user turns on and off, the switches, and the time zone reminders follow (`/me/notification_settings`) - **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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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.1530
21
+ * The version of the OpenAPI document: 1.1.1531
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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 })) ```
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) - **Read state**: mark some or all read, the unread count, and `notifications_read` on every connection of the user - **Settings**: the groups and channels a user turns on and off, the switches, and the time zone reminders follow (`/me/notification_settings`) - **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), `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`) - **Redemption codes**: `POST /me/quests/redeem` finishes a `code_only` quest with a code the server issued and pays at once; `GET /quests/redeemable` lists what codes can finish - **Admin management**: definitions CRUD plus per-user grant/reset/force-claim under `/api/v1/admin/quests`, and redemption codes under `/api/v1/admin/quests/:id/codes` ## **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.1530
21
+ * The version of the OpenAPI document: 1.1.1531
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).