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/esm/api/Titles.d.ts
CHANGED
|
@@ -586,7 +586,21 @@ declare class Titles {
|
|
|
586
586
|
* @param title_id The UUID of the game title.
|
|
587
587
|
* @returns AxiosPromise containing { signallingServer: string }
|
|
588
588
|
*/
|
|
589
|
-
static getMatchmakerServer<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
589
|
+
static getMatchmakerServer<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
590
|
+
/**
|
|
591
|
+
* Send a session heartbeat to keep the dedicated instance claimed.
|
|
592
|
+
* Called every 30s during active gameplay.
|
|
593
|
+
*/
|
|
594
|
+
static matchmakerSessionHeartbeat<T>(title_id: string, data: {
|
|
595
|
+
sessionId: string;
|
|
596
|
+
}): AxiosPromise<Response<T>>;
|
|
597
|
+
/**
|
|
598
|
+
* Release the session (starts reclaim countdown).
|
|
599
|
+
* Called on beforeunload or explicit navigation away.
|
|
600
|
+
*/
|
|
601
|
+
static matchmakerSessionRelease<T>(title_id: string, data: {
|
|
602
|
+
sessionId: string;
|
|
603
|
+
}): AxiosPromise<Response<T>>;
|
|
590
604
|
/**
|
|
591
605
|
* Initiates a resumable S3 multipart upload for large files.
|
|
592
606
|
*/
|
|
@@ -599,5 +613,26 @@ declare class Titles {
|
|
|
599
613
|
* Stitch together all uploaded chunks to complete the file in S3.
|
|
600
614
|
*/
|
|
601
615
|
static completeMultipartUpload<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
616
|
+
static listProgressionStats<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
617
|
+
static createProgressionStat<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
618
|
+
static deleteProgressionStat<T>(title_id: string, id: string): AxiosPromise<Response<T>>;
|
|
619
|
+
static listProgressionAchievements<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
620
|
+
static createProgressionAchievement<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
621
|
+
static listProgressionLeaderboards<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
622
|
+
static createProgressionLeaderboard<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
623
|
+
static listProgressionSeasons<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
624
|
+
static createProgressionSeason<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
625
|
+
/**
|
|
626
|
+
* Submit a gameplay run. Updates stats and scores using the install_id for privacy.
|
|
627
|
+
* @param data { idempotency_key: string, payload: { stats: {}, scores: {} } }
|
|
628
|
+
*/
|
|
629
|
+
static submitProgressionRun<T>(title_id: string, install_id: string, data: object): AxiosPromise<Response<T>>;
|
|
630
|
+
static getProgressionPlayerStats<T>(title_id: string, install_id: string): AxiosPromise<Response<T>>;
|
|
631
|
+
static getProgressionPlayerAchievements<T>(title_id: string, install_id: string): AxiosPromise<Response<T>>;
|
|
632
|
+
/**
|
|
633
|
+
* View leaderboard rankings.
|
|
634
|
+
* @param params Optional filters like { around_me: true, install_id: 'uuid', season_id: 'uuid' }
|
|
635
|
+
*/
|
|
636
|
+
static getProgressionLeaderboard<T>(title_id: string, api_key: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
602
637
|
}
|
|
603
638
|
export default Titles;
|
package/dist/esm/api/Users.d.ts
CHANGED
|
@@ -396,5 +396,25 @@ declare class Users {
|
|
|
396
396
|
* Includes playtime and last played timestamps.
|
|
397
397
|
*/
|
|
398
398
|
static playedGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
399
|
+
/**
|
|
400
|
+
* Get all stats for a user, optionally filtered by title_id.
|
|
401
|
+
*/
|
|
402
|
+
static getProgressionStats<T>(user_id: string, params?: {
|
|
403
|
+
title_id?: string;
|
|
404
|
+
}): AxiosPromise<Response<T>>;
|
|
405
|
+
/**
|
|
406
|
+
* Get all achievements for a user.
|
|
407
|
+
*/
|
|
408
|
+
static getProgressionAchievements<T>(user_id: string, params?: {
|
|
409
|
+
title_id?: string;
|
|
410
|
+
status?: string;
|
|
411
|
+
}): AxiosPromise<Response<T>>;
|
|
412
|
+
/**
|
|
413
|
+
* Get the raw gameplay history (Run Records) for a user.
|
|
414
|
+
*/
|
|
415
|
+
static getProgressionHistory<T>(user_id: string, params?: {
|
|
416
|
+
title_id?: string;
|
|
417
|
+
page?: number;
|
|
418
|
+
}): AxiosPromise<Response<T>>;
|
|
399
419
|
}
|
|
400
420
|
export default Users;
|
package/dist/esm/index.js
CHANGED
|
@@ -8802,6 +8802,9 @@ var UserRoutes = /** @class */ (function () {
|
|
|
8802
8802
|
clearInstagramAuth: { url: '/users/clearInstagramAuth', method: HTTP_METHODS.DELETE },
|
|
8803
8803
|
getSubredditRules: { url: "/users/reddit/redditrules/{subreddit}", method: HTTP_METHODS.GET },
|
|
8804
8804
|
playedGames: { url: '/users/me/played-games', method: HTTP_METHODS.GET },
|
|
8805
|
+
userProgressionStats: { url: '/users/{user_id}/progression/stats', method: HTTP_METHODS.GET },
|
|
8806
|
+
userProgressionAchievements: { url: '/users/{user_id}/progression/achievements', method: HTTP_METHODS.GET },
|
|
8807
|
+
userProgressionHistory: { url: '/users/{user_id}/progression/history', method: HTTP_METHODS.GET },
|
|
8805
8808
|
};
|
|
8806
8809
|
return UserRoutes;
|
|
8807
8810
|
}());
|
|
@@ -9292,6 +9295,24 @@ var Users = /** @class */ (function () {
|
|
|
9292
9295
|
Users.playedGames = function (params) {
|
|
9293
9296
|
return Requests.processRoute(UserRoutes.routes.playedGames, undefined, undefined, params);
|
|
9294
9297
|
};
|
|
9298
|
+
/**
|
|
9299
|
+
* Get all stats for a user, optionally filtered by title_id.
|
|
9300
|
+
*/
|
|
9301
|
+
Users.getProgressionStats = function (user_id, params) {
|
|
9302
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionStats, undefined, { user_id: user_id }, params);
|
|
9303
|
+
};
|
|
9304
|
+
/**
|
|
9305
|
+
* Get all achievements for a user.
|
|
9306
|
+
*/
|
|
9307
|
+
Users.getProgressionAchievements = function (user_id, params) {
|
|
9308
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionAchievements, undefined, { user_id: user_id }, params);
|
|
9309
|
+
};
|
|
9310
|
+
/**
|
|
9311
|
+
* Get the raw gameplay history (Run Records) for a user.
|
|
9312
|
+
*/
|
|
9313
|
+
Users.getProgressionHistory = function (user_id, params) {
|
|
9314
|
+
return Requests.processRoute(UserRoutes.routes.userProgressionHistory, undefined, { user_id: user_id }, params);
|
|
9315
|
+
};
|
|
9295
9316
|
return Users;
|
|
9296
9317
|
}());
|
|
9297
9318
|
|
|
@@ -11785,6 +11806,29 @@ var TitlesRoute = /** @class */ (function () {
|
|
|
11785
11806
|
url: '/titles/{title_id}/matchmaker/server',
|
|
11786
11807
|
method: HTTP_METHODS.GET
|
|
11787
11808
|
},
|
|
11809
|
+
matchmakerSessionHeartbeat: {
|
|
11810
|
+
url: '/titles/{title_id}/matchmaker/session/heartbeat',
|
|
11811
|
+
method: HTTP_METHODS.POST
|
|
11812
|
+
},
|
|
11813
|
+
matchmakerSessionRelease: {
|
|
11814
|
+
url: '/titles/{title_id}/matchmaker/session/release',
|
|
11815
|
+
method: HTTP_METHODS.POST
|
|
11816
|
+
},
|
|
11817
|
+
// --- Title Progression Definitions (Developer API) ---
|
|
11818
|
+
progressionStatsList: { url: '/titles/{title_id}/progression/stats', method: HTTP_METHODS.GET },
|
|
11819
|
+
progressionStatsStore: { url: '/titles/{title_id}/progression/stats', method: HTTP_METHODS.POST },
|
|
11820
|
+
progressionStatsDelete: { url: '/titles/{title_id}/progression/stats/{id}', method: HTTP_METHODS.DELETE },
|
|
11821
|
+
progressionAchievementsList: { url: '/titles/{title_id}/progression/achievements', method: HTTP_METHODS.GET },
|
|
11822
|
+
progressionAchievementsStore: { url: '/titles/{title_id}/progression/achievements', method: HTTP_METHODS.POST },
|
|
11823
|
+
progressionLeaderboardsList: { url: '/titles/{title_id}/progression/leaderboards', method: HTTP_METHODS.GET },
|
|
11824
|
+
progressionLeaderboardsStore: { url: '/titles/{title_id}/progression/leaderboards', method: HTTP_METHODS.POST },
|
|
11825
|
+
progressionSeasonsList: { url: '/titles/{title_id}/progression/seasons', method: HTTP_METHODS.GET },
|
|
11826
|
+
progressionSeasonsStore: { url: '/titles/{title_id}/progression/seasons', method: HTTP_METHODS.POST },
|
|
11827
|
+
// --- In-Game Progression (Client API) ---
|
|
11828
|
+
progressionSubmit: { url: '/titles/{title_id}/installs/{install_id}/submit', method: HTTP_METHODS.POST },
|
|
11829
|
+
progressionPlayerStats: { url: '/titles/{title_id}/installs/{install_id}/stats', method: HTTP_METHODS.GET },
|
|
11830
|
+
progressionPlayerAchievements: { url: '/titles/{title_id}/installs/{install_id}/achievements', method: HTTP_METHODS.GET },
|
|
11831
|
+
progressionLeaderboardView: { url: '/titles/{title_id}/leaderboards/{api_key}', method: HTTP_METHODS.GET },
|
|
11788
11832
|
};
|
|
11789
11833
|
return TitlesRoute;
|
|
11790
11834
|
}());
|
|
@@ -12549,8 +12593,23 @@ var Titles = /** @class */ (function () {
|
|
|
12549
12593
|
* @param title_id The UUID of the game title.
|
|
12550
12594
|
* @returns AxiosPromise containing { signallingServer: string }
|
|
12551
12595
|
*/
|
|
12552
|
-
Titles.getMatchmakerServer = function (title_id) {
|
|
12553
|
-
return Requests.processRoute(TitlesRoute.routes.getMatchmakerServer, {}, { title_id: title_id })
|
|
12596
|
+
Titles.getMatchmakerServer = function (title_id, params) {
|
|
12597
|
+
return Requests.processRoute(TitlesRoute.routes.getMatchmakerServer, {}, { title_id: title_id }, params // ← passes as ?sessionId=xxx via Requests.get()
|
|
12598
|
+
);
|
|
12599
|
+
};
|
|
12600
|
+
/**
|
|
12601
|
+
* Send a session heartbeat to keep the dedicated instance claimed.
|
|
12602
|
+
* Called every 30s during active gameplay.
|
|
12603
|
+
*/
|
|
12604
|
+
Titles.matchmakerSessionHeartbeat = function (title_id, data) {
|
|
12605
|
+
return Requests.processRoute(TitlesRoute.routes.matchmakerSessionHeartbeat, data, { title_id: title_id });
|
|
12606
|
+
};
|
|
12607
|
+
/**
|
|
12608
|
+
* Release the session (starts reclaim countdown).
|
|
12609
|
+
* Called on beforeunload or explicit navigation away.
|
|
12610
|
+
*/
|
|
12611
|
+
Titles.matchmakerSessionRelease = function (title_id, data) {
|
|
12612
|
+
return Requests.processRoute(TitlesRoute.routes.matchmakerSessionRelease, data, { title_id: title_id });
|
|
12554
12613
|
};
|
|
12555
12614
|
/**
|
|
12556
12615
|
* Initiates a resumable S3 multipart upload for large files.
|
|
@@ -12570,6 +12629,54 @@ var Titles = /** @class */ (function () {
|
|
|
12570
12629
|
Titles.completeMultipartUpload = function (title_id, data) {
|
|
12571
12630
|
return Requests.processRoute(TitlesRoute.routes.completeMultipartUpload, data, { title_id: title_id });
|
|
12572
12631
|
};
|
|
12632
|
+
// --- Developer Definition Methods ---
|
|
12633
|
+
Titles.listProgressionStats = function (title_id) {
|
|
12634
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsList, undefined, { title_id: title_id });
|
|
12635
|
+
};
|
|
12636
|
+
Titles.createProgressionStat = function (title_id, data) {
|
|
12637
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsStore, data, { title_id: title_id });
|
|
12638
|
+
};
|
|
12639
|
+
Titles.deleteProgressionStat = function (title_id, id) {
|
|
12640
|
+
return Requests.processRoute(TitlesRoute.routes.progressionStatsDelete, undefined, { title_id: title_id, id: id });
|
|
12641
|
+
};
|
|
12642
|
+
Titles.listProgressionAchievements = function (title_id) {
|
|
12643
|
+
return Requests.processRoute(TitlesRoute.routes.progressionAchievementsList, undefined, { title_id: title_id });
|
|
12644
|
+
};
|
|
12645
|
+
Titles.createProgressionAchievement = function (title_id, data) {
|
|
12646
|
+
return Requests.processRoute(TitlesRoute.routes.progressionAchievementsStore, data, { title_id: title_id });
|
|
12647
|
+
};
|
|
12648
|
+
Titles.listProgressionLeaderboards = function (title_id) {
|
|
12649
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardsList, undefined, { title_id: title_id });
|
|
12650
|
+
};
|
|
12651
|
+
Titles.createProgressionLeaderboard = function (title_id, data) {
|
|
12652
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardsStore, data, { title_id: title_id });
|
|
12653
|
+
};
|
|
12654
|
+
Titles.listProgressionSeasons = function (title_id) {
|
|
12655
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSeasonsList, undefined, { title_id: title_id });
|
|
12656
|
+
};
|
|
12657
|
+
Titles.createProgressionSeason = function (title_id, data) {
|
|
12658
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSeasonsStore, data, { title_id: title_id });
|
|
12659
|
+
};
|
|
12660
|
+
/**
|
|
12661
|
+
* Submit a gameplay run. Updates stats and scores using the install_id for privacy.
|
|
12662
|
+
* @param data { idempotency_key: string, payload: { stats: {}, scores: {} } }
|
|
12663
|
+
*/
|
|
12664
|
+
Titles.submitProgressionRun = function (title_id, install_id, data) {
|
|
12665
|
+
return Requests.processRoute(TitlesRoute.routes.progressionSubmit, data, { title_id: title_id, install_id: install_id });
|
|
12666
|
+
};
|
|
12667
|
+
Titles.getProgressionPlayerStats = function (title_id, install_id) {
|
|
12668
|
+
return Requests.processRoute(TitlesRoute.routes.progressionPlayerStats, undefined, { title_id: title_id, install_id: install_id });
|
|
12669
|
+
};
|
|
12670
|
+
Titles.getProgressionPlayerAchievements = function (title_id, install_id) {
|
|
12671
|
+
return Requests.processRoute(TitlesRoute.routes.progressionPlayerAchievements, undefined, { title_id: title_id, install_id: install_id });
|
|
12672
|
+
};
|
|
12673
|
+
/**
|
|
12674
|
+
* View leaderboard rankings.
|
|
12675
|
+
* @param params Optional filters like { around_me: true, install_id: 'uuid', season_id: 'uuid' }
|
|
12676
|
+
*/
|
|
12677
|
+
Titles.getProgressionLeaderboard = function (title_id, api_key, params) {
|
|
12678
|
+
return Requests.processRoute(TitlesRoute.routes.progressionLeaderboardView, undefined, { title_id: title_id, api_key: api_key }, params);
|
|
12679
|
+
};
|
|
12573
12680
|
return Titles;
|
|
12574
12681
|
}());
|
|
12575
12682
|
|