glitch-javascript-sdk 3.1.3 → 3.1.5
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/dist/cjs/index.js +666 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Multiplayer.d.ts +871 -0
- package/dist/esm/api/Scheduler.d.ts +5 -0
- package/dist/esm/api/ServerOperations.d.ts +7 -0
- package/dist/esm/api/Titles.d.ts +91 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/constants/HttpMethods.d.ts +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +666 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/MultiplayerRoute.d.ts +7 -0
- package/dist/esm/routes/ServerOperationsRoute.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +1 -0
- package/dist/index.d.ts +973 -0
- package/package.json +1 -1
- package/src/api/Multiplayer.ts +1012 -0
- package/src/api/Scheduler.ts +8 -0
- package/src/api/ServerOperations.ts +16 -0
- package/src/api/Titles.ts +117 -4
- package/src/api/index.ts +5 -1
- package/src/constants/HttpMethods.ts +2 -1
- package/src/index.ts +5 -1
- package/src/routes/MultiplayerRoute.ts +46 -0
- package/src/routes/SchedulerRoute.ts +1 -0
- package/src/routes/ServerOperationsRoute.ts +17 -0
- package/src/routes/TitlesRoute.ts +12 -1
- package/src/util/Requests.ts +21 -1
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
export type MultiplayerLobbyType = 'public' | 'invisible' | 'friends_only' | 'private';
|
|
4
|
+
export type MultiplayerLobbyState = 'waiting' | 'ready' | 'in_game' | 'closed';
|
|
5
|
+
export type MultiplayerLobbyMemberStatus = 'joined' | 'left' | 'disconnected' | 'kicked' | 'banned';
|
|
6
|
+
export type MultiplayerLobbyMessageType = 'chat' | 'binary' | 'system' | 'ready' | 'invite' | 'kick' | 'voice';
|
|
7
|
+
export type MultiplayerServerType = 'dedicated' | 'listen' | 'relay';
|
|
8
|
+
export type MultiplayerServerStatus = 'active' | 'available' | 'draining' | 'offline';
|
|
9
|
+
export type MultiplayerTransport = 'udp' | 'tcp' | 'webrtc' | 'relay';
|
|
10
|
+
export type MultiplayerSessionState = 'reserved' | 'active' | 'released' | 'expired';
|
|
11
|
+
export type MultiplayerAuthTicketStatus = 'active' | 'consumed' | 'revoked' | 'expired';
|
|
12
|
+
export type MultiplayerFavoriteKind = 'favorite' | 'history';
|
|
13
|
+
export type MultiplayerVoiceProvider = 'glitch_relay' | 'external';
|
|
14
|
+
export type MultiplayerVoiceTopology = 'lobby' | 'server' | 'party' | 'proximity';
|
|
15
|
+
export type MultiplayerVoiceState = 'active' | 'closed';
|
|
16
|
+
export type MultiplayerVoiceCodec = 'opus' | 'pcm16' | 'aac';
|
|
17
|
+
export type MultiplayerVoiceParticipantStatus = 'joined' | 'left' | 'muted' | 'kicked';
|
|
18
|
+
export type MultiplayerVoicePacketType = 'audio' | 'speaking' | 'mute_state' | 'offer' | 'answer' | 'ice' | 'control';
|
|
19
|
+
export type MultiplayerMetadata = Record<string, any>;
|
|
20
|
+
export interface MultiplayerLobbyMember {
|
|
21
|
+
id: string;
|
|
22
|
+
lobby_id: string;
|
|
23
|
+
player_id: string;
|
|
24
|
+
user_id?: string | null;
|
|
25
|
+
display_name?: string | null;
|
|
26
|
+
status: MultiplayerLobbyMemberStatus;
|
|
27
|
+
ready: boolean;
|
|
28
|
+
member_data: MultiplayerMetadata;
|
|
29
|
+
joined_at?: string | null;
|
|
30
|
+
last_seen_at?: string | null;
|
|
31
|
+
left_at?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface MultiplayerServer {
|
|
34
|
+
id: string;
|
|
35
|
+
title_id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
server_type: MultiplayerServerType;
|
|
38
|
+
status: MultiplayerServerStatus;
|
|
39
|
+
region?: string | null;
|
|
40
|
+
build_version?: string | null;
|
|
41
|
+
host?: string | null;
|
|
42
|
+
game_port?: number | null;
|
|
43
|
+
query_port?: number | null;
|
|
44
|
+
transport: MultiplayerTransport;
|
|
45
|
+
connection_uri?: string | null;
|
|
46
|
+
max_players: number;
|
|
47
|
+
current_players: number;
|
|
48
|
+
bot_players: number;
|
|
49
|
+
secure: boolean;
|
|
50
|
+
password_protected: boolean;
|
|
51
|
+
private: boolean;
|
|
52
|
+
tags: string[];
|
|
53
|
+
rules: MultiplayerMetadata;
|
|
54
|
+
metadata: MultiplayerMetadata;
|
|
55
|
+
last_heartbeat_at?: string | null;
|
|
56
|
+
expires_at?: string | null;
|
|
57
|
+
created_at?: string | null;
|
|
58
|
+
updated_at?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface MultiplayerLobby {
|
|
61
|
+
id: string;
|
|
62
|
+
title_id: string;
|
|
63
|
+
server_id?: string | null;
|
|
64
|
+
owner_player_id: string;
|
|
65
|
+
owner_user_id?: string | null;
|
|
66
|
+
lobby_type: MultiplayerLobbyType;
|
|
67
|
+
state: MultiplayerLobbyState;
|
|
68
|
+
joinable: boolean;
|
|
69
|
+
max_members: number;
|
|
70
|
+
member_count: number;
|
|
71
|
+
region?: string | null;
|
|
72
|
+
game_mode?: string | null;
|
|
73
|
+
map_name?: string | null;
|
|
74
|
+
skill_band?: number | null;
|
|
75
|
+
metadata: MultiplayerMetadata;
|
|
76
|
+
last_activity_at?: string | null;
|
|
77
|
+
expires_at?: string | null;
|
|
78
|
+
created_at?: string | null;
|
|
79
|
+
updated_at?: string | null;
|
|
80
|
+
members?: MultiplayerLobbyMember[];
|
|
81
|
+
server?: MultiplayerServer | null;
|
|
82
|
+
}
|
|
83
|
+
export interface MultiplayerLobbyMessage {
|
|
84
|
+
id: string;
|
|
85
|
+
lobby_id: string;
|
|
86
|
+
player_id: string;
|
|
87
|
+
user_id?: string | null;
|
|
88
|
+
message_type: MultiplayerLobbyMessageType;
|
|
89
|
+
payload: MultiplayerMetadata;
|
|
90
|
+
sequence: number;
|
|
91
|
+
created_at?: string | null;
|
|
92
|
+
updated_at?: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface MultiplayerSession {
|
|
95
|
+
id: string;
|
|
96
|
+
title_id: string;
|
|
97
|
+
server_id?: string | null;
|
|
98
|
+
lobby_id?: string | null;
|
|
99
|
+
player_id: string;
|
|
100
|
+
user_id?: string | null;
|
|
101
|
+
state: MultiplayerSessionState;
|
|
102
|
+
connection_payload: MultiplayerMetadata;
|
|
103
|
+
last_heartbeat_at?: string | null;
|
|
104
|
+
expires_at?: string | null;
|
|
105
|
+
started_at?: string | null;
|
|
106
|
+
ended_at?: string | null;
|
|
107
|
+
created_at?: string | null;
|
|
108
|
+
updated_at?: string | null;
|
|
109
|
+
}
|
|
110
|
+
export interface MultiplayerAuthTicket {
|
|
111
|
+
id: string;
|
|
112
|
+
title_id: string;
|
|
113
|
+
player_id: string;
|
|
114
|
+
user_id?: string | null;
|
|
115
|
+
remote_identity?: string | null;
|
|
116
|
+
status: MultiplayerAuthTicketStatus;
|
|
117
|
+
issued_at?: string | null;
|
|
118
|
+
expires_at?: string | null;
|
|
119
|
+
consumed_at?: string | null;
|
|
120
|
+
created_at?: string | null;
|
|
121
|
+
updated_at?: string | null;
|
|
122
|
+
}
|
|
123
|
+
export interface MultiplayerServerFavorite {
|
|
124
|
+
id: string;
|
|
125
|
+
title_id: string;
|
|
126
|
+
server_id?: string | null;
|
|
127
|
+
user_id?: string | null;
|
|
128
|
+
player_id: string;
|
|
129
|
+
kind: MultiplayerFavoriteKind;
|
|
130
|
+
name?: string | null;
|
|
131
|
+
host?: string | null;
|
|
132
|
+
game_port?: number | null;
|
|
133
|
+
query_port?: number | null;
|
|
134
|
+
metadata: MultiplayerMetadata;
|
|
135
|
+
last_played_at?: string | null;
|
|
136
|
+
created_at?: string | null;
|
|
137
|
+
updated_at?: string | null;
|
|
138
|
+
}
|
|
139
|
+
export interface MultiplayerVoiceParticipant {
|
|
140
|
+
id: string;
|
|
141
|
+
voice_room_id: string;
|
|
142
|
+
player_id: string;
|
|
143
|
+
user_id?: string | null;
|
|
144
|
+
display_name?: string | null;
|
|
145
|
+
status: MultiplayerVoiceParticipantStatus;
|
|
146
|
+
muted: boolean;
|
|
147
|
+
deafened: boolean;
|
|
148
|
+
speaking: boolean;
|
|
149
|
+
last_sequence: number;
|
|
150
|
+
metadata: MultiplayerMetadata;
|
|
151
|
+
joined_at?: string | null;
|
|
152
|
+
last_heartbeat_at?: string | null;
|
|
153
|
+
left_at?: string | null;
|
|
154
|
+
expires_at?: string | null;
|
|
155
|
+
created_at?: string | null;
|
|
156
|
+
updated_at?: string | null;
|
|
157
|
+
}
|
|
158
|
+
export interface MultiplayerVoiceRoom {
|
|
159
|
+
id: string;
|
|
160
|
+
title_id: string;
|
|
161
|
+
lobby_id?: string | null;
|
|
162
|
+
server_id?: string | null;
|
|
163
|
+
owner_player_id: string;
|
|
164
|
+
owner_user_id?: string | null;
|
|
165
|
+
provider: MultiplayerVoiceProvider;
|
|
166
|
+
topology: MultiplayerVoiceTopology;
|
|
167
|
+
state: MultiplayerVoiceState;
|
|
168
|
+
region?: string | null;
|
|
169
|
+
codec: MultiplayerVoiceCodec;
|
|
170
|
+
sample_rate: number;
|
|
171
|
+
bitrate: number;
|
|
172
|
+
frame_duration_ms: 10 | 20 | 40 | 60;
|
|
173
|
+
channels: 1 | 2;
|
|
174
|
+
max_participants: number;
|
|
175
|
+
participant_count: number;
|
|
176
|
+
recording_allowed: boolean;
|
|
177
|
+
moderation_enabled: boolean;
|
|
178
|
+
connection_config: MultiplayerMetadata;
|
|
179
|
+
metadata: MultiplayerMetadata;
|
|
180
|
+
last_activity_at?: string | null;
|
|
181
|
+
expires_at?: string | null;
|
|
182
|
+
created_at?: string | null;
|
|
183
|
+
updated_at?: string | null;
|
|
184
|
+
participants?: MultiplayerVoiceParticipant[];
|
|
185
|
+
}
|
|
186
|
+
export interface MultiplayerVoicePacket {
|
|
187
|
+
id: string;
|
|
188
|
+
voice_room_id: string;
|
|
189
|
+
participant_id?: string | null;
|
|
190
|
+
player_id: string;
|
|
191
|
+
packet_type: MultiplayerVoicePacketType;
|
|
192
|
+
payload: string;
|
|
193
|
+
sequence: number;
|
|
194
|
+
duration_ms?: number | null;
|
|
195
|
+
sent_at?: string | null;
|
|
196
|
+
created_at?: string | null;
|
|
197
|
+
updated_at?: string | null;
|
|
198
|
+
}
|
|
199
|
+
export interface MultiplayerLobbySearchParams {
|
|
200
|
+
region?: string;
|
|
201
|
+
game_mode?: string;
|
|
202
|
+
map_name?: string;
|
|
203
|
+
lobby_type?: MultiplayerLobbyType;
|
|
204
|
+
skill_band?: number;
|
|
205
|
+
limit?: number;
|
|
206
|
+
}
|
|
207
|
+
export interface MultiplayerCreateLobbyRequest {
|
|
208
|
+
player_id?: string;
|
|
209
|
+
display_name?: string;
|
|
210
|
+
member_data?: MultiplayerMetadata;
|
|
211
|
+
lobby_type?: MultiplayerLobbyType;
|
|
212
|
+
state?: MultiplayerLobbyState;
|
|
213
|
+
joinable?: boolean;
|
|
214
|
+
max_members?: number;
|
|
215
|
+
region?: string;
|
|
216
|
+
game_mode?: string;
|
|
217
|
+
map_name?: string;
|
|
218
|
+
skill_band?: number;
|
|
219
|
+
metadata?: MultiplayerMetadata;
|
|
220
|
+
expires_at?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface MultiplayerJoinLobbyRequest {
|
|
223
|
+
player_id?: string;
|
|
224
|
+
display_name?: string;
|
|
225
|
+
ready?: boolean;
|
|
226
|
+
member_data?: MultiplayerMetadata;
|
|
227
|
+
}
|
|
228
|
+
export interface MultiplayerLeaveLobbyRequest {
|
|
229
|
+
player_id?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface MultiplayerUpdateLobbyRequest {
|
|
232
|
+
player_id?: string;
|
|
233
|
+
lobby_type?: MultiplayerLobbyType;
|
|
234
|
+
state?: MultiplayerLobbyState;
|
|
235
|
+
joinable?: boolean;
|
|
236
|
+
max_members?: number;
|
|
237
|
+
region?: string;
|
|
238
|
+
game_mode?: string;
|
|
239
|
+
map_name?: string;
|
|
240
|
+
skill_band?: number;
|
|
241
|
+
metadata?: MultiplayerMetadata;
|
|
242
|
+
expires_at?: string;
|
|
243
|
+
}
|
|
244
|
+
export interface MultiplayerSetLobbyServerRequest {
|
|
245
|
+
player_id?: string;
|
|
246
|
+
server_id: string;
|
|
247
|
+
state?: MultiplayerLobbyState;
|
|
248
|
+
joinable?: boolean;
|
|
249
|
+
}
|
|
250
|
+
export interface MultiplayerLobbyMessagesParams {
|
|
251
|
+
after_sequence?: number;
|
|
252
|
+
limit?: number;
|
|
253
|
+
}
|
|
254
|
+
export interface MultiplayerSendLobbyMessageRequest {
|
|
255
|
+
player_id?: string;
|
|
256
|
+
message_type?: MultiplayerLobbyMessageType;
|
|
257
|
+
payload: MultiplayerMetadata;
|
|
258
|
+
}
|
|
259
|
+
export interface MultiplayerServerBrowserParams {
|
|
260
|
+
region?: string;
|
|
261
|
+
build_version?: string;
|
|
262
|
+
transport?: MultiplayerTransport;
|
|
263
|
+
status?: MultiplayerServerStatus;
|
|
264
|
+
secure?: boolean;
|
|
265
|
+
include_private?: boolean;
|
|
266
|
+
limit?: number;
|
|
267
|
+
}
|
|
268
|
+
export interface MultiplayerRegisterServerRequest {
|
|
269
|
+
name: string;
|
|
270
|
+
server_type?: MultiplayerServerType;
|
|
271
|
+
status?: MultiplayerServerStatus;
|
|
272
|
+
region?: string;
|
|
273
|
+
build_version?: string;
|
|
274
|
+
host?: string;
|
|
275
|
+
game_port?: number;
|
|
276
|
+
query_port?: number;
|
|
277
|
+
transport?: MultiplayerTransport;
|
|
278
|
+
connection_uri?: string;
|
|
279
|
+
max_players?: number;
|
|
280
|
+
current_players?: number;
|
|
281
|
+
bot_players?: number;
|
|
282
|
+
secure?: boolean;
|
|
283
|
+
password_protected?: boolean;
|
|
284
|
+
private?: boolean;
|
|
285
|
+
tags?: string[];
|
|
286
|
+
rules?: MultiplayerMetadata;
|
|
287
|
+
metadata?: MultiplayerMetadata;
|
|
288
|
+
expires_at?: string;
|
|
289
|
+
}
|
|
290
|
+
export interface MultiplayerRegisterServerResponse {
|
|
291
|
+
server: MultiplayerServer;
|
|
292
|
+
server_token: string;
|
|
293
|
+
}
|
|
294
|
+
export interface MultiplayerServerHeartbeatRequest {
|
|
295
|
+
server_token: string;
|
|
296
|
+
status?: MultiplayerServerStatus;
|
|
297
|
+
current_players?: number;
|
|
298
|
+
bot_players?: number;
|
|
299
|
+
rules?: MultiplayerMetadata;
|
|
300
|
+
metadata?: MultiplayerMetadata;
|
|
301
|
+
}
|
|
302
|
+
export interface MultiplayerReserveServerRequest {
|
|
303
|
+
player_id?: string;
|
|
304
|
+
lobby_id?: string;
|
|
305
|
+
ttl_minutes?: number;
|
|
306
|
+
}
|
|
307
|
+
export interface MultiplayerReserveServerResponse {
|
|
308
|
+
session: MultiplayerSession;
|
|
309
|
+
reservation_token: string;
|
|
310
|
+
}
|
|
311
|
+
export interface MultiplayerSessionHeartbeatRequest {
|
|
312
|
+
reservation_token: string;
|
|
313
|
+
state?: Extract<MultiplayerSessionState, 'reserved' | 'active'>;
|
|
314
|
+
ttl_minutes?: number;
|
|
315
|
+
}
|
|
316
|
+
export interface MultiplayerSessionReleaseRequest {
|
|
317
|
+
reservation_token: string;
|
|
318
|
+
}
|
|
319
|
+
export interface MultiplayerIssueAuthTicketRequest {
|
|
320
|
+
player_id?: string;
|
|
321
|
+
remote_identity?: string;
|
|
322
|
+
ttl_minutes?: number;
|
|
323
|
+
}
|
|
324
|
+
export interface MultiplayerIssueAuthTicketResponse {
|
|
325
|
+
ticket: MultiplayerAuthTicket;
|
|
326
|
+
auth_ticket: string;
|
|
327
|
+
}
|
|
328
|
+
export interface MultiplayerValidateAuthTicketRequest {
|
|
329
|
+
auth_ticket: string;
|
|
330
|
+
remote_identity?: string;
|
|
331
|
+
consume?: boolean;
|
|
332
|
+
}
|
|
333
|
+
export interface MultiplayerValidateAuthTicketForServerRequest extends MultiplayerValidateAuthTicketRequest {
|
|
334
|
+
server_token: string;
|
|
335
|
+
}
|
|
336
|
+
export interface MultiplayerValidateAuthTicketResponse {
|
|
337
|
+
valid: boolean;
|
|
338
|
+
ticket: MultiplayerAuthTicket;
|
|
339
|
+
}
|
|
340
|
+
export interface MultiplayerFavoritesParams {
|
|
341
|
+
player_id?: string;
|
|
342
|
+
kind?: MultiplayerFavoriteKind;
|
|
343
|
+
}
|
|
344
|
+
export interface MultiplayerFavoriteRequest {
|
|
345
|
+
player_id?: string;
|
|
346
|
+
server_id?: string;
|
|
347
|
+
kind?: MultiplayerFavoriteKind;
|
|
348
|
+
name?: string;
|
|
349
|
+
host?: string;
|
|
350
|
+
game_port?: number;
|
|
351
|
+
query_port?: number;
|
|
352
|
+
metadata?: MultiplayerMetadata;
|
|
353
|
+
last_played_at?: string;
|
|
354
|
+
}
|
|
355
|
+
export interface MultiplayerDeleteFavoriteParams {
|
|
356
|
+
player_id?: string;
|
|
357
|
+
}
|
|
358
|
+
export interface MultiplayerDeleteFavoriteResponse {
|
|
359
|
+
deleted: boolean;
|
|
360
|
+
}
|
|
361
|
+
export interface MultiplayerVoiceRoomListParams {
|
|
362
|
+
lobby_id?: string;
|
|
363
|
+
server_id?: string;
|
|
364
|
+
provider?: MultiplayerVoiceProvider;
|
|
365
|
+
topology?: MultiplayerVoiceTopology;
|
|
366
|
+
state?: MultiplayerVoiceState;
|
|
367
|
+
region?: string;
|
|
368
|
+
limit?: number;
|
|
369
|
+
}
|
|
370
|
+
export interface MultiplayerCreateVoiceRoomRequest {
|
|
371
|
+
player_id?: string;
|
|
372
|
+
display_name?: string;
|
|
373
|
+
lobby_id?: string;
|
|
374
|
+
server_id?: string;
|
|
375
|
+
provider?: MultiplayerVoiceProvider;
|
|
376
|
+
topology?: MultiplayerVoiceTopology;
|
|
377
|
+
state?: MultiplayerVoiceState;
|
|
378
|
+
region?: string;
|
|
379
|
+
codec?: MultiplayerVoiceCodec;
|
|
380
|
+
sample_rate?: number;
|
|
381
|
+
bitrate?: number;
|
|
382
|
+
frame_duration_ms?: 10 | 20 | 40 | 60;
|
|
383
|
+
channels?: 1 | 2;
|
|
384
|
+
max_participants?: number;
|
|
385
|
+
recording_allowed?: boolean;
|
|
386
|
+
moderation_enabled?: boolean;
|
|
387
|
+
connection_config?: MultiplayerMetadata;
|
|
388
|
+
metadata?: MultiplayerMetadata;
|
|
389
|
+
ttl_minutes?: number;
|
|
390
|
+
expires_at?: string;
|
|
391
|
+
}
|
|
392
|
+
export interface MultiplayerUpdateVoiceRoomRequest {
|
|
393
|
+
player_id?: string;
|
|
394
|
+
state?: MultiplayerVoiceState;
|
|
395
|
+
max_participants?: number;
|
|
396
|
+
recording_allowed?: boolean;
|
|
397
|
+
moderation_enabled?: boolean;
|
|
398
|
+
connection_config?: MultiplayerMetadata;
|
|
399
|
+
metadata?: MultiplayerMetadata;
|
|
400
|
+
expires_at?: string;
|
|
401
|
+
}
|
|
402
|
+
export interface MultiplayerJoinVoiceRoomRequest {
|
|
403
|
+
player_id?: string;
|
|
404
|
+
display_name?: string;
|
|
405
|
+
metadata?: MultiplayerMetadata;
|
|
406
|
+
ttl_minutes?: number;
|
|
407
|
+
}
|
|
408
|
+
export interface MultiplayerVoiceRoomTokenResponse {
|
|
409
|
+
voice_room: MultiplayerVoiceRoom;
|
|
410
|
+
participant: MultiplayerVoiceParticipant;
|
|
411
|
+
voice_token: string;
|
|
412
|
+
}
|
|
413
|
+
export interface MultiplayerVoiceHeartbeatRequest {
|
|
414
|
+
voice_token: string;
|
|
415
|
+
muted?: boolean;
|
|
416
|
+
deafened?: boolean;
|
|
417
|
+
speaking?: boolean;
|
|
418
|
+
last_sequence?: number;
|
|
419
|
+
ttl_minutes?: number;
|
|
420
|
+
}
|
|
421
|
+
export interface MultiplayerVoiceLeaveRequest {
|
|
422
|
+
voice_token: string;
|
|
423
|
+
}
|
|
424
|
+
export interface MultiplayerVoicePacketRequest {
|
|
425
|
+
voice_token: string;
|
|
426
|
+
packet_type?: MultiplayerVoicePacketType;
|
|
427
|
+
payload: string;
|
|
428
|
+
duration_ms?: number;
|
|
429
|
+
}
|
|
430
|
+
export interface MultiplayerVoicePollRequest {
|
|
431
|
+
voice_token: string;
|
|
432
|
+
after_sequence?: number;
|
|
433
|
+
limit?: number;
|
|
434
|
+
exclude_self?: boolean;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Steam-style multiplayer APIs for Glitch titles.
|
|
438
|
+
*
|
|
439
|
+
* The multiplayer surface is split into three groups:
|
|
440
|
+
* lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets.
|
|
441
|
+
* User JWTs can infer the player from the authenticated user. Title-token clients
|
|
442
|
+
* and game clients without a Glitch user session should pass a stable `player_id`.
|
|
443
|
+
* Dedicated servers use `server_token` on heartbeat and server-side ticket validation
|
|
444
|
+
* so they do not need to hold a user JWT or title token.
|
|
445
|
+
*
|
|
446
|
+
* These endpoints are intentionally database-agnostic from the SDK's point of view:
|
|
447
|
+
* callers work with public identifiers, metadata objects, and lifecycle events,
|
|
448
|
+
* while the backend owns how those records are stored.
|
|
449
|
+
*/
|
|
450
|
+
declare class Multiplayer {
|
|
451
|
+
/**
|
|
452
|
+
* Search joinable, non-expired lobbies for a title.
|
|
453
|
+
*
|
|
454
|
+
* Filters are exact-match except `skill_band`, which the backend can use for
|
|
455
|
+
* near sorting. Default results exclude full, closed, unjoinable, and expired
|
|
456
|
+
* lobbies. Lifecycle context: clients usually call this before `joinLobby`;
|
|
457
|
+
* joins create a `lobby.joined` event on the backend.
|
|
458
|
+
*
|
|
459
|
+
* @param title_id Title UUID.
|
|
460
|
+
* @param params Optional filters such as region, game mode, map, lobby type, skill band, and limit.
|
|
461
|
+
* @example
|
|
462
|
+
* Multiplayer.searchLobbies('title-uuid', {
|
|
463
|
+
* region: 'us-central',
|
|
464
|
+
* game_mode: 'ranked_duos',
|
|
465
|
+
* skill_band: 1840,
|
|
466
|
+
* limit: 25
|
|
467
|
+
* });
|
|
468
|
+
*/
|
|
469
|
+
static searchLobbies<T = MultiplayerLobby[]>(title_id: string, params?: MultiplayerLobbySearchParams): AxiosPromise<Response<T>>;
|
|
470
|
+
/**
|
|
471
|
+
* Create a lobby and insert the owner as the first joined member.
|
|
472
|
+
*
|
|
473
|
+
* Use this when matchmaking has no suitable lobby, when a player invites
|
|
474
|
+
* friends, or when a party needs pre-game setup before server assignment.
|
|
475
|
+
* Lifecycle events: `lobby.created`, then `lobby.joined` for the owner.
|
|
476
|
+
*
|
|
477
|
+
* @param title_id Title UUID.
|
|
478
|
+
* @param data Lobby configuration and optional owner/member metadata.
|
|
479
|
+
* @example
|
|
480
|
+
* Multiplayer.createLobby('title-uuid', {
|
|
481
|
+
* player_id: 'steam:76561198000000000',
|
|
482
|
+
* display_name: 'CinderAce',
|
|
483
|
+
* lobby_type: 'public',
|
|
484
|
+
* max_members: 4,
|
|
485
|
+
* region: 'us-central',
|
|
486
|
+
* game_mode: 'ranked_duos',
|
|
487
|
+
* metadata: { playlist: 'ranked', allow_voice: true }
|
|
488
|
+
* });
|
|
489
|
+
*/
|
|
490
|
+
static createLobby<T = MultiplayerLobby>(title_id: string, data: MultiplayerCreateLobbyRequest): AxiosPromise<Response<T>>;
|
|
491
|
+
/**
|
|
492
|
+
* Retrieve a lobby with members and assigned server information when present.
|
|
493
|
+
*
|
|
494
|
+
* Call this after lobby lifecycle notifications such as `lobby.joined`,
|
|
495
|
+
* `lobby.updated`, `lobby.owner_transferred`, or `lobby.server_assigned`.
|
|
496
|
+
*
|
|
497
|
+
* @param title_id Title UUID.
|
|
498
|
+
* @param lobby_id Lobby UUID.
|
|
499
|
+
*/
|
|
500
|
+
static showLobby<T = MultiplayerLobby>(title_id: string, lobby_id: string): AxiosPromise<Response<T>>;
|
|
501
|
+
/**
|
|
502
|
+
* Join a lobby or refresh an existing membership.
|
|
503
|
+
*
|
|
504
|
+
* This call is idempotent for a player already in the lobby and can update
|
|
505
|
+
* display name, ready state, or member metadata. It returns 409 when the lobby
|
|
506
|
+
* is full, closed, expired, or not joinable. Lifecycle event: `lobby.joined`.
|
|
507
|
+
*
|
|
508
|
+
* @param title_id Title UUID.
|
|
509
|
+
* @param lobby_id Lobby UUID.
|
|
510
|
+
* @param data Player identity and optional member metadata.
|
|
511
|
+
* @example
|
|
512
|
+
* Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
|
|
513
|
+
* player_id: 'steam:76561198000000001',
|
|
514
|
+
* display_name: 'Nova',
|
|
515
|
+
* ready: false,
|
|
516
|
+
* member_data: { character: 'Ash', rank: 1799 }
|
|
517
|
+
* });
|
|
518
|
+
*/
|
|
519
|
+
static joinLobby<T = MultiplayerLobbyMember>(title_id: string, lobby_id: string, data: MultiplayerJoinLobbyRequest): AxiosPromise<Response<T>>;
|
|
520
|
+
/**
|
|
521
|
+
* Leave a lobby.
|
|
522
|
+
*
|
|
523
|
+
* If the owner leaves, ownership transfers to the oldest remaining joined
|
|
524
|
+
* member. If no members remain, the lobby closes. Lifecycle events:
|
|
525
|
+
* `lobby.left`, optionally `lobby.owner_transferred` or `lobby.updated`.
|
|
526
|
+
*
|
|
527
|
+
* @param title_id Title UUID.
|
|
528
|
+
* @param lobby_id Lobby UUID.
|
|
529
|
+
* @param data Optional player_id for title-token clients.
|
|
530
|
+
*/
|
|
531
|
+
static leaveLobby<T = MultiplayerLobbyMember | null>(title_id: string, lobby_id: string, data?: MultiplayerLeaveLobbyRequest): AxiosPromise<Response<T>>;
|
|
532
|
+
/**
|
|
533
|
+
* Update lobby metadata, visibility, joinability, limits, or state.
|
|
534
|
+
*
|
|
535
|
+
* This is owner-only. `max_members` cannot be lower than the current member
|
|
536
|
+
* count. Keep metadata low-frequency and mostly search/display oriented.
|
|
537
|
+
* Lifecycle event: `lobby.updated`.
|
|
538
|
+
*
|
|
539
|
+
* @param title_id Title UUID.
|
|
540
|
+
* @param lobby_id Lobby UUID.
|
|
541
|
+
* @param data Owner identity plus fields to update.
|
|
542
|
+
*/
|
|
543
|
+
static updateLobby<T = MultiplayerLobby>(title_id: string, lobby_id: string, data: MultiplayerUpdateLobbyRequest): AxiosPromise<Response<T>>;
|
|
544
|
+
/**
|
|
545
|
+
* Assign a registered game server to a lobby.
|
|
546
|
+
*
|
|
547
|
+
* This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients
|
|
548
|
+
* should react by reserving or connecting to the assigned server, then
|
|
549
|
+
* optionally leaving the lobby. Lifecycle event: `lobby.server_assigned`.
|
|
550
|
+
*
|
|
551
|
+
* @param title_id Title UUID.
|
|
552
|
+
* @param lobby_id Lobby UUID.
|
|
553
|
+
* @param data Server UUID and optional lobby state/joinability updates.
|
|
554
|
+
*/
|
|
555
|
+
static setLobbyServer<T = MultiplayerLobby>(title_id: string, lobby_id: string, data: MultiplayerSetLobbyServerRequest): AxiosPromise<Response<T>>;
|
|
556
|
+
/**
|
|
557
|
+
* List ordered low-bandwidth lobby messages.
|
|
558
|
+
*
|
|
559
|
+
* Use `after_sequence` to poll for messages missed during reconnects or after
|
|
560
|
+
* a realtime `lobby.message_sent` event. This channel is for chat and control
|
|
561
|
+
* messages, not gameplay, positional data, or voice streaming.
|
|
562
|
+
*
|
|
563
|
+
* @param title_id Title UUID.
|
|
564
|
+
* @param lobby_id Lobby UUID.
|
|
565
|
+
* @param params Optional sequence cursor and limit.
|
|
566
|
+
*/
|
|
567
|
+
static listLobbyMessages<T = MultiplayerLobbyMessage[]>(title_id: string, lobby_id: string, params?: MultiplayerLobbyMessagesParams): AxiosPromise<Response<T>>;
|
|
568
|
+
/**
|
|
569
|
+
* Send a low-bandwidth message to all lobby members.
|
|
570
|
+
*
|
|
571
|
+
* Payloads are capped at 4KB by the backend. Use this for chat, ready signals,
|
|
572
|
+
* invite/kick control messages, and owner-arbitrated choices. Lifecycle event:
|
|
573
|
+
* `lobby.message_sent`.
|
|
574
|
+
*
|
|
575
|
+
* @param title_id Title UUID.
|
|
576
|
+
* @param lobby_id Lobby UUID.
|
|
577
|
+
* @param data Message type, sender identity, and JSON payload.
|
|
578
|
+
* @example
|
|
579
|
+
* Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
|
|
580
|
+
* player_id: 'steam:76561198000000000',
|
|
581
|
+
* message_type: 'ready',
|
|
582
|
+
* payload: { ready: true }
|
|
583
|
+
* });
|
|
584
|
+
*/
|
|
585
|
+
static sendLobbyMessage<T = MultiplayerLobbyMessage>(title_id: string, lobby_id: string, data: MultiplayerSendLobbyMessageRequest): AxiosPromise<Response<T>>;
|
|
586
|
+
/**
|
|
587
|
+
* List active/non-expired voice rooms for a title.
|
|
588
|
+
*
|
|
589
|
+
* Rooms can be attached to a lobby, a server, a party, or a proximity group.
|
|
590
|
+
* Use this to discover existing voice state before joining. Lifecycle context:
|
|
591
|
+
* realtime transports should mirror `voice.room_created`, `voice.room_updated`,
|
|
592
|
+
* `voice.joined`, and `voice.left`.
|
|
593
|
+
*
|
|
594
|
+
* @param title_id Title UUID.
|
|
595
|
+
* @param params Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.
|
|
596
|
+
*/
|
|
597
|
+
static listVoiceRooms<T = MultiplayerVoiceRoom[]>(title_id: string, params?: MultiplayerVoiceRoomListParams): AxiosPromise<Response<T>>;
|
|
598
|
+
/**
|
|
599
|
+
* Create a voice room and join the creator as the first participant.
|
|
600
|
+
*
|
|
601
|
+
* The backend returns `voice_token` once. Keep it client-side and use it for
|
|
602
|
+
* voice heartbeat, packet send, packet polling, and leave calls. `glitch_relay`
|
|
603
|
+
* can carry base64 Opus frames for prototypes, small-party fallback, or
|
|
604
|
+
* signaling. For production-scale audio, set `provider: 'external'` and reuse
|
|
605
|
+
* the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an
|
|
606
|
+
* engine-native transport. Lifecycle events: `voice.room_created`,
|
|
607
|
+
* `voice.joined`.
|
|
608
|
+
*
|
|
609
|
+
* @param title_id Title UUID.
|
|
610
|
+
* @param data Voice codec, topology, linked lobby/server, and owner metadata.
|
|
611
|
+
* @example
|
|
612
|
+
* const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
|
|
613
|
+
* player_id: 'steam:76561198000000000',
|
|
614
|
+
* display_name: 'CinderAce',
|
|
615
|
+
* lobby_id: 'lobby-uuid',
|
|
616
|
+
* provider: 'glitch_relay',
|
|
617
|
+
* topology: 'lobby',
|
|
618
|
+
* codec: 'opus',
|
|
619
|
+
* sample_rate: 48000,
|
|
620
|
+
* frame_duration_ms: 20,
|
|
621
|
+
* channels: 1,
|
|
622
|
+
* metadata: { push_to_talk: true }
|
|
623
|
+
* });
|
|
624
|
+
*/
|
|
625
|
+
static createVoiceRoom<T = MultiplayerVoiceRoomTokenResponse>(title_id: string, data: MultiplayerCreateVoiceRoomRequest): AxiosPromise<Response<T>>;
|
|
626
|
+
/**
|
|
627
|
+
* Retrieve a voice room with participant media states.
|
|
628
|
+
*
|
|
629
|
+
* Use this after `voice.joined`, `voice.heartbeat`, `voice.left`, or
|
|
630
|
+
* `voice.room_updated` to refresh in-game UI such as speaker lists, mute
|
|
631
|
+
* icons, or team voice controls.
|
|
632
|
+
*
|
|
633
|
+
* @param title_id Title UUID.
|
|
634
|
+
* @param voice_room_id Voice room UUID.
|
|
635
|
+
*/
|
|
636
|
+
static showVoiceRoom<T = MultiplayerVoiceRoom>(title_id: string, voice_room_id: string): AxiosPromise<Response<T>>;
|
|
637
|
+
/**
|
|
638
|
+
* Update owner-controlled voice room state.
|
|
639
|
+
*
|
|
640
|
+
* Owner-only. Use this to close a room, adjust capacity, update moderation
|
|
641
|
+
* flags, or provide external provider connection details. The backend rejects
|
|
642
|
+
* lowering `max_participants` below the current participant count. Lifecycle
|
|
643
|
+
* event: `voice.room_updated`.
|
|
644
|
+
*
|
|
645
|
+
* @param title_id Title UUID.
|
|
646
|
+
* @param voice_room_id Voice room UUID.
|
|
647
|
+
* @param data Owner player identity and room fields to update.
|
|
648
|
+
*/
|
|
649
|
+
static updateVoiceRoom<T = MultiplayerVoiceRoom>(title_id: string, voice_room_id: string, data: MultiplayerUpdateVoiceRoomRequest): AxiosPromise<Response<T>>;
|
|
650
|
+
/**
|
|
651
|
+
* Join a voice room and receive a participant-scoped token.
|
|
652
|
+
*
|
|
653
|
+
* Rejoining with the same player is idempotent and rotates the token. The
|
|
654
|
+
* token is used by participant endpoints instead of requiring a user JWT or
|
|
655
|
+
* title token on every media request. Returns 409 when the room is closed,
|
|
656
|
+
* expired, or full. Lifecycle event: `voice.joined`.
|
|
657
|
+
*
|
|
658
|
+
* @param title_id Title UUID.
|
|
659
|
+
* @param voice_room_id Voice room UUID.
|
|
660
|
+
* @param data Player identity, display name, metadata, and token TTL.
|
|
661
|
+
*/
|
|
662
|
+
static joinVoiceRoom<T = MultiplayerVoiceRoomTokenResponse>(title_id: string, voice_room_id: string, data: MultiplayerJoinVoiceRoomRequest): AxiosPromise<Response<T>>;
|
|
663
|
+
/**
|
|
664
|
+
* Heartbeat voice participant state.
|
|
665
|
+
*
|
|
666
|
+
* Call every 10-30 seconds and whenever mute/deafen/speaking state changes.
|
|
667
|
+
* `last_sequence` tells the backend how far this participant has processed
|
|
668
|
+
* ordered packets. Expired participants are rejected with 409. Lifecycle event:
|
|
669
|
+
* `voice.heartbeat`.
|
|
670
|
+
*
|
|
671
|
+
* @param data Participant voice token and mutable media state.
|
|
672
|
+
*/
|
|
673
|
+
static heartbeatVoice<T = MultiplayerVoiceParticipant>(data: MultiplayerVoiceHeartbeatRequest): AxiosPromise<Response<T>>;
|
|
674
|
+
/**
|
|
675
|
+
* Leave the current voice room for a participant token.
|
|
676
|
+
*
|
|
677
|
+
* This is idempotent for disconnect cleanup: room participant count is
|
|
678
|
+
* decremented once, room ownership is transferred when possible, and an
|
|
679
|
+
* empty room closes. The token remains valid only for retrying this leave
|
|
680
|
+
* call; heartbeat, send, and poll calls reject left participants. Lifecycle
|
|
681
|
+
* event: `voice.left`.
|
|
682
|
+
*
|
|
683
|
+
* @param data Participant voice token.
|
|
684
|
+
*/
|
|
685
|
+
static leaveVoice<T = MultiplayerVoiceParticipant>(data: MultiplayerVoiceLeaveRequest): AxiosPromise<Response<T>>;
|
|
686
|
+
/**
|
|
687
|
+
* Send one ordered voice-room packet.
|
|
688
|
+
*
|
|
689
|
+
* `audio` packets should contain compact compressed frames such as base64 Opus
|
|
690
|
+
* at 48kHz mono/20ms. `offer`, `answer`, and `ice` packets support WebRTC
|
|
691
|
+
* signaling. `control`, `speaking`, and `mute_state` packets are for custom
|
|
692
|
+
* engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB.
|
|
693
|
+
* Muted participants cannot send audio. Lifecycle event: `voice.packet_sent`.
|
|
694
|
+
*
|
|
695
|
+
* @param data Participant token, packet type, payload, and optional duration.
|
|
696
|
+
* @example
|
|
697
|
+
* await Multiplayer.sendVoicePacket({
|
|
698
|
+
* voice_token: voiceToken,
|
|
699
|
+
* packet_type: 'audio',
|
|
700
|
+
* payload: base64OpusFrame,
|
|
701
|
+
* duration_ms: 20
|
|
702
|
+
* });
|
|
703
|
+
*/
|
|
704
|
+
static sendVoicePacket<T = MultiplayerVoicePacket>(data: MultiplayerVoicePacketRequest): AxiosPromise<Response<T>>;
|
|
705
|
+
/**
|
|
706
|
+
* Poll ordered voice-room packets after a known sequence.
|
|
707
|
+
*
|
|
708
|
+
* Defaults to excluding packets sent by the caller. Use the highest returned
|
|
709
|
+
* sequence as the next `after_sequence` cursor. This is useful for fallback
|
|
710
|
+
* relay, WebRTC signaling, reconnect recovery, and small-party prototypes.
|
|
711
|
+
* Lifecycle event: `voice.packet_polled`.
|
|
712
|
+
*
|
|
713
|
+
* @param data Participant token, optional sequence cursor, limit, and self-exclusion flag.
|
|
714
|
+
*/
|
|
715
|
+
static pollVoicePackets<T = MultiplayerVoicePacket[]>(data: MultiplayerVoicePollRequest): AxiosPromise<Response<T>>;
|
|
716
|
+
/**
|
|
717
|
+
* Browse public, joinable multiplayer servers for a title.
|
|
718
|
+
*
|
|
719
|
+
* Default results exclude private, draining, offline, stale, expired, and full
|
|
720
|
+
* servers. Title administrators can pass `include_private` to inspect servers
|
|
721
|
+
* that normal clients cannot join.
|
|
722
|
+
*
|
|
723
|
+
* @param title_id Title UUID.
|
|
724
|
+
* @param params Optional server browser filters.
|
|
725
|
+
*/
|
|
726
|
+
static browseServers<T = MultiplayerServer[]>(title_id: string, params?: MultiplayerServerBrowserParams): AxiosPromise<Response<T>>;
|
|
727
|
+
/**
|
|
728
|
+
* Register or refresh a multiplayer server and receive a one-time server token.
|
|
729
|
+
*
|
|
730
|
+
* Store `server_token` only on the server process. The backend stores only a
|
|
731
|
+
* hash and will not return the plain token again. Counts are validated so
|
|
732
|
+
* `current_players + bot_players` cannot exceed `max_players`. Lifecycle event:
|
|
733
|
+
* `server.registered`.
|
|
734
|
+
*
|
|
735
|
+
* @param title_id Title UUID.
|
|
736
|
+
* @param data Server browser, connection, rule, and capacity metadata.
|
|
737
|
+
* @example
|
|
738
|
+
* Multiplayer.registerServer('title-uuid', {
|
|
739
|
+
* name: 'Ranked US Central 01',
|
|
740
|
+
* server_type: 'dedicated',
|
|
741
|
+
* status: 'active',
|
|
742
|
+
* host: '203.0.113.42',
|
|
743
|
+
* game_port: 7777,
|
|
744
|
+
* query_port: 27015,
|
|
745
|
+
* transport: 'udp',
|
|
746
|
+
* max_players: 16,
|
|
747
|
+
* secure: true,
|
|
748
|
+
* tags: ['ranked', 'duos']
|
|
749
|
+
* });
|
|
750
|
+
*/
|
|
751
|
+
static registerServer<T = MultiplayerRegisterServerResponse>(title_id: string, data: MultiplayerRegisterServerRequest): AxiosPromise<Response<T>>;
|
|
752
|
+
/**
|
|
753
|
+
* Heartbeat a multiplayer server with its dedicated `server_token`.
|
|
754
|
+
*
|
|
755
|
+
* Call every 30-60 seconds and whenever player counts, rules, or metadata
|
|
756
|
+
* change. Stale servers are hidden from default browsing and reservation.
|
|
757
|
+
* This endpoint is for dedicated/listen server processes and does not require
|
|
758
|
+
* a user JWT. Lifecycle event: `server.heartbeat`.
|
|
759
|
+
*
|
|
760
|
+
* @param title_id Title UUID.
|
|
761
|
+
* @param server_id Server UUID.
|
|
762
|
+
* @param data Server token and optional mutable server state.
|
|
763
|
+
*/
|
|
764
|
+
static heartbeatServer<T = MultiplayerServer>(title_id: string, server_id: string, data: MultiplayerServerHeartbeatRequest): AxiosPromise<Response<T>>;
|
|
765
|
+
/**
|
|
766
|
+
* Reserve a short-lived slot on a multiplayer server before connecting.
|
|
767
|
+
*
|
|
768
|
+
* Reservations protect capacity during game handoff. The backend rejects stale,
|
|
769
|
+
* private, full, draining, offline, expired, or duplicate open reservations.
|
|
770
|
+
* The plain `reservation_token` is returned once and is used for session
|
|
771
|
+
* heartbeat/release calls. Lifecycle event: `server.reserved`.
|
|
772
|
+
*
|
|
773
|
+
* @param title_id Title UUID.
|
|
774
|
+
* @param server_id Server UUID.
|
|
775
|
+
* @param data Optional player/lobby identity and reservation TTL.
|
|
776
|
+
*/
|
|
777
|
+
static reserveServer<T = MultiplayerReserveServerResponse>(title_id: string, server_id: string, data?: MultiplayerReserveServerRequest): AxiosPromise<Response<T>>;
|
|
778
|
+
/**
|
|
779
|
+
* Heartbeat an open multiplayer session reservation.
|
|
780
|
+
*
|
|
781
|
+
* Use this after a successful reservation while the client is connecting or
|
|
782
|
+
* playing. Expired sessions are marked expired and capacity is recovered before
|
|
783
|
+
* the backend returns 409. Lifecycle events: `session.heartbeat` or
|
|
784
|
+
* `session.expired`.
|
|
785
|
+
*
|
|
786
|
+
* @param data Reservation token and optional state/TTL.
|
|
787
|
+
*/
|
|
788
|
+
static heartbeatSession<T = MultiplayerSession>(data: MultiplayerSessionHeartbeatRequest): AxiosPromise<Response<T>>;
|
|
789
|
+
/**
|
|
790
|
+
* Release an open multiplayer session reservation.
|
|
791
|
+
*
|
|
792
|
+
* Call this on normal disconnect, failed connection attempts, or shutdown so
|
|
793
|
+
* server capacity is decremented promptly. The backend makes release safe to
|
|
794
|
+
* call more than once for an already closed reservation. Lifecycle event:
|
|
795
|
+
* `session.released`.
|
|
796
|
+
*
|
|
797
|
+
* @param data Reservation token returned by `reserveServer`.
|
|
798
|
+
*/
|
|
799
|
+
static releaseSession<T = MultiplayerSession>(data: MultiplayerSessionReleaseRequest): AxiosPromise<Response<T>>;
|
|
800
|
+
/**
|
|
801
|
+
* Issue a short-lived multiplayer auth ticket for a player.
|
|
802
|
+
*
|
|
803
|
+
* The plain `auth_ticket` is returned once and only a hash is stored by the
|
|
804
|
+
* backend. Use this for P2P or dedicated-server admission before game traffic
|
|
805
|
+
* begins. `remote_identity` can bind the ticket to a server or validator.
|
|
806
|
+
* Lifecycle event: `auth_ticket.issued`.
|
|
807
|
+
*
|
|
808
|
+
* @param title_id Title UUID.
|
|
809
|
+
* @param data Player identity, optional remote identity, and TTL.
|
|
810
|
+
*/
|
|
811
|
+
static issueAuthTicket<T = MultiplayerIssueAuthTicketResponse>(title_id: string, data?: MultiplayerIssueAuthTicketRequest): AxiosPromise<Response<T>>;
|
|
812
|
+
/**
|
|
813
|
+
* Validate a multiplayer auth ticket from a trusted title/user context.
|
|
814
|
+
*
|
|
815
|
+
* Pass `consume: true` for one-time tickets to prevent replay. Dedicated
|
|
816
|
+
* servers should usually call `validateAuthTicketForServer` so they can use
|
|
817
|
+
* `server_token` instead of a title token or user JWT. Lifecycle event:
|
|
818
|
+
* `auth_ticket.validated`.
|
|
819
|
+
*
|
|
820
|
+
* @param title_id Title UUID.
|
|
821
|
+
* @param data Ticket, optional remote identity check, and consume flag.
|
|
822
|
+
*/
|
|
823
|
+
static validateAuthTicket<T = MultiplayerValidateAuthTicketResponse>(title_id: string, data: MultiplayerValidateAuthTicketRequest): AxiosPromise<Response<T>>;
|
|
824
|
+
/**
|
|
825
|
+
* Validate an auth ticket as a dedicated server.
|
|
826
|
+
*
|
|
827
|
+
* This server-token endpoint lets a dedicated server admit players without
|
|
828
|
+
* holding a user JWT or title token. Pass `consume: true` to prevent replay.
|
|
829
|
+
* Lifecycle event: `auth_ticket.validated`.
|
|
830
|
+
*
|
|
831
|
+
* @param title_id Title UUID.
|
|
832
|
+
* @param server_id Server UUID.
|
|
833
|
+
* @param data Server token, player auth ticket, optional remote identity, and consume flag.
|
|
834
|
+
*/
|
|
835
|
+
static validateAuthTicketForServer<T = MultiplayerValidateAuthTicketResponse>(title_id: string, server_id: string, data: MultiplayerValidateAuthTicketForServerRequest): AxiosPromise<Response<T>>;
|
|
836
|
+
/**
|
|
837
|
+
* List a player's server favorites or history entries.
|
|
838
|
+
*
|
|
839
|
+
* Use this for Steam-like favorites and recent servers tabs. Title-token
|
|
840
|
+
* clients should pass `player_id`; user JWT clients default to the user UUID.
|
|
841
|
+
*
|
|
842
|
+
* @param title_id Title UUID.
|
|
843
|
+
* @param params Optional player and favorite/history filter.
|
|
844
|
+
*/
|
|
845
|
+
static listFavorites<T = MultiplayerServerFavorite[]>(title_id: string, params?: MultiplayerFavoritesParams): AxiosPromise<Response<T>>;
|
|
846
|
+
/**
|
|
847
|
+
* Add or update a favorite/history server entry for a player.
|
|
848
|
+
*
|
|
849
|
+
* Provide `server_id` for a registered Glitch server, or `host` plus
|
|
850
|
+
* `game_port` for a direct/community server. Lifecycle event:
|
|
851
|
+
* `favorite.upserted`.
|
|
852
|
+
*
|
|
853
|
+
* @param title_id Title UUID.
|
|
854
|
+
* @param data Favorite/history target and optional metadata.
|
|
855
|
+
*/
|
|
856
|
+
static addFavorite<T = MultiplayerServerFavorite>(title_id: string, data: MultiplayerFavoriteRequest): AxiosPromise<Response<T>>;
|
|
857
|
+
/**
|
|
858
|
+
* Delete a player's favorite/history server entry.
|
|
859
|
+
*
|
|
860
|
+
* The SDK sends optional `player_id` as a query parameter because the shared
|
|
861
|
+
* request helper treats DELETE payloads as query params. This maps cleanly to
|
|
862
|
+
* the backend's optional player identity validation for title-token clients.
|
|
863
|
+
* Lifecycle event: `favorite.deleted`.
|
|
864
|
+
*
|
|
865
|
+
* @param title_id Title UUID.
|
|
866
|
+
* @param favorite_id Favorite/history UUID.
|
|
867
|
+
* @param params Optional player_id for title-token clients.
|
|
868
|
+
*/
|
|
869
|
+
static deleteFavorite<T = MultiplayerDeleteFavoriteResponse>(title_id: string, favorite_id: string, params?: MultiplayerDeleteFavoriteParams): AxiosPromise<Response<T>>;
|
|
870
|
+
}
|
|
871
|
+
export default Multiplayer;
|