glitch-javascript-sdk 2.9.3 → 2.9.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 +109 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Titles.d.ts +36 -1
- package/dist/esm/api/Users.d.ts +20 -0
- package/dist/esm/index.js +109 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +56 -1
- package/package.json +1 -1
- package/src/api/Titles.ts +88 -1
- package/src/api/Users.ts +21 -0
- package/src/routes/TitlesRoute.ts +30 -1
- package/src/routes/UserRoutes.ts +5 -0
package/dist/index.d.ts
CHANGED
|
@@ -2255,6 +2255,26 @@ declare class Users {
|
|
|
2255
2255
|
* Includes playtime and last played timestamps.
|
|
2256
2256
|
*/
|
|
2257
2257
|
static playedGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2258
|
+
/**
|
|
2259
|
+
* Get all stats for a user, optionally filtered by title_id.
|
|
2260
|
+
*/
|
|
2261
|
+
static getProgressionStats<T>(user_id: string, params?: {
|
|
2262
|
+
title_id?: string;
|
|
2263
|
+
}): AxiosPromise<Response<T>>;
|
|
2264
|
+
/**
|
|
2265
|
+
* Get all achievements for a user.
|
|
2266
|
+
*/
|
|
2267
|
+
static getProgressionAchievements<T>(user_id: string, params?: {
|
|
2268
|
+
title_id?: string;
|
|
2269
|
+
status?: string;
|
|
2270
|
+
}): AxiosPromise<Response<T>>;
|
|
2271
|
+
/**
|
|
2272
|
+
* Get the raw gameplay history (Run Records) for a user.
|
|
2273
|
+
*/
|
|
2274
|
+
static getProgressionHistory<T>(user_id: string, params?: {
|
|
2275
|
+
title_id?: string;
|
|
2276
|
+
page?: number;
|
|
2277
|
+
}): AxiosPromise<Response<T>>;
|
|
2258
2278
|
}
|
|
2259
2279
|
|
|
2260
2280
|
declare class Events {
|
|
@@ -4401,7 +4421,21 @@ declare class Titles {
|
|
|
4401
4421
|
* @param title_id The UUID of the game title.
|
|
4402
4422
|
* @returns AxiosPromise containing { signallingServer: string }
|
|
4403
4423
|
*/
|
|
4404
|
-
static getMatchmakerServer<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4424
|
+
static getMatchmakerServer<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4425
|
+
/**
|
|
4426
|
+
* Send a session heartbeat to keep the dedicated instance claimed.
|
|
4427
|
+
* Called every 30s during active gameplay.
|
|
4428
|
+
*/
|
|
4429
|
+
static matchmakerSessionHeartbeat<T>(title_id: string, data: {
|
|
4430
|
+
sessionId: string;
|
|
4431
|
+
}): AxiosPromise<Response<T>>;
|
|
4432
|
+
/**
|
|
4433
|
+
* Release the session (starts reclaim countdown).
|
|
4434
|
+
* Called on beforeunload or explicit navigation away.
|
|
4435
|
+
*/
|
|
4436
|
+
static matchmakerSessionRelease<T>(title_id: string, data: {
|
|
4437
|
+
sessionId: string;
|
|
4438
|
+
}): AxiosPromise<Response<T>>;
|
|
4405
4439
|
/**
|
|
4406
4440
|
* Initiates a resumable S3 multipart upload for large files.
|
|
4407
4441
|
*/
|
|
@@ -4414,6 +4448,27 @@ declare class Titles {
|
|
|
4414
4448
|
* Stitch together all uploaded chunks to complete the file in S3.
|
|
4415
4449
|
*/
|
|
4416
4450
|
static completeMultipartUpload<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4451
|
+
static listProgressionStats<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4452
|
+
static createProgressionStat<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4453
|
+
static deleteProgressionStat<T>(title_id: string, id: string): AxiosPromise<Response<T>>;
|
|
4454
|
+
static listProgressionAchievements<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4455
|
+
static createProgressionAchievement<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4456
|
+
static listProgressionLeaderboards<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4457
|
+
static createProgressionLeaderboard<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4458
|
+
static listProgressionSeasons<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4459
|
+
static createProgressionSeason<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4460
|
+
/**
|
|
4461
|
+
* Submit a gameplay run. Updates stats and scores using the install_id for privacy.
|
|
4462
|
+
* @param data { idempotency_key: string, payload: { stats: {}, scores: {} } }
|
|
4463
|
+
*/
|
|
4464
|
+
static submitProgressionRun<T>(title_id: string, install_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4465
|
+
static getProgressionPlayerStats<T>(title_id: string, install_id: string): AxiosPromise<Response<T>>;
|
|
4466
|
+
static getProgressionPlayerAchievements<T>(title_id: string, install_id: string): AxiosPromise<Response<T>>;
|
|
4467
|
+
/**
|
|
4468
|
+
* View leaderboard rankings.
|
|
4469
|
+
* @param params Optional filters like { around_me: true, install_id: 'uuid', season_id: 'uuid' }
|
|
4470
|
+
*/
|
|
4471
|
+
static getProgressionLeaderboard<T>(title_id: string, api_key: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4417
4472
|
}
|
|
4418
4473
|
|
|
4419
4474
|
declare class Campaigns {
|
package/package.json
CHANGED
package/src/api/Titles.ts
CHANGED
|
@@ -1100,10 +1100,35 @@ class Titles {
|
|
|
1100
1100
|
* @param title_id The UUID of the game title.
|
|
1101
1101
|
* @returns AxiosPromise containing { signallingServer: string }
|
|
1102
1102
|
*/
|
|
1103
|
-
public static getMatchmakerServer<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
1103
|
+
public static getMatchmakerServer<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
1104
1104
|
return Requests.processRoute(
|
|
1105
1105
|
TitlesRoute.routes.getMatchmakerServer,
|
|
1106
1106
|
{},
|
|
1107
|
+
{ title_id },
|
|
1108
|
+
params // ← passes as ?sessionId=xxx via Requests.get()
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Send a session heartbeat to keep the dedicated instance claimed.
|
|
1114
|
+
* Called every 30s during active gameplay.
|
|
1115
|
+
*/
|
|
1116
|
+
public static matchmakerSessionHeartbeat<T>(title_id: string, data: { sessionId: string }): AxiosPromise<Response<T>> {
|
|
1117
|
+
return Requests.processRoute(
|
|
1118
|
+
TitlesRoute.routes.matchmakerSessionHeartbeat,
|
|
1119
|
+
data,
|
|
1120
|
+
{ title_id }
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Release the session (starts reclaim countdown).
|
|
1126
|
+
* Called on beforeunload or explicit navigation away.
|
|
1127
|
+
*/
|
|
1128
|
+
public static matchmakerSessionRelease<T>(title_id: string, data: { sessionId: string }): AxiosPromise<Response<T>> {
|
|
1129
|
+
return Requests.processRoute(
|
|
1130
|
+
TitlesRoute.routes.matchmakerSessionRelease,
|
|
1131
|
+
data,
|
|
1107
1132
|
{ title_id }
|
|
1108
1133
|
);
|
|
1109
1134
|
}
|
|
@@ -1128,6 +1153,68 @@ class Titles {
|
|
|
1128
1153
|
public static completeMultipartUpload<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1129
1154
|
return Requests.processRoute(TitlesRoute.routes.completeMultipartUpload, data, { title_id });
|
|
1130
1155
|
}
|
|
1156
|
+
|
|
1157
|
+
// --- Developer Definition Methods ---
|
|
1158
|
+
|
|
1159
|
+
public static listProgressionStats<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
1160
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsList, undefined, { title_id });
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
public static createProgressionStat<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1164
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsStore, data, { title_id });
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
public static deleteProgressionStat<T>(title_id: string, id: string): AxiosPromise<Response<T>> {
|
|
1168
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsDelete, undefined, { title_id, id });
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
public static listProgressionAchievements<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
1172
|
+
return Requests.processRoute(TitlesRoute.routes.progressionAchievementsList, undefined, { title_id });
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
public static createProgressionAchievement<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1176
|
+
return Requests.processRoute(TitlesRoute.routes.progressionAchievementsStore, data, { title_id });
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
public static listProgressionLeaderboards<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
1180
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardsList, undefined, { title_id });
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
public static createProgressionLeaderboard<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1184
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardsStore, data, { title_id });
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
public static listProgressionSeasons<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
1188
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSeasonsList, undefined, { title_id });
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
public static createProgressionSeason<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1192
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSeasonsStore, data, { title_id });
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Submit a gameplay run. Updates stats and scores using the install_id for privacy.
|
|
1197
|
+
* @param data { idempotency_key: string, payload: { stats: {}, scores: {} } }
|
|
1198
|
+
*/
|
|
1199
|
+
public static submitProgressionRun<T>(title_id: string, install_id: string, data: object): AxiosPromise<Response<T>> {
|
|
1200
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSubmit, data, { title_id, install_id });
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
public static getProgressionPlayerStats<T>(title_id: string, install_id: string): AxiosPromise<Response<T>> {
|
|
1204
|
+
return Requests.processRoute(TitlesRoute.routes.progressionPlayerStats, undefined, { title_id, install_id });
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
public static getProgressionPlayerAchievements<T>(title_id: string, install_id: string): AxiosPromise<Response<T>> {
|
|
1208
|
+
return Requests.processRoute(TitlesRoute.routes.progressionPlayerAchievements, undefined, { title_id, install_id });
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* View leaderboard rankings.
|
|
1213
|
+
* @param params Optional filters like { around_me: true, install_id: 'uuid', season_id: 'uuid' }
|
|
1214
|
+
*/
|
|
1215
|
+
public static getProgressionLeaderboard<T>(title_id: string, api_key: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
1216
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardView, undefined, { title_id, api_key }, params);
|
|
1217
|
+
}
|
|
1131
1218
|
}
|
|
1132
1219
|
|
|
1133
1220
|
export default Titles;
|
package/src/api/Users.ts
CHANGED
|
@@ -572,6 +572,27 @@ class Users {
|
|
|
572
572
|
return Requests.processRoute(UserRoutes.routes.playedGames, undefined, undefined, params);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
/**
|
|
576
|
+
* Get all stats for a user, optionally filtered by title_id.
|
|
577
|
+
*/
|
|
578
|
+
public static getProgressionStats<T>(user_id: string, params?: { title_id?: string }): AxiosPromise<Response<T>> {
|
|
579
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionStats, undefined, { user_id }, params);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Get all achievements for a user.
|
|
584
|
+
*/
|
|
585
|
+
public static getProgressionAchievements<T>(user_id: string, params?: { title_id?: string, status?: string }): AxiosPromise<Response<T>> {
|
|
586
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionAchievements, undefined, { user_id }, params);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Get the raw gameplay history (Run Records) for a user.
|
|
591
|
+
*/
|
|
592
|
+
public static getProgressionHistory<T>(user_id: string, params?: { title_id?: string, page?: number }): AxiosPromise<Response<T>> {
|
|
593
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionHistory, undefined, { user_id }, params);
|
|
594
|
+
}
|
|
595
|
+
|
|
575
596
|
|
|
576
597
|
}
|
|
577
598
|
|
|
@@ -243,7 +243,36 @@ class TitlesRoute {
|
|
|
243
243
|
method: HTTP_METHODS.GET
|
|
244
244
|
},
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
matchmakerSessionHeartbeat: {
|
|
247
|
+
url: '/titles/{title_id}/matchmaker/session/heartbeat',
|
|
248
|
+
method: HTTP_METHODS.POST
|
|
249
|
+
},
|
|
250
|
+
matchmakerSessionRelease: {
|
|
251
|
+
url: '/titles/{title_id}/matchmaker/session/release',
|
|
252
|
+
method: HTTP_METHODS.POST
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// --- Title Progression Definitions (Developer API) ---
|
|
257
|
+
progressionStatsList: { url: '/titles/{title_id}/progression/stats', method: HTTP_METHODS.GET },
|
|
258
|
+
progressionStatsStore: { url: '/titles/{title_id}/progression/stats', method: HTTP_METHODS.POST },
|
|
259
|
+
progressionStatsDelete: { url: '/titles/{title_id}/progression/stats/{id}', method: HTTP_METHODS.DELETE },
|
|
260
|
+
|
|
261
|
+
progressionAchievementsList: { url: '/titles/{title_id}/progression/achievements', method: HTTP_METHODS.GET },
|
|
262
|
+
progressionAchievementsStore: { url: '/titles/{title_id}/progression/achievements', method: HTTP_METHODS.POST },
|
|
263
|
+
|
|
264
|
+
progressionLeaderboardsList: { url: '/titles/{title_id}/progression/leaderboards', method: HTTP_METHODS.GET },
|
|
265
|
+
progressionLeaderboardsStore: { url: '/titles/{title_id}/progression/leaderboards', method: HTTP_METHODS.POST },
|
|
266
|
+
|
|
267
|
+
progressionSeasonsList: { url: '/titles/{title_id}/progression/seasons', method: HTTP_METHODS.GET },
|
|
268
|
+
progressionSeasonsStore: { url: '/titles/{title_id}/progression/seasons', method: HTTP_METHODS.POST },
|
|
269
|
+
|
|
270
|
+
// --- In-Game Progression (Client API) ---
|
|
271
|
+
progressionSubmit: { url: '/titles/{title_id}/installs/{install_id}/submit', method: HTTP_METHODS.POST },
|
|
272
|
+
progressionPlayerStats: { url: '/titles/{title_id}/installs/{install_id}/stats', method: HTTP_METHODS.GET },
|
|
273
|
+
progressionPlayerAchievements: { url: '/titles/{title_id}/installs/{install_id}/achievements', method: HTTP_METHODS.GET },
|
|
274
|
+
progressionLeaderboardView: { url: '/titles/{title_id}/leaderboards/{api_key}', method: HTTP_METHODS.GET },
|
|
275
|
+
|
|
247
276
|
|
|
248
277
|
};
|
|
249
278
|
|
package/src/routes/UserRoutes.ts
CHANGED
|
@@ -53,6 +53,11 @@ class UserRoutes {
|
|
|
53
53
|
playedGames: { url: '/users/me/played-games', method: HTTP_METHODS.GET },
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
userProgressionStats: { url: '/users/{user_id}/progression/stats', method: HTTP_METHODS.GET },
|
|
57
|
+
userProgressionAchievements: { url: '/users/{user_id}/progression/achievements', method: HTTP_METHODS.GET },
|
|
58
|
+
userProgressionHistory: { url: '/users/{user_id}/progression/history', method: HTTP_METHODS.GET },
|
|
59
|
+
|
|
60
|
+
|
|
56
61
|
};
|
|
57
62
|
|
|
58
63
|
}
|