@ughuuu/game_server 1.0.1001 → 1.0.1004

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 (150) hide show
  1. package/README.md +24 -24
  2. package/dist/ApiClient.js +1 -1
  3. package/dist/api/AchievementsApi.js +15 -15
  4. package/dist/api/AdminAchievementsApi.js +16 -16
  5. package/dist/api/AdminChatApi.js +6 -6
  6. package/dist/api/AdminGroupsApi.js +2 -2
  7. package/dist/api/AdminKVApi.js +19 -19
  8. package/dist/api/AdminLeaderboardsApi.js +19 -19
  9. package/dist/api/AdminLobbiesApi.js +2 -2
  10. package/dist/api/AdminNotificationsApi.js +2 -2
  11. package/dist/api/AdminSessionsApi.js +2 -2
  12. package/dist/api/AdminUsersApi.js +2 -2
  13. package/dist/api/AuthenticationApi.js +2 -2
  14. package/dist/api/ChatApi.js +11 -11
  15. package/dist/api/FriendsApi.js +7 -7
  16. package/dist/api/GroupsApi.js +41 -41
  17. package/dist/api/HealthApi.js +1 -1
  18. package/dist/api/HooksApi.js +2 -2
  19. package/dist/api/KVApi.js +2 -2
  20. package/dist/api/LeaderboardsApi.js +6 -6
  21. package/dist/api/LobbiesApi.js +6 -6
  22. package/dist/api/NotificationsApi.js +6 -6
  23. package/dist/api/PartiesApi.js +25 -25
  24. package/dist/api/PaymentsApi.js +2 -2
  25. package/dist/api/UsersApi.js +3 -3
  26. package/dist/index.js +133 -133
  27. package/dist/model/{ShowParty200Response.js → AcceptPartyInvite200Response.js} +27 -27
  28. package/dist/model/{ShowParty200ResponseMembersInner.js → AcceptPartyInvite200ResponseMembersInner.js} +23 -23
  29. package/dist/model/AcceptPartyInviteRequest.js +1 -1
  30. package/dist/model/AdminCreateAchievementRequest.js +1 -1
  31. package/dist/model/{AdminCreateKvEntry200Response.js → AdminCreateLeaderboard200Response.js} +22 -22
  32. package/dist/model/{AdminEndLeaderboard200ResponseData.js → AdminCreateLeaderboard200ResponseData.js} +32 -32
  33. package/dist/model/AdminCreateLeaderboardRequest.js +1 -1
  34. package/dist/model/AdminCreateNotificationRequest.js +1 -1
  35. package/dist/model/{DeleteNotifications200Response.js → AdminDeleteChatConversation200Response.js} +18 -19
  36. package/dist/model/{AdminUnlockAchievementRequest.js → AdminGrantAchievementRequest.js} +21 -21
  37. package/dist/model/AdminIncrementAchievementRequest.js +1 -1
  38. package/dist/model/AdminListAchievements200Response.js +5 -5
  39. package/dist/model/{AdminUpdateAchievement200Response.js → AdminListAchievements200ResponseDataInner.js} +28 -28
  40. package/dist/model/AdminListChatMessages200Response.js +5 -5
  41. package/dist/model/AdminListChatMessages200ResponseDataInner.js +1 -1
  42. package/dist/model/AdminListGroups200Response.js +5 -5
  43. package/dist/model/AdminListKvEntries200Response.js +9 -9
  44. package/dist/model/AdminListLobbies200Response.js +5 -5
  45. package/dist/model/AdminListLobbies200ResponseDataInner.js +1 -1
  46. package/dist/model/AdminListNotifications200Response.js +5 -5
  47. package/dist/model/AdminListNotifications200ResponseDataInner.js +1 -1
  48. package/dist/model/AdminListSessions200Response.js +5 -5
  49. package/dist/model/AdminListSessions200ResponseDataInner.js +1 -1
  50. package/dist/model/AdminRevokeAchievementRequest.js +1 -1
  51. package/dist/model/AdminSubmitLeaderboardScoreRequest.js +1 -1
  52. package/dist/model/AdminUpdateAchievementRequest.js +1 -1
  53. package/dist/model/AdminUpdateGroup200Response.js +1 -1
  54. package/dist/model/AdminUpdateGroupRequest.js +1 -1
  55. package/dist/model/AdminUpdateKvEntryRequest.js +1 -1
  56. package/dist/model/{AdminSubmitLeaderboardScore200Response.js → AdminUpdateLeaderboardRecord200Response.js} +22 -22
  57. package/dist/model/{AdminSubmitLeaderboardScore200ResponseData.js → AdminUpdateLeaderboardRecord200ResponseData.js} +26 -26
  58. package/dist/model/AdminUpdateLeaderboardRecordRequest.js +1 -1
  59. package/dist/model/AdminUpdateLeaderboardRequest.js +1 -1
  60. package/dist/model/AdminUpdateLobby200Response.js +1 -1
  61. package/dist/model/AdminUpdateUser200Response.js +1 -1
  62. package/dist/model/AdminUpdateUser200ResponseData.js +1 -1
  63. package/dist/model/AdminUpdateUserRequest.js +1 -1
  64. package/dist/model/{AdminEndLeaderboard200Response.js → AdminUpsertKv200Response.js} +22 -22
  65. package/dist/model/{AdminListKvEntries200ResponseDataInner.js → AdminUpsertKv200ResponseData.js} +25 -25
  66. package/dist/model/{AdminCreateKvEntryRequest.js → AdminUpsertKvRequest.js} +24 -24
  67. package/dist/model/{ListGroupMembers200ResponseDataInner.js → ApproveJoinRequest200Response.js} +28 -28
  68. package/dist/model/CallHook200Response.js +1 -1
  69. package/dist/model/CallHookRequest.js +1 -1
  70. package/dist/model/CancelJoinRequest200Response.js +1 -1
  71. package/dist/model/ChatUnreadCount200Response.js +1 -1
  72. package/dist/model/CreateGroupRequest.js +1 -1
  73. package/dist/model/CreateLobbyRequest.js +1 -1
  74. package/dist/model/CreatePartyRequest.js +1 -1
  75. package/dist/model/{InviteToGroup200Response.js → DeclineGroupInvite200Response.js} +18 -19
  76. package/dist/model/DeleteNotificationsRequest.js +1 -1
  77. package/dist/model/DeviceLoginRequest.js +1 -1
  78. package/dist/model/ErrorResponse.js +1 -1
  79. package/dist/model/GetCurrentUser200Response.js +1 -1
  80. package/dist/model/GetCurrentUser200ResponseLinkedProviders.js +1 -1
  81. package/dist/model/GetKv200Response.js +1 -1
  82. package/dist/model/GetLobby200Response.js +5 -5
  83. package/dist/model/GetMyRecord200Response.js +5 -5
  84. package/dist/model/{ListLeaderboardRecords200ResponseDataInner.js → GetMyRecord200ResponseData.js} +23 -23
  85. package/dist/model/HealthResponse.js +1 -1
  86. package/dist/model/{InviteToGroupRequest.js → InviteToPartyRequest.js} +22 -22
  87. package/dist/model/ListBlockedFriends200Response.js +5 -5
  88. package/dist/model/ListBlockedFriends200ResponseDataInner.js +1 -1
  89. package/dist/model/ListBlockedFriends200ResponseDataInnerRequester.js +1 -1
  90. package/dist/model/ListChatMessages200Response.js +5 -5
  91. package/dist/model/{GetChatMessage200Response.js → ListChatMessages200ResponseDataInner.js} +28 -28
  92. package/dist/model/ListFriendRequests200Response.js +1 -1
  93. package/dist/model/ListFriendRequests200ResponseIncomingInner.js +1 -1
  94. package/dist/model/ListFriendRequests200ResponseIncomingInnerRequester.js +1 -1
  95. package/dist/model/ListFriendRequests200ResponseMeta.js +1 -1
  96. package/dist/model/ListFriends200Response.js +5 -5
  97. package/dist/model/ListFriends200ResponseDataInner.js +1 -1
  98. package/dist/model/{AdminListNotifications200ResponseMeta.js → ListFriends200ResponseMeta.js} +23 -23
  99. package/dist/model/ListGroupMembers200Response.js +9 -9
  100. package/dist/model/ListJoinRequests200Response.js +5 -5
  101. package/dist/model/ListLeaderboardRecords200Response.js +9 -9
  102. package/dist/model/ListLeaderboards200Response.js +9 -9
  103. package/dist/model/ListLobbies200Response.js +5 -5
  104. package/dist/model/ListLobbies200ResponseDataInner.js +1 -1
  105. package/dist/model/ListMyGroups200Response.js +5 -5
  106. package/dist/model/ListMyGroups200ResponseDataInner.js +1 -1
  107. package/dist/model/ListPartyInvitations200ResponseInner.js +1 -1
  108. package/dist/model/ListRecordsAroundUser200Response.js +5 -5
  109. package/dist/model/ListSentInvitations200Response.js +5 -5
  110. package/dist/model/ListSentInvitations200ResponseDataInner.js +1 -1
  111. package/dist/model/LoginRequest.js +1 -1
  112. package/dist/model/MarkChatReadRequest.js +1 -1
  113. package/dist/model/{UserAchievements200Response.js → MyAchievements200Response.js} +27 -27
  114. package/dist/model/{UserAchievements200ResponseDataInner.js → MyAchievements200ResponseDataInner.js} +28 -28
  115. package/dist/model/NotifyGroup200Response.js +1 -1
  116. package/dist/model/NotifyGroupRequest.js +1 -1
  117. package/dist/model/OAuthSessionData.js +1 -1
  118. package/dist/model/OAuthSessionDataDetails.js +1 -1
  119. package/dist/model/OAuthSessionStatus.js +1 -1
  120. package/dist/model/OauthApiCallback200Response.js +1 -1
  121. package/dist/model/OauthApiCallbackRequest.js +1 -1
  122. package/dist/model/OauthCallbackApiAppleIosRequest.js +1 -1
  123. package/dist/model/OauthGoogleIdTokenRequest.js +1 -1
  124. package/dist/model/OauthRequest200Response.js +1 -1
  125. package/dist/model/OauthSessionStatus404Response.js +1 -1
  126. package/dist/model/PartyCreateLobbyRequest.js +1 -1
  127. package/dist/model/PartyJoinLobbyRequest.js +1 -1
  128. package/dist/model/{AdminCreateNotification400Response.js → PaymentsEntitlements401Response.js} +18 -18
  129. package/dist/model/PaymentsSteamCheckoutRequest.js +1 -1
  130. package/dist/model/PaymentsSteamFinalizeRequest.js +1 -1
  131. package/dist/model/PaymentsStripeCheckoutRequest.js +1 -1
  132. package/dist/model/QuickJoinRequest.js +1 -1
  133. package/dist/model/RefreshToken200Response.js +1 -1
  134. package/dist/model/RefreshToken200ResponseData.js +1 -1
  135. package/dist/model/RefreshTokenRequest.js +1 -1
  136. package/dist/model/ResolveLeaderboardSlugs200Response.js +4 -4
  137. package/dist/model/{ListLeaderboards200ResponseDataInner.js → ResolveLeaderboardSlugs200ResponseDataValue.js} +33 -33
  138. package/dist/model/ResolveLeaderboardSlugsRequest.js +1 -1
  139. package/dist/model/SearchUsers200Response.js +5 -5
  140. package/dist/model/SearchUsers200ResponseDataInner.js +1 -1
  141. package/dist/model/SendChatMessageRequest.js +1 -1
  142. package/dist/model/SendNotificationRequest.js +1 -1
  143. package/dist/model/UpdateChatMessageRequest.js +1 -1
  144. package/dist/model/{UpdateCurrentUserPassword400Response.js → UpdateCurrentUserDisplayName400Response.js} +19 -19
  145. package/dist/model/UpdateCurrentUserDisplayNameRequest.js +1 -1
  146. package/dist/model/UpdateCurrentUserPasswordRequest.js +1 -1
  147. package/dist/model/UpdateGroupRequest.js +1 -1
  148. package/dist/model/UpdateLobbyRequest.js +1 -1
  149. package/dist/model/UpdatePartyRequest.js +1 -1
  150. package/package.json +1 -1
@@ -15,7 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  * Game Server API
16
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 })) ```
17
17
  *
18
- * The version of the OpenAPI document: 1.0.1001
18
+ * The version of the OpenAPI document: 1.0.1004
19
19
  *
20
20
  *
21
21
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -24,18 +24,18 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
24
24
  *
25
25
  */
26
26
  /**
27
- * The AdminEndLeaderboard200ResponseData model module.
28
- * @module model/AdminEndLeaderboard200ResponseData
27
+ * The AdminCreateLeaderboard200ResponseData model module.
28
+ * @module model/AdminCreateLeaderboard200ResponseData
29
29
  * @version 1.0.0
30
30
  */
31
- var AdminEndLeaderboard200ResponseData = /*#__PURE__*/function () {
31
+ var AdminCreateLeaderboard200ResponseData = /*#__PURE__*/function () {
32
32
  /**
33
- * Constructs a new <code>AdminEndLeaderboard200ResponseData</code>.
34
- * @alias module:model/AdminEndLeaderboard200ResponseData
33
+ * Constructs a new <code>AdminCreateLeaderboard200ResponseData</code>.
34
+ * @alias module:model/AdminCreateLeaderboard200ResponseData
35
35
  */
36
- function AdminEndLeaderboard200ResponseData() {
37
- _classCallCheck(this, AdminEndLeaderboard200ResponseData);
38
- AdminEndLeaderboard200ResponseData.initialize(this);
36
+ function AdminCreateLeaderboard200ResponseData() {
37
+ _classCallCheck(this, AdminCreateLeaderboard200ResponseData);
38
+ AdminCreateLeaderboard200ResponseData.initialize(this);
39
39
  }
40
40
 
41
41
  /**
@@ -43,22 +43,22 @@ var AdminEndLeaderboard200ResponseData = /*#__PURE__*/function () {
43
43
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
44
44
  * Only for internal use.
45
45
  */
46
- return _createClass(AdminEndLeaderboard200ResponseData, null, [{
46
+ return _createClass(AdminCreateLeaderboard200ResponseData, null, [{
47
47
  key: "initialize",
48
48
  value: function initialize(obj) {}
49
49
 
50
50
  /**
51
- * Constructs a <code>AdminEndLeaderboard200ResponseData</code> from a plain JavaScript object, optionally creating a new instance.
51
+ * Constructs a <code>AdminCreateLeaderboard200ResponseData</code> from a plain JavaScript object, optionally creating a new instance.
52
52
  * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
53
53
  * @param {Object} data The plain JavaScript object bearing properties of interest.
54
- * @param {module:model/AdminEndLeaderboard200ResponseData} obj Optional instance to populate.
55
- * @return {module:model/AdminEndLeaderboard200ResponseData} The populated <code>AdminEndLeaderboard200ResponseData</code> instance.
54
+ * @param {module:model/AdminCreateLeaderboard200ResponseData} obj Optional instance to populate.
55
+ * @return {module:model/AdminCreateLeaderboard200ResponseData} The populated <code>AdminCreateLeaderboard200ResponseData</code> instance.
56
56
  */
57
57
  }, {
58
58
  key: "constructFromObject",
59
59
  value: function constructFromObject(data, obj) {
60
60
  if (data) {
61
- obj = obj || new AdminEndLeaderboard200ResponseData();
61
+ obj = obj || new AdminCreateLeaderboard200ResponseData();
62
62
  if (data.hasOwnProperty('description')) {
63
63
  obj['description'] = _ApiClient["default"].convertToType(data['description'], 'String');
64
64
  }
@@ -97,9 +97,9 @@ var AdminEndLeaderboard200ResponseData = /*#__PURE__*/function () {
97
97
  }
98
98
 
99
99
  /**
100
- * Validates the JSON data with respect to <code>AdminEndLeaderboard200ResponseData</code>.
100
+ * Validates the JSON data with respect to <code>AdminCreateLeaderboard200ResponseData</code>.
101
101
  * @param {Object} data The plain JavaScript object bearing properties of interest.
102
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdminEndLeaderboard200ResponseData</code>.
102
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdminCreateLeaderboard200ResponseData</code>.
103
103
  */
104
104
  }, {
105
105
  key: "validateJSON",
@@ -131,64 +131,64 @@ var AdminEndLeaderboard200ResponseData = /*#__PURE__*/function () {
131
131
  /**
132
132
  * @member {String} description
133
133
  */
134
- AdminEndLeaderboard200ResponseData.prototype['description'] = undefined;
134
+ AdminCreateLeaderboard200ResponseData.prototype['description'] = undefined;
135
135
 
136
136
  /**
137
137
  * @member {Date} ends_at
138
138
  */
139
- AdminEndLeaderboard200ResponseData.prototype['ends_at'] = undefined;
139
+ AdminCreateLeaderboard200ResponseData.prototype['ends_at'] = undefined;
140
140
 
141
141
  /**
142
142
  * @member {Number} id
143
143
  */
144
- AdminEndLeaderboard200ResponseData.prototype['id'] = undefined;
144
+ AdminCreateLeaderboard200ResponseData.prototype['id'] = undefined;
145
145
 
146
146
  /**
147
147
  * @member {Date} inserted_at
148
148
  */
149
- AdminEndLeaderboard200ResponseData.prototype['inserted_at'] = undefined;
149
+ AdminCreateLeaderboard200ResponseData.prototype['inserted_at'] = undefined;
150
150
 
151
151
  /**
152
152
  * @member {Object} metadata
153
153
  */
154
- AdminEndLeaderboard200ResponseData.prototype['metadata'] = undefined;
154
+ AdminCreateLeaderboard200ResponseData.prototype['metadata'] = undefined;
155
155
 
156
156
  /**
157
- * @member {module:model/AdminEndLeaderboard200ResponseData.OperatorEnum} operator
157
+ * @member {module:model/AdminCreateLeaderboard200ResponseData.OperatorEnum} operator
158
158
  */
159
- AdminEndLeaderboard200ResponseData.prototype['operator'] = undefined;
159
+ AdminCreateLeaderboard200ResponseData.prototype['operator'] = undefined;
160
160
 
161
161
  /**
162
162
  * @member {String} slug
163
163
  */
164
- AdminEndLeaderboard200ResponseData.prototype['slug'] = undefined;
164
+ AdminCreateLeaderboard200ResponseData.prototype['slug'] = undefined;
165
165
 
166
166
  /**
167
- * @member {module:model/AdminEndLeaderboard200ResponseData.SortOrderEnum} sort_order
167
+ * @member {module:model/AdminCreateLeaderboard200ResponseData.SortOrderEnum} sort_order
168
168
  */
169
- AdminEndLeaderboard200ResponseData.prototype['sort_order'] = undefined;
169
+ AdminCreateLeaderboard200ResponseData.prototype['sort_order'] = undefined;
170
170
 
171
171
  /**
172
172
  * @member {Date} starts_at
173
173
  */
174
- AdminEndLeaderboard200ResponseData.prototype['starts_at'] = undefined;
174
+ AdminCreateLeaderboard200ResponseData.prototype['starts_at'] = undefined;
175
175
 
176
176
  /**
177
177
  * @member {String} title
178
178
  */
179
- AdminEndLeaderboard200ResponseData.prototype['title'] = undefined;
179
+ AdminCreateLeaderboard200ResponseData.prototype['title'] = undefined;
180
180
 
181
181
  /**
182
182
  * @member {Date} updated_at
183
183
  */
184
- AdminEndLeaderboard200ResponseData.prototype['updated_at'] = undefined;
184
+ AdminCreateLeaderboard200ResponseData.prototype['updated_at'] = undefined;
185
185
 
186
186
  /**
187
187
  * Allowed values for the <code>operator</code> property.
188
188
  * @enum {String}
189
189
  * @readonly
190
190
  */
191
- AdminEndLeaderboard200ResponseData['OperatorEnum'] = {
191
+ AdminCreateLeaderboard200ResponseData['OperatorEnum'] = {
192
192
  /**
193
193
  * value: "set"
194
194
  * @const
@@ -216,7 +216,7 @@ AdminEndLeaderboard200ResponseData['OperatorEnum'] = {
216
216
  * @enum {String}
217
217
  * @readonly
218
218
  */
219
- AdminEndLeaderboard200ResponseData['SortOrderEnum'] = {
219
+ AdminCreateLeaderboard200ResponseData['SortOrderEnum'] = {
220
220
  /**
221
221
  * value: "desc"
222
222
  * @const
@@ -228,4 +228,4 @@ AdminEndLeaderboard200ResponseData['SortOrderEnum'] = {
228
228
  */
229
229
  "asc": "asc"
230
230
  };
231
- var _default = exports["default"] = AdminEndLeaderboard200ResponseData;
231
+ var _default = exports["default"] = AdminCreateLeaderboard200ResponseData;
@@ -18,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  * Game Server API
19
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 })) ```
20
20
  *
21
- * The version of the OpenAPI document: 1.0.1001
21
+ * The version of the OpenAPI document: 1.0.1004
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -18,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  * Game Server API
19
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 })) ```
20
20
  *
21
- * The version of the OpenAPI document: 1.0.1001
21
+ * The version of the OpenAPI document: 1.0.1004
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -15,7 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  * Game Server API
16
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 })) ```
17
17
  *
18
- * The version of the OpenAPI document: 1.0.1001
18
+ * The version of the OpenAPI document: 1.0.1004
19
19
  *
20
20
  *
21
21
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -24,18 +24,18 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
24
24
  *
25
25
  */
26
26
  /**
27
- * The DeleteNotifications200Response model module.
28
- * @module model/DeleteNotifications200Response
27
+ * The AdminDeleteChatConversation200Response model module.
28
+ * @module model/AdminDeleteChatConversation200Response
29
29
  * @version 1.0.0
30
30
  */
31
- var DeleteNotifications200Response = /*#__PURE__*/function () {
31
+ var AdminDeleteChatConversation200Response = /*#__PURE__*/function () {
32
32
  /**
33
- * Constructs a new <code>DeleteNotifications200Response</code>.
34
- * @alias module:model/DeleteNotifications200Response
33
+ * Constructs a new <code>AdminDeleteChatConversation200Response</code>.
34
+ * @alias module:model/AdminDeleteChatConversation200Response
35
35
  */
36
- function DeleteNotifications200Response() {
37
- _classCallCheck(this, DeleteNotifications200Response);
38
- DeleteNotifications200Response.initialize(this);
36
+ function AdminDeleteChatConversation200Response() {
37
+ _classCallCheck(this, AdminDeleteChatConversation200Response);
38
+ AdminDeleteChatConversation200Response.initialize(this);
39
39
  }
40
40
 
41
41
  /**
@@ -43,22 +43,22 @@ var DeleteNotifications200Response = /*#__PURE__*/function () {
43
43
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
44
44
  * Only for internal use.
45
45
  */
46
- return _createClass(DeleteNotifications200Response, null, [{
46
+ return _createClass(AdminDeleteChatConversation200Response, null, [{
47
47
  key: "initialize",
48
48
  value: function initialize(obj) {}
49
49
 
50
50
  /**
51
- * Constructs a <code>DeleteNotifications200Response</code> from a plain JavaScript object, optionally creating a new instance.
51
+ * Constructs a <code>AdminDeleteChatConversation200Response</code> from a plain JavaScript object, optionally creating a new instance.
52
52
  * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
53
53
  * @param {Object} data The plain JavaScript object bearing properties of interest.
54
- * @param {module:model/DeleteNotifications200Response} obj Optional instance to populate.
55
- * @return {module:model/DeleteNotifications200Response} The populated <code>DeleteNotifications200Response</code> instance.
54
+ * @param {module:model/AdminDeleteChatConversation200Response} obj Optional instance to populate.
55
+ * @return {module:model/AdminDeleteChatConversation200Response} The populated <code>AdminDeleteChatConversation200Response</code> instance.
56
56
  */
57
57
  }, {
58
58
  key: "constructFromObject",
59
59
  value: function constructFromObject(data, obj) {
60
60
  if (data) {
61
- obj = obj || new DeleteNotifications200Response();
61
+ obj = obj || new AdminDeleteChatConversation200Response();
62
62
  if (data.hasOwnProperty('deleted')) {
63
63
  obj['deleted'] = _ApiClient["default"].convertToType(data['deleted'], 'Number');
64
64
  }
@@ -67,9 +67,9 @@ var DeleteNotifications200Response = /*#__PURE__*/function () {
67
67
  }
68
68
 
69
69
  /**
70
- * Validates the JSON data with respect to <code>DeleteNotifications200Response</code>.
70
+ * Validates the JSON data with respect to <code>AdminDeleteChatConversation200Response</code>.
71
71
  * @param {Object} data The plain JavaScript object bearing properties of interest.
72
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>DeleteNotifications200Response</code>.
72
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdminDeleteChatConversation200Response</code>.
73
73
  */
74
74
  }, {
75
75
  key: "validateJSON",
@@ -79,8 +79,7 @@ var DeleteNotifications200Response = /*#__PURE__*/function () {
79
79
  }]);
80
80
  }();
81
81
  /**
82
- * Number of notifications deleted
83
82
  * @member {Number} deleted
84
83
  */
85
- DeleteNotifications200Response.prototype['deleted'] = undefined;
86
- var _default = exports["default"] = DeleteNotifications200Response;
84
+ AdminDeleteChatConversation200Response.prototype['deleted'] = undefined;
85
+ var _default = exports["default"] = AdminDeleteChatConversation200Response;
@@ -18,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  * Game Server API
19
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 })) ```
20
20
  *
21
- * The version of the OpenAPI document: 1.0.1001
21
+ * The version of the OpenAPI document: 1.0.1004
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -27,20 +27,20 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
27
27
  *
28
28
  */
29
29
  /**
30
- * The AdminUnlockAchievementRequest model module.
31
- * @module model/AdminUnlockAchievementRequest
30
+ * The AdminGrantAchievementRequest model module.
31
+ * @module model/AdminGrantAchievementRequest
32
32
  * @version 1.0.0
33
33
  */
34
- var AdminUnlockAchievementRequest = /*#__PURE__*/function () {
34
+ var AdminGrantAchievementRequest = /*#__PURE__*/function () {
35
35
  /**
36
- * Constructs a new <code>AdminUnlockAchievementRequest</code>.
37
- * @alias module:model/AdminUnlockAchievementRequest
36
+ * Constructs a new <code>AdminGrantAchievementRequest</code>.
37
+ * @alias module:model/AdminGrantAchievementRequest
38
38
  * @param slug {String}
39
39
  * @param userId {Number}
40
40
  */
41
- function AdminUnlockAchievementRequest(slug, userId) {
42
- _classCallCheck(this, AdminUnlockAchievementRequest);
43
- AdminUnlockAchievementRequest.initialize(this, slug, userId);
41
+ function AdminGrantAchievementRequest(slug, userId) {
42
+ _classCallCheck(this, AdminGrantAchievementRequest);
43
+ AdminGrantAchievementRequest.initialize(this, slug, userId);
44
44
  }
45
45
 
46
46
  /**
@@ -48,7 +48,7 @@ var AdminUnlockAchievementRequest = /*#__PURE__*/function () {
48
48
  * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
49
49
  * Only for internal use.
50
50
  */
51
- return _createClass(AdminUnlockAchievementRequest, null, [{
51
+ return _createClass(AdminGrantAchievementRequest, null, [{
52
52
  key: "initialize",
53
53
  value: function initialize(obj, slug, userId) {
54
54
  obj['slug'] = slug;
@@ -56,17 +56,17 @@ var AdminUnlockAchievementRequest = /*#__PURE__*/function () {
56
56
  }
57
57
 
58
58
  /**
59
- * Constructs a <code>AdminUnlockAchievementRequest</code> from a plain JavaScript object, optionally creating a new instance.
59
+ * Constructs a <code>AdminGrantAchievementRequest</code> from a plain JavaScript object, optionally creating a new instance.
60
60
  * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
61
61
  * @param {Object} data The plain JavaScript object bearing properties of interest.
62
- * @param {module:model/AdminUnlockAchievementRequest} obj Optional instance to populate.
63
- * @return {module:model/AdminUnlockAchievementRequest} The populated <code>AdminUnlockAchievementRequest</code> instance.
62
+ * @param {module:model/AdminGrantAchievementRequest} obj Optional instance to populate.
63
+ * @return {module:model/AdminGrantAchievementRequest} The populated <code>AdminGrantAchievementRequest</code> instance.
64
64
  */
65
65
  }, {
66
66
  key: "constructFromObject",
67
67
  value: function constructFromObject(data, obj) {
68
68
  if (data) {
69
- obj = obj || new AdminUnlockAchievementRequest();
69
+ obj = obj || new AdminGrantAchievementRequest();
70
70
  if (data.hasOwnProperty('slug')) {
71
71
  obj['slug'] = _ApiClient["default"].convertToType(data['slug'], 'String');
72
72
  }
@@ -78,15 +78,15 @@ var AdminUnlockAchievementRequest = /*#__PURE__*/function () {
78
78
  }
79
79
 
80
80
  /**
81
- * Validates the JSON data with respect to <code>AdminUnlockAchievementRequest</code>.
81
+ * Validates the JSON data with respect to <code>AdminGrantAchievementRequest</code>.
82
82
  * @param {Object} data The plain JavaScript object bearing properties of interest.
83
- * @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdminUnlockAchievementRequest</code>.
83
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>AdminGrantAchievementRequest</code>.
84
84
  */
85
85
  }, {
86
86
  key: "validateJSON",
87
87
  value: function validateJSON(data) {
88
88
  // check to make sure all required properties are present in the JSON string
89
- var _iterator = _createForOfIteratorHelper(AdminUnlockAchievementRequest.RequiredProperties),
89
+ var _iterator = _createForOfIteratorHelper(AdminGrantAchievementRequest.RequiredProperties),
90
90
  _step;
91
91
  try {
92
92
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -108,15 +108,15 @@ var AdminUnlockAchievementRequest = /*#__PURE__*/function () {
108
108
  }
109
109
  }]);
110
110
  }();
111
- AdminUnlockAchievementRequest.RequiredProperties = ["slug", "user_id"];
111
+ AdminGrantAchievementRequest.RequiredProperties = ["slug", "user_id"];
112
112
 
113
113
  /**
114
114
  * @member {String} slug
115
115
  */
116
- AdminUnlockAchievementRequest.prototype['slug'] = undefined;
116
+ AdminGrantAchievementRequest.prototype['slug'] = undefined;
117
117
 
118
118
  /**
119
119
  * @member {Number} user_id
120
120
  */
121
- AdminUnlockAchievementRequest.prototype['user_id'] = undefined;
122
- var _default = exports["default"] = AdminUnlockAchievementRequest;
121
+ AdminGrantAchievementRequest.prototype['user_id'] = undefined;
122
+ var _default = exports["default"] = AdminGrantAchievementRequest;
@@ -18,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
18
18
  * Game Server API
19
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 })) ```
20
20
  *
21
- * The version of the OpenAPI document: 1.0.1001
21
+ * The version of the OpenAPI document: 1.0.1004
22
22
  *
23
23
  *
24
24
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
- var _AdminUpdateAchievement200Response = _interopRequireDefault(require("./AdminUpdateAchievement200Response"));
8
+ var _AdminListAchievements200ResponseDataInner = _interopRequireDefault(require("./AdminListAchievements200ResponseDataInner"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
10
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
11
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
@@ -19,7 +19,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  * Game Server API
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, 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 })) ```
21
21
  *
22
- * The version of the OpenAPI document: 1.0.1001
22
+ * The version of the OpenAPI document: 1.0.1004
23
23
  *
24
24
  *
25
25
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -64,7 +64,7 @@ var AdminListAchievements200Response = /*#__PURE__*/function () {
64
64
  if (data) {
65
65
  obj = obj || new AdminListAchievements200Response();
66
66
  if (data.hasOwnProperty('data')) {
67
- obj['data'] = _ApiClient["default"].convertToType(data['data'], [_AdminUpdateAchievement200Response["default"]]);
67
+ obj['data'] = _ApiClient["default"].convertToType(data['data'], [_AdminListAchievements200ResponseDataInner["default"]]);
68
68
  }
69
69
  if (data.hasOwnProperty('meta')) {
70
70
  obj['meta'] = _ApiClient["default"].convertToType(data['meta'], Object);
@@ -93,7 +93,7 @@ var AdminListAchievements200Response = /*#__PURE__*/function () {
93
93
  try {
94
94
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
95
95
  var item = _step.value;
96
- _AdminUpdateAchievement200Response["default"].validateJSON(item);
96
+ _AdminListAchievements200ResponseDataInner["default"].validateJSON(item);
97
97
  }
98
98
  } catch (err) {
99
99
  _iterator.e(err);
@@ -107,7 +107,7 @@ var AdminListAchievements200Response = /*#__PURE__*/function () {
107
107
  }]);
108
108
  }();
109
109
  /**
110
- * @member {Array.<module:model/AdminUpdateAchievement200Response>} data
110
+ * @member {Array.<module:model/AdminListAchievements200ResponseDataInner>} data
111
111
  */
112
112
  AdminListAchievements200Response.prototype['data'] = undefined;
113
113