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/esm/index.js
CHANGED
|
@@ -5308,6 +5308,7 @@ var axios$1 = axios;
|
|
|
5308
5308
|
var HTTP_METHODS = {
|
|
5309
5309
|
GET: 'GET',
|
|
5310
5310
|
POST: 'POST',
|
|
5311
|
+
PATCH: 'PATCH',
|
|
5311
5312
|
PUT: 'PUT',
|
|
5312
5313
|
DELETE: 'DELETE',
|
|
5313
5314
|
};
|
|
@@ -5394,6 +5395,21 @@ var Requests = /** @class */ (function () {
|
|
|
5394
5395
|
}
|
|
5395
5396
|
return Requests.request('PUT', url, data);
|
|
5396
5397
|
};
|
|
5398
|
+
Requests.patch = function (url, data, params) {
|
|
5399
|
+
if (params && Object.keys(params).length > 0) {
|
|
5400
|
+
var queryString = Object.entries(params)
|
|
5401
|
+
.map(function (_a) {
|
|
5402
|
+
var key = _a[0], value = _a[1];
|
|
5403
|
+
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
5404
|
+
})
|
|
5405
|
+
.join('&');
|
|
5406
|
+
url = "".concat(url, "?").concat(queryString);
|
|
5407
|
+
}
|
|
5408
|
+
if (Requests.community_id) {
|
|
5409
|
+
data = __assign(__assign({}, data), { community_id: Requests.community_id });
|
|
5410
|
+
}
|
|
5411
|
+
return Requests.request('PATCH', url, data);
|
|
5412
|
+
};
|
|
5397
5413
|
Requests.delete = function (url, params) {
|
|
5398
5414
|
if (params && Object.keys(params).length > 0) {
|
|
5399
5415
|
var queryString = Object.entries(params)
|
|
@@ -5565,6 +5581,9 @@ var Requests = /** @class */ (function () {
|
|
|
5565
5581
|
else if (route.method == HTTP_METHODS.POST) {
|
|
5566
5582
|
return Requests.post(url, data, params);
|
|
5567
5583
|
}
|
|
5584
|
+
else if (route.method == HTTP_METHODS.PATCH) {
|
|
5585
|
+
return Requests.patch(url, data, params);
|
|
5586
|
+
}
|
|
5568
5587
|
else if (route.method == HTTP_METHODS.PUT) {
|
|
5569
5588
|
return Requests.put(url, data, params);
|
|
5570
5589
|
}
|
|
@@ -12045,6 +12064,16 @@ var TitlesRoute = /** @class */ (function () {
|
|
|
12045
12064
|
wishlistConversions: { url: '/titles/{title_id}/wishlist/conversions', method: HTTP_METHODS.GET },
|
|
12046
12065
|
wishlistGeo: { url: '/titles/{title_id}/wishlist/geo', method: HTTP_METHODS.GET },
|
|
12047
12066
|
wishlistDevices: { url: '/titles/{title_id}/wishlist/devices', method: HTTP_METHODS.GET },
|
|
12067
|
+
// Game Reviews
|
|
12068
|
+
reviewsList: { url: '/titles/{title_id}/reviews', method: HTTP_METHODS.GET },
|
|
12069
|
+
reviewsSummary: { url: '/titles/{title_id}/review-summary', method: HTTP_METHODS.GET },
|
|
12070
|
+
reviewsCreate: { url: '/titles/{title_id}/reviews', method: HTTP_METHODS.POST },
|
|
12071
|
+
reviewsShow: { url: '/reviews/{review_id}', method: HTTP_METHODS.GET },
|
|
12072
|
+
reviewsUpdate: { url: '/reviews/{review_id}', method: HTTP_METHODS.PATCH },
|
|
12073
|
+
reviewsDelete: { url: '/reviews/{review_id}', method: HTTP_METHODS.DELETE },
|
|
12074
|
+
reviewsVote: { url: '/reviews/{review_id}/vote', method: HTTP_METHODS.POST },
|
|
12075
|
+
reviewsReport: { url: '/reviews/{review_id}/report', method: HTTP_METHODS.POST },
|
|
12076
|
+
reviewsDeveloperResponse: { url: '/reviews/{review_id}/developer-response', method: HTTP_METHODS.POST },
|
|
12048
12077
|
};
|
|
12049
12078
|
return TitlesRoute;
|
|
12050
12079
|
}());
|
|
@@ -12979,6 +13008,64 @@ var Titles = /** @class */ (function () {
|
|
|
12979
13008
|
Titles.wishlistDevices = function (title_id, params) {
|
|
12980
13009
|
return Requests.processRoute(TitlesRoute.routes.wishlistDevices, undefined, { title_id: title_id }, params);
|
|
12981
13010
|
};
|
|
13011
|
+
/**
|
|
13012
|
+
* List public reviews for a title.
|
|
13013
|
+
*
|
|
13014
|
+
* @param title_id The UUID of the title.
|
|
13015
|
+
* @param params Optional filters: recommendation, language, current_version_only,
|
|
13016
|
+
* verified_only, platform, acquisition_type, complaint, playtime, sort, per_page.
|
|
13017
|
+
*/
|
|
13018
|
+
Titles.listReviews = function (title_id, params) {
|
|
13019
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsList, {}, { title_id: title_id }, params);
|
|
13020
|
+
};
|
|
13021
|
+
/**
|
|
13022
|
+
* Get aggregate review scores and structured praise/complaint summaries.
|
|
13023
|
+
*/
|
|
13024
|
+
Titles.reviewSummary = function (title_id, params) {
|
|
13025
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsSummary, {}, { title_id: title_id }, params);
|
|
13026
|
+
};
|
|
13027
|
+
/**
|
|
13028
|
+
* Create the current user's review for a title. The backend verifies play/purchase eligibility.
|
|
13029
|
+
*/
|
|
13030
|
+
Titles.createReview = function (title_id, data) {
|
|
13031
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsCreate, data, { title_id: title_id });
|
|
13032
|
+
};
|
|
13033
|
+
/**
|
|
13034
|
+
* View a single review, including revision history when the backend includes it.
|
|
13035
|
+
*/
|
|
13036
|
+
Titles.viewReview = function (review_id, params) {
|
|
13037
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsShow, {}, { review_id: review_id }, params);
|
|
13038
|
+
};
|
|
13039
|
+
/**
|
|
13040
|
+
* Update the current user's review and preserve a backend revision trail.
|
|
13041
|
+
*/
|
|
13042
|
+
Titles.updateReview = function (review_id, data) {
|
|
13043
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsUpdate, data, { review_id: review_id });
|
|
13044
|
+
};
|
|
13045
|
+
/**
|
|
13046
|
+
* Delete the current user's review, or a title admin's moderated review.
|
|
13047
|
+
*/
|
|
13048
|
+
Titles.deleteReview = function (review_id) {
|
|
13049
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsDelete, {}, { review_id: review_id });
|
|
13050
|
+
};
|
|
13051
|
+
/**
|
|
13052
|
+
* Vote on a review as helpful, funny, detailed, or not helpful.
|
|
13053
|
+
*/
|
|
13054
|
+
Titles.voteReview = function (review_id, vote_type) {
|
|
13055
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsVote, { vote_type: vote_type }, { review_id: review_id });
|
|
13056
|
+
};
|
|
13057
|
+
/**
|
|
13058
|
+
* Report a review for moderation.
|
|
13059
|
+
*/
|
|
13060
|
+
Titles.reportReview = function (review_id, data) {
|
|
13061
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsReport, data, { review_id: review_id });
|
|
13062
|
+
};
|
|
13063
|
+
/**
|
|
13064
|
+
* Create or update the title developer's official response to a review.
|
|
13065
|
+
*/
|
|
13066
|
+
Titles.respondToReview = function (review_id, data) {
|
|
13067
|
+
return Requests.processRoute(TitlesRoute.routes.reviewsDeveloperResponse, data, { review_id: review_id });
|
|
13068
|
+
};
|
|
12982
13069
|
return Titles;
|
|
12983
13070
|
}());
|
|
12984
13071
|
|
|
@@ -15526,6 +15613,8 @@ var SchedulerRoute = /** @class */ (function () {
|
|
|
15526
15613
|
},
|
|
15527
15614
|
getRedditRecommendations: { url: '/schedulers/{scheduler_id}/reddit/recommendations', method: HTTP_METHODS.POST },
|
|
15528
15615
|
generateRedditContent: { url: '/schedulers/{scheduler_id}/reddit/generateContent', method: HTTP_METHODS.POST },
|
|
15616
|
+
getRedditSubredditMatches: { url: '/schedulers/{scheduler_id}/reddit/subreddit-matches', method: HTTP_METHODS.POST },
|
|
15617
|
+
getRedditSubredditPositioning: { url: '/schedulers/{scheduler_id}/reddit/subreddit-positioning', method: HTTP_METHODS.POST },
|
|
15529
15618
|
listDestinations: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations', method: HTTP_METHODS.GET },
|
|
15530
15619
|
createDestination: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations', method: HTTP_METHODS.POST },
|
|
15531
15620
|
getDestination: { url: '/schedulers/{scheduler_id}/updates/{update_id}/destinations/{destination_id}', method: HTTP_METHODS.GET },
|
|
@@ -16156,7 +16245,7 @@ var Scheduler = /** @class */ (function () {
|
|
|
16156
16245
|
return Requests.processRoute(SchedulerRoute.routes.deleteDestination, {}, { scheduler_id: scheduler_id, update_id: update_id, destination_id: destination_id }, params);
|
|
16157
16246
|
};
|
|
16158
16247
|
/**
|
|
16159
|
-
* Get
|
|
16248
|
+
* Get subreddit recommendations for a scheduler.
|
|
16160
16249
|
*
|
|
16161
16250
|
* @see https://api.glitch.fun/api/documentation#/Scheduler/getSchedulerRedditRecommendations
|
|
16162
16251
|
*
|
|
@@ -16179,6 +16268,27 @@ var Scheduler = /** @class */ (function () {
|
|
|
16179
16268
|
Scheduler.generateRedditContent = function (scheduler_id, data, params) {
|
|
16180
16269
|
return Requests.processRoute(SchedulerRoute.routes.generateRedditContent, data, { scheduler_id: scheduler_id }, params);
|
|
16181
16270
|
};
|
|
16271
|
+
/**
|
|
16272
|
+
* Match the scheduler title to indexed Reddit communities.
|
|
16273
|
+
*
|
|
16274
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
16275
|
+
* @param data Optional post context and filters.
|
|
16276
|
+
* @returns promise
|
|
16277
|
+
*/
|
|
16278
|
+
Scheduler.getRedditSubredditMatches = function (scheduler_id, data, params) {
|
|
16279
|
+
if (data === void 0) { data = {}; }
|
|
16280
|
+
return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditMatches, data, { scheduler_id: scheduler_id }, params);
|
|
16281
|
+
};
|
|
16282
|
+
/**
|
|
16283
|
+
* Position a registered game for a subreddit and optionally prepare Reddit draft content.
|
|
16284
|
+
*
|
|
16285
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
16286
|
+
* @param data The target subreddit and optional post context.
|
|
16287
|
+
* @returns promise
|
|
16288
|
+
*/
|
|
16289
|
+
Scheduler.getRedditSubredditPositioning = function (scheduler_id, data, params) {
|
|
16290
|
+
return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditPositioning, data, { scheduler_id: scheduler_id }, params);
|
|
16291
|
+
};
|
|
16182
16292
|
/**
|
|
16183
16293
|
* Get all posts and comments for a scheduler.
|
|
16184
16294
|
*
|
|
@@ -16284,6 +16394,66 @@ var Scheduler = /** @class */ (function () {
|
|
|
16284
16394
|
return Scheduler;
|
|
16285
16395
|
}());
|
|
16286
16396
|
|
|
16397
|
+
var RedditSubredditsRoute = /** @class */ (function () {
|
|
16398
|
+
function RedditSubredditsRoute() {
|
|
16399
|
+
}
|
|
16400
|
+
RedditSubredditsRoute.routes = {
|
|
16401
|
+
list: { url: '/reddit/subreddits', method: HTTP_METHODS.GET },
|
|
16402
|
+
show: { url: '/reddit/subreddits/{subreddit}', method: HTTP_METHODS.GET },
|
|
16403
|
+
match: { url: '/reddit/subreddits/match', method: HTTP_METHODS.POST },
|
|
16404
|
+
ingest: { url: '/admin/reddit/subreddits/ingest', method: HTTP_METHODS.POST },
|
|
16405
|
+
refresh: { url: '/admin/reddit/subreddits/{subreddit}/refresh', method: HTTP_METHODS.POST },
|
|
16406
|
+
};
|
|
16407
|
+
return RedditSubredditsRoute;
|
|
16408
|
+
}());
|
|
16409
|
+
|
|
16410
|
+
var RedditSubreddits = /** @class */ (function () {
|
|
16411
|
+
function RedditSubreddits() {
|
|
16412
|
+
}
|
|
16413
|
+
/**
|
|
16414
|
+
* Search indexed Reddit communities for game marketing research.
|
|
16415
|
+
*
|
|
16416
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/indexRedditSubreddits
|
|
16417
|
+
*/
|
|
16418
|
+
RedditSubreddits.list = function (params) {
|
|
16419
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.list, undefined, undefined, params);
|
|
16420
|
+
};
|
|
16421
|
+
/**
|
|
16422
|
+
* Get an analyzed subreddit record by display name.
|
|
16423
|
+
*
|
|
16424
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/showRedditSubreddit
|
|
16425
|
+
*/
|
|
16426
|
+
RedditSubreddits.show = function (subreddit, params) {
|
|
16427
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.show, undefined, { subreddit: subreddit }, params);
|
|
16428
|
+
};
|
|
16429
|
+
/**
|
|
16430
|
+
* Match a game concept to relevant Reddit communities.
|
|
16431
|
+
*
|
|
16432
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/matchRedditSubreddits
|
|
16433
|
+
*/
|
|
16434
|
+
RedditSubreddits.match = function (data, params) {
|
|
16435
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.match, data, undefined, params);
|
|
16436
|
+
};
|
|
16437
|
+
/**
|
|
16438
|
+
* Admin-only ingestion of subreddit metadata and rules.
|
|
16439
|
+
*
|
|
16440
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/ingestRedditSubreddits
|
|
16441
|
+
*/
|
|
16442
|
+
RedditSubreddits.ingest = function (data, params) {
|
|
16443
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.ingest, data, undefined, params);
|
|
16444
|
+
};
|
|
16445
|
+
/**
|
|
16446
|
+
* Admin-only refresh for one subreddit.
|
|
16447
|
+
*
|
|
16448
|
+
* @see https://api.glitch.fun/api/documentation#/Reddit%20Subreddit%20Intelligence/refreshRedditSubreddit
|
|
16449
|
+
*/
|
|
16450
|
+
RedditSubreddits.refresh = function (subreddit, data, params) {
|
|
16451
|
+
if (data === void 0) { data = {}; }
|
|
16452
|
+
return Requests.processRoute(RedditSubredditsRoute.routes.refresh, data, { subreddit: subreddit }, params);
|
|
16453
|
+
};
|
|
16454
|
+
return RedditSubreddits;
|
|
16455
|
+
}());
|
|
16456
|
+
|
|
16287
16457
|
// src/routes/FunnelRoutes.tsx
|
|
16288
16458
|
var FunnelRoutes = /** @class */ (function () {
|
|
16289
16459
|
function FunnelRoutes() {
|
|
@@ -18147,6 +18317,571 @@ var Crm = /** @class */ (function () {
|
|
|
18147
18317
|
return Crm;
|
|
18148
18318
|
}());
|
|
18149
18319
|
|
|
18320
|
+
var MultiplayerRoute = /** @class */ (function () {
|
|
18321
|
+
function MultiplayerRoute() {
|
|
18322
|
+
}
|
|
18323
|
+
MultiplayerRoute.routes = {
|
|
18324
|
+
searchLobbies: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.GET },
|
|
18325
|
+
createLobby: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.POST },
|
|
18326
|
+
showLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.GET },
|
|
18327
|
+
updateLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.PUT },
|
|
18328
|
+
joinLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/join', method: HTTP_METHODS.POST },
|
|
18329
|
+
leaveLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/leave', method: HTTP_METHODS.POST },
|
|
18330
|
+
setLobbyServer: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/server', method: HTTP_METHODS.POST },
|
|
18331
|
+
listLobbyMessages: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.GET },
|
|
18332
|
+
sendLobbyMessage: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.POST },
|
|
18333
|
+
listVoiceRooms: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.GET },
|
|
18334
|
+
createVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.POST },
|
|
18335
|
+
showVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.GET },
|
|
18336
|
+
updateVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.PUT },
|
|
18337
|
+
joinVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}/join', method: HTTP_METHODS.POST },
|
|
18338
|
+
heartbeatVoice: { url: '/multiplayer/voice/heartbeat', method: HTTP_METHODS.POST },
|
|
18339
|
+
leaveVoice: { url: '/multiplayer/voice/leave', method: HTTP_METHODS.POST },
|
|
18340
|
+
sendVoicePacket: { url: '/multiplayer/voice/packets', method: HTTP_METHODS.POST },
|
|
18341
|
+
pollVoicePackets: { url: '/multiplayer/voice/poll', method: HTTP_METHODS.POST },
|
|
18342
|
+
browseServers: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.GET },
|
|
18343
|
+
registerServer: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.POST },
|
|
18344
|
+
heartbeatServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/heartbeat', method: HTTP_METHODS.POST },
|
|
18345
|
+
reserveServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/reserve', method: HTTP_METHODS.POST },
|
|
18346
|
+
heartbeatSession: { url: '/multiplayer/sessions/heartbeat', method: HTTP_METHODS.POST },
|
|
18347
|
+
releaseSession: { url: '/multiplayer/sessions/release', method: HTTP_METHODS.POST },
|
|
18348
|
+
issueAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets', method: HTTP_METHODS.POST },
|
|
18349
|
+
validateAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
18350
|
+
validateAuthTicketForServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
18351
|
+
listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
|
|
18352
|
+
addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
|
|
18353
|
+
deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
|
|
18354
|
+
};
|
|
18355
|
+
return MultiplayerRoute;
|
|
18356
|
+
}());
|
|
18357
|
+
|
|
18358
|
+
/**
|
|
18359
|
+
* Steam-style multiplayer APIs for Glitch titles.
|
|
18360
|
+
*
|
|
18361
|
+
* The multiplayer surface is split into three groups:
|
|
18362
|
+
* lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets.
|
|
18363
|
+
* User JWTs can infer the player from the authenticated user. Title-token clients
|
|
18364
|
+
* and game clients without a Glitch user session should pass a stable `player_id`.
|
|
18365
|
+
* Dedicated servers use `server_token` on heartbeat and server-side ticket validation
|
|
18366
|
+
* so they do not need to hold a user JWT or title token.
|
|
18367
|
+
*
|
|
18368
|
+
* These endpoints are intentionally database-agnostic from the SDK's point of view:
|
|
18369
|
+
* callers work with public identifiers, metadata objects, and lifecycle events,
|
|
18370
|
+
* while the backend owns how those records are stored.
|
|
18371
|
+
*/
|
|
18372
|
+
var Multiplayer = /** @class */ (function () {
|
|
18373
|
+
function Multiplayer() {
|
|
18374
|
+
}
|
|
18375
|
+
/**
|
|
18376
|
+
* Search joinable, non-expired lobbies for a title.
|
|
18377
|
+
*
|
|
18378
|
+
* Filters are exact-match except `skill_band`, which the backend can use for
|
|
18379
|
+
* near sorting. Default results exclude full, closed, unjoinable, and expired
|
|
18380
|
+
* lobbies. Lifecycle context: clients usually call this before `joinLobby`;
|
|
18381
|
+
* joins create a `lobby.joined` event on the backend.
|
|
18382
|
+
*
|
|
18383
|
+
* @param title_id Title UUID.
|
|
18384
|
+
* @param params Optional filters such as region, game mode, map, lobby type, skill band, and limit.
|
|
18385
|
+
* @example
|
|
18386
|
+
* Multiplayer.searchLobbies('title-uuid', {
|
|
18387
|
+
* region: 'us-central',
|
|
18388
|
+
* game_mode: 'ranked_duos',
|
|
18389
|
+
* skill_band: 1840,
|
|
18390
|
+
* limit: 25
|
|
18391
|
+
* });
|
|
18392
|
+
*/
|
|
18393
|
+
Multiplayer.searchLobbies = function (title_id, params) {
|
|
18394
|
+
return Requests.processRoute(MultiplayerRoute.routes.searchLobbies, undefined, { title_id: title_id }, params);
|
|
18395
|
+
};
|
|
18396
|
+
/**
|
|
18397
|
+
* Create a lobby and insert the owner as the first joined member.
|
|
18398
|
+
*
|
|
18399
|
+
* Use this when matchmaking has no suitable lobby, when a player invites
|
|
18400
|
+
* friends, or when a party needs pre-game setup before server assignment.
|
|
18401
|
+
* Lifecycle events: `lobby.created`, then `lobby.joined` for the owner.
|
|
18402
|
+
*
|
|
18403
|
+
* @param title_id Title UUID.
|
|
18404
|
+
* @param data Lobby configuration and optional owner/member metadata.
|
|
18405
|
+
* @example
|
|
18406
|
+
* Multiplayer.createLobby('title-uuid', {
|
|
18407
|
+
* player_id: 'steam:76561198000000000',
|
|
18408
|
+
* display_name: 'CinderAce',
|
|
18409
|
+
* lobby_type: 'public',
|
|
18410
|
+
* max_members: 4,
|
|
18411
|
+
* region: 'us-central',
|
|
18412
|
+
* game_mode: 'ranked_duos',
|
|
18413
|
+
* metadata: { playlist: 'ranked', allow_voice: true }
|
|
18414
|
+
* });
|
|
18415
|
+
*/
|
|
18416
|
+
Multiplayer.createLobby = function (title_id, data) {
|
|
18417
|
+
return Requests.processRoute(MultiplayerRoute.routes.createLobby, data, { title_id: title_id });
|
|
18418
|
+
};
|
|
18419
|
+
/**
|
|
18420
|
+
* Retrieve a lobby with members and assigned server information when present.
|
|
18421
|
+
*
|
|
18422
|
+
* Call this after lobby lifecycle notifications such as `lobby.joined`,
|
|
18423
|
+
* `lobby.updated`, `lobby.owner_transferred`, or `lobby.server_assigned`.
|
|
18424
|
+
*
|
|
18425
|
+
* @param title_id Title UUID.
|
|
18426
|
+
* @param lobby_id Lobby UUID.
|
|
18427
|
+
*/
|
|
18428
|
+
Multiplayer.showLobby = function (title_id, lobby_id) {
|
|
18429
|
+
return Requests.processRoute(MultiplayerRoute.routes.showLobby, undefined, { title_id: title_id, lobby_id: lobby_id });
|
|
18430
|
+
};
|
|
18431
|
+
/**
|
|
18432
|
+
* Join a lobby or refresh an existing membership.
|
|
18433
|
+
*
|
|
18434
|
+
* This call is idempotent for a player already in the lobby and can update
|
|
18435
|
+
* display name, ready state, or member metadata. It returns 409 when the lobby
|
|
18436
|
+
* is full, closed, expired, or not joinable. Lifecycle event: `lobby.joined`.
|
|
18437
|
+
*
|
|
18438
|
+
* @param title_id Title UUID.
|
|
18439
|
+
* @param lobby_id Lobby UUID.
|
|
18440
|
+
* @param data Player identity and optional member metadata.
|
|
18441
|
+
* @example
|
|
18442
|
+
* Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
|
|
18443
|
+
* player_id: 'steam:76561198000000001',
|
|
18444
|
+
* display_name: 'Nova',
|
|
18445
|
+
* ready: false,
|
|
18446
|
+
* member_data: { character: 'Ash', rank: 1799 }
|
|
18447
|
+
* });
|
|
18448
|
+
*/
|
|
18449
|
+
Multiplayer.joinLobby = function (title_id, lobby_id, data) {
|
|
18450
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18451
|
+
};
|
|
18452
|
+
/**
|
|
18453
|
+
* Leave a lobby.
|
|
18454
|
+
*
|
|
18455
|
+
* If the owner leaves, ownership transfers to the oldest remaining joined
|
|
18456
|
+
* member. If no members remain, the lobby closes. Lifecycle events:
|
|
18457
|
+
* `lobby.left`, optionally `lobby.owner_transferred` or `lobby.updated`.
|
|
18458
|
+
*
|
|
18459
|
+
* @param title_id Title UUID.
|
|
18460
|
+
* @param lobby_id Lobby UUID.
|
|
18461
|
+
* @param data Optional player_id for title-token clients.
|
|
18462
|
+
*/
|
|
18463
|
+
Multiplayer.leaveLobby = function (title_id, lobby_id, data) {
|
|
18464
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18465
|
+
};
|
|
18466
|
+
/**
|
|
18467
|
+
* Update lobby metadata, visibility, joinability, limits, or state.
|
|
18468
|
+
*
|
|
18469
|
+
* This is owner-only. `max_members` cannot be lower than the current member
|
|
18470
|
+
* count. Keep metadata low-frequency and mostly search/display oriented.
|
|
18471
|
+
* Lifecycle event: `lobby.updated`.
|
|
18472
|
+
*
|
|
18473
|
+
* @param title_id Title UUID.
|
|
18474
|
+
* @param lobby_id Lobby UUID.
|
|
18475
|
+
* @param data Owner identity plus fields to update.
|
|
18476
|
+
*/
|
|
18477
|
+
Multiplayer.updateLobby = function (title_id, lobby_id, data) {
|
|
18478
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18479
|
+
};
|
|
18480
|
+
/**
|
|
18481
|
+
* Assign a registered game server to a lobby.
|
|
18482
|
+
*
|
|
18483
|
+
* This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients
|
|
18484
|
+
* should react by reserving or connecting to the assigned server, then
|
|
18485
|
+
* optionally leaving the lobby. Lifecycle event: `lobby.server_assigned`.
|
|
18486
|
+
*
|
|
18487
|
+
* @param title_id Title UUID.
|
|
18488
|
+
* @param lobby_id Lobby UUID.
|
|
18489
|
+
* @param data Server UUID and optional lobby state/joinability updates.
|
|
18490
|
+
*/
|
|
18491
|
+
Multiplayer.setLobbyServer = function (title_id, lobby_id, data) {
|
|
18492
|
+
return Requests.processRoute(MultiplayerRoute.routes.setLobbyServer, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18493
|
+
};
|
|
18494
|
+
/**
|
|
18495
|
+
* List ordered low-bandwidth lobby messages.
|
|
18496
|
+
*
|
|
18497
|
+
* Use `after_sequence` to poll for messages missed during reconnects or after
|
|
18498
|
+
* a realtime `lobby.message_sent` event. This channel is for chat and control
|
|
18499
|
+
* messages, not gameplay, positional data, or voice streaming.
|
|
18500
|
+
*
|
|
18501
|
+
* @param title_id Title UUID.
|
|
18502
|
+
* @param lobby_id Lobby UUID.
|
|
18503
|
+
* @param params Optional sequence cursor and limit.
|
|
18504
|
+
*/
|
|
18505
|
+
Multiplayer.listLobbyMessages = function (title_id, lobby_id, params) {
|
|
18506
|
+
return Requests.processRoute(MultiplayerRoute.routes.listLobbyMessages, undefined, { title_id: title_id, lobby_id: lobby_id }, params);
|
|
18507
|
+
};
|
|
18508
|
+
/**
|
|
18509
|
+
* Send a low-bandwidth message to all lobby members.
|
|
18510
|
+
*
|
|
18511
|
+
* Payloads are capped at 4KB by the backend. Use this for chat, ready signals,
|
|
18512
|
+
* invite/kick control messages, and owner-arbitrated choices. Lifecycle event:
|
|
18513
|
+
* `lobby.message_sent`.
|
|
18514
|
+
*
|
|
18515
|
+
* @param title_id Title UUID.
|
|
18516
|
+
* @param lobby_id Lobby UUID.
|
|
18517
|
+
* @param data Message type, sender identity, and JSON payload.
|
|
18518
|
+
* @example
|
|
18519
|
+
* Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
|
|
18520
|
+
* player_id: 'steam:76561198000000000',
|
|
18521
|
+
* message_type: 'ready',
|
|
18522
|
+
* payload: { ready: true }
|
|
18523
|
+
* });
|
|
18524
|
+
*/
|
|
18525
|
+
Multiplayer.sendLobbyMessage = function (title_id, lobby_id, data) {
|
|
18526
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendLobbyMessage, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18527
|
+
};
|
|
18528
|
+
/**
|
|
18529
|
+
* List active/non-expired voice rooms for a title.
|
|
18530
|
+
*
|
|
18531
|
+
* Rooms can be attached to a lobby, a server, a party, or a proximity group.
|
|
18532
|
+
* Use this to discover existing voice state before joining. Lifecycle context:
|
|
18533
|
+
* realtime transports should mirror `voice.room_created`, `voice.room_updated`,
|
|
18534
|
+
* `voice.joined`, and `voice.left`.
|
|
18535
|
+
*
|
|
18536
|
+
* @param title_id Title UUID.
|
|
18537
|
+
* @param params Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.
|
|
18538
|
+
*/
|
|
18539
|
+
Multiplayer.listVoiceRooms = function (title_id, params) {
|
|
18540
|
+
return Requests.processRoute(MultiplayerRoute.routes.listVoiceRooms, undefined, { title_id: title_id }, params);
|
|
18541
|
+
};
|
|
18542
|
+
/**
|
|
18543
|
+
* Create a voice room and join the creator as the first participant.
|
|
18544
|
+
*
|
|
18545
|
+
* The backend returns `voice_token` once. Keep it client-side and use it for
|
|
18546
|
+
* voice heartbeat, packet send, packet polling, and leave calls. `glitch_relay`
|
|
18547
|
+
* can carry base64 Opus frames for prototypes, small-party fallback, or
|
|
18548
|
+
* signaling. For production-scale audio, set `provider: 'external'` and reuse
|
|
18549
|
+
* the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an
|
|
18550
|
+
* engine-native transport. Lifecycle events: `voice.room_created`,
|
|
18551
|
+
* `voice.joined`.
|
|
18552
|
+
*
|
|
18553
|
+
* @param title_id Title UUID.
|
|
18554
|
+
* @param data Voice codec, topology, linked lobby/server, and owner metadata.
|
|
18555
|
+
* @example
|
|
18556
|
+
* const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
|
|
18557
|
+
* player_id: 'steam:76561198000000000',
|
|
18558
|
+
* display_name: 'CinderAce',
|
|
18559
|
+
* lobby_id: 'lobby-uuid',
|
|
18560
|
+
* provider: 'glitch_relay',
|
|
18561
|
+
* topology: 'lobby',
|
|
18562
|
+
* codec: 'opus',
|
|
18563
|
+
* sample_rate: 48000,
|
|
18564
|
+
* frame_duration_ms: 20,
|
|
18565
|
+
* channels: 1,
|
|
18566
|
+
* metadata: { push_to_talk: true }
|
|
18567
|
+
* });
|
|
18568
|
+
*/
|
|
18569
|
+
Multiplayer.createVoiceRoom = function (title_id, data) {
|
|
18570
|
+
return Requests.processRoute(MultiplayerRoute.routes.createVoiceRoom, data, { title_id: title_id });
|
|
18571
|
+
};
|
|
18572
|
+
/**
|
|
18573
|
+
* Retrieve a voice room with participant media states.
|
|
18574
|
+
*
|
|
18575
|
+
* Use this after `voice.joined`, `voice.heartbeat`, `voice.left`, or
|
|
18576
|
+
* `voice.room_updated` to refresh in-game UI such as speaker lists, mute
|
|
18577
|
+
* icons, or team voice controls.
|
|
18578
|
+
*
|
|
18579
|
+
* @param title_id Title UUID.
|
|
18580
|
+
* @param voice_room_id Voice room UUID.
|
|
18581
|
+
*/
|
|
18582
|
+
Multiplayer.showVoiceRoom = function (title_id, voice_room_id) {
|
|
18583
|
+
return Requests.processRoute(MultiplayerRoute.routes.showVoiceRoom, undefined, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18584
|
+
};
|
|
18585
|
+
/**
|
|
18586
|
+
* Update owner-controlled voice room state.
|
|
18587
|
+
*
|
|
18588
|
+
* Owner-only. Use this to close a room, adjust capacity, update moderation
|
|
18589
|
+
* flags, or provide external provider connection details. The backend rejects
|
|
18590
|
+
* lowering `max_participants` below the current participant count. Lifecycle
|
|
18591
|
+
* event: `voice.room_updated`.
|
|
18592
|
+
*
|
|
18593
|
+
* @param title_id Title UUID.
|
|
18594
|
+
* @param voice_room_id Voice room UUID.
|
|
18595
|
+
* @param data Owner player identity and room fields to update.
|
|
18596
|
+
*/
|
|
18597
|
+
Multiplayer.updateVoiceRoom = function (title_id, voice_room_id, data) {
|
|
18598
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18599
|
+
};
|
|
18600
|
+
/**
|
|
18601
|
+
* Join a voice room and receive a participant-scoped token.
|
|
18602
|
+
*
|
|
18603
|
+
* Rejoining with the same player is idempotent and rotates the token. The
|
|
18604
|
+
* token is used by participant endpoints instead of requiring a user JWT or
|
|
18605
|
+
* title token on every media request. Returns 409 when the room is closed,
|
|
18606
|
+
* expired, or full. Lifecycle event: `voice.joined`.
|
|
18607
|
+
*
|
|
18608
|
+
* @param title_id Title UUID.
|
|
18609
|
+
* @param voice_room_id Voice room UUID.
|
|
18610
|
+
* @param data Player identity, display name, metadata, and token TTL.
|
|
18611
|
+
*/
|
|
18612
|
+
Multiplayer.joinVoiceRoom = function (title_id, voice_room_id, data) {
|
|
18613
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18614
|
+
};
|
|
18615
|
+
/**
|
|
18616
|
+
* Heartbeat voice participant state.
|
|
18617
|
+
*
|
|
18618
|
+
* Call every 10-30 seconds and whenever mute/deafen/speaking state changes.
|
|
18619
|
+
* `last_sequence` tells the backend how far this participant has processed
|
|
18620
|
+
* ordered packets. Expired participants are rejected with 409. Lifecycle event:
|
|
18621
|
+
* `voice.heartbeat`.
|
|
18622
|
+
*
|
|
18623
|
+
* @param data Participant voice token and mutable media state.
|
|
18624
|
+
*/
|
|
18625
|
+
Multiplayer.heartbeatVoice = function (data) {
|
|
18626
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatVoice, data);
|
|
18627
|
+
};
|
|
18628
|
+
/**
|
|
18629
|
+
* Leave the current voice room for a participant token.
|
|
18630
|
+
*
|
|
18631
|
+
* This is idempotent for disconnect cleanup: room participant count is
|
|
18632
|
+
* decremented once, room ownership is transferred when possible, and an
|
|
18633
|
+
* empty room closes. The token remains valid only for retrying this leave
|
|
18634
|
+
* call; heartbeat, send, and poll calls reject left participants. Lifecycle
|
|
18635
|
+
* event: `voice.left`.
|
|
18636
|
+
*
|
|
18637
|
+
* @param data Participant voice token.
|
|
18638
|
+
*/
|
|
18639
|
+
Multiplayer.leaveVoice = function (data) {
|
|
18640
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveVoice, data);
|
|
18641
|
+
};
|
|
18642
|
+
/**
|
|
18643
|
+
* Send one ordered voice-room packet.
|
|
18644
|
+
*
|
|
18645
|
+
* `audio` packets should contain compact compressed frames such as base64 Opus
|
|
18646
|
+
* at 48kHz mono/20ms. `offer`, `answer`, and `ice` packets support WebRTC
|
|
18647
|
+
* signaling. `control`, `speaking`, and `mute_state` packets are for custom
|
|
18648
|
+
* engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB.
|
|
18649
|
+
* Muted participants cannot send audio. Lifecycle event: `voice.packet_sent`.
|
|
18650
|
+
*
|
|
18651
|
+
* @param data Participant token, packet type, payload, and optional duration.
|
|
18652
|
+
* @example
|
|
18653
|
+
* await Multiplayer.sendVoicePacket({
|
|
18654
|
+
* voice_token: voiceToken,
|
|
18655
|
+
* packet_type: 'audio',
|
|
18656
|
+
* payload: base64OpusFrame,
|
|
18657
|
+
* duration_ms: 20
|
|
18658
|
+
* });
|
|
18659
|
+
*/
|
|
18660
|
+
Multiplayer.sendVoicePacket = function (data) {
|
|
18661
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendVoicePacket, data);
|
|
18662
|
+
};
|
|
18663
|
+
/**
|
|
18664
|
+
* Poll ordered voice-room packets after a known sequence.
|
|
18665
|
+
*
|
|
18666
|
+
* Defaults to excluding packets sent by the caller. Use the highest returned
|
|
18667
|
+
* sequence as the next `after_sequence` cursor. This is useful for fallback
|
|
18668
|
+
* relay, WebRTC signaling, reconnect recovery, and small-party prototypes.
|
|
18669
|
+
* Lifecycle event: `voice.packet_polled`.
|
|
18670
|
+
*
|
|
18671
|
+
* @param data Participant token, optional sequence cursor, limit, and self-exclusion flag.
|
|
18672
|
+
*/
|
|
18673
|
+
Multiplayer.pollVoicePackets = function (data) {
|
|
18674
|
+
return Requests.processRoute(MultiplayerRoute.routes.pollVoicePackets, data);
|
|
18675
|
+
};
|
|
18676
|
+
/**
|
|
18677
|
+
* Browse public, joinable multiplayer servers for a title.
|
|
18678
|
+
*
|
|
18679
|
+
* Default results exclude private, draining, offline, stale, expired, and full
|
|
18680
|
+
* servers. Title administrators can pass `include_private` to inspect servers
|
|
18681
|
+
* that normal clients cannot join.
|
|
18682
|
+
*
|
|
18683
|
+
* @param title_id Title UUID.
|
|
18684
|
+
* @param params Optional server browser filters.
|
|
18685
|
+
*/
|
|
18686
|
+
Multiplayer.browseServers = function (title_id, params) {
|
|
18687
|
+
return Requests.processRoute(MultiplayerRoute.routes.browseServers, undefined, { title_id: title_id }, params);
|
|
18688
|
+
};
|
|
18689
|
+
/**
|
|
18690
|
+
* Register or refresh a multiplayer server and receive a one-time server token.
|
|
18691
|
+
*
|
|
18692
|
+
* Store `server_token` only on the server process. The backend stores only a
|
|
18693
|
+
* hash and will not return the plain token again. Counts are validated so
|
|
18694
|
+
* `current_players + bot_players` cannot exceed `max_players`. Lifecycle event:
|
|
18695
|
+
* `server.registered`.
|
|
18696
|
+
*
|
|
18697
|
+
* @param title_id Title UUID.
|
|
18698
|
+
* @param data Server browser, connection, rule, and capacity metadata.
|
|
18699
|
+
* @example
|
|
18700
|
+
* Multiplayer.registerServer('title-uuid', {
|
|
18701
|
+
* name: 'Ranked US Central 01',
|
|
18702
|
+
* server_type: 'dedicated',
|
|
18703
|
+
* status: 'active',
|
|
18704
|
+
* host: '203.0.113.42',
|
|
18705
|
+
* game_port: 7777,
|
|
18706
|
+
* query_port: 27015,
|
|
18707
|
+
* transport: 'udp',
|
|
18708
|
+
* max_players: 16,
|
|
18709
|
+
* secure: true,
|
|
18710
|
+
* tags: ['ranked', 'duos']
|
|
18711
|
+
* });
|
|
18712
|
+
*/
|
|
18713
|
+
Multiplayer.registerServer = function (title_id, data) {
|
|
18714
|
+
return Requests.processRoute(MultiplayerRoute.routes.registerServer, data, { title_id: title_id });
|
|
18715
|
+
};
|
|
18716
|
+
/**
|
|
18717
|
+
* Heartbeat a multiplayer server with its dedicated `server_token`.
|
|
18718
|
+
*
|
|
18719
|
+
* Call every 30-60 seconds and whenever player counts, rules, or metadata
|
|
18720
|
+
* change. Stale servers are hidden from default browsing and reservation.
|
|
18721
|
+
* This endpoint is for dedicated/listen server processes and does not require
|
|
18722
|
+
* a user JWT. Lifecycle event: `server.heartbeat`.
|
|
18723
|
+
*
|
|
18724
|
+
* @param title_id Title UUID.
|
|
18725
|
+
* @param server_id Server UUID.
|
|
18726
|
+
* @param data Server token and optional mutable server state.
|
|
18727
|
+
*/
|
|
18728
|
+
Multiplayer.heartbeatServer = function (title_id, server_id, data) {
|
|
18729
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatServer, data, { title_id: title_id, server_id: server_id });
|
|
18730
|
+
};
|
|
18731
|
+
/**
|
|
18732
|
+
* Reserve a short-lived slot on a multiplayer server before connecting.
|
|
18733
|
+
*
|
|
18734
|
+
* Reservations protect capacity during game handoff. The backend rejects stale,
|
|
18735
|
+
* private, full, draining, offline, expired, or duplicate open reservations.
|
|
18736
|
+
* The plain `reservation_token` is returned once and is used for session
|
|
18737
|
+
* heartbeat/release calls. Lifecycle event: `server.reserved`.
|
|
18738
|
+
*
|
|
18739
|
+
* @param title_id Title UUID.
|
|
18740
|
+
* @param server_id Server UUID.
|
|
18741
|
+
* @param data Optional player/lobby identity and reservation TTL.
|
|
18742
|
+
*/
|
|
18743
|
+
Multiplayer.reserveServer = function (title_id, server_id, data) {
|
|
18744
|
+
return Requests.processRoute(MultiplayerRoute.routes.reserveServer, data, { title_id: title_id, server_id: server_id });
|
|
18745
|
+
};
|
|
18746
|
+
/**
|
|
18747
|
+
* Heartbeat an open multiplayer session reservation.
|
|
18748
|
+
*
|
|
18749
|
+
* Use this after a successful reservation while the client is connecting or
|
|
18750
|
+
* playing. Expired sessions are marked expired and capacity is recovered before
|
|
18751
|
+
* the backend returns 409. Lifecycle events: `session.heartbeat` or
|
|
18752
|
+
* `session.expired`.
|
|
18753
|
+
*
|
|
18754
|
+
* @param data Reservation token and optional state/TTL.
|
|
18755
|
+
*/
|
|
18756
|
+
Multiplayer.heartbeatSession = function (data) {
|
|
18757
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatSession, data);
|
|
18758
|
+
};
|
|
18759
|
+
/**
|
|
18760
|
+
* Release an open multiplayer session reservation.
|
|
18761
|
+
*
|
|
18762
|
+
* Call this on normal disconnect, failed connection attempts, or shutdown so
|
|
18763
|
+
* server capacity is decremented promptly. The backend makes release safe to
|
|
18764
|
+
* call more than once for an already closed reservation. Lifecycle event:
|
|
18765
|
+
* `session.released`.
|
|
18766
|
+
*
|
|
18767
|
+
* @param data Reservation token returned by `reserveServer`.
|
|
18768
|
+
*/
|
|
18769
|
+
Multiplayer.releaseSession = function (data) {
|
|
18770
|
+
return Requests.processRoute(MultiplayerRoute.routes.releaseSession, data);
|
|
18771
|
+
};
|
|
18772
|
+
/**
|
|
18773
|
+
* Issue a short-lived multiplayer auth ticket for a player.
|
|
18774
|
+
*
|
|
18775
|
+
* The plain `auth_ticket` is returned once and only a hash is stored by the
|
|
18776
|
+
* backend. Use this for P2P or dedicated-server admission before game traffic
|
|
18777
|
+
* begins. `remote_identity` can bind the ticket to a server or validator.
|
|
18778
|
+
* Lifecycle event: `auth_ticket.issued`.
|
|
18779
|
+
*
|
|
18780
|
+
* @param title_id Title UUID.
|
|
18781
|
+
* @param data Player identity, optional remote identity, and TTL.
|
|
18782
|
+
*/
|
|
18783
|
+
Multiplayer.issueAuthTicket = function (title_id, data) {
|
|
18784
|
+
return Requests.processRoute(MultiplayerRoute.routes.issueAuthTicket, data, { title_id: title_id });
|
|
18785
|
+
};
|
|
18786
|
+
/**
|
|
18787
|
+
* Validate a multiplayer auth ticket from a trusted title/user context.
|
|
18788
|
+
*
|
|
18789
|
+
* Pass `consume: true` for one-time tickets to prevent replay. Dedicated
|
|
18790
|
+
* servers should usually call `validateAuthTicketForServer` so they can use
|
|
18791
|
+
* `server_token` instead of a title token or user JWT. Lifecycle event:
|
|
18792
|
+
* `auth_ticket.validated`.
|
|
18793
|
+
*
|
|
18794
|
+
* @param title_id Title UUID.
|
|
18795
|
+
* @param data Ticket, optional remote identity check, and consume flag.
|
|
18796
|
+
*/
|
|
18797
|
+
Multiplayer.validateAuthTicket = function (title_id, data) {
|
|
18798
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicket, data, { title_id: title_id });
|
|
18799
|
+
};
|
|
18800
|
+
/**
|
|
18801
|
+
* Validate an auth ticket as a dedicated server.
|
|
18802
|
+
*
|
|
18803
|
+
* This server-token endpoint lets a dedicated server admit players without
|
|
18804
|
+
* holding a user JWT or title token. Pass `consume: true` to prevent replay.
|
|
18805
|
+
* Lifecycle event: `auth_ticket.validated`.
|
|
18806
|
+
*
|
|
18807
|
+
* @param title_id Title UUID.
|
|
18808
|
+
* @param server_id Server UUID.
|
|
18809
|
+
* @param data Server token, player auth ticket, optional remote identity, and consume flag.
|
|
18810
|
+
*/
|
|
18811
|
+
Multiplayer.validateAuthTicketForServer = function (title_id, server_id, data) {
|
|
18812
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicketForServer, data, { title_id: title_id, server_id: server_id });
|
|
18813
|
+
};
|
|
18814
|
+
/**
|
|
18815
|
+
* List a player's server favorites or history entries.
|
|
18816
|
+
*
|
|
18817
|
+
* Use this for Steam-like favorites and recent servers tabs. Title-token
|
|
18818
|
+
* clients should pass `player_id`; user JWT clients default to the user UUID.
|
|
18819
|
+
*
|
|
18820
|
+
* @param title_id Title UUID.
|
|
18821
|
+
* @param params Optional player and favorite/history filter.
|
|
18822
|
+
*/
|
|
18823
|
+
Multiplayer.listFavorites = function (title_id, params) {
|
|
18824
|
+
return Requests.processRoute(MultiplayerRoute.routes.listFavorites, undefined, { title_id: title_id }, params);
|
|
18825
|
+
};
|
|
18826
|
+
/**
|
|
18827
|
+
* Add or update a favorite/history server entry for a player.
|
|
18828
|
+
*
|
|
18829
|
+
* Provide `server_id` for a registered Glitch server, or `host` plus
|
|
18830
|
+
* `game_port` for a direct/community server. Lifecycle event:
|
|
18831
|
+
* `favorite.upserted`.
|
|
18832
|
+
*
|
|
18833
|
+
* @param title_id Title UUID.
|
|
18834
|
+
* @param data Favorite/history target and optional metadata.
|
|
18835
|
+
*/
|
|
18836
|
+
Multiplayer.addFavorite = function (title_id, data) {
|
|
18837
|
+
return Requests.processRoute(MultiplayerRoute.routes.addFavorite, data, { title_id: title_id });
|
|
18838
|
+
};
|
|
18839
|
+
/**
|
|
18840
|
+
* Delete a player's favorite/history server entry.
|
|
18841
|
+
*
|
|
18842
|
+
* The SDK sends optional `player_id` as a query parameter because the shared
|
|
18843
|
+
* request helper treats DELETE payloads as query params. This maps cleanly to
|
|
18844
|
+
* the backend's optional player identity validation for title-token clients.
|
|
18845
|
+
* Lifecycle event: `favorite.deleted`.
|
|
18846
|
+
*
|
|
18847
|
+
* @param title_id Title UUID.
|
|
18848
|
+
* @param favorite_id Favorite/history UUID.
|
|
18849
|
+
* @param params Optional player_id for title-token clients.
|
|
18850
|
+
*/
|
|
18851
|
+
Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
|
|
18852
|
+
return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
|
|
18853
|
+
};
|
|
18854
|
+
return Multiplayer;
|
|
18855
|
+
}());
|
|
18856
|
+
|
|
18857
|
+
var ServerOperationsRoute = /** @class */ (function () {
|
|
18858
|
+
function ServerOperationsRoute() {
|
|
18859
|
+
}
|
|
18860
|
+
ServerOperationsRoute.routes = {
|
|
18861
|
+
listDeployments: {
|
|
18862
|
+
url: '/admin/server-operations/deployments',
|
|
18863
|
+
method: HTTP_METHODS.GET
|
|
18864
|
+
},
|
|
18865
|
+
updatePolicy: {
|
|
18866
|
+
url: '/admin/server-operations/titles/{title_id}/builds/{build_id}/policy',
|
|
18867
|
+
method: HTTP_METHODS.PUT
|
|
18868
|
+
},
|
|
18869
|
+
};
|
|
18870
|
+
return ServerOperationsRoute;
|
|
18871
|
+
}());
|
|
18872
|
+
|
|
18873
|
+
var ServerOperations = /** @class */ (function () {
|
|
18874
|
+
function ServerOperations() {
|
|
18875
|
+
}
|
|
18876
|
+
ServerOperations.listDeployments = function (params) {
|
|
18877
|
+
return Requests.processRoute(ServerOperationsRoute.routes.listDeployments, undefined, undefined, params);
|
|
18878
|
+
};
|
|
18879
|
+
ServerOperations.updatePolicy = function (title_id, build_id, data) {
|
|
18880
|
+
return Requests.processRoute(ServerOperationsRoute.routes.updatePolicy, data, { title_id: title_id, build_id: build_id });
|
|
18881
|
+
};
|
|
18882
|
+
return ServerOperations;
|
|
18883
|
+
}());
|
|
18884
|
+
|
|
18150
18885
|
var Parser = /** @class */ (function () {
|
|
18151
18886
|
function Parser() {
|
|
18152
18887
|
}
|
|
@@ -18675,6 +19410,7 @@ var Glitch = /** @class */ (function () {
|
|
|
18675
19410
|
PlayTests: PlayTests,
|
|
18676
19411
|
Media: Media,
|
|
18677
19412
|
Scheduler: Scheduler,
|
|
19413
|
+
RedditSubreddits: RedditSubreddits,
|
|
18678
19414
|
Funnel: Funnel,
|
|
18679
19415
|
SocialStats: SocialStats,
|
|
18680
19416
|
WebsiteAnalytics: WebsiteAnalytics,
|
|
@@ -18687,6 +19423,8 @@ var Glitch = /** @class */ (function () {
|
|
|
18687
19423
|
DiscordMarketplace: DiscordMarketplace,
|
|
18688
19424
|
Education: Education,
|
|
18689
19425
|
Crm: Crm,
|
|
19426
|
+
Multiplayer: Multiplayer,
|
|
19427
|
+
ServerOperations: ServerOperations,
|
|
18690
19428
|
};
|
|
18691
19429
|
Glitch.util = {
|
|
18692
19430
|
Requests: Requests,
|