glitch-javascript-sdk 2.9.4 → 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/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 {
@@ -4428,6 +4448,27 @@ declare class Titles {
4428
4448
  * Stitch together all uploaded chunks to complete the file in S3.
4429
4449
  */
4430
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>>;
4431
4472
  }
4432
4473
 
4433
4474
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Titles.ts CHANGED
@@ -1153,6 +1153,68 @@ class Titles {
1153
1153
  public static completeMultipartUpload<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
1154
1154
  return Requests.processRoute(TitlesRoute.routes.completeMultipartUpload, data, { title_id });
1155
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
+ }
1156
1218
  }
1157
1219
 
1158
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
 
@@ -253,6 +253,26 @@ class TitlesRoute {
253
253
  },
254
254
 
255
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
+
256
276
 
257
277
  };
258
278
 
@@ -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
  }