glitch-javascript-sdk 3.1.4 → 3.1.6
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 +739 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Multiplayer.d.ts +871 -0
- package/dist/esm/api/RedditSubreddits.d.ts +35 -0
- package/dist/esm/api/Scheduler.d.ts +17 -1
- package/dist/esm/api/ServerOperations.d.ts +7 -0
- package/dist/esm/api/Titles.d.ts +84 -0
- package/dist/esm/api/index.d.ts +6 -0
- package/dist/esm/constants/HttpMethods.d.ts +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +739 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/MultiplayerRoute.d.ts +7 -0
- package/dist/esm/routes/RedditSubredditsRoute.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 +1012 -1
- package/package.json +4 -1
- package/src/api/Multiplayer.ts +1012 -0
- package/src/api/RedditSubreddits.ts +53 -0
- package/src/api/Scheduler.ts +23 -1
- package/src/api/ServerOperations.ts +16 -0
- package/src/api/Titles.ts +109 -0
- package/src/api/index.ts +7 -1
- package/src/constants/HttpMethods.ts +2 -1
- package/src/index.ts +7 -1
- package/src/routes/MultiplayerRoute.ts +46 -0
- package/src/routes/RedditSubredditsRoute.ts +14 -0
- package/src/routes/SchedulerRoute.ts +2 -0
- package/src/routes/ServerOperationsRoute.ts +17 -0
- package/src/routes/TitlesRoute.ts +12 -1
- package/src/util/Requests.ts +21 -1
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
|
|
|
@@ -27524,6 +27611,8 @@ var SchedulerRoute = /** @class */ (function () {
|
|
|
27524
27611
|
},
|
|
27525
27612
|
getRedditRecommendations: { url: '/schedulers/{scheduler_id}/reddit/recommendations', method: HTTP_METHODS.POST },
|
|
27526
27613
|
generateRedditContent: { url: '/schedulers/{scheduler_id}/reddit/generateContent', method: HTTP_METHODS.POST },
|
|
27614
|
+
getRedditSubredditMatches: { url: '/schedulers/{scheduler_id}/reddit/subreddit-matches', method: HTTP_METHODS.POST },
|
|
27615
|
+
getRedditSubredditPositioning: { url: '/schedulers/{scheduler_id}/reddit/subreddit-positioning', method: HTTP_METHODS.POST },
|
|
27527
27616
|
listDestinations: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations', method: HTTP_METHODS.GET },
|
|
27528
27617
|
createDestination: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations', method: HTTP_METHODS.POST },
|
|
27529
27618
|
getDestination: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations/{destination_id}', method: HTTP_METHODS.GET },
|
|
@@ -28154,7 +28243,7 @@ var Scheduler = /** @class */ (function () {
|
|
|
28154
28243
|
return Requests.processRoute(SchedulerRoute.routes.deleteDestination, {}, { scheduler_id: scheduler_id, update_id: update_id, destination_id: destination_id }, params);
|
|
28155
28244
|
};
|
|
28156
28245
|
/**
|
|
28157
|
-
* Get
|
|
28246
|
+
* Get subreddit recommendations for a scheduler.
|
|
28158
28247
|
*
|
|
28159
28248
|
* @see https://api.glitch.fun/api/documentation#/Scheduler/getSchedulerRedditRecommendations
|
|
28160
28249
|
*
|
|
@@ -28177,6 +28266,27 @@ var Scheduler = /** @class */ (function () {
|
|
|
28177
28266
|
Scheduler.generateRedditContent = function (scheduler_id, data, params) {
|
|
28178
28267
|
return Requests.processRoute(SchedulerRoute.routes.generateRedditContent, data, { scheduler_id: scheduler_id }, params);
|
|
28179
28268
|
};
|
|
28269
|
+
/**
|
|
28270
|
+
* Match the scheduler title to indexed Reddit communities.
|
|
28271
|
+
*
|
|
28272
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
28273
|
+
* @param data Optional post context and filters.
|
|
28274
|
+
* @returns promise
|
|
28275
|
+
*/
|
|
28276
|
+
Scheduler.getRedditSubredditMatches = function (scheduler_id, data, params) {
|
|
28277
|
+
if (data === void 0) { data = {}; }
|
|
28278
|
+
return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditMatches, data, { scheduler_id: scheduler_id }, params);
|
|
28279
|
+
};
|
|
28280
|
+
/**
|
|
28281
|
+
* Position a registered game for a subreddit and optionally prepare Reddit draft content.
|
|
28282
|
+
*
|
|
28283
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
28284
|
+
* @param data The target subreddit and optional post context.
|
|
28285
|
+
* @returns promise
|
|
28286
|
+
*/
|
|
28287
|
+
Scheduler.getRedditSubredditPositioning = function (scheduler_id, data, params) {
|
|
28288
|
+
return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditPositioning, data, { scheduler_id: scheduler_id }, params);
|
|
28289
|
+
};
|
|
28180
28290
|
/**
|
|
28181
28291
|
* Get all posts and comments for a scheduler.
|
|
28182
28292
|
*
|
|
@@ -28282,6 +28392,66 @@ var Scheduler = /** @class */ (function () {
|
|
|
28282
28392
|
return Scheduler;
|
|
28283
28393
|
}());
|
|
28284
28394
|
|
|
28395
|
+
var RedditSubredditsRoute = /** @class */ (function () {
|
|
28396
|
+
function RedditSubredditsRoute() {
|
|
28397
|
+
}
|
|
28398
|
+
RedditSubredditsRoute.routes = {
|
|
28399
|
+
list: { url: '/reddit/subreddits', method: HTTP_METHODS.GET },
|
|
28400
|
+
show: { url: '/reddit/subreddits/{subreddit}', method: HTTP_METHODS.GET },
|
|
28401
|
+
match: { url: '/reddit/subreddits/match', method: HTTP_METHODS.POST },
|
|
28402
|
+
ingest: { url: '/admin/reddit/subreddits/ingest', method: HTTP_METHODS.POST },
|
|
28403
|
+
refresh: { url: '/admin/reddit/subreddits/{subreddit}/refresh', method: HTTP_METHODS.POST },
|
|
28404
|
+
};
|
|
28405
|
+
return RedditSubredditsRoute;
|
|
28406
|
+
}());
|
|
28407
|
+
|
|
28408
|
+
var RedditSubreddits = /** @class */ (function () {
|
|
28409
|
+
function RedditSubreddits() {
|
|
28410
|
+
}
|
|
28411
|
+
/**
|
|
28412
|
+
* Search indexed Reddit communities for game marketing research.
|
|
28413
|
+
*
|
|
28414
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/indexRedditSubreddits
|
|
28415
|
+
*/
|
|
28416
|
+
RedditSubreddits.list = function (params) {
|
|
28417
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.list, undefined, undefined, params);
|
|
28418
|
+
};
|
|
28419
|
+
/**
|
|
28420
|
+
* Get an analyzed subreddit record by display name.
|
|
28421
|
+
*
|
|
28422
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/showRedditSubreddit
|
|
28423
|
+
*/
|
|
28424
|
+
RedditSubreddits.show = function (subreddit, params) {
|
|
28425
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.show, undefined, { subreddit: subreddit }, params);
|
|
28426
|
+
};
|
|
28427
|
+
/**
|
|
28428
|
+
* Match a game concept to relevant Reddit communities.
|
|
28429
|
+
*
|
|
28430
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/matchRedditSubreddits
|
|
28431
|
+
*/
|
|
28432
|
+
RedditSubreddits.match = function (data, params) {
|
|
28433
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.match, data, undefined, params);
|
|
28434
|
+
};
|
|
28435
|
+
/**
|
|
28436
|
+
* Admin-only ingestion of subreddit metadata and rules.
|
|
28437
|
+
*
|
|
28438
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/ingestRedditSubreddits
|
|
28439
|
+
*/
|
|
28440
|
+
RedditSubreddits.ingest = function (data, params) {
|
|
28441
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.ingest, data, undefined, params);
|
|
28442
|
+
};
|
|
28443
|
+
/**
|
|
28444
|
+
* Admin-only refresh for one subreddit.
|
|
28445
|
+
*
|
|
28446
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/refreshRedditSubreddit
|
|
28447
|
+
*/
|
|
28448
|
+
RedditSubreddits.refresh = function (subreddit, data, params) {
|
|
28449
|
+
if (data === void 0) { data = {}; }
|
|
28450
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.refresh, data, { subreddit: subreddit }, params);
|
|
28451
|
+
};
|
|
28452
|
+
return RedditSubreddits;
|
|
28453
|
+
}());
|
|
28454
|
+
|
|
28285
28455
|
// src/routes/FunnelRoutes.tsx
|
|
28286
28456
|
var FunnelRoutes = /** @class */ (function () {
|
|
28287
28457
|
function FunnelRoutes() {
|
|
@@ -30145,6 +30315,571 @@ var Crm = /** @class */ (function () {
|
|
|
30145
30315
|
return Crm;
|
|
30146
30316
|
}());
|
|
30147
30317
|
|
|
30318
|
+
var MultiplayerRoute = /** @class */ (function () {
|
|
30319
|
+
function MultiplayerRoute() {
|
|
30320
|
+
}
|
|
30321
|
+
MultiplayerRoute.routes = {
|
|
30322
|
+
searchLobbies: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.GET },
|
|
30323
|
+
createLobby: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.POST },
|
|
30324
|
+
showLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.GET },
|
|
30325
|
+
updateLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.PUT },
|
|
30326
|
+
joinLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/join', method: HTTP_METHODS.POST },
|
|
30327
|
+
leaveLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/leave', method: HTTP_METHODS.POST },
|
|
30328
|
+
setLobbyServer: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/server', method: HTTP_METHODS.POST },
|
|
30329
|
+
listLobbyMessages: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.GET },
|
|
30330
|
+
sendLobbyMessage: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.POST },
|
|
30331
|
+
listVoiceRooms: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.GET },
|
|
30332
|
+
createVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.POST },
|
|
30333
|
+
showVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.GET },
|
|
30334
|
+
updateVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.PUT },
|
|
30335
|
+
joinVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}/join', method: HTTP_METHODS.POST },
|
|
30336
|
+
heartbeatVoice: { url: '/multiplayer/voice/heartbeat', method: HTTP_METHODS.POST },
|
|
30337
|
+
leaveVoice: { url: '/multiplayer/voice/leave', method: HTTP_METHODS.POST },
|
|
30338
|
+
sendVoicePacket: { url: '/multiplayer/voice/packets', method: HTTP_METHODS.POST },
|
|
30339
|
+
pollVoicePackets: { url: '/multiplayer/voice/poll', method: HTTP_METHODS.POST },
|
|
30340
|
+
browseServers: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.GET },
|
|
30341
|
+
registerServer: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.POST },
|
|
30342
|
+
heartbeatServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/heartbeat', method: HTTP_METHODS.POST },
|
|
30343
|
+
reserveServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/reserve', method: HTTP_METHODS.POST },
|
|
30344
|
+
heartbeatSession: { url: '/multiplayer/sessions/heartbeat', method: HTTP_METHODS.POST },
|
|
30345
|
+
releaseSession: { url: '/multiplayer/sessions/release', method: HTTP_METHODS.POST },
|
|
30346
|
+
issueAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets', method: HTTP_METHODS.POST },
|
|
30347
|
+
validateAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
30348
|
+
validateAuthTicketForServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
30349
|
+
listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
|
|
30350
|
+
addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
|
|
30351
|
+
deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
|
|
30352
|
+
};
|
|
30353
|
+
return MultiplayerRoute;
|
|
30354
|
+
}());
|
|
30355
|
+
|
|
30356
|
+
/**
|
|
30357
|
+
* Steam-style multiplayer APIs for Glitch titles.
|
|
30358
|
+
*
|
|
30359
|
+
* The multiplayer surface is split into three groups:
|
|
30360
|
+
* lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets.
|
|
30361
|
+
* User JWTs can infer the player from the authenticated user. Title-token clients
|
|
30362
|
+
* and game clients without a Glitch user session should pass a stable `player_id`.
|
|
30363
|
+
* Dedicated servers use `server_token` on heartbeat and server-side ticket validation
|
|
30364
|
+
* so they do not need to hold a user JWT or title token.
|
|
30365
|
+
*
|
|
30366
|
+
* These endpoints are intentionally database-agnostic from the SDK's point of view:
|
|
30367
|
+
* callers work with public identifiers, metadata objects, and lifecycle events,
|
|
30368
|
+
* while the backend owns how those records are stored.
|
|
30369
|
+
*/
|
|
30370
|
+
var Multiplayer = /** @class */ (function () {
|
|
30371
|
+
function Multiplayer() {
|
|
30372
|
+
}
|
|
30373
|
+
/**
|
|
30374
|
+
* Search joinable, non-expired lobbies for a title.
|
|
30375
|
+
*
|
|
30376
|
+
* Filters are exact-match except `skill_band`, which the backend can use for
|
|
30377
|
+
* near sorting. Default results exclude full, closed, unjoinable, and expired
|
|
30378
|
+
* lobbies. Lifecycle context: clients usually call this before `joinLobby`;
|
|
30379
|
+
* joins create a `lobby.joined` event on the backend.
|
|
30380
|
+
*
|
|
30381
|
+
* @param title_id Title UUID.
|
|
30382
|
+
* @param params Optional filters such as region, game mode, map, lobby type, skill band, and limit.
|
|
30383
|
+
* @example
|
|
30384
|
+
* Multiplayer.searchLobbies('title-uuid', {
|
|
30385
|
+
* region: 'us-central',
|
|
30386
|
+
* game_mode: 'ranked_duos',
|
|
30387
|
+
* skill_band: 1840,
|
|
30388
|
+
* limit: 25
|
|
30389
|
+
* });
|
|
30390
|
+
*/
|
|
30391
|
+
Multiplayer.searchLobbies = function (title_id, params) {
|
|
30392
|
+
return Requests.processRoute(MultiplayerRoute.routes.searchLobbies, undefined, { title_id: title_id }, params);
|
|
30393
|
+
};
|
|
30394
|
+
/**
|
|
30395
|
+
* Create a lobby and insert the owner as the first joined member.
|
|
30396
|
+
*
|
|
30397
|
+
* Use this when matchmaking has no suitable lobby, when a player invites
|
|
30398
|
+
* friends, or when a party needs pre-game setup before server assignment.
|
|
30399
|
+
* Lifecycle events: `lobby.created`, then `lobby.joined` for the owner.
|
|
30400
|
+
*
|
|
30401
|
+
* @param title_id Title UUID.
|
|
30402
|
+
* @param data Lobby configuration and optional owner/member metadata.
|
|
30403
|
+
* @example
|
|
30404
|
+
* Multiplayer.createLobby('title-uuid', {
|
|
30405
|
+
* player_id: 'steam:76561198000000000',
|
|
30406
|
+
* display_name: 'CinderAce',
|
|
30407
|
+
* lobby_type: 'public',
|
|
30408
|
+
* max_members: 4,
|
|
30409
|
+
* region: 'us-central',
|
|
30410
|
+
* game_mode: 'ranked_duos',
|
|
30411
|
+
* metadata: { playlist: 'ranked', allow_voice: true }
|
|
30412
|
+
* });
|
|
30413
|
+
*/
|
|
30414
|
+
Multiplayer.createLobby = function (title_id, data) {
|
|
30415
|
+
return Requests.processRoute(MultiplayerRoute.routes.createLobby, data, { title_id: title_id });
|
|
30416
|
+
};
|
|
30417
|
+
/**
|
|
30418
|
+
* Retrieve a lobby with members and assigned server information when present.
|
|
30419
|
+
*
|
|
30420
|
+
* Call this after lobby lifecycle notifications such as `lobby.joined`,
|
|
30421
|
+
* `lobby.updated`, `lobby.owner_transferred`, or `lobby.server_assigned`.
|
|
30422
|
+
*
|
|
30423
|
+
* @param title_id Title UUID.
|
|
30424
|
+
* @param lobby_id Lobby UUID.
|
|
30425
|
+
*/
|
|
30426
|
+
Multiplayer.showLobby = function (title_id, lobby_id) {
|
|
30427
|
+
return Requests.processRoute(MultiplayerRoute.routes.showLobby, undefined, { title_id: title_id, lobby_id: lobby_id });
|
|
30428
|
+
};
|
|
30429
|
+
/**
|
|
30430
|
+
* Join a lobby or refresh an existing membership.
|
|
30431
|
+
*
|
|
30432
|
+
* This call is idempotent for a player already in the lobby and can update
|
|
30433
|
+
* display name, ready state, or member metadata. It returns 409 when the lobby
|
|
30434
|
+
* is full, closed, expired, or not joinable. Lifecycle event: `lobby.joined`.
|
|
30435
|
+
*
|
|
30436
|
+
* @param title_id Title UUID.
|
|
30437
|
+
* @param lobby_id Lobby UUID.
|
|
30438
|
+
* @param data Player identity and optional member metadata.
|
|
30439
|
+
* @example
|
|
30440
|
+
* Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
|
|
30441
|
+
* player_id: 'steam:76561198000000001',
|
|
30442
|
+
* display_name: 'Nova',
|
|
30443
|
+
* ready: false,
|
|
30444
|
+
* member_data: { character: 'Ash', rank: 1799 }
|
|
30445
|
+
* });
|
|
30446
|
+
*/
|
|
30447
|
+
Multiplayer.joinLobby = function (title_id, lobby_id, data) {
|
|
30448
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
30449
|
+
};
|
|
30450
|
+
/**
|
|
30451
|
+
* Leave a lobby.
|
|
30452
|
+
*
|
|
30453
|
+
* If the owner leaves, ownership transfers to the oldest remaining joined
|
|
30454
|
+
* member. If no members remain, the lobby closes. Lifecycle events:
|
|
30455
|
+
* `lobby.left`, optionally `lobby.owner_transferred` or `lobby.updated`.
|
|
30456
|
+
*
|
|
30457
|
+
* @param title_id Title UUID.
|
|
30458
|
+
* @param lobby_id Lobby UUID.
|
|
30459
|
+
* @param data Optional player_id for title-token clients.
|
|
30460
|
+
*/
|
|
30461
|
+
Multiplayer.leaveLobby = function (title_id, lobby_id, data) {
|
|
30462
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
30463
|
+
};
|
|
30464
|
+
/**
|
|
30465
|
+
* Update lobby metadata, visibility, joinability, limits, or state.
|
|
30466
|
+
*
|
|
30467
|
+
* This is owner-only. `max_members` cannot be lower than the current member
|
|
30468
|
+
* count. Keep metadata low-frequency and mostly search/display oriented.
|
|
30469
|
+
* Lifecycle event: `lobby.updated`.
|
|
30470
|
+
*
|
|
30471
|
+
* @param title_id Title UUID.
|
|
30472
|
+
* @param lobby_id Lobby UUID.
|
|
30473
|
+
* @param data Owner identity plus fields to update.
|
|
30474
|
+
*/
|
|
30475
|
+
Multiplayer.updateLobby = function (title_id, lobby_id, data) {
|
|
30476
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
30477
|
+
};
|
|
30478
|
+
/**
|
|
30479
|
+
* Assign a registered game server to a lobby.
|
|
30480
|
+
*
|
|
30481
|
+
* This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients
|
|
30482
|
+
* should react by reserving or connecting to the assigned server, then
|
|
30483
|
+
* optionally leaving the lobby. Lifecycle event: `lobby.server_assigned`.
|
|
30484
|
+
*
|
|
30485
|
+
* @param title_id Title UUID.
|
|
30486
|
+
* @param lobby_id Lobby UUID.
|
|
30487
|
+
* @param data Server UUID and optional lobby state/joinability updates.
|
|
30488
|
+
*/
|
|
30489
|
+
Multiplayer.setLobbyServer = function (title_id, lobby_id, data) {
|
|
30490
|
+
return Requests.processRoute(MultiplayerRoute.routes.setLobbyServer, data, { title_id: title_id, lobby_id: lobby_id });
|
|
30491
|
+
};
|
|
30492
|
+
/**
|
|
30493
|
+
* List ordered low-bandwidth lobby messages.
|
|
30494
|
+
*
|
|
30495
|
+
* Use `after_sequence` to poll for messages missed during reconnects or after
|
|
30496
|
+
* a realtime `lobby.message_sent` event. This channel is for chat and control
|
|
30497
|
+
* messages, not gameplay, positional data, or voice streaming.
|
|
30498
|
+
*
|
|
30499
|
+
* @param title_id Title UUID.
|
|
30500
|
+
* @param lobby_id Lobby UUID.
|
|
30501
|
+
* @param params Optional sequence cursor and limit.
|
|
30502
|
+
*/
|
|
30503
|
+
Multiplayer.listLobbyMessages = function (title_id, lobby_id, params) {
|
|
30504
|
+
return Requests.processRoute(MultiplayerRoute.routes.listLobbyMessages, undefined, { title_id: title_id, lobby_id: lobby_id }, params);
|
|
30505
|
+
};
|
|
30506
|
+
/**
|
|
30507
|
+
* Send a low-bandwidth message to all lobby members.
|
|
30508
|
+
*
|
|
30509
|
+
* Payloads are capped at 4KB by the backend. Use this for chat, ready signals,
|
|
30510
|
+
* invite/kick control messages, and owner-arbitrated choices. Lifecycle event:
|
|
30511
|
+
* `lobby.message_sent`.
|
|
30512
|
+
*
|
|
30513
|
+
* @param title_id Title UUID.
|
|
30514
|
+
* @param lobby_id Lobby UUID.
|
|
30515
|
+
* @param data Message type, sender identity, and JSON payload.
|
|
30516
|
+
* @example
|
|
30517
|
+
* Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
|
|
30518
|
+
* player_id: 'steam:76561198000000000',
|
|
30519
|
+
* message_type: 'ready',
|
|
30520
|
+
* payload: { ready: true }
|
|
30521
|
+
* });
|
|
30522
|
+
*/
|
|
30523
|
+
Multiplayer.sendLobbyMessage = function (title_id, lobby_id, data) {
|
|
30524
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendLobbyMessage, data, { title_id: title_id, lobby_id: lobby_id });
|
|
30525
|
+
};
|
|
30526
|
+
/**
|
|
30527
|
+
* List active/non-expired voice rooms for a title.
|
|
30528
|
+
*
|
|
30529
|
+
* Rooms can be attached to a lobby, a server, a party, or a proximity group.
|
|
30530
|
+
* Use this to discover existing voice state before joining. Lifecycle context:
|
|
30531
|
+
* realtime transports should mirror `voice.room_created`, `voice.room_updated`,
|
|
30532
|
+
* `voice.joined`, and `voice.left`.
|
|
30533
|
+
*
|
|
30534
|
+
* @param title_id Title UUID.
|
|
30535
|
+
* @param params Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.
|
|
30536
|
+
*/
|
|
30537
|
+
Multiplayer.listVoiceRooms = function (title_id, params) {
|
|
30538
|
+
return Requests.processRoute(MultiplayerRoute.routes.listVoiceRooms, undefined, { title_id: title_id }, params);
|
|
30539
|
+
};
|
|
30540
|
+
/**
|
|
30541
|
+
* Create a voice room and join the creator as the first participant.
|
|
30542
|
+
*
|
|
30543
|
+
* The backend returns `voice_token` once. Keep it client-side and use it for
|
|
30544
|
+
* voice heartbeat, packet send, packet polling, and leave calls. `glitch_relay`
|
|
30545
|
+
* can carry base64 Opus frames for prototypes, small-party fallback, or
|
|
30546
|
+
* signaling. For production-scale audio, set `provider: 'external'` and reuse
|
|
30547
|
+
* the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an
|
|
30548
|
+
* engine-native transport. Lifecycle events: `voice.room_created`,
|
|
30549
|
+
* `voice.joined`.
|
|
30550
|
+
*
|
|
30551
|
+
* @param title_id Title UUID.
|
|
30552
|
+
* @param data Voice codec, topology, linked lobby/server, and owner metadata.
|
|
30553
|
+
* @example
|
|
30554
|
+
* const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
|
|
30555
|
+
* player_id: 'steam:76561198000000000',
|
|
30556
|
+
* display_name: 'CinderAce',
|
|
30557
|
+
* lobby_id: 'lobby-uuid',
|
|
30558
|
+
* provider: 'glitch_relay',
|
|
30559
|
+
* topology: 'lobby',
|
|
30560
|
+
* codec: 'opus',
|
|
30561
|
+
* sample_rate: 48000,
|
|
30562
|
+
* frame_duration_ms: 20,
|
|
30563
|
+
* channels: 1,
|
|
30564
|
+
* metadata: { push_to_talk: true }
|
|
30565
|
+
* });
|
|
30566
|
+
*/
|
|
30567
|
+
Multiplayer.createVoiceRoom = function (title_id, data) {
|
|
30568
|
+
return Requests.processRoute(MultiplayerRoute.routes.createVoiceRoom, data, { title_id: title_id });
|
|
30569
|
+
};
|
|
30570
|
+
/**
|
|
30571
|
+
* Retrieve a voice room with participant media states.
|
|
30572
|
+
*
|
|
30573
|
+
* Use this after `voice.joined`, `voice.heartbeat`, `voice.left`, or
|
|
30574
|
+
* `voice.room_updated` to refresh in-game UI such as speaker lists, mute
|
|
30575
|
+
* icons, or team voice controls.
|
|
30576
|
+
*
|
|
30577
|
+
* @param title_id Title UUID.
|
|
30578
|
+
* @param voice_room_id Voice room UUID.
|
|
30579
|
+
*/
|
|
30580
|
+
Multiplayer.showVoiceRoom = function (title_id, voice_room_id) {
|
|
30581
|
+
return Requests.processRoute(MultiplayerRoute.routes.showVoiceRoom, undefined, { title_id: title_id, voice_room_id: voice_room_id });
|
|
30582
|
+
};
|
|
30583
|
+
/**
|
|
30584
|
+
* Update owner-controlled voice room state.
|
|
30585
|
+
*
|
|
30586
|
+
* Owner-only. Use this to close a room, adjust capacity, update moderation
|
|
30587
|
+
* flags, or provide external provider connection details. The backend rejects
|
|
30588
|
+
* lowering `max_participants` below the current participant count. Lifecycle
|
|
30589
|
+
* event: `voice.room_updated`.
|
|
30590
|
+
*
|
|
30591
|
+
* @param title_id Title UUID.
|
|
30592
|
+
* @param voice_room_id Voice room UUID.
|
|
30593
|
+
* @param data Owner player identity and room fields to update.
|
|
30594
|
+
*/
|
|
30595
|
+
Multiplayer.updateVoiceRoom = function (title_id, voice_room_id, data) {
|
|
30596
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
30597
|
+
};
|
|
30598
|
+
/**
|
|
30599
|
+
* Join a voice room and receive a participant-scoped token.
|
|
30600
|
+
*
|
|
30601
|
+
* Rejoining with the same player is idempotent and rotates the token. The
|
|
30602
|
+
* token is used by participant endpoints instead of requiring a user JWT or
|
|
30603
|
+
* title token on every media request. Returns 409 when the room is closed,
|
|
30604
|
+
* expired, or full. Lifecycle event: `voice.joined`.
|
|
30605
|
+
*
|
|
30606
|
+
* @param title_id Title UUID.
|
|
30607
|
+
* @param voice_room_id Voice room UUID.
|
|
30608
|
+
* @param data Player identity, display name, metadata, and token TTL.
|
|
30609
|
+
*/
|
|
30610
|
+
Multiplayer.joinVoiceRoom = function (title_id, voice_room_id, data) {
|
|
30611
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
30612
|
+
};
|
|
30613
|
+
/**
|
|
30614
|
+
* Heartbeat voice participant state.
|
|
30615
|
+
*
|
|
30616
|
+
* Call every 10-30 seconds and whenever mute/deafen/speaking state changes.
|
|
30617
|
+
* `last_sequence` tells the backend how far this participant has processed
|
|
30618
|
+
* ordered packets. Expired participants are rejected with 409. Lifecycle event:
|
|
30619
|
+
* `voice.heartbeat`.
|
|
30620
|
+
*
|
|
30621
|
+
* @param data Participant voice token and mutable media state.
|
|
30622
|
+
*/
|
|
30623
|
+
Multiplayer.heartbeatVoice = function (data) {
|
|
30624
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatVoice, data);
|
|
30625
|
+
};
|
|
30626
|
+
/**
|
|
30627
|
+
* Leave the current voice room for a participant token.
|
|
30628
|
+
*
|
|
30629
|
+
* This is idempotent for disconnect cleanup: room participant count is
|
|
30630
|
+
* decremented once, room ownership is transferred when possible, and an
|
|
30631
|
+
* empty room closes. The token remains valid only for retrying this leave
|
|
30632
|
+
* call; heartbeat, send, and poll calls reject left participants. Lifecycle
|
|
30633
|
+
* event: `voice.left`.
|
|
30634
|
+
*
|
|
30635
|
+
* @param data Participant voice token.
|
|
30636
|
+
*/
|
|
30637
|
+
Multiplayer.leaveVoice = function (data) {
|
|
30638
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveVoice, data);
|
|
30639
|
+
};
|
|
30640
|
+
/**
|
|
30641
|
+
* Send one ordered voice-room packet.
|
|
30642
|
+
*
|
|
30643
|
+
* `audio` packets should contain compact compressed frames such as base64 Opus
|
|
30644
|
+
* at 48kHz mono/20ms. `offer`, `answer`, and `ice` packets support WebRTC
|
|
30645
|
+
* signaling. `control`, `speaking`, and `mute_state` packets are for custom
|
|
30646
|
+
* engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB.
|
|
30647
|
+
* Muted participants cannot send audio. Lifecycle event: `voice.packet_sent`.
|
|
30648
|
+
*
|
|
30649
|
+
* @param data Participant token, packet type, payload, and optional duration.
|
|
30650
|
+
* @example
|
|
30651
|
+
* await Multiplayer.sendVoicePacket({
|
|
30652
|
+
* voice_token: voiceToken,
|
|
30653
|
+
* packet_type: 'audio',
|
|
30654
|
+
* payload: base64OpusFrame,
|
|
30655
|
+
* duration_ms: 20
|
|
30656
|
+
* });
|
|
30657
|
+
*/
|
|
30658
|
+
Multiplayer.sendVoicePacket = function (data) {
|
|
30659
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendVoicePacket, data);
|
|
30660
|
+
};
|
|
30661
|
+
/**
|
|
30662
|
+
* Poll ordered voice-room packets after a known sequence.
|
|
30663
|
+
*
|
|
30664
|
+
* Defaults to excluding packets sent by the caller. Use the highest returned
|
|
30665
|
+
* sequence as the next `after_sequence` cursor. This is useful for fallback
|
|
30666
|
+
* relay, WebRTC signaling, reconnect recovery, and small-party prototypes.
|
|
30667
|
+
* Lifecycle event: `voice.packet_polled`.
|
|
30668
|
+
*
|
|
30669
|
+
* @param data Participant token, optional sequence cursor, limit, and self-exclusion flag.
|
|
30670
|
+
*/
|
|
30671
|
+
Multiplayer.pollVoicePackets = function (data) {
|
|
30672
|
+
return Requests.processRoute(MultiplayerRoute.routes.pollVoicePackets, data);
|
|
30673
|
+
};
|
|
30674
|
+
/**
|
|
30675
|
+
* Browse public, joinable multiplayer servers for a title.
|
|
30676
|
+
*
|
|
30677
|
+
* Default results exclude private, draining, offline, stale, expired, and full
|
|
30678
|
+
* servers. Title administrators can pass `include_private` to inspect servers
|
|
30679
|
+
* that normal clients cannot join.
|
|
30680
|
+
*
|
|
30681
|
+
* @param title_id Title UUID.
|
|
30682
|
+
* @param params Optional server browser filters.
|
|
30683
|
+
*/
|
|
30684
|
+
Multiplayer.browseServers = function (title_id, params) {
|
|
30685
|
+
return Requests.processRoute(MultiplayerRoute.routes.browseServers, undefined, { title_id: title_id }, params);
|
|
30686
|
+
};
|
|
30687
|
+
/**
|
|
30688
|
+
* Register or refresh a multiplayer server and receive a one-time server token.
|
|
30689
|
+
*
|
|
30690
|
+
* Store `server_token` only on the server process. The backend stores only a
|
|
30691
|
+
* hash and will not return the plain token again. Counts are validated so
|
|
30692
|
+
* `current_players + bot_players` cannot exceed `max_players`. Lifecycle event:
|
|
30693
|
+
* `server.registered`.
|
|
30694
|
+
*
|
|
30695
|
+
* @param title_id Title UUID.
|
|
30696
|
+
* @param data Server browser, connection, rule, and capacity metadata.
|
|
30697
|
+
* @example
|
|
30698
|
+
* Multiplayer.registerServer('title-uuid', {
|
|
30699
|
+
* name: 'Ranked US Central 01',
|
|
30700
|
+
* server_type: 'dedicated',
|
|
30701
|
+
* status: 'active',
|
|
30702
|
+
* host: '203.0.113.42',
|
|
30703
|
+
* game_port: 7777,
|
|
30704
|
+
* query_port: 27015,
|
|
30705
|
+
* transport: 'udp',
|
|
30706
|
+
* max_players: 16,
|
|
30707
|
+
* secure: true,
|
|
30708
|
+
* tags: ['ranked', 'duos']
|
|
30709
|
+
* });
|
|
30710
|
+
*/
|
|
30711
|
+
Multiplayer.registerServer = function (title_id, data) {
|
|
30712
|
+
return Requests.processRoute(MultiplayerRoute.routes.registerServer, data, { title_id: title_id });
|
|
30713
|
+
};
|
|
30714
|
+
/**
|
|
30715
|
+
* Heartbeat a multiplayer server with its dedicated `server_token`.
|
|
30716
|
+
*
|
|
30717
|
+
* Call every 30-60 seconds and whenever player counts, rules, or metadata
|
|
30718
|
+
* change. Stale servers are hidden from default browsing and reservation.
|
|
30719
|
+
* This endpoint is for dedicated/listen server processes and does not require
|
|
30720
|
+
* a user JWT. Lifecycle event: `server.heartbeat`.
|
|
30721
|
+
*
|
|
30722
|
+
* @param title_id Title UUID.
|
|
30723
|
+
* @param server_id Server UUID.
|
|
30724
|
+
* @param data Server token and optional mutable server state.
|
|
30725
|
+
*/
|
|
30726
|
+
Multiplayer.heartbeatServer = function (title_id, server_id, data) {
|
|
30727
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatServer, data, { title_id: title_id, server_id: server_id });
|
|
30728
|
+
};
|
|
30729
|
+
/**
|
|
30730
|
+
* Reserve a short-lived slot on a multiplayer server before connecting.
|
|
30731
|
+
*
|
|
30732
|
+
* Reservations protect capacity during game handoff. The backend rejects stale,
|
|
30733
|
+
* private, full, draining, offline, expired, or duplicate open reservations.
|
|
30734
|
+
* The plain `reservation_token` is returned once and is used for session
|
|
30735
|
+
* heartbeat/release calls. Lifecycle event: `server.reserved`.
|
|
30736
|
+
*
|
|
30737
|
+
* @param title_id Title UUID.
|
|
30738
|
+
* @param server_id Server UUID.
|
|
30739
|
+
* @param data Optional player/lobby identity and reservation TTL.
|
|
30740
|
+
*/
|
|
30741
|
+
Multiplayer.reserveServer = function (title_id, server_id, data) {
|
|
30742
|
+
return Requests.processRoute(MultiplayerRoute.routes.reserveServer, data, { title_id: title_id, server_id: server_id });
|
|
30743
|
+
};
|
|
30744
|
+
/**
|
|
30745
|
+
* Heartbeat an open multiplayer session reservation.
|
|
30746
|
+
*
|
|
30747
|
+
* Use this after a successful reservation while the client is connecting or
|
|
30748
|
+
* playing. Expired sessions are marked expired and capacity is recovered before
|
|
30749
|
+
* the backend returns 409. Lifecycle events: `session.heartbeat` or
|
|
30750
|
+
* `session.expired`.
|
|
30751
|
+
*
|
|
30752
|
+
* @param data Reservation token and optional state/TTL.
|
|
30753
|
+
*/
|
|
30754
|
+
Multiplayer.heartbeatSession = function (data) {
|
|
30755
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatSession, data);
|
|
30756
|
+
};
|
|
30757
|
+
/**
|
|
30758
|
+
* Release an open multiplayer session reservation.
|
|
30759
|
+
*
|
|
30760
|
+
* Call this on normal disconnect, failed connection attempts, or shutdown so
|
|
30761
|
+
* server capacity is decremented promptly. The backend makes release safe to
|
|
30762
|
+
* call more than once for an already closed reservation. Lifecycle event:
|
|
30763
|
+
* `session.released`.
|
|
30764
|
+
*
|
|
30765
|
+
* @param data Reservation token returned by `reserveServer`.
|
|
30766
|
+
*/
|
|
30767
|
+
Multiplayer.releaseSession = function (data) {
|
|
30768
|
+
return Requests.processRoute(MultiplayerRoute.routes.releaseSession, data);
|
|
30769
|
+
};
|
|
30770
|
+
/**
|
|
30771
|
+
* Issue a short-lived multiplayer auth ticket for a player.
|
|
30772
|
+
*
|
|
30773
|
+
* The plain `auth_ticket` is returned once and only a hash is stored by the
|
|
30774
|
+
* backend. Use this for P2P or dedicated-server admission before game traffic
|
|
30775
|
+
* begins. `remote_identity` can bind the ticket to a server or validator.
|
|
30776
|
+
* Lifecycle event: `auth_ticket.issued`.
|
|
30777
|
+
*
|
|
30778
|
+
* @param title_id Title UUID.
|
|
30779
|
+
* @param data Player identity, optional remote identity, and TTL.
|
|
30780
|
+
*/
|
|
30781
|
+
Multiplayer.issueAuthTicket = function (title_id, data) {
|
|
30782
|
+
return Requests.processRoute(MultiplayerRoute.routes.issueAuthTicket, data, { title_id: title_id });
|
|
30783
|
+
};
|
|
30784
|
+
/**
|
|
30785
|
+
* Validate a multiplayer auth ticket from a trusted title/user context.
|
|
30786
|
+
*
|
|
30787
|
+
* Pass `consume: true` for one-time tickets to prevent replay. Dedicated
|
|
30788
|
+
* servers should usually call `validateAuthTicketForServer` so they can use
|
|
30789
|
+
* `server_token` instead of a title token or user JWT. Lifecycle event:
|
|
30790
|
+
* `auth_ticket.validated`.
|
|
30791
|
+
*
|
|
30792
|
+
* @param title_id Title UUID.
|
|
30793
|
+
* @param data Ticket, optional remote identity check, and consume flag.
|
|
30794
|
+
*/
|
|
30795
|
+
Multiplayer.validateAuthTicket = function (title_id, data) {
|
|
30796
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicket, data, { title_id: title_id });
|
|
30797
|
+
};
|
|
30798
|
+
/**
|
|
30799
|
+
* Validate an auth ticket as a dedicated server.
|
|
30800
|
+
*
|
|
30801
|
+
* This server-token endpoint lets a dedicated server admit players without
|
|
30802
|
+
* holding a user JWT or title token. Pass `consume: true` to prevent replay.
|
|
30803
|
+
* Lifecycle event: `auth_ticket.validated`.
|
|
30804
|
+
*
|
|
30805
|
+
* @param title_id Title UUID.
|
|
30806
|
+
* @param server_id Server UUID.
|
|
30807
|
+
* @param data Server token, player auth ticket, optional remote identity, and consume flag.
|
|
30808
|
+
*/
|
|
30809
|
+
Multiplayer.validateAuthTicketForServer = function (title_id, server_id, data) {
|
|
30810
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicketForServer, data, { title_id: title_id, server_id: server_id });
|
|
30811
|
+
};
|
|
30812
|
+
/**
|
|
30813
|
+
* List a player's server favorites or history entries.
|
|
30814
|
+
*
|
|
30815
|
+
* Use this for Steam-like favorites and recent servers tabs. Title-token
|
|
30816
|
+
* clients should pass `player_id`; user JWT clients default to the user UUID.
|
|
30817
|
+
*
|
|
30818
|
+
* @param title_id Title UUID.
|
|
30819
|
+
* @param params Optional player and favorite/history filter.
|
|
30820
|
+
*/
|
|
30821
|
+
Multiplayer.listFavorites = function (title_id, params) {
|
|
30822
|
+
return Requests.processRoute(MultiplayerRoute.routes.listFavorites, undefined, { title_id: title_id }, params);
|
|
30823
|
+
};
|
|
30824
|
+
/**
|
|
30825
|
+
* Add or update a favorite/history server entry for a player.
|
|
30826
|
+
*
|
|
30827
|
+
* Provide `server_id` for a registered Glitch server, or `host` plus
|
|
30828
|
+
* `game_port` for a direct/community server. Lifecycle event:
|
|
30829
|
+
* `favorite.upserted`.
|
|
30830
|
+
*
|
|
30831
|
+
* @param title_id Title UUID.
|
|
30832
|
+
* @param data Favorite/history target and optional metadata.
|
|
30833
|
+
*/
|
|
30834
|
+
Multiplayer.addFavorite = function (title_id, data) {
|
|
30835
|
+
return Requests.processRoute(MultiplayerRoute.routes.addFavorite, data, { title_id: title_id });
|
|
30836
|
+
};
|
|
30837
|
+
/**
|
|
30838
|
+
* Delete a player's favorite/history server entry.
|
|
30839
|
+
*
|
|
30840
|
+
* The SDK sends optional `player_id` as a query parameter because the shared
|
|
30841
|
+
* request helper treats DELETE payloads as query params. This maps cleanly to
|
|
30842
|
+
* the backend's optional player identity validation for title-token clients.
|
|
30843
|
+
* Lifecycle event: `favorite.deleted`.
|
|
30844
|
+
*
|
|
30845
|
+
* @param title_id Title UUID.
|
|
30846
|
+
* @param favorite_id Favorite/history UUID.
|
|
30847
|
+
* @param params Optional player_id for title-token clients.
|
|
30848
|
+
*/
|
|
30849
|
+
Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
|
|
30850
|
+
return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
|
|
30851
|
+
};
|
|
30852
|
+
return Multiplayer;
|
|
30853
|
+
}());
|
|
30854
|
+
|
|
30855
|
+
var ServerOperationsRoute = /** @class */ (function () {
|
|
30856
|
+
function ServerOperationsRoute() {
|
|
30857
|
+
}
|
|
30858
|
+
ServerOperationsRoute.routes = {
|
|
30859
|
+
listDeployments: {
|
|
30860
|
+
url: '/admin/server-operations/deployments',
|
|
30861
|
+
method: HTTP_METHODS.GET
|
|
30862
|
+
},
|
|
30863
|
+
updatePolicy: {
|
|
30864
|
+
url: '/admin/server-operations/titles/{title_id}/builds/{build_id}/policy',
|
|
30865
|
+
method: HTTP_METHODS.PUT
|
|
30866
|
+
},
|
|
30867
|
+
};
|
|
30868
|
+
return ServerOperationsRoute;
|
|
30869
|
+
}());
|
|
30870
|
+
|
|
30871
|
+
var ServerOperations = /** @class */ (function () {
|
|
30872
|
+
function ServerOperations() {
|
|
30873
|
+
}
|
|
30874
|
+
ServerOperations.listDeployments = function (params) {
|
|
30875
|
+
return Requests.processRoute(ServerOperationsRoute.routes.listDeployments, undefined, undefined, params);
|
|
30876
|
+
};
|
|
30877
|
+
ServerOperations.updatePolicy = function (title_id, build_id, data) {
|
|
30878
|
+
return Requests.processRoute(ServerOperationsRoute.routes.updatePolicy, data, { title_id: title_id, build_id: build_id });
|
|
30879
|
+
};
|
|
30880
|
+
return ServerOperations;
|
|
30881
|
+
}());
|
|
30882
|
+
|
|
30148
30883
|
var Parser = /** @class */ (function () {
|
|
30149
30884
|
function Parser() {
|
|
30150
30885
|
}
|
|
@@ -30673,6 +31408,7 @@ var Glitch = /** @class */ (function () {
|
|
|
30673
31408
|
PlayTests: PlayTests,
|
|
30674
31409
|
Media: Media,
|
|
30675
31410
|
Scheduler: Scheduler,
|
|
31411
|
+
RedditSubreddits: RedditSubreddits,
|
|
30676
31412
|
Funnel: Funnel,
|
|
30677
31413
|
SocialStats: SocialStats,
|
|
30678
31414
|
WebsiteAnalytics: WebsiteAnalytics,
|
|
@@ -30685,6 +31421,8 @@ var Glitch = /** @class */ (function () {
|
|
|
30685
31421
|
DiscordMarketplace: DiscordMarketplace,
|
|
30686
31422
|
Education: Education,
|
|
30687
31423
|
Crm: Crm,
|
|
31424
|
+
Multiplayer: Multiplayer,
|
|
31425
|
+
ServerOperations: ServerOperations,
|
|
30688
31426
|
};
|
|
30689
31427
|
Glitch.util = {
|
|
30690
31428
|
Requests: Requests,
|