@ughuuu/game_server 1.0.382 → 1.0.791
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.
- package/README.md +174 -24
- package/dist/ApiClient.js +2 -2
- package/dist/api/AchievementsApi.js +224 -0
- package/dist/api/AdminAchievementsApi.js +356 -0
- package/dist/api/AdminChatApi.js +2 -2
- package/dist/api/AdminGroupsApi.js +2 -2
- package/dist/api/AdminKVApi.js +2 -2
- package/dist/api/AdminLeaderboardsApi.js +2 -2
- package/dist/api/AdminLobbiesApi.js +2 -2
- package/dist/api/AdminNotificationsApi.js +2 -2
- package/dist/api/AdminSessionsApi.js +2 -2
- package/dist/api/AdminUsersApi.js +2 -2
- package/dist/api/AuthenticationApi.js +2 -2
- package/dist/api/ChatApi.js +141 -12
- package/dist/api/FriendsApi.js +2 -2
- package/dist/api/GroupsApi.js +69 -27
- package/dist/api/HealthApi.js +2 -2
- package/dist/api/HooksApi.js +2 -2
- package/dist/api/KVApi.js +2 -2
- package/dist/api/LeaderboardsApi.js +43 -2
- package/dist/api/LobbiesApi.js +44 -2
- package/dist/api/NotificationsApi.js +2 -2
- package/dist/api/PartiesApi.js +206 -22
- package/dist/api/UsersApi.js +2 -2
- package/dist/index.js +157 -10
- package/dist/model/AcceptPartyInviteRequest.js +109 -0
- package/dist/model/AdminCreateAchievementRequest.js +182 -0
- package/dist/model/AdminCreateKvEntry200Response.js +2 -2
- package/dist/model/AdminCreateKvEntryRequest.js +2 -2
- package/dist/model/AdminCreateLeaderboardRequest.js +2 -2
- package/dist/model/AdminCreateNotification400Response.js +2 -2
- package/dist/model/AdminCreateNotificationRequest.js +2 -2
- package/dist/model/AdminDeleteChatConversation200Response.js +2 -2
- package/dist/model/AdminEndLeaderboard200Response.js +2 -2
- package/dist/model/AdminEndLeaderboard200ResponseData.js +2 -2
- package/dist/model/AdminIncrementAchievementRequest.js +130 -0
- package/dist/model/AdminListAchievements200Response.js +118 -0
- package/dist/model/AdminListChatMessages200Response.js +2 -2
- package/dist/model/AdminListChatMessages200ResponseDataInner.js +20 -3
- package/dist/model/AdminListGroups200Response.js +2 -2
- package/dist/model/AdminListKvEntries200Response.js +2 -2
- package/dist/model/AdminListKvEntries200ResponseDataInner.js +2 -2
- package/dist/model/AdminListLobbies200Response.js +2 -2
- package/dist/model/AdminListLobbies200ResponseDataInner.js +32 -2
- package/dist/model/AdminListNotifications200Response.js +2 -2
- package/dist/model/AdminListNotifications200ResponseDataInner.js +15 -2
- package/dist/model/AdminListNotifications200ResponseMeta.js +2 -2
- package/dist/model/AdminListSessions200Response.js +2 -2
- package/dist/model/AdminListSessions200ResponseDataInner.js +2 -2
- package/dist/model/AdminRevokeAchievementRequest.js +118 -0
- package/dist/model/AdminSubmitLeaderboardScore200Response.js +2 -2
- package/dist/model/AdminSubmitLeaderboardScore200ResponseData.js +14 -2
- package/dist/model/AdminSubmitLeaderboardScoreRequest.js +20 -8
- package/dist/model/AdminUnlockAchievementRequest.js +122 -0
- package/dist/model/AdminUpdateAchievement200Response.js +181 -0
- package/dist/model/AdminUpdateAchievementRequest.js +145 -0
- package/dist/model/AdminUpdateGroup200Response.js +23 -2
- package/dist/model/AdminUpdateGroupRequest.js +11 -2
- package/dist/model/AdminUpdateKvEntryRequest.js +2 -2
- package/dist/model/AdminUpdateLeaderboardRecordRequest.js +2 -2
- package/dist/model/AdminUpdateLeaderboardRequest.js +2 -2
- package/dist/model/AdminUpdateLobby200Response.js +2 -2
- package/dist/model/AdminUpdateLobbyRequest.js +11 -2
- package/dist/model/AdminUpdateUser200Response.js +2 -2
- package/dist/model/AdminUpdateUser200ResponseData.js +2 -2
- package/dist/model/AdminUpdateUserRequest.js +2 -2
- package/dist/model/CallHook200Response.js +2 -2
- package/dist/model/CallHookRequest.js +2 -2
- package/dist/model/CancelGroupInvite200Response.js +2 -2
- package/dist/model/CancelJoinRequest200Response.js +2 -2
- package/dist/model/CancelPartyInviteRequest.js +109 -0
- package/dist/model/ChatUnreadCount200Response.js +2 -2
- package/dist/model/CreateFriendRequestRequest.js +2 -2
- package/dist/model/CreateGroupRequest.js +11 -2
- package/dist/model/CreateLobbyRequest.js +11 -2
- package/dist/model/CreatePartyRequest.js +2 -2
- package/dist/model/DeclinePartyInviteRequest.js +109 -0
- package/dist/model/DeleteNotifications200Response.js +2 -2
- package/dist/model/DeleteNotificationsRequest.js +2 -2
- package/dist/model/DemoteGroupMemberRequest.js +2 -2
- package/dist/model/DeviceLoginRequest.js +2 -2
- package/dist/model/ErrorResponse.js +2 -2
- package/dist/model/GetChatMessage200Response.js +196 -0
- package/dist/model/GetCurrentUser200Response.js +2 -2
- package/dist/model/GetCurrentUser200ResponseLinkedProviders.js +2 -2
- package/dist/model/GetKv200Response.js +2 -2
- package/dist/model/GetLobby200Response.js +133 -0
- package/dist/model/GetLobby200ResponseMembersInner.js +146 -0
- package/dist/model/GetMyRecord200Response.js +2 -2
- package/dist/model/HealthResponse.js +2 -2
- package/dist/model/InviteToGroup200Response.js +90 -0
- package/dist/model/InviteToGroupRequest.js +2 -2
- package/dist/model/InviteToPartyRequest.js +109 -0
- package/dist/model/KickGroupMemberRequest.js +2 -2
- package/dist/model/KickUserRequest.js +2 -2
- package/dist/model/LinkDeviceRequest.js +2 -2
- package/dist/model/ListBlockedFriends200Response.js +2 -2
- package/dist/model/ListBlockedFriends200ResponseDataInner.js +2 -2
- package/dist/model/ListBlockedFriends200ResponseDataInnerRequester.js +2 -2
- package/dist/model/ListChatMessages200Response.js +6 -6
- package/dist/model/ListFriendRequests200Response.js +2 -2
- package/dist/model/ListFriendRequests200ResponseIncomingInner.js +2 -2
- package/dist/model/ListFriendRequests200ResponseIncomingInnerRequester.js +11 -2
- package/dist/model/ListFriendRequests200ResponseMeta.js +2 -2
- package/dist/model/ListFriends200Response.js +2 -2
- package/dist/model/ListFriends200ResponseDataInner.js +11 -2
- package/dist/model/ListGroupInvitations200Response.js +2 -2
- package/dist/model/ListGroupInvitations200ResponseDataInner.js +48 -3
- package/dist/model/ListGroupMembers200Response.js +2 -2
- package/dist/model/ListGroupMembers200ResponseDataInner.js +2 -2
- package/dist/model/ListJoinRequests200Response.js +2 -2
- package/dist/model/ListLeaderboardRecords200Response.js +2 -2
- package/dist/model/ListLeaderboardRecords200ResponseDataInner.js +4 -4
- package/dist/model/ListLeaderboards200Response.js +2 -2
- package/dist/model/ListLeaderboards200ResponseDataInner.js +2 -2
- package/dist/model/ListLobbies200Response.js +2 -2
- package/dist/model/ListLobbies200ResponseDataInner.js +24 -2
- package/dist/model/ListMyGroups200Response.js +2 -2
- package/dist/model/ListMyGroups200ResponseDataInner.js +24 -2
- package/dist/model/ListNotifications200Response.js +2 -2
- package/dist/model/ListNotifications200ResponseDataInner.js +15 -2
- package/dist/model/ListPartyInvitations200ResponseInner.js +155 -0
- package/dist/model/ListRecordsAroundUser200Response.js +2 -2
- package/dist/model/ListSentInvitations200Response.js +2 -2
- package/dist/model/ListSentInvitations200ResponseDataInner.js +26 -2
- package/dist/model/Login200Response.js +2 -2
- package/dist/model/Login200ResponseData.js +15 -2
- package/dist/model/LoginRequest.js +2 -2
- package/dist/model/MarkChatReadRequest.js +8 -3
- package/dist/model/NotifyGroup200Response.js +2 -2
- package/dist/model/NotifyGroupRequest.js +3 -3
- package/dist/model/OAuthSessionData.js +15 -2
- package/dist/model/OAuthSessionDataDetails.js +2 -2
- package/dist/model/OAuthSessionStatus.js +2 -2
- package/dist/model/OauthApiCallback200Response.js +2 -2
- package/dist/model/OauthApiCallbackRequest.js +2 -2
- package/dist/model/OauthCallbackApiAppleIosRequest.js +2 -2
- package/dist/model/OauthGoogleIdTokenRequest.js +2 -2
- package/dist/model/OauthRequest200Response.js +2 -2
- package/dist/model/OauthSessionStatus404Response.js +2 -2
- package/dist/model/PartyCreateLobbyRequest.js +2 -2
- package/dist/model/PartyJoinLobbyRequest.js +2 -2
- package/dist/model/PromoteGroupMemberRequest.js +2 -2
- package/dist/model/QuickJoinRequest.js +2 -2
- package/dist/model/RefreshToken200Response.js +2 -2
- package/dist/model/RefreshToken200ResponseData.js +15 -2
- package/dist/model/RefreshTokenRequest.js +2 -2
- package/dist/model/ResolveLeaderboardSlugs200Response.js +89 -0
- package/dist/model/ResolveLeaderboardSlugsRequest.js +113 -0
- package/dist/model/SearchUsers200Response.js +2 -2
- package/dist/model/SearchUsers200ResponseDataInner.js +11 -2
- package/dist/model/SendChatMessageRequest.js +10 -5
- package/dist/model/SendNotificationRequest.js +2 -2
- package/dist/model/ShowParty200Response.js +13 -13
- package/dist/model/ShowParty200ResponseMembersInner.js +11 -2
- package/dist/model/UpdateChatMessageRequest.js +99 -0
- package/dist/model/UpdateCurrentUserDisplayNameRequest.js +2 -2
- package/dist/model/UpdateCurrentUserPassword400Response.js +2 -2
- package/dist/model/UpdateCurrentUserPasswordRequest.js +2 -2
- package/dist/model/UpdateGroupRequest.js +11 -2
- package/dist/model/UpdateLobbyRequest.js +11 -2
- package/dist/model/UpdatePartyRequest.js +2 -2
- package/dist/model/UserAchievements200Response.js +124 -0
- package/dist/model/UserAchievements200ResponseDataInner.js +192 -0
- package/dist/realtime.js +247 -0
- package/dist/webrtc.js +375 -0
- package/package.json +16 -23
- package/dist/model/CreateLobby401Response.js +0 -89
- package/dist/model/JoinLobby200Response.js +0 -89
- package/dist/model/JoinLobbyRequest.js +0 -90
- package/dist/model/JoinPartyByCodeRequest.js +0 -113
- package/dist/model/KickUser200Response.js +0 -89
- package/dist/model/LeaveLobby200Response.js +0 -89
- package/dist/model/ListChatMessages200ResponseDataInner.js +0 -170
- package/dist/model/ListLeaderboardRecords200ResponseMeta.js +0 -125
- package/dist/model/ListLobbies200ResponseInner.js +0 -153
- package/dist/model/ListLobbies200ResponseMeta.js +0 -125
- package/dist/model/Login200ResponseDataUser.js +0 -97
- package/dist/model/RemoveFriendship401Response.js +0 -89
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @ughuuu/game_server
|
|
2
2
|
|
|
3
3
|
UghuuuGameServer - JavaScript client for @ughuuu/game_server
|
|
4
|
-
API for Game Server
|
|
4
|
+
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, server scripting, and admin portal.
|
|
5
5
|
|
|
6
|
-
## Authentication
|
|
6
|
+
## **1. Authentication**
|
|
7
7
|
|
|
8
8
|
This API uses JWT (JSON Web Tokens) with access and refresh tokens:
|
|
9
9
|
|
|
10
|
-
### Getting Tokens
|
|
10
|
+
### **1.1 Getting Tokens**
|
|
11
11
|
- **Email/Password**: POST to `/api/v1/login` with email and password
|
|
12
12
|
- **Device (SDK)**: POST to `/api/v1/login` with a `device_id` string (creates/returns a device user)
|
|
13
13
|
- **Discord OAuth**: Use `/api/v1/auth/discord` flow
|
|
@@ -20,16 +20,16 @@ Both methods return:
|
|
|
20
20
|
- `access_token` - Short-lived (15 min), use for API requests
|
|
21
21
|
- `refresh_token` - Long-lived (30 days), use to get new access tokens
|
|
22
22
|
|
|
23
|
-
### Using Tokens
|
|
23
|
+
### **1.2 Using Tokens**
|
|
24
24
|
Include the access token in the Authorization header:
|
|
25
25
|
```
|
|
26
26
|
Authorization: Bearer <access_token>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### Refreshing Tokens
|
|
29
|
+
### **1.3 Refreshing Tokens**
|
|
30
30
|
When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token.
|
|
31
31
|
|
|
32
|
-
## Users
|
|
32
|
+
## **2. Users**
|
|
33
33
|
Users endpoints cover the user lifecycle and profile features. Key highlights:
|
|
34
34
|
|
|
35
35
|
- **Registration and login** (email/password, device token for SDKs, and OAuth providers)
|
|
@@ -37,14 +37,14 @@ Users endpoints cover the user lifecycle and profile features. Key highlights:
|
|
|
37
37
|
- **Account lifecycle**: password reset, email confirmation, and account deletion
|
|
38
38
|
- **Sessions & tokens**: both browser sessions and JWT-based API tokens are supported
|
|
39
39
|
|
|
40
|
-
## Friends
|
|
40
|
+
## **3. Friends**
|
|
41
41
|
The Friends domain offers lightweight social features:
|
|
42
42
|
|
|
43
43
|
- **Friend requests** (send / accept / reject / block flows)
|
|
44
44
|
- **Friend listing & pagination**, with basic privacy controls
|
|
45
45
|
- **Domain helpers** to manage and query friend relationships from API or UI contexts
|
|
46
46
|
|
|
47
|
-
## Lobbies
|
|
47
|
+
## **4. Lobbies**
|
|
48
48
|
Lobbies provide matchmaking / room management primitives. Highlights:
|
|
49
49
|
|
|
50
50
|
- **Create / list / update / delete** lobbies with rich metadata (mode, region, tags)
|
|
@@ -53,7 +53,7 @@ Lobbies provide matchmaking / room management primitives. Highlights:
|
|
|
53
53
|
- **Controls & protection**: max users, hidden/locked states, and optional password protection
|
|
54
54
|
- **Hidden lobbies** are excluded from public listings; public listing endpoints are paginated
|
|
55
55
|
|
|
56
|
-
## Notifications
|
|
56
|
+
## **5. Notifications**
|
|
57
57
|
Persistent user-to-user notifications that survive across sessions:
|
|
58
58
|
|
|
59
59
|
- **Send notifications** to accepted friends with a title, optional content, and optional metadata
|
|
@@ -62,11 +62,124 @@ Persistent user-to-user notifications that survive across sessions:
|
|
|
62
62
|
- **Real-time delivery** via the user WebSocket channel (`\"notification\"` events)
|
|
63
63
|
- **Offline delivery**: undeleted notifications are replayed on WebSocket reconnect
|
|
64
64
|
|
|
65
|
+
## **6. Groups**
|
|
66
|
+
Groups provide persistent community management for players:
|
|
67
|
+
|
|
68
|
+
- **Three group types**: `public` (anyone joins directly), `private` (users request to join, admins approve), `hidden` (invite-only, never listed)
|
|
69
|
+
- **Membership roles**: `admin` and `member`, with promote/demote capabilities
|
|
70
|
+
- **Join requests**: for private groups, users submit requests that admins approve or reject
|
|
71
|
+
- **Invitations**: admins can invite users directly (blocked users are rejected)
|
|
72
|
+
- **CRUD operations**: create, update, delete groups with metadata support
|
|
73
|
+
- **Group chat**: integrated via the Chat API with `chat_type: \"group\"`
|
|
74
|
+
|
|
75
|
+
## **7. Parties**
|
|
76
|
+
Ephemeral groups of users for short-lived sessions (e.g., matchmaking squads):
|
|
77
|
+
|
|
78
|
+
- **Invite-only joining**: the party leader sends invites by user ID to friends or shared-group members
|
|
79
|
+
- **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`
|
|
80
|
+
- **Invite visibility**: leader can list sent invites (`GET /parties/invitations/sent`); recipient can list received invites (`GET /parties/invitations`)
|
|
81
|
+
- **Connection requirement**: invites can only be sent to users who are friends or share at least one group with the leader
|
|
82
|
+
- **One party at a time**: a user can only be in one party; accepting an invite while already in a party is rejected
|
|
83
|
+
- **Leader management**: the creator is the leader; leadership can be transferred
|
|
84
|
+
- **Lobby integration**: parties can create or join lobbies as a group
|
|
85
|
+
- **Party chat**: integrated via the Chat API with `chat_type: \"party\"`
|
|
86
|
+
- **Real-time events** via the party WebSocket channel
|
|
87
|
+
|
|
88
|
+
## **8. Chat**
|
|
89
|
+
Real-time messaging across multiple conversation types:
|
|
90
|
+
|
|
91
|
+
- **Chat types**: `lobby` (within a lobby), `group` (within a group), `party` (within a party), `friend` (DMs between friends)
|
|
92
|
+
- **Send messages** with content, optional metadata, and automatic access validation
|
|
93
|
+
- **List messages** with pagination (newest first)
|
|
94
|
+
- **Read tracking**: mark messages as read and get unread counts per conversation
|
|
95
|
+
- **Real-time delivery** via PubSub and WebSocket channels
|
|
96
|
+
- **Moderation hooks**: `before_chat_message` pipeline hook for filtering/blocking
|
|
97
|
+
|
|
98
|
+
## **9. Leaderboards**
|
|
99
|
+
Server-managed ranked scoreboards:
|
|
100
|
+
|
|
101
|
+
- **Multiple leaderboards**: create named leaderboards with configurable sort order
|
|
102
|
+
- **Score submission**: submit scores with optional metadata
|
|
103
|
+
- **Rankings**: retrieve paginated rankings with user details
|
|
104
|
+
- **Reset support**: leaderboards can be reset periodically
|
|
105
|
+
|
|
106
|
+
## **10. Key-Value Storage**
|
|
107
|
+
Per-user persistent key-value storage for game state, preferences, and settings:
|
|
108
|
+
|
|
109
|
+
- **Get/set/delete** key-value pairs scoped to the authenticated user
|
|
110
|
+
- **List keys** with optional prefix filtering
|
|
111
|
+
- **Metadata support**: values can include arbitrary JSON metadata
|
|
112
|
+
|
|
113
|
+
## **11. Achievements**
|
|
114
|
+
Track player accomplishments with progress-based or instant-unlock achievements:
|
|
115
|
+
|
|
116
|
+
- **Achievement definitions**: admin-created with slug, title, description, icon, sort order, and optional progress target
|
|
117
|
+
- **Progress tracking**: increment progress toward a target; auto-unlocks when progress reaches the target
|
|
118
|
+
- **Instant unlock**: directly unlock achievements without progress tracking
|
|
119
|
+
- **Hidden achievements**: details obscured (\"???\") until unlocked by the user
|
|
120
|
+
- **Public listings**: paginated, optionally filtered; authenticated users see their own progress
|
|
121
|
+
- **Admin management**: create, update, delete, grant, revoke, unlock, and increment achievements
|
|
122
|
+
|
|
123
|
+
## **12. Real-time: WebSocket Channels**
|
|
124
|
+
The server provides real-time communication via Phoenix WebSocket channels. Connect to the WebSocket endpoint and join topic-based channels for live updates.
|
|
125
|
+
|
|
126
|
+
### **12.1 Connection**
|
|
127
|
+
Connect to `wss://your-server.com/socket` with your JWT token as a parameter:
|
|
128
|
+
```
|
|
129
|
+
const socket = new Socket(\"wss://your-server.com/socket\", { params: { token: \"<access_token>\" } })
|
|
130
|
+
socket.connect()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### **12.2 Available Channels**
|
|
134
|
+
- **User channel** (`user:<user_id>`): notifications, friend events, achievement unlocks, party/group invites
|
|
135
|
+
- **Lobby channel** (`lobby:<lobby_id>`): lobby member joins/leaves, lobby updates, lobby chat
|
|
136
|
+
- **Lobbies channel** (`lobbies`): global lobby list changes (created, updated, deleted)
|
|
137
|
+
- **Group channel** (`group:<group_id>`): group member changes, group updates, group chat
|
|
138
|
+
- **Groups channel** (`groups`): global group list changes
|
|
139
|
+
- **Party channel** (`party:<party_id>`): party member changes, party updates, party chat
|
|
140
|
+
|
|
141
|
+
### **12.3 JS SDK Helper**
|
|
142
|
+
The `GameRealtime` class (included in this SDK) wraps Phoenix.Socket with convenient channel helpers:
|
|
143
|
+
```javascript
|
|
144
|
+
import { GameRealtime } from '@ughuuu/game_server'
|
|
145
|
+
const realtime = new GameRealtime('https://your-server.com', accessToken)
|
|
146
|
+
const userChannel = realtime.joinUserChannel(userId)
|
|
147
|
+
userChannel.on('notification', payload => console.log(payload))
|
|
148
|
+
```
|
|
149
|
+
Requires the `phoenix` npm package as a peer dependency: `npm install phoenix`
|
|
150
|
+
|
|
151
|
+
## **13. Real-time: WebRTC DataChannels**
|
|
152
|
+
For low-latency game data, the server supports WebRTC DataChannels alongside WebSocket. The server acts as a WebRTC peer (not P2P between clients).
|
|
153
|
+
|
|
154
|
+
### **13.1 How It Works**
|
|
155
|
+
1. Client connects via WebSocket and joins the **User channel**
|
|
156
|
+
2. Client sends an SDP offer over the channel (`webrtc:offer` event)
|
|
157
|
+
3. Server responds with an SDP answer (`webrtc:answer` event)
|
|
158
|
+
4. ICE candidates are exchanged (`webrtc:ice` events)
|
|
159
|
+
5. Once connected, named DataChannels carry game data at low latency
|
|
160
|
+
|
|
161
|
+
### **13.2 Default DataChannels**
|
|
162
|
+
- **`events`** (reliable, ordered): important game events (player actions, state changes)
|
|
163
|
+
- **`state`** (unreliable, unordered): high-frequency position/state sync
|
|
164
|
+
|
|
165
|
+
### **13.3 JS SDK Helper**
|
|
166
|
+
The `GameWebRTC` class (included in this SDK, browser-only) handles signaling automatically:
|
|
167
|
+
```javascript
|
|
168
|
+
import { GameRealtime, GameWebRTC } from '@ughuuu/game_server'
|
|
169
|
+
const realtime = new GameRealtime('https://your-server.com', token)
|
|
170
|
+
const userChannel = realtime.joinUserChannel(userId)
|
|
171
|
+
const webrtc = new GameWebRTC(userChannel, {
|
|
172
|
+
onData: (label, data) => console.log(label, data)
|
|
173
|
+
})
|
|
174
|
+
await webrtc.connect()
|
|
175
|
+
webrtc.send('events', JSON.stringify({ type: 'move', x: 10, y: 20 }))
|
|
176
|
+
```
|
|
177
|
+
|
|
65
178
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
66
179
|
|
|
67
|
-
- API version: 1.0.
|
|
180
|
+
- API version: 1.0.791
|
|
68
181
|
- Package version: 1.0.0
|
|
69
|
-
- Generator version: 7.
|
|
182
|
+
- Generator version: 7.20.0
|
|
70
183
|
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
|
|
71
184
|
|
|
72
185
|
## Installation
|
|
@@ -161,15 +274,10 @@ Please follow the [installation](#installation) instruction and execute the foll
|
|
|
161
274
|
```javascript
|
|
162
275
|
var UghuuuGameServer = require('@ughuuu/game_server');
|
|
163
276
|
|
|
164
|
-
var defaultClient = UghuuuGameServer.ApiClient.instance;
|
|
165
|
-
// Configure Bearer (JWT) access token for authorization: authorization
|
|
166
|
-
var authorization = defaultClient.authentications['authorization'];
|
|
167
|
-
authorization.accessToken = "YOUR ACCESS TOKEN"
|
|
168
277
|
|
|
169
|
-
var api = new UghuuuGameServer.
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
api.adminDeleteChatConversation(chatType, chatRefId).then(function(data) {
|
|
278
|
+
var api = new UghuuuGameServer.AchievementsApi()
|
|
279
|
+
var slug = "slug_example"; // {String}
|
|
280
|
+
api.getAchievement(slug).then(function(data) {
|
|
173
281
|
console.log('API called successfully. Returned data: ' + data);
|
|
174
282
|
}, function(error) {
|
|
175
283
|
console.error(error);
|
|
@@ -184,6 +292,18 @@ All URIs are relative to *http://localhost:4000*
|
|
|
184
292
|
|
|
185
293
|
Class | Method | HTTP request | Description
|
|
186
294
|
------------ | ------------- | ------------- | -------------
|
|
295
|
+
*UghuuuGameServer.AchievementsApi* | [**getAchievement**](docs/AchievementsApi.md#getAchievement) | **GET** /api/v1/achievements/{slug} | Get achievement details
|
|
296
|
+
*UghuuuGameServer.AchievementsApi* | [**listAchievements**](docs/AchievementsApi.md#listAchievements) | **GET** /api/v1/achievements | List achievements
|
|
297
|
+
*UghuuuGameServer.AchievementsApi* | [**myAchievements**](docs/AchievementsApi.md#myAchievements) | **GET** /api/v1/achievements/me | List my unlocked achievements
|
|
298
|
+
*UghuuuGameServer.AchievementsApi* | [**userAchievements**](docs/AchievementsApi.md#userAchievements) | **GET** /api/v1/achievements/user/{user_id} | List a user's unlocked achievements
|
|
299
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminCreateAchievement**](docs/AdminAchievementsApi.md#adminCreateAchievement) | **POST** /api/v1/admin/achievements | Create achievement (admin)
|
|
300
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminDeleteAchievement**](docs/AdminAchievementsApi.md#adminDeleteAchievement) | **DELETE** /api/v1/admin/achievements/{id} | Delete achievement (admin)
|
|
301
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminGrantAchievement**](docs/AdminAchievementsApi.md#adminGrantAchievement) | **POST** /api/v1/admin/achievements/grant | Grant achievement to user (admin)
|
|
302
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminIncrementAchievement**](docs/AdminAchievementsApi.md#adminIncrementAchievement) | **POST** /api/v1/admin/achievements/increment | Increment achievement progress for user (admin)
|
|
303
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminListAchievements**](docs/AdminAchievementsApi.md#adminListAchievements) | **GET** /api/v1/admin/achievements | List all achievements (admin, includes hidden)
|
|
304
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminRevokeAchievement**](docs/AdminAchievementsApi.md#adminRevokeAchievement) | **POST** /api/v1/admin/achievements/revoke | Revoke achievement from user (admin)
|
|
305
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminUnlockAchievement**](docs/AdminAchievementsApi.md#adminUnlockAchievement) | **POST** /api/v1/admin/achievements/unlock | Unlock achievement for user (admin)
|
|
306
|
+
*UghuuuGameServer.AdminAchievementsApi* | [**adminUpdateAchievement**](docs/AdminAchievementsApi.md#adminUpdateAchievement) | **PATCH** /api/v1/admin/achievements/{id} | Update achievement (admin)
|
|
187
307
|
*UghuuuGameServer.AdminChatApi* | [**adminDeleteChatConversation**](docs/AdminChatApi.md#adminDeleteChatConversation) | **DELETE** /api/v1/admin/chat/conversation | Delete all messages in a conversation (admin)
|
|
188
308
|
*UghuuuGameServer.AdminChatApi* | [**adminDeleteChatMessage**](docs/AdminChatApi.md#adminDeleteChatMessage) | **DELETE** /api/v1/admin/chat/{id} | Delete a chat message (admin)
|
|
189
309
|
*UghuuuGameServer.AdminChatApi* | [**adminListChatMessages**](docs/AdminChatApi.md#adminListChatMessages) | **GET** /api/v1/admin/chat | List all chat messages (admin)
|
|
@@ -228,9 +348,12 @@ Class | Method | HTTP request | Description
|
|
|
228
348
|
*UghuuuGameServer.AuthenticationApi* | [**unlinkDevice**](docs/AuthenticationApi.md#unlinkDevice) | **DELETE** /api/v1/me/device | Unlink device ID
|
|
229
349
|
*UghuuuGameServer.AuthenticationApi* | [**unlinkProvider**](docs/AuthenticationApi.md#unlinkProvider) | **DELETE** /api/v1/me/providers/{provider} | Unlink OAuth provider
|
|
230
350
|
*UghuuuGameServer.ChatApi* | [**chatUnreadCount**](docs/ChatApi.md#chatUnreadCount) | **GET** /api/v1/chat/unread | Get unread message count
|
|
351
|
+
*UghuuuGameServer.ChatApi* | [**deleteChatMessage**](docs/ChatApi.md#deleteChatMessage) | **DELETE** /api/v1/chat/messages/{id} | Delete your own chat message
|
|
352
|
+
*UghuuuGameServer.ChatApi* | [**getChatMessage**](docs/ChatApi.md#getChatMessage) | **GET** /api/v1/chat/messages/{id} | Get a single chat message
|
|
231
353
|
*UghuuuGameServer.ChatApi* | [**listChatMessages**](docs/ChatApi.md#listChatMessages) | **GET** /api/v1/chat/messages | List chat messages
|
|
232
354
|
*UghuuuGameServer.ChatApi* | [**markChatRead**](docs/ChatApi.md#markChatRead) | **POST** /api/v1/chat/read | Mark chat as read
|
|
233
355
|
*UghuuuGameServer.ChatApi* | [**sendChatMessage**](docs/ChatApi.md#sendChatMessage) | **POST** /api/v1/chat/messages | Send a chat message
|
|
356
|
+
*UghuuuGameServer.ChatApi* | [**updateChatMessage**](docs/ChatApi.md#updateChatMessage) | **PATCH** /api/v1/chat/messages/{id} | Update your own chat message
|
|
234
357
|
*UghuuuGameServer.FriendsApi* | [**acceptFriendRequest**](docs/FriendsApi.md#acceptFriendRequest) | **POST** /api/v1/friends/{id}/accept | Accept a friend request
|
|
235
358
|
*UghuuuGameServer.FriendsApi* | [**blockFriendRequest**](docs/FriendsApi.md#blockFriendRequest) | **POST** /api/v1/friends/{id}/block | Block a friend request / user
|
|
236
359
|
*UghuuuGameServer.FriendsApi* | [**createFriendRequest**](docs/FriendsApi.md#createFriendRequest) | **POST** /api/v1/friends | Send a friend request
|
|
@@ -240,14 +363,15 @@ Class | Method | HTTP request | Description
|
|
|
240
363
|
*UghuuuGameServer.FriendsApi* | [**rejectFriendRequest**](docs/FriendsApi.md#rejectFriendRequest) | **POST** /api/v1/friends/{id}/reject | Reject a friend request
|
|
241
364
|
*UghuuuGameServer.FriendsApi* | [**removeFriendship**](docs/FriendsApi.md#removeFriendship) | **DELETE** /api/v1/friends/{id} | Remove/cancel a friendship or request
|
|
242
365
|
*UghuuuGameServer.FriendsApi* | [**unblockFriend**](docs/FriendsApi.md#unblockFriend) | **POST** /api/v1/friends/{id}/unblock | Unblock a previously-blocked friendship
|
|
243
|
-
*UghuuuGameServer.GroupsApi* | [**acceptGroupInvite**](docs/GroupsApi.md#acceptGroupInvite) | **POST** /api/v1/groups/{
|
|
366
|
+
*UghuuuGameServer.GroupsApi* | [**acceptGroupInvite**](docs/GroupsApi.md#acceptGroupInvite) | **POST** /api/v1/groups/invitations/{invite_id}/accept | Accept a group invitation
|
|
244
367
|
*UghuuuGameServer.GroupsApi* | [**approveJoinRequest**](docs/GroupsApi.md#approveJoinRequest) | **POST** /api/v1/groups/{id}/join_requests/{request_id}/approve | Approve a join request (admin only)
|
|
245
368
|
*UghuuuGameServer.GroupsApi* | [**cancelGroupInvite**](docs/GroupsApi.md#cancelGroupInvite) | **DELETE** /api/v1/groups/sent_invitations/{invite_id} | Cancel a sent group invitation
|
|
246
369
|
*UghuuuGameServer.GroupsApi* | [**cancelJoinRequest**](docs/GroupsApi.md#cancelJoinRequest) | **DELETE** /api/v1/groups/{id}/join_requests/{request_id} | Cancel your own pending join request
|
|
247
370
|
*UghuuuGameServer.GroupsApi* | [**createGroup**](docs/GroupsApi.md#createGroup) | **POST** /api/v1/groups | Create a group
|
|
371
|
+
*UghuuuGameServer.GroupsApi* | [**declineGroupInvite**](docs/GroupsApi.md#declineGroupInvite) | **POST** /api/v1/groups/invitations/{invite_id}/decline | Decline a group invitation
|
|
248
372
|
*UghuuuGameServer.GroupsApi* | [**demoteGroupMember**](docs/GroupsApi.md#demoteGroupMember) | **POST** /api/v1/groups/{id}/demote | Demote admin to member
|
|
249
373
|
*UghuuuGameServer.GroupsApi* | [**getGroup**](docs/GroupsApi.md#getGroup) | **GET** /api/v1/groups/{id} | Get group details
|
|
250
|
-
*UghuuuGameServer.GroupsApi* | [**inviteToGroup**](docs/GroupsApi.md#inviteToGroup) | **POST** /api/v1/groups/{id}/invite | Invite a user to a
|
|
374
|
+
*UghuuuGameServer.GroupsApi* | [**inviteToGroup**](docs/GroupsApi.md#inviteToGroup) | **POST** /api/v1/groups/{id}/invite | Invite a user to a group (admin only)
|
|
251
375
|
*UghuuuGameServer.GroupsApi* | [**joinGroup**](docs/GroupsApi.md#joinGroup) | **POST** /api/v1/groups/{id}/join | Join a group
|
|
252
376
|
*UghuuuGameServer.GroupsApi* | [**kickGroupMember**](docs/GroupsApi.md#kickGroupMember) | **POST** /api/v1/groups/{id}/kick | Kick a member (admin only)
|
|
253
377
|
*UghuuuGameServer.GroupsApi* | [**leaveGroup**](docs/GroupsApi.md#leaveGroup) | **POST** /api/v1/groups/{id}/leave | Leave a group
|
|
@@ -270,7 +394,9 @@ Class | Method | HTTP request | Description
|
|
|
270
394
|
*UghuuuGameServer.LeaderboardsApi* | [**listLeaderboardRecords**](docs/LeaderboardsApi.md#listLeaderboardRecords) | **GET** /api/v1/leaderboards/{id}/records | List leaderboard records
|
|
271
395
|
*UghuuuGameServer.LeaderboardsApi* | [**listLeaderboards**](docs/LeaderboardsApi.md#listLeaderboards) | **GET** /api/v1/leaderboards | List leaderboards
|
|
272
396
|
*UghuuuGameServer.LeaderboardsApi* | [**listRecordsAroundUser**](docs/LeaderboardsApi.md#listRecordsAroundUser) | **GET** /api/v1/leaderboards/{id}/records/around/{user_id} | List records around a user
|
|
397
|
+
*UghuuuGameServer.LeaderboardsApi* | [**resolveLeaderboardSlugs**](docs/LeaderboardsApi.md#resolveLeaderboardSlugs) | **POST** /api/v1/leaderboards/resolve | Resolve multiple slugs to active leaderboards
|
|
273
398
|
*UghuuuGameServer.LobbiesApi* | [**createLobby**](docs/LobbiesApi.md#createLobby) | **POST** /api/v1/lobbies | Create a lobby
|
|
399
|
+
*UghuuuGameServer.LobbiesApi* | [**getLobby**](docs/LobbiesApi.md#getLobby) | **GET** /api/v1/lobbies/{id} | Get a single lobby
|
|
274
400
|
*UghuuuGameServer.LobbiesApi* | [**joinLobby**](docs/LobbiesApi.md#joinLobby) | **POST** /api/v1/lobbies/{id}/join | Join a lobby
|
|
275
401
|
*UghuuuGameServer.LobbiesApi* | [**kickUser**](docs/LobbiesApi.md#kickUser) | **POST** /api/v1/lobbies/kick | Kick a user from the lobby (host only)
|
|
276
402
|
*UghuuuGameServer.LobbiesApi* | [**leaveLobby**](docs/LobbiesApi.md#leaveLobby) | **POST** /api/v1/lobbies/leave | Leave the current lobby
|
|
@@ -280,10 +406,15 @@ Class | Method | HTTP request | Description
|
|
|
280
406
|
*UghuuuGameServer.NotificationsApi* | [**deleteNotifications**](docs/NotificationsApi.md#deleteNotifications) | **DELETE** /api/v1/notifications | Delete notifications by IDs
|
|
281
407
|
*UghuuuGameServer.NotificationsApi* | [**listNotifications**](docs/NotificationsApi.md#listNotifications) | **GET** /api/v1/notifications | List own notifications
|
|
282
408
|
*UghuuuGameServer.NotificationsApi* | [**sendNotification**](docs/NotificationsApi.md#sendNotification) | **POST** /api/v1/notifications | Send a notification to a friend
|
|
409
|
+
*UghuuuGameServer.PartiesApi* | [**acceptPartyInvite**](docs/PartiesApi.md#acceptPartyInvite) | **POST** /api/v1/parties/invite/accept | Accept a party invite
|
|
410
|
+
*UghuuuGameServer.PartiesApi* | [**cancelPartyInvite**](docs/PartiesApi.md#cancelPartyInvite) | **POST** /api/v1/parties/invite/cancel | Cancel a pending party invite (leader only)
|
|
283
411
|
*UghuuuGameServer.PartiesApi* | [**createParty**](docs/PartiesApi.md#createParty) | **POST** /api/v1/parties | Create a party
|
|
284
|
-
*UghuuuGameServer.PartiesApi* | [**
|
|
412
|
+
*UghuuuGameServer.PartiesApi* | [**declinePartyInvite**](docs/PartiesApi.md#declinePartyInvite) | **POST** /api/v1/parties/invite/decline | Decline a party invite
|
|
413
|
+
*UghuuuGameServer.PartiesApi* | [**inviteToParty**](docs/PartiesApi.md#inviteToParty) | **POST** /api/v1/parties/invite | Invite a user to the party (leader only)
|
|
285
414
|
*UghuuuGameServer.PartiesApi* | [**kickPartyMember**](docs/PartiesApi.md#kickPartyMember) | **POST** /api/v1/parties/kick | Kick a member from the party (leader only)
|
|
286
415
|
*UghuuuGameServer.PartiesApi* | [**leaveParty**](docs/PartiesApi.md#leaveParty) | **POST** /api/v1/parties/leave | Leave the current party
|
|
416
|
+
*UghuuuGameServer.PartiesApi* | [**listPartyInvitations**](docs/PartiesApi.md#listPartyInvitations) | **GET** /api/v1/parties/invitations | List pending party invites for the current user
|
|
417
|
+
*UghuuuGameServer.PartiesApi* | [**listSentPartyInvitations**](docs/PartiesApi.md#listSentPartyInvitations) | **GET** /api/v1/parties/invitations/sent | List pending party invites sent by the current leader
|
|
287
418
|
*UghuuuGameServer.PartiesApi* | [**partyCreateLobby**](docs/PartiesApi.md#partyCreateLobby) | **POST** /api/v1/parties/create_lobby | Create a lobby with the party (leader only)
|
|
288
419
|
*UghuuuGameServer.PartiesApi* | [**partyJoinLobby**](docs/PartiesApi.md#partyJoinLobby) | **POST** /api/v1/parties/join_lobby/{id} | Join a lobby with the party (leader only)
|
|
289
420
|
*UghuuuGameServer.PartiesApi* | [**showParty**](docs/PartiesApi.md#showParty) | **GET** /api/v1/parties/me | Get current party
|
|
@@ -298,6 +429,8 @@ Class | Method | HTTP request | Description
|
|
|
298
429
|
|
|
299
430
|
## Documentation for Models
|
|
300
431
|
|
|
432
|
+
- [UghuuuGameServer.AcceptPartyInviteRequest](docs/AcceptPartyInviteRequest.md)
|
|
433
|
+
- [UghuuuGameServer.AdminCreateAchievementRequest](docs/AdminCreateAchievementRequest.md)
|
|
301
434
|
- [UghuuuGameServer.AdminCreateKvEntry200Response](docs/AdminCreateKvEntry200Response.md)
|
|
302
435
|
- [UghuuuGameServer.AdminCreateKvEntryRequest](docs/AdminCreateKvEntryRequest.md)
|
|
303
436
|
- [UghuuuGameServer.AdminCreateLeaderboardRequest](docs/AdminCreateLeaderboardRequest.md)
|
|
@@ -306,6 +439,8 @@ Class | Method | HTTP request | Description
|
|
|
306
439
|
- [UghuuuGameServer.AdminDeleteChatConversation200Response](docs/AdminDeleteChatConversation200Response.md)
|
|
307
440
|
- [UghuuuGameServer.AdminEndLeaderboard200Response](docs/AdminEndLeaderboard200Response.md)
|
|
308
441
|
- [UghuuuGameServer.AdminEndLeaderboard200ResponseData](docs/AdminEndLeaderboard200ResponseData.md)
|
|
442
|
+
- [UghuuuGameServer.AdminIncrementAchievementRequest](docs/AdminIncrementAchievementRequest.md)
|
|
443
|
+
- [UghuuuGameServer.AdminListAchievements200Response](docs/AdminListAchievements200Response.md)
|
|
309
444
|
- [UghuuuGameServer.AdminListChatMessages200Response](docs/AdminListChatMessages200Response.md)
|
|
310
445
|
- [UghuuuGameServer.AdminListChatMessages200ResponseDataInner](docs/AdminListChatMessages200ResponseDataInner.md)
|
|
311
446
|
- [UghuuuGameServer.AdminListGroups200Response](docs/AdminListGroups200Response.md)
|
|
@@ -318,9 +453,13 @@ Class | Method | HTTP request | Description
|
|
|
318
453
|
- [UghuuuGameServer.AdminListNotifications200ResponseMeta](docs/AdminListNotifications200ResponseMeta.md)
|
|
319
454
|
- [UghuuuGameServer.AdminListSessions200Response](docs/AdminListSessions200Response.md)
|
|
320
455
|
- [UghuuuGameServer.AdminListSessions200ResponseDataInner](docs/AdminListSessions200ResponseDataInner.md)
|
|
456
|
+
- [UghuuuGameServer.AdminRevokeAchievementRequest](docs/AdminRevokeAchievementRequest.md)
|
|
321
457
|
- [UghuuuGameServer.AdminSubmitLeaderboardScore200Response](docs/AdminSubmitLeaderboardScore200Response.md)
|
|
322
458
|
- [UghuuuGameServer.AdminSubmitLeaderboardScore200ResponseData](docs/AdminSubmitLeaderboardScore200ResponseData.md)
|
|
323
459
|
- [UghuuuGameServer.AdminSubmitLeaderboardScoreRequest](docs/AdminSubmitLeaderboardScoreRequest.md)
|
|
460
|
+
- [UghuuuGameServer.AdminUnlockAchievementRequest](docs/AdminUnlockAchievementRequest.md)
|
|
461
|
+
- [UghuuuGameServer.AdminUpdateAchievement200Response](docs/AdminUpdateAchievement200Response.md)
|
|
462
|
+
- [UghuuuGameServer.AdminUpdateAchievementRequest](docs/AdminUpdateAchievementRequest.md)
|
|
324
463
|
- [UghuuuGameServer.AdminUpdateGroup200Response](docs/AdminUpdateGroup200Response.md)
|
|
325
464
|
- [UghuuuGameServer.AdminUpdateGroupRequest](docs/AdminUpdateGroupRequest.md)
|
|
326
465
|
- [UghuuuGameServer.AdminUpdateKvEntryRequest](docs/AdminUpdateKvEntryRequest.md)
|
|
@@ -335,23 +474,29 @@ Class | Method | HTTP request | Description
|
|
|
335
474
|
- [UghuuuGameServer.CallHookRequest](docs/CallHookRequest.md)
|
|
336
475
|
- [UghuuuGameServer.CancelGroupInvite200Response](docs/CancelGroupInvite200Response.md)
|
|
337
476
|
- [UghuuuGameServer.CancelJoinRequest200Response](docs/CancelJoinRequest200Response.md)
|
|
477
|
+
- [UghuuuGameServer.CancelPartyInviteRequest](docs/CancelPartyInviteRequest.md)
|
|
338
478
|
- [UghuuuGameServer.ChatUnreadCount200Response](docs/ChatUnreadCount200Response.md)
|
|
339
479
|
- [UghuuuGameServer.CreateFriendRequestRequest](docs/CreateFriendRequestRequest.md)
|
|
340
480
|
- [UghuuuGameServer.CreateGroupRequest](docs/CreateGroupRequest.md)
|
|
341
481
|
- [UghuuuGameServer.CreateLobbyRequest](docs/CreateLobbyRequest.md)
|
|
342
482
|
- [UghuuuGameServer.CreatePartyRequest](docs/CreatePartyRequest.md)
|
|
483
|
+
- [UghuuuGameServer.DeclinePartyInviteRequest](docs/DeclinePartyInviteRequest.md)
|
|
343
484
|
- [UghuuuGameServer.DeleteNotifications200Response](docs/DeleteNotifications200Response.md)
|
|
344
485
|
- [UghuuuGameServer.DeleteNotificationsRequest](docs/DeleteNotificationsRequest.md)
|
|
345
486
|
- [UghuuuGameServer.DemoteGroupMemberRequest](docs/DemoteGroupMemberRequest.md)
|
|
346
487
|
- [UghuuuGameServer.DeviceLoginRequest](docs/DeviceLoginRequest.md)
|
|
347
488
|
- [UghuuuGameServer.ErrorResponse](docs/ErrorResponse.md)
|
|
489
|
+
- [UghuuuGameServer.GetChatMessage200Response](docs/GetChatMessage200Response.md)
|
|
348
490
|
- [UghuuuGameServer.GetCurrentUser200Response](docs/GetCurrentUser200Response.md)
|
|
349
491
|
- [UghuuuGameServer.GetCurrentUser200ResponseLinkedProviders](docs/GetCurrentUser200ResponseLinkedProviders.md)
|
|
350
492
|
- [UghuuuGameServer.GetKv200Response](docs/GetKv200Response.md)
|
|
493
|
+
- [UghuuuGameServer.GetLobby200Response](docs/GetLobby200Response.md)
|
|
494
|
+
- [UghuuuGameServer.GetLobby200ResponseMembersInner](docs/GetLobby200ResponseMembersInner.md)
|
|
351
495
|
- [UghuuuGameServer.GetMyRecord200Response](docs/GetMyRecord200Response.md)
|
|
352
496
|
- [UghuuuGameServer.HealthResponse](docs/HealthResponse.md)
|
|
497
|
+
- [UghuuuGameServer.InviteToGroup200Response](docs/InviteToGroup200Response.md)
|
|
353
498
|
- [UghuuuGameServer.InviteToGroupRequest](docs/InviteToGroupRequest.md)
|
|
354
|
-
- [UghuuuGameServer.
|
|
499
|
+
- [UghuuuGameServer.InviteToPartyRequest](docs/InviteToPartyRequest.md)
|
|
355
500
|
- [UghuuuGameServer.KickGroupMemberRequest](docs/KickGroupMemberRequest.md)
|
|
356
501
|
- [UghuuuGameServer.KickUserRequest](docs/KickUserRequest.md)
|
|
357
502
|
- [UghuuuGameServer.LinkDeviceRequest](docs/LinkDeviceRequest.md)
|
|
@@ -359,7 +504,6 @@ Class | Method | HTTP request | Description
|
|
|
359
504
|
- [UghuuuGameServer.ListBlockedFriends200ResponseDataInner](docs/ListBlockedFriends200ResponseDataInner.md)
|
|
360
505
|
- [UghuuuGameServer.ListBlockedFriends200ResponseDataInnerRequester](docs/ListBlockedFriends200ResponseDataInnerRequester.md)
|
|
361
506
|
- [UghuuuGameServer.ListChatMessages200Response](docs/ListChatMessages200Response.md)
|
|
362
|
-
- [UghuuuGameServer.ListChatMessages200ResponseDataInner](docs/ListChatMessages200ResponseDataInner.md)
|
|
363
507
|
- [UghuuuGameServer.ListFriendRequests200Response](docs/ListFriendRequests200Response.md)
|
|
364
508
|
- [UghuuuGameServer.ListFriendRequests200ResponseIncomingInner](docs/ListFriendRequests200ResponseIncomingInner.md)
|
|
365
509
|
- [UghuuuGameServer.ListFriendRequests200ResponseIncomingInnerRequester](docs/ListFriendRequests200ResponseIncomingInnerRequester.md)
|
|
@@ -381,6 +525,7 @@ Class | Method | HTTP request | Description
|
|
|
381
525
|
- [UghuuuGameServer.ListMyGroups200ResponseDataInner](docs/ListMyGroups200ResponseDataInner.md)
|
|
382
526
|
- [UghuuuGameServer.ListNotifications200Response](docs/ListNotifications200Response.md)
|
|
383
527
|
- [UghuuuGameServer.ListNotifications200ResponseDataInner](docs/ListNotifications200ResponseDataInner.md)
|
|
528
|
+
- [UghuuuGameServer.ListPartyInvitations200ResponseInner](docs/ListPartyInvitations200ResponseInner.md)
|
|
384
529
|
- [UghuuuGameServer.ListRecordsAroundUser200Response](docs/ListRecordsAroundUser200Response.md)
|
|
385
530
|
- [UghuuuGameServer.ListSentInvitations200Response](docs/ListSentInvitations200Response.md)
|
|
386
531
|
- [UghuuuGameServer.ListSentInvitations200ResponseDataInner](docs/ListSentInvitations200ResponseDataInner.md)
|
|
@@ -406,18 +551,23 @@ Class | Method | HTTP request | Description
|
|
|
406
551
|
- [UghuuuGameServer.RefreshToken200Response](docs/RefreshToken200Response.md)
|
|
407
552
|
- [UghuuuGameServer.RefreshToken200ResponseData](docs/RefreshToken200ResponseData.md)
|
|
408
553
|
- [UghuuuGameServer.RefreshTokenRequest](docs/RefreshTokenRequest.md)
|
|
554
|
+
- [UghuuuGameServer.ResolveLeaderboardSlugs200Response](docs/ResolveLeaderboardSlugs200Response.md)
|
|
555
|
+
- [UghuuuGameServer.ResolveLeaderboardSlugsRequest](docs/ResolveLeaderboardSlugsRequest.md)
|
|
409
556
|
- [UghuuuGameServer.SearchUsers200Response](docs/SearchUsers200Response.md)
|
|
410
557
|
- [UghuuuGameServer.SearchUsers200ResponseDataInner](docs/SearchUsers200ResponseDataInner.md)
|
|
411
558
|
- [UghuuuGameServer.SendChatMessageRequest](docs/SendChatMessageRequest.md)
|
|
412
559
|
- [UghuuuGameServer.SendNotificationRequest](docs/SendNotificationRequest.md)
|
|
413
560
|
- [UghuuuGameServer.ShowParty200Response](docs/ShowParty200Response.md)
|
|
414
561
|
- [UghuuuGameServer.ShowParty200ResponseMembersInner](docs/ShowParty200ResponseMembersInner.md)
|
|
562
|
+
- [UghuuuGameServer.UpdateChatMessageRequest](docs/UpdateChatMessageRequest.md)
|
|
415
563
|
- [UghuuuGameServer.UpdateCurrentUserDisplayNameRequest](docs/UpdateCurrentUserDisplayNameRequest.md)
|
|
416
564
|
- [UghuuuGameServer.UpdateCurrentUserPassword400Response](docs/UpdateCurrentUserPassword400Response.md)
|
|
417
565
|
- [UghuuuGameServer.UpdateCurrentUserPasswordRequest](docs/UpdateCurrentUserPasswordRequest.md)
|
|
418
566
|
- [UghuuuGameServer.UpdateGroupRequest](docs/UpdateGroupRequest.md)
|
|
419
567
|
- [UghuuuGameServer.UpdateLobbyRequest](docs/UpdateLobbyRequest.md)
|
|
420
568
|
- [UghuuuGameServer.UpdatePartyRequest](docs/UpdatePartyRequest.md)
|
|
569
|
+
- [UghuuuGameServer.UserAchievements200Response](docs/UserAchievements200Response.md)
|
|
570
|
+
- [UghuuuGameServer.UserAchievements200ResponseDataInner](docs/UserAchievements200ResponseDataInner.md)
|
|
421
571
|
|
|
422
572
|
|
|
423
573
|
## Documentation for Authorization
|
package/dist/ApiClient.js
CHANGED
|
@@ -13,9 +13,9 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
15
15
|
* Game Server API
|
|
16
|
-
* API for Game Server
|
|
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, 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.
|
|
18
|
+
* The version of the OpenAPI document: 1.0.791
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|