glitch-javascript-sdk 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +666 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Multiplayer.d.ts +871 -0
- package/dist/esm/api/Scheduler.d.ts +5 -0
- package/dist/esm/api/ServerOperations.d.ts +7 -0
- package/dist/esm/api/Titles.d.ts +91 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/constants/HttpMethods.d.ts +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +666 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/MultiplayerRoute.d.ts +7 -0
- package/dist/esm/routes/ServerOperationsRoute.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +1 -0
- package/dist/index.d.ts +973 -0
- package/package.json +1 -1
- package/src/api/Multiplayer.ts +1012 -0
- package/src/api/Scheduler.ts +8 -0
- package/src/api/ServerOperations.ts +16 -0
- package/src/api/Titles.ts +117 -4
- package/src/api/index.ts +5 -1
- package/src/constants/HttpMethods.ts +2 -1
- package/src/index.ts +5 -1
- package/src/routes/MultiplayerRoute.ts +46 -0
- package/src/routes/SchedulerRoute.ts +1 -0
- package/src/routes/ServerOperationsRoute.ts +17 -0
- package/src/routes/TitlesRoute.ts +12 -1
- package/src/util/Requests.ts +21 -1
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
|
}());
|
|
@@ -12902,6 +12931,7 @@ var Titles = /** @class */ (function () {
|
|
|
12902
12931
|
* @param params
|
|
12903
12932
|
* - window: number (hours, default 24)
|
|
12904
12933
|
* - limit: number (default 10)
|
|
12934
|
+
* - is_nsfw: 1 for adult titles only, 0 for safe titles only
|
|
12905
12935
|
*/
|
|
12906
12936
|
Titles.getCommunityActivity = function (params) {
|
|
12907
12937
|
return Requests.processRoute(TitlesRoute.routes.communityActivity, {}, {}, params);
|
|
@@ -12913,6 +12943,7 @@ var Titles = /** @class */ (function () {
|
|
|
12913
12943
|
* - type: 'influencer' (campaigns) or 'organic' (non-paid)
|
|
12914
12944
|
* - window: number (hours, default 168)
|
|
12915
12945
|
* - limit: number (default 10)
|
|
12946
|
+
* - is_nsfw: 1 for adult titles only, 0 for safe titles only
|
|
12916
12947
|
*/
|
|
12917
12948
|
Titles.getSocialTrending = function (params) {
|
|
12918
12949
|
return Requests.processRoute(TitlesRoute.routes.socialTrending, {}, {}, params);
|
|
@@ -12923,6 +12954,7 @@ var Titles = /** @class */ (function () {
|
|
|
12923
12954
|
* @param params
|
|
12924
12955
|
* - limit: number (default 12)
|
|
12925
12956
|
* - device_id: string (highly recommended for guest tracking)
|
|
12957
|
+
* - is_nsfw: 1 for adult titles only, 0 for safe titles only
|
|
12926
12958
|
*/
|
|
12927
12959
|
Titles.getDiscoveryQueue = function (params) {
|
|
12928
12960
|
return Requests.processRoute(TitlesRoute.routes.discoveryQueue, {}, {}, params);
|
|
@@ -12937,6 +12969,7 @@ var Titles = /** @class */ (function () {
|
|
|
12937
12969
|
* - seed?: number (For consistent randomization)
|
|
12938
12970
|
* - genres?: string[] (Filter by genre names)
|
|
12939
12971
|
* - models?: string[] (premium, rental, subscription, free)
|
|
12972
|
+
* - is_nsfw?: 1 | 0 (1 for adult titles only, 0 for safe titles only)
|
|
12940
12973
|
* - excluded_ids?: string[] (UUIDs to skip)
|
|
12941
12974
|
* - page?: number
|
|
12942
12975
|
* - per_page?: number
|
|
@@ -12975,6 +13008,64 @@ var Titles = /** @class */ (function () {
|
|
|
12975
13008
|
Titles.wishlistDevices = function (title_id, params) {
|
|
12976
13009
|
return Requests.processRoute(TitlesRoute.routes.wishlistDevices, undefined, { title_id: title_id }, params);
|
|
12977
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
|
+
};
|
|
12978
13069
|
return Titles;
|
|
12979
13070
|
}());
|
|
12980
13071
|
|
|
@@ -15541,6 +15632,7 @@ var SchedulerRoute = /** @class */ (function () {
|
|
|
15541
15632
|
getTikTokTrendingHashtags: { url: '/schedulers/{scheduler_id}/tiktok/discovery/hashtags/trending', method: HTTP_METHODS.GET },
|
|
15542
15633
|
getTikTokHashtagDetail: { url: '/schedulers/{scheduler_id}/tiktok/discovery/hashtags/detail', method: HTTP_METHODS.GET },
|
|
15543
15634
|
getTikTokTrendingKeywords: { url: '/schedulers/{scheduler_id}/tiktok/discovery/search-keywords', method: HTTP_METHODS.GET },
|
|
15635
|
+
getTikTokRecommendedKeywords: { url: '/schedulers/{scheduler_id}/tiktok/discovery/search-keywords/recommend', method: HTTP_METHODS.GET },
|
|
15544
15636
|
};
|
|
15545
15637
|
return SchedulerRoute;
|
|
15546
15638
|
}());
|
|
@@ -16269,6 +16361,13 @@ var Scheduler = /** @class */ (function () {
|
|
|
16269
16361
|
Scheduler.getTikTokTrendingKeywords = function (scheduler_id, params) {
|
|
16270
16362
|
return Requests.processRoute(SchedulerRoute.routes.getTikTokTrendingKeywords, {}, { scheduler_id: scheduler_id }, params);
|
|
16271
16363
|
};
|
|
16364
|
+
/**
|
|
16365
|
+
* Get recommended search keywords on TikTok.
|
|
16366
|
+
* @param params { is_personalized: boolean }
|
|
16367
|
+
*/
|
|
16368
|
+
Scheduler.getTikTokRecommendedKeywords = function (scheduler_id, params) {
|
|
16369
|
+
return Requests.processRoute(SchedulerRoute.routes.getTikTokRecommendedKeywords, {}, { scheduler_id: scheduler_id }, params);
|
|
16370
|
+
};
|
|
16272
16371
|
return Scheduler;
|
|
16273
16372
|
}());
|
|
16274
16373
|
|
|
@@ -18135,6 +18234,571 @@ var Crm = /** @class */ (function () {
|
|
|
18135
18234
|
return Crm;
|
|
18136
18235
|
}());
|
|
18137
18236
|
|
|
18237
|
+
var MultiplayerRoute = /** @class */ (function () {
|
|
18238
|
+
function MultiplayerRoute() {
|
|
18239
|
+
}
|
|
18240
|
+
MultiplayerRoute.routes = {
|
|
18241
|
+
searchLobbies: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.GET },
|
|
18242
|
+
createLobby: { url: '/titles/{title_id}/multiplayer/lobbies', method: HTTP_METHODS.POST },
|
|
18243
|
+
showLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.GET },
|
|
18244
|
+
updateLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}', method: HTTP_METHODS.PUT },
|
|
18245
|
+
joinLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/join', method: HTTP_METHODS.POST },
|
|
18246
|
+
leaveLobby: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/leave', method: HTTP_METHODS.POST },
|
|
18247
|
+
setLobbyServer: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/server', method: HTTP_METHODS.POST },
|
|
18248
|
+
listLobbyMessages: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.GET },
|
|
18249
|
+
sendLobbyMessage: { url: '/titles/{title_id}/multiplayer/lobbies/{lobby_id}/messages', method: HTTP_METHODS.POST },
|
|
18250
|
+
listVoiceRooms: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.GET },
|
|
18251
|
+
createVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms', method: HTTP_METHODS.POST },
|
|
18252
|
+
showVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.GET },
|
|
18253
|
+
updateVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}', method: HTTP_METHODS.PUT },
|
|
18254
|
+
joinVoiceRoom: { url: '/titles/{title_id}/multiplayer/voice/rooms/{voice_room_id}/join', method: HTTP_METHODS.POST },
|
|
18255
|
+
heartbeatVoice: { url: '/multiplayer/voice/heartbeat', method: HTTP_METHODS.POST },
|
|
18256
|
+
leaveVoice: { url: '/multiplayer/voice/leave', method: HTTP_METHODS.POST },
|
|
18257
|
+
sendVoicePacket: { url: '/multiplayer/voice/packets', method: HTTP_METHODS.POST },
|
|
18258
|
+
pollVoicePackets: { url: '/multiplayer/voice/poll', method: HTTP_METHODS.POST },
|
|
18259
|
+
browseServers: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.GET },
|
|
18260
|
+
registerServer: { url: '/titles/{title_id}/multiplayer/servers', method: HTTP_METHODS.POST },
|
|
18261
|
+
heartbeatServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/heartbeat', method: HTTP_METHODS.POST },
|
|
18262
|
+
reserveServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/reserve', method: HTTP_METHODS.POST },
|
|
18263
|
+
heartbeatSession: { url: '/multiplayer/sessions/heartbeat', method: HTTP_METHODS.POST },
|
|
18264
|
+
releaseSession: { url: '/multiplayer/sessions/release', method: HTTP_METHODS.POST },
|
|
18265
|
+
issueAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets', method: HTTP_METHODS.POST },
|
|
18266
|
+
validateAuthTicket: { url: '/titles/{title_id}/multiplayer/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
18267
|
+
validateAuthTicketForServer: { url: '/titles/{title_id}/multiplayer/servers/{server_id}/auth-tickets/validate', method: HTTP_METHODS.POST },
|
|
18268
|
+
listFavorites: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.GET },
|
|
18269
|
+
addFavorite: { url: '/titles/{title_id}/multiplayer/favorites', method: HTTP_METHODS.POST },
|
|
18270
|
+
deleteFavorite: { url: '/titles/{title_id}/multiplayer/favorites/{favorite_id}', method: HTTP_METHODS.DELETE },
|
|
18271
|
+
};
|
|
18272
|
+
return MultiplayerRoute;
|
|
18273
|
+
}());
|
|
18274
|
+
|
|
18275
|
+
/**
|
|
18276
|
+
* Steam-style multiplayer APIs for Glitch titles.
|
|
18277
|
+
*
|
|
18278
|
+
* The multiplayer surface is split into three groups:
|
|
18279
|
+
* lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets.
|
|
18280
|
+
* User JWTs can infer the player from the authenticated user. Title-token clients
|
|
18281
|
+
* and game clients without a Glitch user session should pass a stable `player_id`.
|
|
18282
|
+
* Dedicated servers use `server_token` on heartbeat and server-side ticket validation
|
|
18283
|
+
* so they do not need to hold a user JWT or title token.
|
|
18284
|
+
*
|
|
18285
|
+
* These endpoints are intentionally database-agnostic from the SDK's point of view:
|
|
18286
|
+
* callers work with public identifiers, metadata objects, and lifecycle events,
|
|
18287
|
+
* while the backend owns how those records are stored.
|
|
18288
|
+
*/
|
|
18289
|
+
var Multiplayer = /** @class */ (function () {
|
|
18290
|
+
function Multiplayer() {
|
|
18291
|
+
}
|
|
18292
|
+
/**
|
|
18293
|
+
* Search joinable, non-expired lobbies for a title.
|
|
18294
|
+
*
|
|
18295
|
+
* Filters are exact-match except `skill_band`, which the backend can use for
|
|
18296
|
+
* near sorting. Default results exclude full, closed, unjoinable, and expired
|
|
18297
|
+
* lobbies. Lifecycle context: clients usually call this before `joinLobby`;
|
|
18298
|
+
* joins create a `lobby.joined` event on the backend.
|
|
18299
|
+
*
|
|
18300
|
+
* @param title_id Title UUID.
|
|
18301
|
+
* @param params Optional filters such as region, game mode, map, lobby type, skill band, and limit.
|
|
18302
|
+
* @example
|
|
18303
|
+
* Multiplayer.searchLobbies('title-uuid', {
|
|
18304
|
+
* region: 'us-central',
|
|
18305
|
+
* game_mode: 'ranked_duos',
|
|
18306
|
+
* skill_band: 1840,
|
|
18307
|
+
* limit: 25
|
|
18308
|
+
* });
|
|
18309
|
+
*/
|
|
18310
|
+
Multiplayer.searchLobbies = function (title_id, params) {
|
|
18311
|
+
return Requests.processRoute(MultiplayerRoute.routes.searchLobbies, undefined, { title_id: title_id }, params);
|
|
18312
|
+
};
|
|
18313
|
+
/**
|
|
18314
|
+
* Create a lobby and insert the owner as the first joined member.
|
|
18315
|
+
*
|
|
18316
|
+
* Use this when matchmaking has no suitable lobby, when a player invites
|
|
18317
|
+
* friends, or when a party needs pre-game setup before server assignment.
|
|
18318
|
+
* Lifecycle events: `lobby.created`, then `lobby.joined` for the owner.
|
|
18319
|
+
*
|
|
18320
|
+
* @param title_id Title UUID.
|
|
18321
|
+
* @param data Lobby configuration and optional owner/member metadata.
|
|
18322
|
+
* @example
|
|
18323
|
+
* Multiplayer.createLobby('title-uuid', {
|
|
18324
|
+
* player_id: 'steam:76561198000000000',
|
|
18325
|
+
* display_name: 'CinderAce',
|
|
18326
|
+
* lobby_type: 'public',
|
|
18327
|
+
* max_members: 4,
|
|
18328
|
+
* region: 'us-central',
|
|
18329
|
+
* game_mode: 'ranked_duos',
|
|
18330
|
+
* metadata: { playlist: 'ranked', allow_voice: true }
|
|
18331
|
+
* });
|
|
18332
|
+
*/
|
|
18333
|
+
Multiplayer.createLobby = function (title_id, data) {
|
|
18334
|
+
return Requests.processRoute(MultiplayerRoute.routes.createLobby, data, { title_id: title_id });
|
|
18335
|
+
};
|
|
18336
|
+
/**
|
|
18337
|
+
* Retrieve a lobby with members and assigned server information when present.
|
|
18338
|
+
*
|
|
18339
|
+
* Call this after lobby lifecycle notifications such as `lobby.joined`,
|
|
18340
|
+
* `lobby.updated`, `lobby.owner_transferred`, or `lobby.server_assigned`.
|
|
18341
|
+
*
|
|
18342
|
+
* @param title_id Title UUID.
|
|
18343
|
+
* @param lobby_id Lobby UUID.
|
|
18344
|
+
*/
|
|
18345
|
+
Multiplayer.showLobby = function (title_id, lobby_id) {
|
|
18346
|
+
return Requests.processRoute(MultiplayerRoute.routes.showLobby, undefined, { title_id: title_id, lobby_id: lobby_id });
|
|
18347
|
+
};
|
|
18348
|
+
/**
|
|
18349
|
+
* Join a lobby or refresh an existing membership.
|
|
18350
|
+
*
|
|
18351
|
+
* This call is idempotent for a player already in the lobby and can update
|
|
18352
|
+
* display name, ready state, or member metadata. It returns 409 when the lobby
|
|
18353
|
+
* is full, closed, expired, or not joinable. Lifecycle event: `lobby.joined`.
|
|
18354
|
+
*
|
|
18355
|
+
* @param title_id Title UUID.
|
|
18356
|
+
* @param lobby_id Lobby UUID.
|
|
18357
|
+
* @param data Player identity and optional member metadata.
|
|
18358
|
+
* @example
|
|
18359
|
+
* Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
|
|
18360
|
+
* player_id: 'steam:76561198000000001',
|
|
18361
|
+
* display_name: 'Nova',
|
|
18362
|
+
* ready: false,
|
|
18363
|
+
* member_data: { character: 'Ash', rank: 1799 }
|
|
18364
|
+
* });
|
|
18365
|
+
*/
|
|
18366
|
+
Multiplayer.joinLobby = function (title_id, lobby_id, data) {
|
|
18367
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18368
|
+
};
|
|
18369
|
+
/**
|
|
18370
|
+
* Leave a lobby.
|
|
18371
|
+
*
|
|
18372
|
+
* If the owner leaves, ownership transfers to the oldest remaining joined
|
|
18373
|
+
* member. If no members remain, the lobby closes. Lifecycle events:
|
|
18374
|
+
* `lobby.left`, optionally `lobby.owner_transferred` or `lobby.updated`.
|
|
18375
|
+
*
|
|
18376
|
+
* @param title_id Title UUID.
|
|
18377
|
+
* @param lobby_id Lobby UUID.
|
|
18378
|
+
* @param data Optional player_id for title-token clients.
|
|
18379
|
+
*/
|
|
18380
|
+
Multiplayer.leaveLobby = function (title_id, lobby_id, data) {
|
|
18381
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18382
|
+
};
|
|
18383
|
+
/**
|
|
18384
|
+
* Update lobby metadata, visibility, joinability, limits, or state.
|
|
18385
|
+
*
|
|
18386
|
+
* This is owner-only. `max_members` cannot be lower than the current member
|
|
18387
|
+
* count. Keep metadata low-frequency and mostly search/display oriented.
|
|
18388
|
+
* Lifecycle event: `lobby.updated`.
|
|
18389
|
+
*
|
|
18390
|
+
* @param title_id Title UUID.
|
|
18391
|
+
* @param lobby_id Lobby UUID.
|
|
18392
|
+
* @param data Owner identity plus fields to update.
|
|
18393
|
+
*/
|
|
18394
|
+
Multiplayer.updateLobby = function (title_id, lobby_id, data) {
|
|
18395
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateLobby, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18396
|
+
};
|
|
18397
|
+
/**
|
|
18398
|
+
* Assign a registered game server to a lobby.
|
|
18399
|
+
*
|
|
18400
|
+
* This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients
|
|
18401
|
+
* should react by reserving or connecting to the assigned server, then
|
|
18402
|
+
* optionally leaving the lobby. Lifecycle event: `lobby.server_assigned`.
|
|
18403
|
+
*
|
|
18404
|
+
* @param title_id Title UUID.
|
|
18405
|
+
* @param lobby_id Lobby UUID.
|
|
18406
|
+
* @param data Server UUID and optional lobby state/joinability updates.
|
|
18407
|
+
*/
|
|
18408
|
+
Multiplayer.setLobbyServer = function (title_id, lobby_id, data) {
|
|
18409
|
+
return Requests.processRoute(MultiplayerRoute.routes.setLobbyServer, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18410
|
+
};
|
|
18411
|
+
/**
|
|
18412
|
+
* List ordered low-bandwidth lobby messages.
|
|
18413
|
+
*
|
|
18414
|
+
* Use `after_sequence` to poll for messages missed during reconnects or after
|
|
18415
|
+
* a realtime `lobby.message_sent` event. This channel is for chat and control
|
|
18416
|
+
* messages, not gameplay, positional data, or voice streaming.
|
|
18417
|
+
*
|
|
18418
|
+
* @param title_id Title UUID.
|
|
18419
|
+
* @param lobby_id Lobby UUID.
|
|
18420
|
+
* @param params Optional sequence cursor and limit.
|
|
18421
|
+
*/
|
|
18422
|
+
Multiplayer.listLobbyMessages = function (title_id, lobby_id, params) {
|
|
18423
|
+
return Requests.processRoute(MultiplayerRoute.routes.listLobbyMessages, undefined, { title_id: title_id, lobby_id: lobby_id }, params);
|
|
18424
|
+
};
|
|
18425
|
+
/**
|
|
18426
|
+
* Send a low-bandwidth message to all lobby members.
|
|
18427
|
+
*
|
|
18428
|
+
* Payloads are capped at 4KB by the backend. Use this for chat, ready signals,
|
|
18429
|
+
* invite/kick control messages, and owner-arbitrated choices. Lifecycle event:
|
|
18430
|
+
* `lobby.message_sent`.
|
|
18431
|
+
*
|
|
18432
|
+
* @param title_id Title UUID.
|
|
18433
|
+
* @param lobby_id Lobby UUID.
|
|
18434
|
+
* @param data Message type, sender identity, and JSON payload.
|
|
18435
|
+
* @example
|
|
18436
|
+
* Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
|
|
18437
|
+
* player_id: 'steam:76561198000000000',
|
|
18438
|
+
* message_type: 'ready',
|
|
18439
|
+
* payload: { ready: true }
|
|
18440
|
+
* });
|
|
18441
|
+
*/
|
|
18442
|
+
Multiplayer.sendLobbyMessage = function (title_id, lobby_id, data) {
|
|
18443
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendLobbyMessage, data, { title_id: title_id, lobby_id: lobby_id });
|
|
18444
|
+
};
|
|
18445
|
+
/**
|
|
18446
|
+
* List active/non-expired voice rooms for a title.
|
|
18447
|
+
*
|
|
18448
|
+
* Rooms can be attached to a lobby, a server, a party, or a proximity group.
|
|
18449
|
+
* Use this to discover existing voice state before joining. Lifecycle context:
|
|
18450
|
+
* realtime transports should mirror `voice.room_created`, `voice.room_updated`,
|
|
18451
|
+
* `voice.joined`, and `voice.left`.
|
|
18452
|
+
*
|
|
18453
|
+
* @param title_id Title UUID.
|
|
18454
|
+
* @param params Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.
|
|
18455
|
+
*/
|
|
18456
|
+
Multiplayer.listVoiceRooms = function (title_id, params) {
|
|
18457
|
+
return Requests.processRoute(MultiplayerRoute.routes.listVoiceRooms, undefined, { title_id: title_id }, params);
|
|
18458
|
+
};
|
|
18459
|
+
/**
|
|
18460
|
+
* Create a voice room and join the creator as the first participant.
|
|
18461
|
+
*
|
|
18462
|
+
* The backend returns `voice_token` once. Keep it client-side and use it for
|
|
18463
|
+
* voice heartbeat, packet send, packet polling, and leave calls. `glitch_relay`
|
|
18464
|
+
* can carry base64 Opus frames for prototypes, small-party fallback, or
|
|
18465
|
+
* signaling. For production-scale audio, set `provider: 'external'` and reuse
|
|
18466
|
+
* the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an
|
|
18467
|
+
* engine-native transport. Lifecycle events: `voice.room_created`,
|
|
18468
|
+
* `voice.joined`.
|
|
18469
|
+
*
|
|
18470
|
+
* @param title_id Title UUID.
|
|
18471
|
+
* @param data Voice codec, topology, linked lobby/server, and owner metadata.
|
|
18472
|
+
* @example
|
|
18473
|
+
* const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
|
|
18474
|
+
* player_id: 'steam:76561198000000000',
|
|
18475
|
+
* display_name: 'CinderAce',
|
|
18476
|
+
* lobby_id: 'lobby-uuid',
|
|
18477
|
+
* provider: 'glitch_relay',
|
|
18478
|
+
* topology: 'lobby',
|
|
18479
|
+
* codec: 'opus',
|
|
18480
|
+
* sample_rate: 48000,
|
|
18481
|
+
* frame_duration_ms: 20,
|
|
18482
|
+
* channels: 1,
|
|
18483
|
+
* metadata: { push_to_talk: true }
|
|
18484
|
+
* });
|
|
18485
|
+
*/
|
|
18486
|
+
Multiplayer.createVoiceRoom = function (title_id, data) {
|
|
18487
|
+
return Requests.processRoute(MultiplayerRoute.routes.createVoiceRoom, data, { title_id: title_id });
|
|
18488
|
+
};
|
|
18489
|
+
/**
|
|
18490
|
+
* Retrieve a voice room with participant media states.
|
|
18491
|
+
*
|
|
18492
|
+
* Use this after `voice.joined`, `voice.heartbeat`, `voice.left`, or
|
|
18493
|
+
* `voice.room_updated` to refresh in-game UI such as speaker lists, mute
|
|
18494
|
+
* icons, or team voice controls.
|
|
18495
|
+
*
|
|
18496
|
+
* @param title_id Title UUID.
|
|
18497
|
+
* @param voice_room_id Voice room UUID.
|
|
18498
|
+
*/
|
|
18499
|
+
Multiplayer.showVoiceRoom = function (title_id, voice_room_id) {
|
|
18500
|
+
return Requests.processRoute(MultiplayerRoute.routes.showVoiceRoom, undefined, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18501
|
+
};
|
|
18502
|
+
/**
|
|
18503
|
+
* Update owner-controlled voice room state.
|
|
18504
|
+
*
|
|
18505
|
+
* Owner-only. Use this to close a room, adjust capacity, update moderation
|
|
18506
|
+
* flags, or provide external provider connection details. The backend rejects
|
|
18507
|
+
* lowering `max_participants` below the current participant count. Lifecycle
|
|
18508
|
+
* event: `voice.room_updated`.
|
|
18509
|
+
*
|
|
18510
|
+
* @param title_id Title UUID.
|
|
18511
|
+
* @param voice_room_id Voice room UUID.
|
|
18512
|
+
* @param data Owner player identity and room fields to update.
|
|
18513
|
+
*/
|
|
18514
|
+
Multiplayer.updateVoiceRoom = function (title_id, voice_room_id, data) {
|
|
18515
|
+
return Requests.processRoute(MultiplayerRoute.routes.updateVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18516
|
+
};
|
|
18517
|
+
/**
|
|
18518
|
+
* Join a voice room and receive a participant-scoped token.
|
|
18519
|
+
*
|
|
18520
|
+
* Rejoining with the same player is idempotent and rotates the token. The
|
|
18521
|
+
* token is used by participant endpoints instead of requiring a user JWT or
|
|
18522
|
+
* title token on every media request. Returns 409 when the room is closed,
|
|
18523
|
+
* expired, or full. Lifecycle event: `voice.joined`.
|
|
18524
|
+
*
|
|
18525
|
+
* @param title_id Title UUID.
|
|
18526
|
+
* @param voice_room_id Voice room UUID.
|
|
18527
|
+
* @param data Player identity, display name, metadata, and token TTL.
|
|
18528
|
+
*/
|
|
18529
|
+
Multiplayer.joinVoiceRoom = function (title_id, voice_room_id, data) {
|
|
18530
|
+
return Requests.processRoute(MultiplayerRoute.routes.joinVoiceRoom, data, { title_id: title_id, voice_room_id: voice_room_id });
|
|
18531
|
+
};
|
|
18532
|
+
/**
|
|
18533
|
+
* Heartbeat voice participant state.
|
|
18534
|
+
*
|
|
18535
|
+
* Call every 10-30 seconds and whenever mute/deafen/speaking state changes.
|
|
18536
|
+
* `last_sequence` tells the backend how far this participant has processed
|
|
18537
|
+
* ordered packets. Expired participants are rejected with 409. Lifecycle event:
|
|
18538
|
+
* `voice.heartbeat`.
|
|
18539
|
+
*
|
|
18540
|
+
* @param data Participant voice token and mutable media state.
|
|
18541
|
+
*/
|
|
18542
|
+
Multiplayer.heartbeatVoice = function (data) {
|
|
18543
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatVoice, data);
|
|
18544
|
+
};
|
|
18545
|
+
/**
|
|
18546
|
+
* Leave the current voice room for a participant token.
|
|
18547
|
+
*
|
|
18548
|
+
* This is idempotent for disconnect cleanup: room participant count is
|
|
18549
|
+
* decremented once, room ownership is transferred when possible, and an
|
|
18550
|
+
* empty room closes. The token remains valid only for retrying this leave
|
|
18551
|
+
* call; heartbeat, send, and poll calls reject left participants. Lifecycle
|
|
18552
|
+
* event: `voice.left`.
|
|
18553
|
+
*
|
|
18554
|
+
* @param data Participant voice token.
|
|
18555
|
+
*/
|
|
18556
|
+
Multiplayer.leaveVoice = function (data) {
|
|
18557
|
+
return Requests.processRoute(MultiplayerRoute.routes.leaveVoice, data);
|
|
18558
|
+
};
|
|
18559
|
+
/**
|
|
18560
|
+
* Send one ordered voice-room packet.
|
|
18561
|
+
*
|
|
18562
|
+
* `audio` packets should contain compact compressed frames such as base64 Opus
|
|
18563
|
+
* at 48kHz mono/20ms. `offer`, `answer`, and `ice` packets support WebRTC
|
|
18564
|
+
* signaling. `control`, `speaking`, and `mute_state` packets are for custom
|
|
18565
|
+
* engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB.
|
|
18566
|
+
* Muted participants cannot send audio. Lifecycle event: `voice.packet_sent`.
|
|
18567
|
+
*
|
|
18568
|
+
* @param data Participant token, packet type, payload, and optional duration.
|
|
18569
|
+
* @example
|
|
18570
|
+
* await Multiplayer.sendVoicePacket({
|
|
18571
|
+
* voice_token: voiceToken,
|
|
18572
|
+
* packet_type: 'audio',
|
|
18573
|
+
* payload: base64OpusFrame,
|
|
18574
|
+
* duration_ms: 20
|
|
18575
|
+
* });
|
|
18576
|
+
*/
|
|
18577
|
+
Multiplayer.sendVoicePacket = function (data) {
|
|
18578
|
+
return Requests.processRoute(MultiplayerRoute.routes.sendVoicePacket, data);
|
|
18579
|
+
};
|
|
18580
|
+
/**
|
|
18581
|
+
* Poll ordered voice-room packets after a known sequence.
|
|
18582
|
+
*
|
|
18583
|
+
* Defaults to excluding packets sent by the caller. Use the highest returned
|
|
18584
|
+
* sequence as the next `after_sequence` cursor. This is useful for fallback
|
|
18585
|
+
* relay, WebRTC signaling, reconnect recovery, and small-party prototypes.
|
|
18586
|
+
* Lifecycle event: `voice.packet_polled`.
|
|
18587
|
+
*
|
|
18588
|
+
* @param data Participant token, optional sequence cursor, limit, and self-exclusion flag.
|
|
18589
|
+
*/
|
|
18590
|
+
Multiplayer.pollVoicePackets = function (data) {
|
|
18591
|
+
return Requests.processRoute(MultiplayerRoute.routes.pollVoicePackets, data);
|
|
18592
|
+
};
|
|
18593
|
+
/**
|
|
18594
|
+
* Browse public, joinable multiplayer servers for a title.
|
|
18595
|
+
*
|
|
18596
|
+
* Default results exclude private, draining, offline, stale, expired, and full
|
|
18597
|
+
* servers. Title administrators can pass `include_private` to inspect servers
|
|
18598
|
+
* that normal clients cannot join.
|
|
18599
|
+
*
|
|
18600
|
+
* @param title_id Title UUID.
|
|
18601
|
+
* @param params Optional server browser filters.
|
|
18602
|
+
*/
|
|
18603
|
+
Multiplayer.browseServers = function (title_id, params) {
|
|
18604
|
+
return Requests.processRoute(MultiplayerRoute.routes.browseServers, undefined, { title_id: title_id }, params);
|
|
18605
|
+
};
|
|
18606
|
+
/**
|
|
18607
|
+
* Register or refresh a multiplayer server and receive a one-time server token.
|
|
18608
|
+
*
|
|
18609
|
+
* Store `server_token` only on the server process. The backend stores only a
|
|
18610
|
+
* hash and will not return the plain token again. Counts are validated so
|
|
18611
|
+
* `current_players + bot_players` cannot exceed `max_players`. Lifecycle event:
|
|
18612
|
+
* `server.registered`.
|
|
18613
|
+
*
|
|
18614
|
+
* @param title_id Title UUID.
|
|
18615
|
+
* @param data Server browser, connection, rule, and capacity metadata.
|
|
18616
|
+
* @example
|
|
18617
|
+
* Multiplayer.registerServer('title-uuid', {
|
|
18618
|
+
* name: 'Ranked US Central 01',
|
|
18619
|
+
* server_type: 'dedicated',
|
|
18620
|
+
* status: 'active',
|
|
18621
|
+
* host: '203.0.113.42',
|
|
18622
|
+
* game_port: 7777,
|
|
18623
|
+
* query_port: 27015,
|
|
18624
|
+
* transport: 'udp',
|
|
18625
|
+
* max_players: 16,
|
|
18626
|
+
* secure: true,
|
|
18627
|
+
* tags: ['ranked', 'duos']
|
|
18628
|
+
* });
|
|
18629
|
+
*/
|
|
18630
|
+
Multiplayer.registerServer = function (title_id, data) {
|
|
18631
|
+
return Requests.processRoute(MultiplayerRoute.routes.registerServer, data, { title_id: title_id });
|
|
18632
|
+
};
|
|
18633
|
+
/**
|
|
18634
|
+
* Heartbeat a multiplayer server with its dedicated `server_token`.
|
|
18635
|
+
*
|
|
18636
|
+
* Call every 30-60 seconds and whenever player counts, rules, or metadata
|
|
18637
|
+
* change. Stale servers are hidden from default browsing and reservation.
|
|
18638
|
+
* This endpoint is for dedicated/listen server processes and does not require
|
|
18639
|
+
* a user JWT. Lifecycle event: `server.heartbeat`.
|
|
18640
|
+
*
|
|
18641
|
+
* @param title_id Title UUID.
|
|
18642
|
+
* @param server_id Server UUID.
|
|
18643
|
+
* @param data Server token and optional mutable server state.
|
|
18644
|
+
*/
|
|
18645
|
+
Multiplayer.heartbeatServer = function (title_id, server_id, data) {
|
|
18646
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatServer, data, { title_id: title_id, server_id: server_id });
|
|
18647
|
+
};
|
|
18648
|
+
/**
|
|
18649
|
+
* Reserve a short-lived slot on a multiplayer server before connecting.
|
|
18650
|
+
*
|
|
18651
|
+
* Reservations protect capacity during game handoff. The backend rejects stale,
|
|
18652
|
+
* private, full, draining, offline, expired, or duplicate open reservations.
|
|
18653
|
+
* The plain `reservation_token` is returned once and is used for session
|
|
18654
|
+
* heartbeat/release calls. Lifecycle event: `server.reserved`.
|
|
18655
|
+
*
|
|
18656
|
+
* @param title_id Title UUID.
|
|
18657
|
+
* @param server_id Server UUID.
|
|
18658
|
+
* @param data Optional player/lobby identity and reservation TTL.
|
|
18659
|
+
*/
|
|
18660
|
+
Multiplayer.reserveServer = function (title_id, server_id, data) {
|
|
18661
|
+
return Requests.processRoute(MultiplayerRoute.routes.reserveServer, data, { title_id: title_id, server_id: server_id });
|
|
18662
|
+
};
|
|
18663
|
+
/**
|
|
18664
|
+
* Heartbeat an open multiplayer session reservation.
|
|
18665
|
+
*
|
|
18666
|
+
* Use this after a successful reservation while the client is connecting or
|
|
18667
|
+
* playing. Expired sessions are marked expired and capacity is recovered before
|
|
18668
|
+
* the backend returns 409. Lifecycle events: `session.heartbeat` or
|
|
18669
|
+
* `session.expired`.
|
|
18670
|
+
*
|
|
18671
|
+
* @param data Reservation token and optional state/TTL.
|
|
18672
|
+
*/
|
|
18673
|
+
Multiplayer.heartbeatSession = function (data) {
|
|
18674
|
+
return Requests.processRoute(MultiplayerRoute.routes.heartbeatSession, data);
|
|
18675
|
+
};
|
|
18676
|
+
/**
|
|
18677
|
+
* Release an open multiplayer session reservation.
|
|
18678
|
+
*
|
|
18679
|
+
* Call this on normal disconnect, failed connection attempts, or shutdown so
|
|
18680
|
+
* server capacity is decremented promptly. The backend makes release safe to
|
|
18681
|
+
* call more than once for an already closed reservation. Lifecycle event:
|
|
18682
|
+
* `session.released`.
|
|
18683
|
+
*
|
|
18684
|
+
* @param data Reservation token returned by `reserveServer`.
|
|
18685
|
+
*/
|
|
18686
|
+
Multiplayer.releaseSession = function (data) {
|
|
18687
|
+
return Requests.processRoute(MultiplayerRoute.routes.releaseSession, data);
|
|
18688
|
+
};
|
|
18689
|
+
/**
|
|
18690
|
+
* Issue a short-lived multiplayer auth ticket for a player.
|
|
18691
|
+
*
|
|
18692
|
+
* The plain `auth_ticket` is returned once and only a hash is stored by the
|
|
18693
|
+
* backend. Use this for P2P or dedicated-server admission before game traffic
|
|
18694
|
+
* begins. `remote_identity` can bind the ticket to a server or validator.
|
|
18695
|
+
* Lifecycle event: `auth_ticket.issued`.
|
|
18696
|
+
*
|
|
18697
|
+
* @param title_id Title UUID.
|
|
18698
|
+
* @param data Player identity, optional remote identity, and TTL.
|
|
18699
|
+
*/
|
|
18700
|
+
Multiplayer.issueAuthTicket = function (title_id, data) {
|
|
18701
|
+
return Requests.processRoute(MultiplayerRoute.routes.issueAuthTicket, data, { title_id: title_id });
|
|
18702
|
+
};
|
|
18703
|
+
/**
|
|
18704
|
+
* Validate a multiplayer auth ticket from a trusted title/user context.
|
|
18705
|
+
*
|
|
18706
|
+
* Pass `consume: true` for one-time tickets to prevent replay. Dedicated
|
|
18707
|
+
* servers should usually call `validateAuthTicketForServer` so they can use
|
|
18708
|
+
* `server_token` instead of a title token or user JWT. Lifecycle event:
|
|
18709
|
+
* `auth_ticket.validated`.
|
|
18710
|
+
*
|
|
18711
|
+
* @param title_id Title UUID.
|
|
18712
|
+
* @param data Ticket, optional remote identity check, and consume flag.
|
|
18713
|
+
*/
|
|
18714
|
+
Multiplayer.validateAuthTicket = function (title_id, data) {
|
|
18715
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicket, data, { title_id: title_id });
|
|
18716
|
+
};
|
|
18717
|
+
/**
|
|
18718
|
+
* Validate an auth ticket as a dedicated server.
|
|
18719
|
+
*
|
|
18720
|
+
* This server-token endpoint lets a dedicated server admit players without
|
|
18721
|
+
* holding a user JWT or title token. Pass `consume: true` to prevent replay.
|
|
18722
|
+
* Lifecycle event: `auth_ticket.validated`.
|
|
18723
|
+
*
|
|
18724
|
+
* @param title_id Title UUID.
|
|
18725
|
+
* @param server_id Server UUID.
|
|
18726
|
+
* @param data Server token, player auth ticket, optional remote identity, and consume flag.
|
|
18727
|
+
*/
|
|
18728
|
+
Multiplayer.validateAuthTicketForServer = function (title_id, server_id, data) {
|
|
18729
|
+
return Requests.processRoute(MultiplayerRoute.routes.validateAuthTicketForServer, data, { title_id: title_id, server_id: server_id });
|
|
18730
|
+
};
|
|
18731
|
+
/**
|
|
18732
|
+
* List a player's server favorites or history entries.
|
|
18733
|
+
*
|
|
18734
|
+
* Use this for Steam-like favorites and recent servers tabs. Title-token
|
|
18735
|
+
* clients should pass `player_id`; user JWT clients default to the user UUID.
|
|
18736
|
+
*
|
|
18737
|
+
* @param title_id Title UUID.
|
|
18738
|
+
* @param params Optional player and favorite/history filter.
|
|
18739
|
+
*/
|
|
18740
|
+
Multiplayer.listFavorites = function (title_id, params) {
|
|
18741
|
+
return Requests.processRoute(MultiplayerRoute.routes.listFavorites, undefined, { title_id: title_id }, params);
|
|
18742
|
+
};
|
|
18743
|
+
/**
|
|
18744
|
+
* Add or update a favorite/history server entry for a player.
|
|
18745
|
+
*
|
|
18746
|
+
* Provide `server_id` for a registered Glitch server, or `host` plus
|
|
18747
|
+
* `game_port` for a direct/community server. Lifecycle event:
|
|
18748
|
+
* `favorite.upserted`.
|
|
18749
|
+
*
|
|
18750
|
+
* @param title_id Title UUID.
|
|
18751
|
+
* @param data Favorite/history target and optional metadata.
|
|
18752
|
+
*/
|
|
18753
|
+
Multiplayer.addFavorite = function (title_id, data) {
|
|
18754
|
+
return Requests.processRoute(MultiplayerRoute.routes.addFavorite, data, { title_id: title_id });
|
|
18755
|
+
};
|
|
18756
|
+
/**
|
|
18757
|
+
* Delete a player's favorite/history server entry.
|
|
18758
|
+
*
|
|
18759
|
+
* The SDK sends optional `player_id` as a query parameter because the shared
|
|
18760
|
+
* request helper treats DELETE payloads as query params. This maps cleanly to
|
|
18761
|
+
* the backend's optional player identity validation for title-token clients.
|
|
18762
|
+
* Lifecycle event: `favorite.deleted`.
|
|
18763
|
+
*
|
|
18764
|
+
* @param title_id Title UUID.
|
|
18765
|
+
* @param favorite_id Favorite/history UUID.
|
|
18766
|
+
* @param params Optional player_id for title-token clients.
|
|
18767
|
+
*/
|
|
18768
|
+
Multiplayer.deleteFavorite = function (title_id, favorite_id, params) {
|
|
18769
|
+
return Requests.processRoute(MultiplayerRoute.routes.deleteFavorite, undefined, { title_id: title_id, favorite_id: favorite_id }, params);
|
|
18770
|
+
};
|
|
18771
|
+
return Multiplayer;
|
|
18772
|
+
}());
|
|
18773
|
+
|
|
18774
|
+
var ServerOperationsRoute = /** @class */ (function () {
|
|
18775
|
+
function ServerOperationsRoute() {
|
|
18776
|
+
}
|
|
18777
|
+
ServerOperationsRoute.routes = {
|
|
18778
|
+
listDeployments: {
|
|
18779
|
+
url: '/admin/server-operations/deployments',
|
|
18780
|
+
method: HTTP_METHODS.GET
|
|
18781
|
+
},
|
|
18782
|
+
updatePolicy: {
|
|
18783
|
+
url: '/admin/server-operations/titles/{title_id}/builds/{build_id}/policy',
|
|
18784
|
+
method: HTTP_METHODS.PUT
|
|
18785
|
+
},
|
|
18786
|
+
};
|
|
18787
|
+
return ServerOperationsRoute;
|
|
18788
|
+
}());
|
|
18789
|
+
|
|
18790
|
+
var ServerOperations = /** @class */ (function () {
|
|
18791
|
+
function ServerOperations() {
|
|
18792
|
+
}
|
|
18793
|
+
ServerOperations.listDeployments = function (params) {
|
|
18794
|
+
return Requests.processRoute(ServerOperationsRoute.routes.listDeployments, undefined, undefined, params);
|
|
18795
|
+
};
|
|
18796
|
+
ServerOperations.updatePolicy = function (title_id, build_id, data) {
|
|
18797
|
+
return Requests.processRoute(ServerOperationsRoute.routes.updatePolicy, data, { title_id: title_id, build_id: build_id });
|
|
18798
|
+
};
|
|
18799
|
+
return ServerOperations;
|
|
18800
|
+
}());
|
|
18801
|
+
|
|
18138
18802
|
var Parser = /** @class */ (function () {
|
|
18139
18803
|
function Parser() {
|
|
18140
18804
|
}
|
|
@@ -18675,6 +19339,8 @@ var Glitch = /** @class */ (function () {
|
|
|
18675
19339
|
DiscordMarketplace: DiscordMarketplace,
|
|
18676
19340
|
Education: Education,
|
|
18677
19341
|
Crm: Crm,
|
|
19342
|
+
Multiplayer: Multiplayer,
|
|
19343
|
+
ServerOperations: ServerOperations,
|
|
18678
19344
|
};
|
|
18679
19345
|
Glitch.util = {
|
|
18680
19346
|
Requests: Requests,
|