glitch-javascript-sdk 3.1.4 → 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 CHANGED
@@ -17306,6 +17306,7 @@ var axios$1 = axios;
17306
17306
  var HTTP_METHODS = {
17307
17307
  GET: 'GET',
17308
17308
  POST: 'POST',
17309
+ PATCH: 'PATCH',
17309
17310
  PUT: 'PUT',
17310
17311
  DELETE: 'DELETE',
17311
17312
  };
@@ -17392,6 +17393,21 @@ var Requests = /** @class */ (function () {
17392
17393
  }
17393
17394
  return Requests.request('PUT', url, data);
17394
17395
  };
17396
+ Requests.patch = function (url, data, params) {
17397
+ if (params && Object.keys(params).length > 0) {
17398
+ var queryString = Object.entries(params)
17399
+ .map(function (_a) {
17400
+ var key = _a[0], value = _a[1];
17401
+ return "".concat(key, "=").concat(encodeURIComponent(value));
17402
+ })
17403
+ .join('&');
17404
+ url = "".concat(url, "?").concat(queryString);
17405
+ }
17406
+ if (Requests.community_id) {
17407
+ data = __assign(__assign({}, data), { community_id: Requests.community_id });
17408
+ }
17409
+ return Requests.request('PATCH', url, data);
17410
+ };
17395
17411
  Requests.delete = function (url, params) {
17396
17412
  if (params && Object.keys(params).length > 0) {
17397
17413
  var queryString = Object.entries(params)
@@ -17563,6 +17579,9 @@ var Requests = /** @class */ (function () {
17563
17579
  else if (route.method == HTTP_METHODS.POST) {
17564
17580
  return Requests.post(url, data, params);
17565
17581
  }
17582
+ else if (route.method == HTTP_METHODS.PATCH) {
17583
+ return Requests.patch(url, data, params);
17584
+ }
17566
17585
  else if (route.method == HTTP_METHODS.PUT) {
17567
17586
  return Requests.put(url, data, params);
17568
17587
  }
@@ -24043,6 +24062,16 @@ var TitlesRoute = /** @class */ (function () {
24043
24062
  wishlistConversions: { url: '/titles/{title_id}/wishlist/conversions', method: HTTP_METHODS.GET },
24044
24063
  wishlistGeo: { url: '/titles/{title_id}/wishlist/geo', method: HTTP_METHODS.GET },
24045
24064
  wishlistDevices: { url: '/titles/{title_id}/wishlist/devices', method: HTTP_METHODS.GET },
24065
+ // Game Reviews
24066
+ reviewsList: { url: '/titles/{title_id}/reviews', method: HTTP_METHODS.GET },
24067
+ reviewsSummary: { url: '/titles/{title_id}/review-summary', method: HTTP_METHODS.GET },
24068
+ reviewsCreate: { url: '/titles/{title_id}/reviews', method: HTTP_METHODS.POST },
24069
+ reviewsShow: { url: '/reviews/{review_id}', method: HTTP_METHODS.GET },
24070
+ reviewsUpdate: { url: '/reviews/{review_id}', method: HTTP_METHODS.PATCH },
24071
+ reviewsDelete: { url: '/reviews/{review_id}', method: HTTP_METHODS.DELETE },
24072
+ reviewsVote: { url: '/reviews/{review_id}/vote', method: HTTP_METHODS.POST },
24073
+ reviewsReport: { url: '/reviews/{review_id}/report', method: HTTP_METHODS.POST },
24074
+ reviewsDeveloperResponse: { url: '/reviews/{review_id}/developer-response', method: HTTP_METHODS.POST },
24046
24075
  };
24047
24076
  return TitlesRoute;
24048
24077
  }());
@@ -24977,6 +25006,64 @@ var Titles = /** @class */ (function () {
24977
25006
  Titles.wishlistDevices = function (title_id, params) {
24978
25007
  return Requests.processRoute(TitlesRoute.routes.wishlistDevices, undefined, { title_id: title_id }, params);
24979
25008
  };
25009
+ /**
25010
+ * List public reviews for a title.
25011
+ *
25012
+ * @param title_id The UUID of the title.
25013
+ * @param params Optional filters: recommendation, language, current_version_only,
25014
+ * verified_only, platform, acquisition_type, complaint, playtime, sort, per_page.
25015
+ */
25016
+ Titles.listReviews = function (title_id, params) {
25017
+ return Requests.processRoute(TitlesRoute.routes.reviewsList, {}, { title_id: title_id }, params);
25018
+ };
25019
+ /**
25020
+ * Get aggregate review scores and structured praise/complaint summaries.
25021
+ */
25022
+ Titles.reviewSummary = function (title_id, params) {
25023
+ return Requests.processRoute(TitlesRoute.routes.reviewsSummary, {}, { title_id: title_id }, params);
25024
+ };
25025
+ /**
25026
+ * Create the current user's review for a title. The backend verifies play/purchase eligibility.
25027
+ */
25028
+ Titles.createReview = function (title_id, data) {
25029
+ return Requests.processRoute(TitlesRoute.routes.reviewsCreate, data, { title_id: title_id });
25030
+ };
25031
+ /**
25032
+ * View a single review, including revision history when the backend includes it.
25033
+ */
25034
+ Titles.viewReview = function (review_id, params) {
25035
+ return Requests.processRoute(TitlesRoute.routes.reviewsShow, {}, { review_id: review_id }, params);
25036
+ };
25037
+ /**
25038
+ * Update the current user's review and preserve a backend revision trail.
25039
+ */
25040
+ Titles.updateReview = function (review_id, data) {
25041
+ return Requests.processRoute(TitlesRoute.routes.reviewsUpdate, data, { review_id: review_id });
25042
+ };
25043
+ /**
25044
+ * Delete the current user's review, or a title admin's moderated review.
25045
+ */
25046
+ Titles.deleteReview = function (review_id) {
25047
+ return Requests.processRoute(TitlesRoute.routes.reviewsDelete, {}, { review_id: review_id });
25048
+ };
25049
+ /**
25050
+ * Vote on a review as helpful, funny, detailed, or not helpful.
25051
+ */
25052
+ Titles.voteReview = function (review_id, vote_type) {
25053
+ return Requests.processRoute(TitlesRoute.routes.reviewsVote, { vote_type: vote_type }, { review_id: review_id });
25054
+ };
25055
+ /**
25056
+ * Report a review for moderation.
25057
+ */
25058
+ Titles.reportReview = function (review_id, data) {
25059
+ return Requests.processRoute(TitlesRoute.routes.reviewsReport, data, { review_id: review_id });
25060
+ };
25061
+ /**
25062
+ * Create or update the title developer's official response to a review.
25063
+ */
25064
+ Titles.respondToReview = function (review_id, data) {
25065
+ return Requests.processRoute(TitlesRoute.routes.reviewsDeveloperResponse, data, { review_id: review_id });
25066
+ };
24980
25067
  return Titles;
24981
25068
  }());
24982
25069
 
@@ -30145,6 +30232,571 @@ var Crm = /** @class */ (function () {
30145
30232
  return Crm;
30146
30233
  }());
30147
30234
 
30235
+ var MultiplayerRoute = /** @class */ (function () {
30236
+ function MultiplayerRoute() {
30237
+ }
30238
+ MultiplayerRoute.routes = {
30239
+ searchLobbies: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.GET },
30240
+ createLobby: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.POST },
30241
+ showLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.GET },
30242
+ updateLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.PUT },
30243
+ joinLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/join', method: HTTP_METHODS.POST },
30244
+ leaveLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/leave', method: HTTP_METHODS.POST },
30245
+ setLobbyServer: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/server', method: HTTP_METHODS.POST },
30246
+ listLobbyMessages: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.GET },
30247
+ sendLobbyMessage: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.POST },
30248
+ listVoiceRooms: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.GET },
30249
+ createVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.POST },
30250
+ showVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.GET },
30251
+ updateVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.PUT },
30252
+ joinVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}/join', method: HTTP_METHODS.POST },
30253
+ heartbeatVoice: { url: '/multiplayer/voice/heartbeat', method: HTTP_METHODS.POST },
30254
+ leaveVoice: { url: '/multiplayer/voice/leave', method: HTTP_METHODS.POST },
30255
+ sendVoicePacket: { url: '/multiplayer/voice/packets', method: HTTP_METHODS.POST },
30256
+ pollVoicePackets: { url: '/multiplayer/voice/poll', method: HTTP_METHODS.POST },
30257
+ browseServers: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.GET },
30258
+ registerServer: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.POST },
30259
+ heartbeatServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/heartbeat', method: HTTP_METHODS.POST },
30260
+ reserveServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/reserve', method: HTTP_METHODS.POST },
30261
+ heartbeatSession: { url: '/multiplayer/sessions/heartbeat', method: HTTP_METHODS.POST },
30262
+ releaseSession: { url: '/multiplayer/sessions/release', method: HTTP_METHODS.POST },
30263
+ issueAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets', method: HTTP_METHODS.POST },
30264
+ validateAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets/validate', method: HTTP_METHODS.POST },
30265
+ validateAuthTicketForServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/auth-tickets/validate', method: HTTP_METHODS.POST },
30266
+ listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
30267
+ addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
30268
+ deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
30269
+ };
30270
+ return MultiplayerRoute;
30271
+ }());
30272
+
30273
+ /**
30274
+ * Steam-style multiplayer APIs for Glitch titles.
30275
+ *
30276
+ * The multiplayer surface is split into three groups:
30277
+ * lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets.
30278
+ * User JWTs can infer the player from the authenticated user. Title-token clients
30279
+ * and game clients without a Glitch user session should pass a stable `player_id`.
30280
+ * Dedicated servers use `server_token` on heartbeat and server-side ticket validation
30281
+ * so they do not need to hold a user JWT or title token.
30282
+ *
30283
+ * These endpoints are intentionally database-agnostic from the SDK's point of view:
30284
+ * callers work with public identifiers, metadata objects, and lifecycle events,
30285
+ * while the backend owns how those records are stored.
30286
+ */
30287
+ var Multiplayer = /** @class */ (function () {
30288
+ function Multiplayer() {
30289
+ }
30290
+ /**
30291
+ * Search joinable, non-expired lobbies for a title.
30292
+ *
30293
+ * Filters are exact-match except `skill_band`, which the backend can use for
30294
+ * near sorting. Default results exclude full, closed, unjoinable, and expired
30295
+ * lobbies. Lifecycle context: clients usually call this before `joinLobby`;
30296
+ * joins create a `lobby.joined` event on the backend.
30297
+ *
30298
+ * @param title_id Title UUID.
30299
+ * @param params Optional filters such as region, game mode, map, lobby type, skill band, and limit.
30300
+ * @example
30301
+ * Multiplayer.searchLobbies('title-uuid', {
30302
+ * region: 'us-central',
30303
+ * game_mode: 'ranked_duos',
30304
+ * skill_band: 1840,
30305
+ * limit: 25
30306
+ * });
30307
+ */
30308
+ Multiplayer.searchLobbies = function (title_id, params) {
30309
+ return Requests.processRoute(MultiplayerRoute.routes.searchLobbies, undefined, { title_id: title_id }, params);
30310
+ };
30311
+ /**
30312
+ * Create a lobby and insert the owner as the first joined member.
30313
+ *
30314
+ * Use this when matchmaking has no suitable lobby, when a player invites
30315
+ * friends, or when a party needs pre-game setup before server assignment.
30316
+ * Lifecycle events: `lobby.created`, then `lobby.joined` for the owner.
30317
+ *
30318
+ * @param title_id Title UUID.
30319
+ * @param data Lobby configuration and optional owner/member metadata.
30320
+ * @example
30321
+ * Multiplayer.createLobby('title-uuid', {
30322
+ * player_id: 'steam:76561198000000000',
30323
+ * display_name: 'CinderAce',
30324
+ * lobby_type: 'public',
30325
+ * max_members: 4,
30326
+ * region: 'us-central',
30327
+ * game_mode: 'ranked_duos',
30328
+ * metadata: { playlist: 'ranked', allow_voice: true }
30329
+ * });
30330
+ */
30331
+ Multiplayer.createLobby = function (title_id, data) {
30332
+ return Requests.processRoute(MultiplayerRoute.routes.createLobby, data, { title_id: title_id });
30333
+ };
30334
+ /**
30335
+ * Retrieve a lobby with members and assigned server information when present.
30336
+ *
30337
+ * Call this after lobby lifecycle notifications such as `lobby.joined`,
30338
+ * `lobby.updated`, `lobby.owner_transferred`, or `lobby.server_assigned`.
30339
+ *
30340
+ * @param title_id Title UUID.
30341
+ * @param lobby_id Lobby UUID.
30342
+ */
30343
+ Multiplayer.showLobby = function (title_id, lobby_id) {
30344
+ return Requests.processRoute(MultiplayerRoute.routes.showLobby, undefined, { title_id: title_id, lobby_id: lobby_id });
30345
+ };
30346
+ /**
30347
+ * Join a lobby or refresh an existing membership.
30348
+ *
30349
+ * This call is idempotent for a player already in the lobby and can update
30350
+ * display name, ready state, or member metadata. It returns 409 when the lobby
30351
+ * is full, closed, expired, or not joinable. Lifecycle event: `lobby.joined`.
30352
+ *
30353
+ * @param title_id Title UUID.
30354
+ * @param lobby_id Lobby UUID.
30355
+ * @param data Player identity and optional member metadata.
30356
+ * @example
30357
+ * Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
30358
+ * player_id: 'steam:76561198000000001',
30359
+ * display_name: 'Nova',
30360
+ * ready: false,
30361
+ * member_data: { character: 'Ash', rank: 1799 }
30362
+ * });
30363
+ */
30364
+ Multiplayer.joinLobby = function (title_id, lobby_id, data) {
30365
+ return Requests.processRoute(MultiplayerRoute.routes.joinLobby, data, { title_id: title_id, lobby_id: lobby_id });
30366
+ };
30367
+ /**
30368
+ * Leave a lobby.
30369
+ *
30370
+ * If the owner leaves, ownership transfers to the oldest remaining joined
30371
+ * member. If no members remain, the lobby closes. Lifecycle events:
30372
+ * `lobby.left`, optionally `lobby.owner_transferred` or `lobby.updated`.
30373
+ *
30374
+ * @param title_id Title UUID.
30375
+ * @param lobby_id Lobby UUID.
30376
+ * @param data Optional player_id for title-token clients.
30377
+ */
30378
+ Multiplayer.leaveLobby = function (title_id, lobby_id, data) {
30379
+ return Requests.processRoute(MultiplayerRoute.routes.leaveLobby, data, { title_id: title_id, lobby_id: lobby_id });
30380
+ };
30381
+ /**
30382
+ * Update lobby metadata, visibility, joinability, limits, or state.
30383
+ *
30384
+ * This is owner-only. `max_members` cannot be lower than the current member
30385
+ * count. Keep metadata low-frequency and mostly search/display oriented.
30386
+ * Lifecycle event: `lobby.updated`.
30387
+ *
30388
+ * @param title_id Title UUID.
30389
+ * @param lobby_id Lobby UUID.
30390
+ * @param data Owner identity plus fields to update.
30391
+ */
30392
+ Multiplayer.updateLobby = function (title_id, lobby_id, data) {
30393
+ return Requests.processRoute(MultiplayerRoute.routes.updateLobby, data, { title_id: title_id, lobby_id: lobby_id });
30394
+ };
30395
+ /**
30396
+ * Assign a registered game server to a lobby.
30397
+ *
30398
+ * This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients
30399
+ * should react by reserving or connecting to the assigned server, then
30400
+ * optionally leaving the lobby. Lifecycle event: `lobby.server_assigned`.
30401
+ *
30402
+ * @param title_id Title UUID.
30403
+ * @param lobby_id Lobby UUID.
30404
+ * @param data Server UUID and optional lobby state/joinability updates.
30405
+ */
30406
+ Multiplayer.setLobbyServer = function (title_id, lobby_id, data) {
30407
+ return Requests.processRoute(MultiplayerRoute.routes.setLobbyServer, data, { title_id: title_id, lobby_id: lobby_id });
30408
+ };
30409
+ /**
30410
+ * List ordered low-bandwidth lobby messages.
30411
+ *
30412
+ * Use `after_sequence` to poll for messages missed during reconnects or after
30413
+ * a realtime `lobby.message_sent` event. This channel is for chat and control
30414
+ * messages, not gameplay, positional data, or voice streaming.
30415
+ *
30416
+ * @param title_id Title UUID.
30417
+ * @param lobby_id Lobby UUID.
30418
+ * @param params Optional sequence cursor and limit.
30419
+ */
30420
+ Multiplayer.listLobbyMessages = function (title_id, lobby_id, params) {
30421
+ return Requests.processRoute(MultiplayerRoute.routes.listLobbyMessages, undefined, { title_id: title_id, lobby_id: lobby_id }, params);
30422
+ };
30423
+ /**
30424
+ * Send a low-bandwidth message to all lobby members.
30425
+ *
30426
+ * Payloads are capped at 4KB by the backend. Use this for chat, ready signals,
30427
+ * invite/kick control messages, and owner-arbitrated choices. Lifecycle event:
30428
+ * `lobby.message_sent`.
30429
+ *
30430
+ * @param title_id Title UUID.
30431
+ * @param lobby_id Lobby UUID.
30432
+ * @param data Message type, sender identity, and JSON payload.
30433
+ * @example
30434
+ * Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
30435
+ * player_id: 'steam:76561198000000000',
30436
+ * message_type: 'ready',
30437
+ * payload: { ready: true }
30438
+ * });
30439
+ */
30440
+ Multiplayer.sendLobbyMessage = function (title_id, lobby_id, data) {
30441
+ return Requests.processRoute(MultiplayerRoute.routes.sendLobbyMessage, data, { title_id: title_id, lobby_id: lobby_id });
30442
+ };
30443
+ /**
30444
+ * List active/non-expired voice rooms for a title.
30445
+ *
30446
+ * Rooms can be attached to a lobby, a server, a party, or a proximity group.
30447
+ * Use this to discover existing voice state before joining. Lifecycle context:
30448
+ * realtime transports should mirror `voice.room_created`, `voice.room_updated`,
30449
+ * `voice.joined`, and `voice.left`.
30450
+ *
30451
+ * @param title_id Title UUID.
30452
+ * @param params Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.
30453
+ */
30454
+ Multiplayer.listVoiceRooms = function (title_id, params) {
30455
+ return Requests.processRoute(MultiplayerRoute.routes.listVoiceRooms, undefined, { title_id: title_id }, params);
30456
+ };
30457
+ /**
30458
+ * Create a voice room and join the creator as the first participant.
30459
+ *
30460
+ * The backend returns `voice_token` once. Keep it client-side and use it for
30461
+ * voice heartbeat, packet send, packet polling, and leave calls. `glitch_relay`
30462
+ * can carry base64 Opus frames for prototypes, small-party fallback, or
30463
+ * signaling. For production-scale audio, set `provider: 'external'` and reuse
30464
+ * the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an
30465
+ * engine-native transport. Lifecycle events: `voice.room_created`,
30466
+ * `voice.joined`.
30467
+ *
30468
+ * @param title_id Title UUID.
30469
+ * @param data Voice codec, topology, linked lobby/server, and owner metadata.
30470
+ * @example
30471
+ * const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
30472
+ * player_id: 'steam:76561198000000000',
30473
+ * display_name: 'CinderAce',
30474
+ * lobby_id: 'lobby-uuid',
30475
+ * provider: 'glitch_relay',
30476
+ * topology: 'lobby',
30477
+ * codec: 'opus',
30478
+ * sample_rate: 48000,
30479
+ * frame_duration_ms: 20,
30480
+ * channels: 1,
30481
+ * metadata: { push_to_talk: true }
30482
+ * });
30483
+ */
30484
+ Multiplayer.createVoiceRoom = function (title_id, data) {
30485
+ return Requests.processRoute(MultiplayerRoute.routes.createVoiceRoom, data, { title_id: title_id });
30486
+ };
30487
+ /**
30488
+ * Retrieve a voice room with participant media states.
30489
+ *
30490
+ * Use this after `voice.joined`, `voice.heartbeat`, `voice.left`, or
30491
+ * `voice.room_updated` to refresh in-game UI such as speaker lists, mute
30492
+ * icons, or team voice controls.
30493
+ *
30494
+ * @param title_id Title UUID.
30495
+ * @param voice_room_id Voice room UUID.
30496
+ */
30497
+ Multiplayer.showVoiceRoom = function (title_id, voice_room_id) {
30498
+ return Requests.processRoute(MultiplayerRoute.routes.showVoiceRoom, undefined, { title_id: title_id, voice_room_id: voice_room_id });
30499
+ };
30500
+ /**
30501
+ * Update owner-controlled voice room state.
30502
+ *
30503
+ * Owner-only. Use this to close a room, adjust capacity, update moderation
30504
+ * flags, or provide external provider connection details. The backend rejects
30505
+ * lowering `max_participants` below the current participant count. Lifecycle
30506
+ * event: `voice.room_updated`.
30507
+ *
30508
+ * @param title_id Title UUID.
30509
+ * @param voice_room_id Voice room UUID.
30510
+ * @param data Owner player identity and room fields to update.
30511
+ */
30512
+ Multiplayer.updateVoiceRoom = function (title_id, voice_room_id, data) {
30513
+ return Requests.processRoute(MultiplayerRoute.routes.updateVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
30514
+ };
30515
+ /**
30516
+ * Join a voice room and receive a participant-scoped token.
30517
+ *
30518
+ * Rejoining with the same player is idempotent and rotates the token. The
30519
+ * token is used by participant endpoints instead of requiring a user JWT or
30520
+ * title token on every media request. Returns 409 when the room is closed,
30521
+ * expired, or full. Lifecycle event: `voice.joined`.
30522
+ *
30523
+ * @param title_id Title UUID.
30524
+ * @param voice_room_id Voice room UUID.
30525
+ * @param data Player identity, display name, metadata, and token TTL.
30526
+ */
30527
+ Multiplayer.joinVoiceRoom = function (title_id, voice_room_id, data) {
30528
+ return Requests.processRoute(MultiplayerRoute.routes.joinVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
30529
+ };
30530
+ /**
30531
+ * Heartbeat voice participant state.
30532
+ *
30533
+ * Call every 10-30 seconds and whenever mute/deafen/speaking state changes.
30534
+ * `last_sequence` tells the backend how far this participant has processed
30535
+ * ordered packets. Expired participants are rejected with 409. Lifecycle event:
30536
+ * `voice.heartbeat`.
30537
+ *
30538
+ * @param data Participant voice token and mutable media state.
30539
+ */
30540
+ Multiplayer.heartbeatVoice = function (data) {
30541
+ return Requests.processRoute(MultiplayerRoute.routes.heartbeatVoice, data);
30542
+ };
30543
+ /**
30544
+ * Leave the current voice room for a participant token.
30545
+ *
30546
+ * This is idempotent for disconnect cleanup: room participant count is
30547
+ * decremented once, room ownership is transferred when possible, and an
30548
+ * empty room closes. The token remains valid only for retrying this leave
30549
+ * call; heartbeat, send, and poll calls reject left participants. Lifecycle
30550
+ * event: `voice.left`.
30551
+ *
30552
+ * @param data Participant voice token.
30553
+ */
30554
+ Multiplayer.leaveVoice = function (data) {
30555
+ return Requests.processRoute(MultiplayerRoute.routes.leaveVoice, data);
30556
+ };
30557
+ /**
30558
+ * Send one ordered voice-room packet.
30559
+ *
30560
+ * `audio` packets should contain compact compressed frames such as base64 Opus
30561
+ * at 48kHz mono/20ms. `offer`, `answer`, and `ice` packets support WebRTC
30562
+ * signaling. `control`, `speaking`, and `mute_state` packets are for custom
30563
+ * engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB.
30564
+ * Muted participants cannot send audio. Lifecycle event: `voice.packet_sent`.
30565
+ *
30566
+ * @param data Participant token, packet type, payload, and optional duration.
30567
+ * @example
30568
+ * await Multiplayer.sendVoicePacket({
30569
+ * voice_token: voiceToken,
30570
+ * packet_type: 'audio',
30571
+ * payload: base64OpusFrame,
30572
+ * duration_ms: 20
30573
+ * });
30574
+ */
30575
+ Multiplayer.sendVoicePacket = function (data) {
30576
+ return Requests.processRoute(MultiplayerRoute.routes.sendVoicePacket, data);
30577
+ };
30578
+ /**
30579
+ * Poll ordered voice-room packets after a known sequence.
30580
+ *
30581
+ * Defaults to excluding packets sent by the caller. Use the highest returned
30582
+ * sequence as the next `after_sequence` cursor. This is useful for fallback
30583
+ * relay, WebRTC signaling, reconnect recovery, and small-party prototypes.
30584
+ * Lifecycle event: `voice.packet_polled`.
30585
+ *
30586
+ * @param data Participant token, optional sequence cursor, limit, and self-exclusion flag.
30587
+ */
30588
+ Multiplayer.pollVoicePackets = function (data) {
30589
+ return Requests.processRoute(MultiplayerRoute.routes.pollVoicePackets, data);
30590
+ };
30591
+ /**
30592
+ * Browse public, joinable multiplayer servers for a title.
30593
+ *
30594
+ * Default results exclude private, draining, offline, stale, expired, and full
30595
+ * servers. Title administrators can pass `include_private` to inspect servers
30596
+ * that normal clients cannot join.
30597
+ *
30598
+ * @param title_id Title UUID.
30599
+ * @param params Optional server browser filters.
30600
+ */
30601
+ Multiplayer.browseServers = function (title_id, params) {
30602
+ return Requests.processRoute(MultiplayerRoute.routes.browseServers, undefined, { title_id: title_id }, params);
30603
+ };
30604
+ /**
30605
+ * Register or refresh a multiplayer server and receive a one-time server token.
30606
+ *
30607
+ * Store `server_token` only on the server process. The backend stores only a
30608
+ * hash and will not return the plain token again. Counts are validated so
30609
+ * `current_players + bot_players` cannot exceed `max_players`. Lifecycle event:
30610
+ * `server.registered`.
30611
+ *
30612
+ * @param title_id Title UUID.
30613
+ * @param data Server browser, connection, rule, and capacity metadata.
30614
+ * @example
30615
+ * Multiplayer.registerServer('title-uuid', {
30616
+ * name: 'Ranked US Central 01',
30617
+ * server_type: 'dedicated',
30618
+ * status: 'active',
30619
+ * host: '203.0.113.42',
30620
+ * game_port: 7777,
30621
+ * query_port: 27015,
30622
+ * transport: 'udp',
30623
+ * max_players: 16,
30624
+ * secure: true,
30625
+ * tags: ['ranked', 'duos']
30626
+ * });
30627
+ */
30628
+ Multiplayer.registerServer = function (title_id, data) {
30629
+ return Requests.processRoute(MultiplayerRoute.routes.registerServer, data, { title_id: title_id });
30630
+ };
30631
+ /**
30632
+ * Heartbeat a multiplayer server with its dedicated `server_token`.
30633
+ *
30634
+ * Call every 30-60 seconds and whenever player counts, rules, or metadata
30635
+ * change. Stale servers are hidden from default browsing and reservation.
30636
+ * This endpoint is for dedicated/listen server processes and does not require
30637
+ * a user JWT. Lifecycle event: `server.heartbeat`.
30638
+ *
30639
+ * @param title_id Title UUID.
30640
+ * @param server_id Server UUID.
30641
+ * @param data Server token and optional mutable server state.
30642
+ */
30643
+ Multiplayer.heartbeatServer = function (title_id, server_id, data) {
30644
+ return Requests.processRoute(MultiplayerRoute.routes.heartbeatServer, data, { title_id: title_id, server_id: server_id });
30645
+ };
30646
+ /**
30647
+ * Reserve a short-lived slot on a multiplayer server before connecting.
30648
+ *
30649
+ * Reservations protect capacity during game handoff. The backend rejects stale,
30650
+ * private, full, draining, offline, expired, or duplicate open reservations.
30651
+ * The plain `reservation_token` is returned once and is used for session
30652
+ * heartbeat/release calls. Lifecycle event: `server.reserved`.
30653
+ *
30654
+ * @param title_id Title UUID.
30655
+ * @param server_id Server UUID.
30656
+ * @param data Optional player/lobby identity and reservation TTL.
30657
+ */
30658
+ Multiplayer.reserveServer = function (title_id, server_id, data) {
30659
+ return Requests.processRoute(MultiplayerRoute.routes.reserveServer, data, { title_id: title_id, server_id: server_id });
30660
+ };
30661
+ /**
30662
+ * Heartbeat an open multiplayer session reservation.
30663
+ *
30664
+ * Use this after a successful reservation while the client is connecting or
30665
+ * playing. Expired sessions are marked expired and capacity is recovered before
30666
+ * the backend returns 409. Lifecycle events: `session.heartbeat` or
30667
+ * `session.expired`.
30668
+ *
30669
+ * @param data Reservation token and optional state/TTL.
30670
+ */
30671
+ Multiplayer.heartbeatSession = function (data) {
30672
+ return Requests.processRoute(MultiplayerRoute.routes.heartbeatSession, data);
30673
+ };
30674
+ /**
30675
+ * Release an open multiplayer session reservation.
30676
+ *
30677
+ * Call this on normal disconnect, failed connection attempts, or shutdown so
30678
+ * server capacity is decremented promptly. The backend makes release safe to
30679
+ * call more than once for an already closed reservation. Lifecycle event:
30680
+ * `session.released`.
30681
+ *
30682
+ * @param data Reservation token returned by `reserveServer`.
30683
+ */
30684
+ Multiplayer.releaseSession = function (data) {
30685
+ return Requests.processRoute(MultiplayerRoute.routes.releaseSession, data);
30686
+ };
30687
+ /**
30688
+ * Issue a short-lived multiplayer auth ticket for a player.
30689
+ *
30690
+ * The plain `auth_ticket` is returned once and only a hash is stored by the
30691
+ * backend. Use this for P2P or dedicated-server admission before game traffic
30692
+ * begins. `remote_identity` can bind the ticket to a server or validator.
30693
+ * Lifecycle event: `auth_ticket.issued`.
30694
+ *
30695
+ * @param title_id Title UUID.
30696
+ * @param data Player identity, optional remote identity, and TTL.
30697
+ */
30698
+ Multiplayer.issueAuthTicket = function (title_id, data) {
30699
+ return Requests.processRoute(MultiplayerRoute.routes.issueAuthTicket, data, { title_id: title_id });
30700
+ };
30701
+ /**
30702
+ * Validate a multiplayer auth ticket from a trusted title/user context.
30703
+ *
30704
+ * Pass `consume: true` for one-time tickets to prevent replay. Dedicated
30705
+ * servers should usually call `validateAuthTicketForServer` so they can use
30706
+ * `server_token` instead of a title token or user JWT. Lifecycle event:
30707
+ * `auth_ticket.validated`.
30708
+ *
30709
+ * @param title_id Title UUID.
30710
+ * @param data Ticket, optional remote identity check, and consume flag.
30711
+ */
30712
+ Multiplayer.validateAuthTicket = function (title_id, data) {
30713
+ return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicket, data, { title_id: title_id });
30714
+ };
30715
+ /**
30716
+ * Validate an auth ticket as a dedicated server.
30717
+ *
30718
+ * This server-token endpoint lets a dedicated server admit players without
30719
+ * holding a user JWT or title token. Pass `consume: true` to prevent replay.
30720
+ * Lifecycle event: `auth_ticket.validated`.
30721
+ *
30722
+ * @param title_id Title UUID.
30723
+ * @param server_id Server UUID.
30724
+ * @param data Server token, player auth ticket, optional remote identity, and consume flag.
30725
+ */
30726
+ Multiplayer.validateAuthTicketForServer = function (title_id, server_id, data) {
30727
+ return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicketForServer, data, { title_id: title_id, server_id: server_id });
30728
+ };
30729
+ /**
30730
+ * List a player's server favorites or history entries.
30731
+ *
30732
+ * Use this for Steam-like favorites and recent servers tabs. Title-token
30733
+ * clients should pass `player_id`; user JWT clients default to the user UUID.
30734
+ *
30735
+ * @param title_id Title UUID.
30736
+ * @param params Optional player and favorite/history filter.
30737
+ */
30738
+ Multiplayer.listFavorites = function (title_id, params) {
30739
+ return Requests.processRoute(MultiplayerRoute.routes.listFavorites, undefined, { title_id: title_id }, params);
30740
+ };
30741
+ /**
30742
+ * Add or update a favorite/history server entry for a player.
30743
+ *
30744
+ * Provide `server_id` for a registered Glitch server, or `host` plus
30745
+ * `game_port` for a direct/community server. Lifecycle event:
30746
+ * `favorite.upserted`.
30747
+ *
30748
+ * @param title_id Title UUID.
30749
+ * @param data Favorite/history target and optional metadata.
30750
+ */
30751
+ Multiplayer.addFavorite = function (title_id, data) {
30752
+ return Requests.processRoute(MultiplayerRoute.routes.addFavorite, data, { title_id: title_id });
30753
+ };
30754
+ /**
30755
+ * Delete a player's favorite/history server entry.
30756
+ *
30757
+ * The SDK sends optional `player_id` as a query parameter because the shared
30758
+ * request helper treats DELETE payloads as query params. This maps cleanly to
30759
+ * the backend's optional player identity validation for title-token clients.
30760
+ * Lifecycle event: `favorite.deleted`.
30761
+ *
30762
+ * @param title_id Title UUID.
30763
+ * @param favorite_id Favorite/history UUID.
30764
+ * @param params Optional player_id for title-token clients.
30765
+ */
30766
+ Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
30767
+ return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
30768
+ };
30769
+ return Multiplayer;
30770
+ }());
30771
+
30772
+ var ServerOperationsRoute = /** @class */ (function () {
30773
+ function ServerOperationsRoute() {
30774
+ }
30775
+ ServerOperationsRoute.routes = {
30776
+ listDeployments: {
30777
+ url: '/admin/server-operations/deployments',
30778
+ method: HTTP_METHODS.GET
30779
+ },
30780
+ updatePolicy: {
30781
+ url: '/admin/server-operations/titles/{title_id}/builds/{build_id}/policy',
30782
+ method: HTTP_METHODS.PUT
30783
+ },
30784
+ };
30785
+ return ServerOperationsRoute;
30786
+ }());
30787
+
30788
+ var ServerOperations = /** @class */ (function () {
30789
+ function ServerOperations() {
30790
+ }
30791
+ ServerOperations.listDeployments = function (params) {
30792
+ return Requests.processRoute(ServerOperationsRoute.routes.listDeployments, undefined, undefined, params);
30793
+ };
30794
+ ServerOperations.updatePolicy = function (title_id, build_id, data) {
30795
+ return Requests.processRoute(ServerOperationsRoute.routes.updatePolicy, data, { title_id: title_id, build_id: build_id });
30796
+ };
30797
+ return ServerOperations;
30798
+ }());
30799
+
30148
30800
  var Parser = /** @class */ (function () {
30149
30801
  function Parser() {
30150
30802
  }
@@ -30685,6 +31337,8 @@ var Glitch = /** @class */ (function () {
30685
31337
  DiscordMarketplace: DiscordMarketplace,
30686
31338
  Education: Education,
30687
31339
  Crm: Crm,
31340
+ Multiplayer: Multiplayer,
31341
+ ServerOperations: ServerOperations,
30688
31342
  };
30689
31343
  Glitch.util = {
30690
31344
  Requests: Requests,