@ughuuu/game_server 1.0.1038 → 1.0.1040

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 (182) hide show
  1. package/README.md +78 -12
  2. package/dist/ApiClient.js +2 -2
  3. package/dist/api/AchievementsApi.js +2 -2
  4. package/dist/api/AdminAchievementsApi.js +2 -2
  5. package/dist/api/AdminChatApi.js +2 -2
  6. package/dist/api/AdminGroupsApi.js +2 -2
  7. package/dist/api/AdminKVApi.js +2 -2
  8. package/dist/api/AdminLeaderboardsApi.js +2 -2
  9. package/dist/api/AdminLobbiesApi.js +2 -2
  10. package/dist/api/AdminMatchmakingApi.js +165 -0
  11. package/dist/api/AdminNotificationsApi.js +2 -2
  12. package/dist/api/AdminSessionsApi.js +2 -2
  13. package/dist/api/AdminTournamentsApi.js +374 -0
  14. package/dist/api/AdminUsersApi.js +2 -2
  15. package/dist/api/AuthenticationApi.js +2 -2
  16. package/dist/api/ChatApi.js +2 -2
  17. package/dist/api/FriendsApi.js +126 -2
  18. package/dist/api/GroupsApi.js +2 -2
  19. package/dist/api/HealthApi.js +2 -2
  20. package/dist/api/HooksApi.js +2 -2
  21. package/dist/api/KVApi.js +2 -2
  22. package/dist/api/LeaderboardsApi.js +2 -2
  23. package/dist/api/LobbiesApi.js +2 -2
  24. package/dist/api/MatchmakingApi.js +187 -0
  25. package/dist/api/NotificationsApi.js +2 -2
  26. package/dist/api/PartiesApi.js +2 -2
  27. package/dist/api/PaymentsApi.js +2 -2
  28. package/dist/api/TournamentsApi.js +394 -0
  29. package/dist/api/UsersApi.js +2 -2
  30. package/dist/gamend_proto.js +389 -0
  31. package/dist/gamend_realtime.pb.js +6473 -0
  32. package/dist/index.js +189 -7
  33. package/dist/model/AcceptPartyInvite200Response.js +2 -2
  34. package/dist/model/AcceptPartyInvite200ResponseMembersInner.js +2 -2
  35. package/dist/model/AcceptPartyInviteRequest.js +2 -2
  36. package/dist/model/AdminCancelMatchmakingTicket200Response.js +91 -0
  37. package/dist/model/AdminCreateAchievementRequest.js +2 -2
  38. package/dist/model/AdminCreateLeaderboard200Response.js +2 -2
  39. package/dist/model/AdminCreateLeaderboard200ResponseData.js +2 -2
  40. package/dist/model/AdminCreateLeaderboardRequest.js +2 -2
  41. package/dist/model/AdminCreateNotificationRequest.js +2 -2
  42. package/dist/model/AdminDeleteChatConversation200Response.js +2 -2
  43. package/dist/model/AdminDrawTournament200Response.js +91 -0
  44. package/dist/model/AdminDrawTournament200ResponseData.js +297 -0
  45. package/dist/model/AdminGrantAchievementRequest.js +2 -2
  46. package/dist/model/AdminIncrementAchievementRequest.js +2 -2
  47. package/dist/model/AdminListAchievements200Response.js +2 -2
  48. package/dist/model/AdminListAchievements200ResponseDataInner.js +2 -2
  49. package/dist/model/AdminListChatMessages200Response.js +2 -2
  50. package/dist/model/AdminListChatMessages200ResponseDataInner.js +2 -2
  51. package/dist/model/AdminListGroups200Response.js +2 -2
  52. package/dist/model/AdminListKvEntries200Response.js +2 -2
  53. package/dist/model/AdminListLobbies200Response.js +2 -2
  54. package/dist/model/AdminListLobbies200ResponseDataInner.js +2 -2
  55. package/dist/model/AdminListMatchmakingTickets200Response.js +124 -0
  56. package/dist/model/AdminListMatchmakingTickets200ResponseDataInner.js +196 -0
  57. package/dist/model/AdminListNotifications200Response.js +2 -2
  58. package/dist/model/AdminListNotifications200ResponseDataInner.js +2 -2
  59. package/dist/model/AdminListSessions200Response.js +2 -2
  60. package/dist/model/AdminListSessions200ResponseDataInner.js +2 -2
  61. package/dist/model/AdminMatchmakingStats200Response.js +91 -0
  62. package/dist/model/AdminMatchmakingStats200ResponseData.js +113 -0
  63. package/dist/model/AdminResolveTournamentMatchRequest.js +90 -0
  64. package/dist/model/AdminRevokeAchievementRequest.js +2 -2
  65. package/dist/model/AdminSubmitLeaderboardScoreRequest.js +2 -2
  66. package/dist/model/AdminUpdateAchievementRequest.js +2 -2
  67. package/dist/model/AdminUpdateGroup200Response.js +2 -2
  68. package/dist/model/AdminUpdateGroupRequest.js +2 -2
  69. package/dist/model/AdminUpdateKvEntryRequest.js +2 -2
  70. package/dist/model/AdminUpdateLeaderboardRecord200Response.js +2 -2
  71. package/dist/model/AdminUpdateLeaderboardRecord200ResponseData.js +2 -2
  72. package/dist/model/AdminUpdateLeaderboardRecordRequest.js +2 -2
  73. package/dist/model/AdminUpdateLeaderboardRequest.js +2 -2
  74. package/dist/model/AdminUpdateLobby200Response.js +2 -2
  75. package/dist/model/AdminUpdateTournamentRequest.js +253 -0
  76. package/dist/model/AdminUpdateUser200Response.js +2 -2
  77. package/dist/model/AdminUpdateUser200ResponseData.js +2 -2
  78. package/dist/model/AdminUpdateUserRequest.js +2 -2
  79. package/dist/model/AdminUpsertKv200Response.js +2 -2
  80. package/dist/model/AdminUpsertKv200ResponseData.js +2 -2
  81. package/dist/model/AdminUpsertKvRequest.js +2 -2
  82. package/dist/model/ApproveJoinRequest200Response.js +2 -2
  83. package/dist/model/CallHook200Response.js +2 -2
  84. package/dist/model/CallHookRequest.js +2 -2
  85. package/dist/model/CancelJoinRequest200Response.js +2 -2
  86. package/dist/model/ChatUnreadCount200Response.js +2 -2
  87. package/dist/model/CreateGroupRequest.js +2 -2
  88. package/dist/model/CreateLobbyRequest.js +2 -2
  89. package/dist/model/CreatePartyRequest.js +2 -2
  90. package/dist/model/DeclineGroupInvite200Response.js +2 -2
  91. package/dist/model/DeleteNotificationsRequest.js +2 -2
  92. package/dist/model/DeviceLoginRequest.js +2 -2
  93. package/dist/model/ErrorResponse.js +2 -2
  94. package/dist/model/GameServerWebApiV1TournamentControllerIndex200Response.js +110 -0
  95. package/dist/model/GameServerWebApiV1TournamentControllerIndex200ResponseDataInner.js +258 -0
  96. package/dist/model/GameServerWebApiV1TournamentControllerMyMatch200Response.js +173 -0
  97. package/dist/model/GetCurrentUser200Response.js +2 -2
  98. package/dist/model/GetCurrentUser200ResponseLinkedProviders.js +2 -2
  99. package/dist/model/GetKv200Response.js +2 -2
  100. package/dist/model/GetLobby200Response.js +2 -2
  101. package/dist/model/GetMyRecord200Response.js +2 -2
  102. package/dist/model/GetMyRecord200ResponseData.js +2 -2
  103. package/dist/model/HealthResponse.js +2 -2
  104. package/dist/model/InviteToPartyRequest.js +2 -2
  105. package/dist/model/ListBlacklistedUsers200Response.js +118 -0
  106. package/dist/model/ListBlacklistedUsers200ResponseDataInner.js +113 -0
  107. package/dist/model/ListBlockedFriends200Response.js +2 -2
  108. package/dist/model/ListBlockedFriends200ResponseDataInner.js +6 -6
  109. package/dist/model/ListChatMessages200Response.js +2 -2
  110. package/dist/model/ListChatMessages200ResponseDataInner.js +2 -2
  111. package/dist/model/ListFriendRequests200Response.js +2 -2
  112. package/dist/model/ListFriendRequests200ResponseIncomingInner.js +2 -2
  113. package/dist/model/ListFriendRequests200ResponseIncomingInnerRequester.js +2 -2
  114. package/dist/model/ListFriendRequests200ResponseMeta.js +2 -2
  115. package/dist/model/ListFriends200Response.js +2 -2
  116. package/dist/model/ListFriends200ResponseDataInner.js +2 -2
  117. package/dist/model/ListFriends200ResponseMeta.js +2 -2
  118. package/dist/model/ListGroupMembers200Response.js +2 -2
  119. package/dist/model/ListJoinRequests200Response.js +2 -2
  120. package/dist/model/ListLeaderboardRecords200Response.js +2 -2
  121. package/dist/model/ListLeaderboards200Response.js +2 -2
  122. package/dist/model/ListLobbies200Response.js +2 -2
  123. package/dist/model/ListLobbies200ResponseDataInner.js +2 -2
  124. package/dist/model/ListMyGroups200Response.js +2 -2
  125. package/dist/model/ListMyGroups200ResponseDataInner.js +2 -2
  126. package/dist/model/ListPartyInvitations200ResponseInner.js +2 -2
  127. package/dist/model/ListRecordsAroundUser200Response.js +2 -2
  128. package/dist/model/ListSentInvitations200Response.js +2 -2
  129. package/dist/model/ListSentInvitations200ResponseDataInner.js +2 -2
  130. package/dist/model/LoginRequest.js +2 -2
  131. package/dist/model/MarkChatReadRequest.js +2 -2
  132. package/dist/model/MatchmakingCancel200Response.js +85 -0
  133. package/dist/model/MatchmakingJoin201Response.js +91 -0
  134. package/dist/model/MatchmakingJoin201ResponseData.js +186 -0
  135. package/dist/model/MatchmakingJoinRequest.js +101 -0
  136. package/dist/model/MatchmakingMyTicket200Response.js +91 -0
  137. package/dist/model/MatchmakingMyTicket200ResponseData.js +186 -0
  138. package/dist/model/MatchmakingStats200Response.js +91 -0
  139. package/dist/model/MatchmakingStats200ResponseData.js +118 -0
  140. package/dist/model/MatchmakingStats200ResponseDataQueuesInner.js +93 -0
  141. package/dist/model/MyAchievements200Response.js +2 -2
  142. package/dist/model/MyAchievements200ResponseDataInner.js +2 -2
  143. package/dist/model/NotifyGroup200Response.js +2 -2
  144. package/dist/model/NotifyGroupRequest.js +2 -2
  145. package/dist/model/OAuthSessionData.js +2 -2
  146. package/dist/model/OAuthSessionDataDetails.js +2 -2
  147. package/dist/model/OAuthSessionStatus.js +2 -2
  148. package/dist/model/OauthApiCallback200Response.js +2 -2
  149. package/dist/model/OauthApiCallbackRequest.js +2 -2
  150. package/dist/model/OauthCallbackApiAppleIosRequest.js +2 -2
  151. package/dist/model/OauthGoogleIdTokenRequest.js +2 -2
  152. package/dist/model/OauthRequest200Response.js +2 -2
  153. package/dist/model/OauthSessionStatus404Response.js +2 -2
  154. package/dist/model/PartyCreateLobbyRequest.js +2 -2
  155. package/dist/model/PartyJoinLobbyRequest.js +2 -2
  156. package/dist/model/PaymentsEntitlements401Response.js +2 -2
  157. package/dist/model/PaymentsSteamCheckoutRequest.js +2 -2
  158. package/dist/model/PaymentsSteamFinalizeRequest.js +2 -2
  159. package/dist/model/PaymentsStripeCheckoutRequest.js +2 -2
  160. package/dist/model/QuickJoinRequest.js +2 -2
  161. package/dist/model/RefreshToken200Response.js +2 -2
  162. package/dist/model/RefreshToken200ResponseData.js +2 -2
  163. package/dist/model/RefreshTokenRequest.js +2 -2
  164. package/dist/model/ResolveLeaderboardSlugs200Response.js +2 -2
  165. package/dist/model/ResolveLeaderboardSlugs200ResponseDataValue.js +2 -2
  166. package/dist/model/ResolveLeaderboardSlugsRequest.js +2 -2
  167. package/dist/model/SearchUsers200Response.js +2 -2
  168. package/dist/model/SearchUsers200ResponseDataInner.js +2 -2
  169. package/dist/model/SendChatMessageRequest.js +2 -2
  170. package/dist/model/SendNotificationRequest.js +2 -2
  171. package/dist/model/UpdateChatMessageRequest.js +2 -2
  172. package/dist/model/UpdateCurrentUserDisplayName400Response.js +2 -2
  173. package/dist/model/UpdateCurrentUserDisplayNameRequest.js +2 -2
  174. package/dist/model/UpdateCurrentUserPasswordRequest.js +2 -2
  175. package/dist/model/UpdateCurrentUserUsernameRequest.js +2 -2
  176. package/dist/model/UpdateGroupRequest.js +2 -2
  177. package/dist/model/UpdateLobbyRequest.js +2 -2
  178. package/dist/model/UpdatePartyRequest.js +2 -2
  179. package/dist/realtime.js +75 -12
  180. package/dist/webrtc.js +187 -21
  181. package/package.json +2 -2
  182. package/dist/model/ListBlockedFriends200ResponseDataInnerRequester.js +0 -113
package/dist/index.js CHANGED
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "AdminAchievementsApi", {
33
33
  return _AdminAchievementsApi["default"];
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "AdminCancelMatchmakingTicket200Response", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _AdminCancelMatchmakingTicket200Response["default"];
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "AdminChatApi", {
37
43
  enumerable: true,
38
44
  get: function get() {
@@ -75,6 +81,18 @@ Object.defineProperty(exports, "AdminDeleteChatConversation200Response", {
75
81
  return _AdminDeleteChatConversation200Response["default"];
76
82
  }
77
83
  });
84
+ Object.defineProperty(exports, "AdminDrawTournament200Response", {
85
+ enumerable: true,
86
+ get: function get() {
87
+ return _AdminDrawTournament200Response["default"];
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "AdminDrawTournament200ResponseData", {
91
+ enumerable: true,
92
+ get: function get() {
93
+ return _AdminDrawTournament200ResponseData["default"];
94
+ }
95
+ });
78
96
  Object.defineProperty(exports, "AdminGrantAchievementRequest", {
79
97
  enumerable: true,
80
98
  get: function get() {
@@ -153,6 +171,18 @@ Object.defineProperty(exports, "AdminListLobbies200ResponseDataInner", {
153
171
  return _AdminListLobbies200ResponseDataInner["default"];
154
172
  }
155
173
  });
174
+ Object.defineProperty(exports, "AdminListMatchmakingTickets200Response", {
175
+ enumerable: true,
176
+ get: function get() {
177
+ return _AdminListMatchmakingTickets200Response["default"];
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "AdminListMatchmakingTickets200ResponseDataInner", {
181
+ enumerable: true,
182
+ get: function get() {
183
+ return _AdminListMatchmakingTickets200ResponseDataInner["default"];
184
+ }
185
+ });
156
186
  Object.defineProperty(exports, "AdminListNotifications200Response", {
157
187
  enumerable: true,
158
188
  get: function get() {
@@ -183,12 +213,36 @@ Object.defineProperty(exports, "AdminLobbiesApi", {
183
213
  return _AdminLobbiesApi["default"];
184
214
  }
185
215
  });
216
+ Object.defineProperty(exports, "AdminMatchmakingApi", {
217
+ enumerable: true,
218
+ get: function get() {
219
+ return _AdminMatchmakingApi["default"];
220
+ }
221
+ });
222
+ Object.defineProperty(exports, "AdminMatchmakingStats200Response", {
223
+ enumerable: true,
224
+ get: function get() {
225
+ return _AdminMatchmakingStats200Response["default"];
226
+ }
227
+ });
228
+ Object.defineProperty(exports, "AdminMatchmakingStats200ResponseData", {
229
+ enumerable: true,
230
+ get: function get() {
231
+ return _AdminMatchmakingStats200ResponseData["default"];
232
+ }
233
+ });
186
234
  Object.defineProperty(exports, "AdminNotificationsApi", {
187
235
  enumerable: true,
188
236
  get: function get() {
189
237
  return _AdminNotificationsApi["default"];
190
238
  }
191
239
  });
240
+ Object.defineProperty(exports, "AdminResolveTournamentMatchRequest", {
241
+ enumerable: true,
242
+ get: function get() {
243
+ return _AdminResolveTournamentMatchRequest["default"];
244
+ }
245
+ });
192
246
  Object.defineProperty(exports, "AdminRevokeAchievementRequest", {
193
247
  enumerable: true,
194
248
  get: function get() {
@@ -207,6 +261,12 @@ Object.defineProperty(exports, "AdminSubmitLeaderboardScoreRequest", {
207
261
  return _AdminSubmitLeaderboardScoreRequest["default"];
208
262
  }
209
263
  });
264
+ Object.defineProperty(exports, "AdminTournamentsApi", {
265
+ enumerable: true,
266
+ get: function get() {
267
+ return _AdminTournamentsApi["default"];
268
+ }
269
+ });
210
270
  Object.defineProperty(exports, "AdminUpdateAchievementRequest", {
211
271
  enumerable: true,
212
272
  get: function get() {
@@ -261,6 +321,12 @@ Object.defineProperty(exports, "AdminUpdateLobby200Response", {
261
321
  return _AdminUpdateLobby200Response["default"];
262
322
  }
263
323
  });
324
+ Object.defineProperty(exports, "AdminUpdateTournamentRequest", {
325
+ enumerable: true,
326
+ get: function get() {
327
+ return _AdminUpdateTournamentRequest["default"];
328
+ }
329
+ });
264
330
  Object.defineProperty(exports, "AdminUpdateUser200Response", {
265
331
  enumerable: true,
266
332
  get: function get() {
@@ -399,6 +465,24 @@ Object.defineProperty(exports, "FriendsApi", {
399
465
  return _FriendsApi["default"];
400
466
  }
401
467
  });
468
+ Object.defineProperty(exports, "GameServerWebApiV1TournamentControllerIndex200Response", {
469
+ enumerable: true,
470
+ get: function get() {
471
+ return _GameServerWebApiV1TournamentControllerIndex200Response["default"];
472
+ }
473
+ });
474
+ Object.defineProperty(exports, "GameServerWebApiV1TournamentControllerIndex200ResponseDataInner", {
475
+ enumerable: true,
476
+ get: function get() {
477
+ return _GameServerWebApiV1TournamentControllerIndex200ResponseDataInner["default"];
478
+ }
479
+ });
480
+ Object.defineProperty(exports, "GameServerWebApiV1TournamentControllerMyMatch200Response", {
481
+ enumerable: true,
482
+ get: function get() {
483
+ return _GameServerWebApiV1TournamentControllerMyMatch200Response["default"];
484
+ }
485
+ });
402
486
  Object.defineProperty(exports, "GetCurrentUser200Response", {
403
487
  enumerable: true,
404
488
  get: function get() {
@@ -477,22 +561,28 @@ Object.defineProperty(exports, "LeaderboardsApi", {
477
561
  return _LeaderboardsApi["default"];
478
562
  }
479
563
  });
480
- Object.defineProperty(exports, "ListBlockedFriends200Response", {
564
+ Object.defineProperty(exports, "ListBlacklistedUsers200Response", {
481
565
  enumerable: true,
482
566
  get: function get() {
483
- return _ListBlockedFriends200Response["default"];
567
+ return _ListBlacklistedUsers200Response["default"];
484
568
  }
485
569
  });
486
- Object.defineProperty(exports, "ListBlockedFriends200ResponseDataInner", {
570
+ Object.defineProperty(exports, "ListBlacklistedUsers200ResponseDataInner", {
487
571
  enumerable: true,
488
572
  get: function get() {
489
- return _ListBlockedFriends200ResponseDataInner["default"];
573
+ return _ListBlacklistedUsers200ResponseDataInner["default"];
574
+ }
575
+ });
576
+ Object.defineProperty(exports, "ListBlockedFriends200Response", {
577
+ enumerable: true,
578
+ get: function get() {
579
+ return _ListBlockedFriends200Response["default"];
490
580
  }
491
581
  });
492
- Object.defineProperty(exports, "ListBlockedFriends200ResponseDataInnerRequester", {
582
+ Object.defineProperty(exports, "ListBlockedFriends200ResponseDataInner", {
493
583
  enumerable: true,
494
584
  get: function get() {
495
- return _ListBlockedFriends200ResponseDataInnerRequester["default"];
585
+ return _ListBlockedFriends200ResponseDataInner["default"];
496
586
  }
497
587
  });
498
588
  Object.defineProperty(exports, "ListChatMessages200Response", {
@@ -639,6 +729,66 @@ Object.defineProperty(exports, "MarkChatReadRequest", {
639
729
  return _MarkChatReadRequest["default"];
640
730
  }
641
731
  });
732
+ Object.defineProperty(exports, "MatchmakingApi", {
733
+ enumerable: true,
734
+ get: function get() {
735
+ return _MatchmakingApi["default"];
736
+ }
737
+ });
738
+ Object.defineProperty(exports, "MatchmakingCancel200Response", {
739
+ enumerable: true,
740
+ get: function get() {
741
+ return _MatchmakingCancel200Response["default"];
742
+ }
743
+ });
744
+ Object.defineProperty(exports, "MatchmakingJoin201Response", {
745
+ enumerable: true,
746
+ get: function get() {
747
+ return _MatchmakingJoin201Response["default"];
748
+ }
749
+ });
750
+ Object.defineProperty(exports, "MatchmakingJoin201ResponseData", {
751
+ enumerable: true,
752
+ get: function get() {
753
+ return _MatchmakingJoin201ResponseData["default"];
754
+ }
755
+ });
756
+ Object.defineProperty(exports, "MatchmakingJoinRequest", {
757
+ enumerable: true,
758
+ get: function get() {
759
+ return _MatchmakingJoinRequest["default"];
760
+ }
761
+ });
762
+ Object.defineProperty(exports, "MatchmakingMyTicket200Response", {
763
+ enumerable: true,
764
+ get: function get() {
765
+ return _MatchmakingMyTicket200Response["default"];
766
+ }
767
+ });
768
+ Object.defineProperty(exports, "MatchmakingMyTicket200ResponseData", {
769
+ enumerable: true,
770
+ get: function get() {
771
+ return _MatchmakingMyTicket200ResponseData["default"];
772
+ }
773
+ });
774
+ Object.defineProperty(exports, "MatchmakingStats200Response", {
775
+ enumerable: true,
776
+ get: function get() {
777
+ return _MatchmakingStats200Response["default"];
778
+ }
779
+ });
780
+ Object.defineProperty(exports, "MatchmakingStats200ResponseData", {
781
+ enumerable: true,
782
+ get: function get() {
783
+ return _MatchmakingStats200ResponseData["default"];
784
+ }
785
+ });
786
+ Object.defineProperty(exports, "MatchmakingStats200ResponseDataQueuesInner", {
787
+ enumerable: true,
788
+ get: function get() {
789
+ return _MatchmakingStats200ResponseDataQueuesInner["default"];
790
+ }
791
+ });
642
792
  Object.defineProperty(exports, "MyAchievements200Response", {
643
793
  enumerable: true,
644
794
  get: function get() {
@@ -837,6 +987,12 @@ Object.defineProperty(exports, "SendNotificationRequest", {
837
987
  return _SendNotificationRequest["default"];
838
988
  }
839
989
  });
990
+ Object.defineProperty(exports, "TournamentsApi", {
991
+ enumerable: true,
992
+ get: function get() {
993
+ return _TournamentsApi["default"];
994
+ }
995
+ });
840
996
  Object.defineProperty(exports, "UpdateChatMessageRequest", {
841
997
  enumerable: true,
842
998
  get: function get() {
@@ -895,12 +1051,15 @@ var _ApiClient = _interopRequireDefault(require("./ApiClient"));
895
1051
  var _AcceptPartyInvite200Response = _interopRequireDefault(require("./model/AcceptPartyInvite200Response"));
896
1052
  var _AcceptPartyInvite200ResponseMembersInner = _interopRequireDefault(require("./model/AcceptPartyInvite200ResponseMembersInner"));
897
1053
  var _AcceptPartyInviteRequest = _interopRequireDefault(require("./model/AcceptPartyInviteRequest"));
1054
+ var _AdminCancelMatchmakingTicket200Response = _interopRequireDefault(require("./model/AdminCancelMatchmakingTicket200Response"));
898
1055
  var _AdminCreateAchievementRequest = _interopRequireDefault(require("./model/AdminCreateAchievementRequest"));
899
1056
  var _AdminCreateLeaderboard200Response = _interopRequireDefault(require("./model/AdminCreateLeaderboard200Response"));
900
1057
  var _AdminCreateLeaderboard200ResponseData = _interopRequireDefault(require("./model/AdminCreateLeaderboard200ResponseData"));
901
1058
  var _AdminCreateLeaderboardRequest = _interopRequireDefault(require("./model/AdminCreateLeaderboardRequest"));
902
1059
  var _AdminCreateNotificationRequest = _interopRequireDefault(require("./model/AdminCreateNotificationRequest"));
903
1060
  var _AdminDeleteChatConversation200Response = _interopRequireDefault(require("./model/AdminDeleteChatConversation200Response"));
1061
+ var _AdminDrawTournament200Response = _interopRequireDefault(require("./model/AdminDrawTournament200Response"));
1062
+ var _AdminDrawTournament200ResponseData = _interopRequireDefault(require("./model/AdminDrawTournament200ResponseData"));
904
1063
  var _AdminGrantAchievementRequest = _interopRequireDefault(require("./model/AdminGrantAchievementRequest"));
905
1064
  var _AdminIncrementAchievementRequest = _interopRequireDefault(require("./model/AdminIncrementAchievementRequest"));
906
1065
  var _AdminListAchievements200Response = _interopRequireDefault(require("./model/AdminListAchievements200Response"));
@@ -911,10 +1070,15 @@ var _AdminListGroups200Response = _interopRequireDefault(require("./model/AdminL
911
1070
  var _AdminListKvEntries200Response = _interopRequireDefault(require("./model/AdminListKvEntries200Response"));
912
1071
  var _AdminListLobbies200Response = _interopRequireDefault(require("./model/AdminListLobbies200Response"));
913
1072
  var _AdminListLobbies200ResponseDataInner = _interopRequireDefault(require("./model/AdminListLobbies200ResponseDataInner"));
1073
+ var _AdminListMatchmakingTickets200Response = _interopRequireDefault(require("./model/AdminListMatchmakingTickets200Response"));
1074
+ var _AdminListMatchmakingTickets200ResponseDataInner = _interopRequireDefault(require("./model/AdminListMatchmakingTickets200ResponseDataInner"));
914
1075
  var _AdminListNotifications200Response = _interopRequireDefault(require("./model/AdminListNotifications200Response"));
915
1076
  var _AdminListNotifications200ResponseDataInner = _interopRequireDefault(require("./model/AdminListNotifications200ResponseDataInner"));
916
1077
  var _AdminListSessions200Response = _interopRequireDefault(require("./model/AdminListSessions200Response"));
917
1078
  var _AdminListSessions200ResponseDataInner = _interopRequireDefault(require("./model/AdminListSessions200ResponseDataInner"));
1079
+ var _AdminMatchmakingStats200Response = _interopRequireDefault(require("./model/AdminMatchmakingStats200Response"));
1080
+ var _AdminMatchmakingStats200ResponseData = _interopRequireDefault(require("./model/AdminMatchmakingStats200ResponseData"));
1081
+ var _AdminResolveTournamentMatchRequest = _interopRequireDefault(require("./model/AdminResolveTournamentMatchRequest"));
918
1082
  var _AdminRevokeAchievementRequest = _interopRequireDefault(require("./model/AdminRevokeAchievementRequest"));
919
1083
  var _AdminSubmitLeaderboardScoreRequest = _interopRequireDefault(require("./model/AdminSubmitLeaderboardScoreRequest"));
920
1084
  var _AdminUpdateAchievementRequest = _interopRequireDefault(require("./model/AdminUpdateAchievementRequest"));
@@ -926,6 +1090,7 @@ var _AdminUpdateLeaderboardRecord200ResponseData = _interopRequireDefault(requir
926
1090
  var _AdminUpdateLeaderboardRecordRequest = _interopRequireDefault(require("./model/AdminUpdateLeaderboardRecordRequest"));
927
1091
  var _AdminUpdateLeaderboardRequest = _interopRequireDefault(require("./model/AdminUpdateLeaderboardRequest"));
928
1092
  var _AdminUpdateLobby200Response = _interopRequireDefault(require("./model/AdminUpdateLobby200Response"));
1093
+ var _AdminUpdateTournamentRequest = _interopRequireDefault(require("./model/AdminUpdateTournamentRequest"));
929
1094
  var _AdminUpdateUser200Response = _interopRequireDefault(require("./model/AdminUpdateUser200Response"));
930
1095
  var _AdminUpdateUser200ResponseData = _interopRequireDefault(require("./model/AdminUpdateUser200ResponseData"));
931
1096
  var _AdminUpdateUserRequest = _interopRequireDefault(require("./model/AdminUpdateUserRequest"));
@@ -944,6 +1109,9 @@ var _DeclineGroupInvite200Response = _interopRequireDefault(require("./model/Dec
944
1109
  var _DeleteNotificationsRequest = _interopRequireDefault(require("./model/DeleteNotificationsRequest"));
945
1110
  var _DeviceLoginRequest = _interopRequireDefault(require("./model/DeviceLoginRequest"));
946
1111
  var _ErrorResponse = _interopRequireDefault(require("./model/ErrorResponse"));
1112
+ var _GameServerWebApiV1TournamentControllerIndex200Response = _interopRequireDefault(require("./model/GameServerWebApiV1TournamentControllerIndex200Response"));
1113
+ var _GameServerWebApiV1TournamentControllerIndex200ResponseDataInner = _interopRequireDefault(require("./model/GameServerWebApiV1TournamentControllerIndex200ResponseDataInner"));
1114
+ var _GameServerWebApiV1TournamentControllerMyMatch200Response = _interopRequireDefault(require("./model/GameServerWebApiV1TournamentControllerMyMatch200Response"));
947
1115
  var _GetCurrentUser200Response = _interopRequireDefault(require("./model/GetCurrentUser200Response"));
948
1116
  var _GetCurrentUser200ResponseLinkedProviders = _interopRequireDefault(require("./model/GetCurrentUser200ResponseLinkedProviders"));
949
1117
  var _GetKv200Response = _interopRequireDefault(require("./model/GetKv200Response"));
@@ -952,9 +1120,10 @@ var _GetMyRecord200Response = _interopRequireDefault(require("./model/GetMyRecor
952
1120
  var _GetMyRecord200ResponseData = _interopRequireDefault(require("./model/GetMyRecord200ResponseData"));
953
1121
  var _HealthResponse = _interopRequireDefault(require("./model/HealthResponse"));
954
1122
  var _InviteToPartyRequest = _interopRequireDefault(require("./model/InviteToPartyRequest"));
1123
+ var _ListBlacklistedUsers200Response = _interopRequireDefault(require("./model/ListBlacklistedUsers200Response"));
1124
+ var _ListBlacklistedUsers200ResponseDataInner = _interopRequireDefault(require("./model/ListBlacklistedUsers200ResponseDataInner"));
955
1125
  var _ListBlockedFriends200Response = _interopRequireDefault(require("./model/ListBlockedFriends200Response"));
956
1126
  var _ListBlockedFriends200ResponseDataInner = _interopRequireDefault(require("./model/ListBlockedFriends200ResponseDataInner"));
957
- var _ListBlockedFriends200ResponseDataInnerRequester = _interopRequireDefault(require("./model/ListBlockedFriends200ResponseDataInnerRequester"));
958
1127
  var _ListChatMessages200Response = _interopRequireDefault(require("./model/ListChatMessages200Response"));
959
1128
  var _ListChatMessages200ResponseDataInner = _interopRequireDefault(require("./model/ListChatMessages200ResponseDataInner"));
960
1129
  var _ListFriendRequests200Response = _interopRequireDefault(require("./model/ListFriendRequests200Response"));
@@ -978,6 +1147,15 @@ var _ListSentInvitations200Response = _interopRequireDefault(require("./model/Li
978
1147
  var _ListSentInvitations200ResponseDataInner = _interopRequireDefault(require("./model/ListSentInvitations200ResponseDataInner"));
979
1148
  var _LoginRequest = _interopRequireDefault(require("./model/LoginRequest"));
980
1149
  var _MarkChatReadRequest = _interopRequireDefault(require("./model/MarkChatReadRequest"));
1150
+ var _MatchmakingCancel200Response = _interopRequireDefault(require("./model/MatchmakingCancel200Response"));
1151
+ var _MatchmakingJoin201Response = _interopRequireDefault(require("./model/MatchmakingJoin201Response"));
1152
+ var _MatchmakingJoin201ResponseData = _interopRequireDefault(require("./model/MatchmakingJoin201ResponseData"));
1153
+ var _MatchmakingJoinRequest = _interopRequireDefault(require("./model/MatchmakingJoinRequest"));
1154
+ var _MatchmakingMyTicket200Response = _interopRequireDefault(require("./model/MatchmakingMyTicket200Response"));
1155
+ var _MatchmakingMyTicket200ResponseData = _interopRequireDefault(require("./model/MatchmakingMyTicket200ResponseData"));
1156
+ var _MatchmakingStats200Response = _interopRequireDefault(require("./model/MatchmakingStats200Response"));
1157
+ var _MatchmakingStats200ResponseData = _interopRequireDefault(require("./model/MatchmakingStats200ResponseData"));
1158
+ var _MatchmakingStats200ResponseDataQueuesInner = _interopRequireDefault(require("./model/MatchmakingStats200ResponseDataQueuesInner"));
981
1159
  var _MyAchievements200Response = _interopRequireDefault(require("./model/MyAchievements200Response"));
982
1160
  var _MyAchievements200ResponseDataInner = _interopRequireDefault(require("./model/MyAchievements200ResponseDataInner"));
983
1161
  var _NotifyGroup200Response = _interopRequireDefault(require("./model/NotifyGroup200Response"));
@@ -1023,8 +1201,10 @@ var _AdminGroupsApi = _interopRequireDefault(require("./api/AdminGroupsApi"));
1023
1201
  var _AdminKVApi = _interopRequireDefault(require("./api/AdminKVApi"));
1024
1202
  var _AdminLeaderboardsApi = _interopRequireDefault(require("./api/AdminLeaderboardsApi"));
1025
1203
  var _AdminLobbiesApi = _interopRequireDefault(require("./api/AdminLobbiesApi"));
1204
+ var _AdminMatchmakingApi = _interopRequireDefault(require("./api/AdminMatchmakingApi"));
1026
1205
  var _AdminNotificationsApi = _interopRequireDefault(require("./api/AdminNotificationsApi"));
1027
1206
  var _AdminSessionsApi = _interopRequireDefault(require("./api/AdminSessionsApi"));
1207
+ var _AdminTournamentsApi = _interopRequireDefault(require("./api/AdminTournamentsApi"));
1028
1208
  var _AdminUsersApi = _interopRequireDefault(require("./api/AdminUsersApi"));
1029
1209
  var _AuthenticationApi = _interopRequireDefault(require("./api/AuthenticationApi"));
1030
1210
  var _ChatApi = _interopRequireDefault(require("./api/ChatApi"));
@@ -1035,8 +1215,10 @@ var _HooksApi = _interopRequireDefault(require("./api/HooksApi"));
1035
1215
  var _KVApi = _interopRequireDefault(require("./api/KVApi"));
1036
1216
  var _LeaderboardsApi = _interopRequireDefault(require("./api/LeaderboardsApi"));
1037
1217
  var _LobbiesApi = _interopRequireDefault(require("./api/LobbiesApi"));
1218
+ var _MatchmakingApi = _interopRequireDefault(require("./api/MatchmakingApi"));
1038
1219
  var _NotificationsApi = _interopRequireDefault(require("./api/NotificationsApi"));
1039
1220
  var _PartiesApi = _interopRequireDefault(require("./api/PartiesApi"));
1040
1221
  var _PaymentsApi = _interopRequireDefault(require("./api/PaymentsApi"));
1222
+ var _TournamentsApi = _interopRequireDefault(require("./api/TournamentsApi"));
1041
1223
  var _UsersApi = _interopRequireDefault(require("./api/UsersApi"));
1042
1224
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -17,9 +17,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
19
19
  * Game Server API
20
- * API for the Gamend Game Server. 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, achievements, leaderboards, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. 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. ### **12.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() ``` ### **12.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites - **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 ### **12.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **13. 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). ### **13.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 ### **13.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **13.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
20
+ * API for the Gamend Game Server. 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, achievements, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my-match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it - **The result is a push, not a poll**: matched players receive `matchmaking_found` (`lobby_id`, `match_params`) on their user channel; disconnecting 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. 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. ### **14.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() ``` ### **14.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites, tournament events, 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 ### **14.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **15. 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). ### **15.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 ### **15.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **15.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(userId) const webrtc = new GameWebRTC(userChannel, { onData: (label, data) => console.log(label, data) }) await webrtc.connect() webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 })) ```
21
21
  *
22
- * The version of the OpenAPI document: 1.0.1038
22
+ * The version of the OpenAPI document: 1.0.1040
23
23
  *
24
24
  *
25
25
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -13,9 +13,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
13
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
14
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
15
15
  * Game Server API
16
- * API for the Gamend Game Server. 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, achievements, leaderboards, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. 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. ### **12.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() ``` ### **12.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites - **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 ### **12.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **13. 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). ### **13.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 ### **13.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **13.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(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 })) ```
16
+ * API for the Gamend Game Server. 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, achievements, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my-match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it - **The result is a push, not a poll**: matched players receive `matchmaking_found` (`lobby_id`, `match_params`) on their user channel; disconnecting 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. 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. ### **14.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() ``` ### **14.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites, tournament events, 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 ### **14.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **15. 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). ### **15.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 ### **15.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **15.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(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 })) ```
17
17
  *
18
- * The version of the OpenAPI document: 1.0.1038
18
+ * The version of the OpenAPI document: 1.0.1040
19
19
  *
20
20
  *
21
21
  * 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, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
18
18
  * Game Server API
19
- * API for the Gamend Game Server. 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, achievements, leaderboards, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. 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. ### **12.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() ``` ### **12.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites - **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 ### **12.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **13. 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). ### **13.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 ### **13.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **13.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(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 the Gamend Game Server. 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, achievements, 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 - **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), use for API requests - `refresh_token` - Long-lived (30 days), 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. ## **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 ## **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 hooks**: `before_chat_message` pipeline hook for filtering/blocking ## **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. Achievements** Track player accomplishments with progress-based or instant-unlock achievements: - **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target - **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target - **Instant unlock**: directly unlock achievements without progress tracking - **Hidden achievements**: details obscured (\"???\") until unlocked by the user - **Public listings**: paginated, optionally filtered; authenticated users see their own progress - **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements ## **12. Tournaments** Single-elimination bracket tournaments, server-structured and game-judged: - **Registration window → seeded draw → timed rounds → champions**; recurring tournaments (cron) create one occurrence per cycle sharing a slug; a nil starts_at keeps registration open until an admin draws manually - **Join/leave** as an entry leader (`POST`/`DELETE /tournaments/:id/join`); team composition is game policy - **Browse**: list/filter tournaments, standings, full bracket view, and the caller's current match (`GET /tournaments/:id/my-match`) - **Match verdicts are server-side** (game hooks) — no public resolve endpoint; clients get `tournament_match_ready` / `tournament_match_resolved` / `tournament_updated` / `tournament_finished` on the user channel - **Admin management** over HTTP: create/update/delete, cancel, draw now, finish, and force match verdicts under `/api/v1/admin/tournaments` ## **13. Matchmaking** Ticket-based queueing that turns waiting players into hidden, locked lobbies: - **Join over HTTP** (`POST /matchmaking/tickets` with a `match_params` string map); only tickets with identical params match together — encode mode/map/skill band as parameter values - **A match forms** when a group reaches `max_players`, or has at least `min_players` and the oldest ticket outwaited the timeout; the server creates a hidden lobby, seats everyone and locks it - **The result is a push, not a poll**: matched players receive `matchmaking_found` (`lobby_id`, `match_params`) on their user channel; disconnecting 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. 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. ### **14.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() ``` ### **14.2 Available Channels** - **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites, tournament events, 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 ### **14.3 JS SDK Helper** The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers: ```javascript import { GameRealtime } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', accessToken) const userChannel = realtime.joinUserChannel(userId) userChannel.on('notification', payload => console.log(payload)) ``` Requires the `phoenix` npm package as a peer dependency: `npm install phoenix` ## **15. 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). ### **15.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 ### **15.2 Default DataChannels** - **`events`** (reliable, ordered): important game events (player actions, state changes) - **`state`** (unreliable, unordered): high-frequency position/state sync ### **15.3 JS SDK Helper** The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically: ```javascript import { GameRealtime, GameWebRTC } from '@ughuuu/game_server' const realtime = new GameRealtime('https://your-server.com', token) const userChannel = realtime.joinUserChannel(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.0.1038
21
+ * The version of the OpenAPI document: 1.0.1040
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).