glitch-javascript-sdk 2.7.7 → 2.7.8
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 +27 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Games.d.ts +50 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +50 -0
- package/package.json +1 -1
- package/src/api/Games.ts +77 -11
- package/src/routes/GamesRoutes.ts +1 -1
package/dist/esm/api/Games.d.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import Response from "../util/Response";
|
|
2
2
|
import { AxiosPromise } from "axios";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for the Release Stats response to help developers
|
|
5
|
+
* understand the data structure returned by the optimizer.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReleaseStatEntry {
|
|
8
|
+
date: string;
|
|
9
|
+
count: number;
|
|
10
|
+
intensity: 'low' | 'medium' | 'high' | 'extreme';
|
|
11
|
+
is_danger_zone: boolean;
|
|
12
|
+
recommendation: string;
|
|
13
|
+
events: Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
type: 'nextfest' | 'sale';
|
|
16
|
+
start: string;
|
|
17
|
+
end: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface ReleaseStatsResponse {
|
|
21
|
+
data: ReleaseStatEntry[];
|
|
22
|
+
meta: {
|
|
23
|
+
user_status: 'authenticated' | 'guest';
|
|
24
|
+
lookahead_days: number;
|
|
25
|
+
start_date: string;
|
|
26
|
+
end_date: string;
|
|
27
|
+
global_events: any[];
|
|
28
|
+
};
|
|
29
|
+
}
|
|
3
30
|
declare class Games {
|
|
4
31
|
/**
|
|
5
32
|
* Get a list of Games available on he platform.
|
|
@@ -47,5 +74,28 @@ declare class Games {
|
|
|
47
74
|
* @returns promise
|
|
48
75
|
*/
|
|
49
76
|
static createGameScheduler<T>(game_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
77
|
+
/**
|
|
78
|
+
* Get release competition statistics and Steam danger zones.
|
|
79
|
+
*
|
|
80
|
+
* This tool analyzes the 'ExternalGames' database to show how many other games
|
|
81
|
+
* are releasing around a specific date. It also overlays hard-coded Steam events
|
|
82
|
+
* like NextFest and Seasonal Sales.
|
|
83
|
+
*
|
|
84
|
+
* @see https://api.glitch.fun/api/documentation#/ExternalGames/getReleaseStats
|
|
85
|
+
*
|
|
86
|
+
* @param params Filtering options:
|
|
87
|
+
* - precision: 'day' | 'month' | 'year' (Default: 'day'). Use 'month' for long-term planning.
|
|
88
|
+
* - start_date: 'YYYY-MM-DD'. The date to begin the analysis from.
|
|
89
|
+
*
|
|
90
|
+
* @returns AxiosPromise<Response<ReleaseStatsResponse>>
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* Games.getReleaseStats({ precision: 'day', start_date: '2025-06-01' })
|
|
94
|
+
* .then(res => console.log(res.data.data));
|
|
95
|
+
*/
|
|
96
|
+
static getReleaseStats<T = ReleaseStatsResponse>(params?: {
|
|
97
|
+
precision?: 'day' | 'month' | 'year';
|
|
98
|
+
start_date?: string;
|
|
99
|
+
}): AxiosPromise<Response<T>>;
|
|
50
100
|
}
|
|
51
101
|
export default Games;
|
package/dist/esm/index.js
CHANGED
|
@@ -13755,6 +13755,7 @@ var GamesRoutes = /** @class */ (function () {
|
|
|
13755
13755
|
createCampaignWithTitle: { url: '/games/{game_id}/generateCampaignWithTitle', method: HTTP_METHODS.POST },
|
|
13756
13756
|
createGameTitle: { url: '/games/{game_id}/generateTitle', method: HTTP_METHODS.POST },
|
|
13757
13757
|
createGameScheduler: { url: '/games/{game_id}/generateScheduler', method: HTTP_METHODS.POST },
|
|
13758
|
+
releaseStats: { url: '/games/release-stats', method: HTTP_METHODS.GET },
|
|
13758
13759
|
};
|
|
13759
13760
|
return GamesRoutes;
|
|
13760
13761
|
}());
|
|
@@ -13820,6 +13821,32 @@ var Games = /** @class */ (function () {
|
|
|
13820
13821
|
Games.createGameScheduler = function (game_id, data, params) {
|
|
13821
13822
|
return Requests.processRoute(GamesRoutes.routes.createGameScheduler, data, { game_id: game_id }, params);
|
|
13822
13823
|
};
|
|
13824
|
+
/**
|
|
13825
|
+
* Get release competition statistics and Steam danger zones.
|
|
13826
|
+
*
|
|
13827
|
+
* This tool analyzes the 'ExternalGames' database to show how many other games
|
|
13828
|
+
* are releasing around a specific date. It also overlays hard-coded Steam events
|
|
13829
|
+
* like NextFest and Seasonal Sales.
|
|
13830
|
+
*
|
|
13831
|
+
* @see https://api.glitch.fun/api/documentation#/ExternalGames/getReleaseStats
|
|
13832
|
+
*
|
|
13833
|
+
* @param params Filtering options:
|
|
13834
|
+
* - precision: 'day' | 'month' | 'year' (Default: 'day'). Use 'month' for long-term planning.
|
|
13835
|
+
* - start_date: 'YYYY-MM-DD'. The date to begin the analysis from.
|
|
13836
|
+
*
|
|
13837
|
+
* @returns AxiosPromise<Response<ReleaseStatsResponse>>
|
|
13838
|
+
*
|
|
13839
|
+
* @example
|
|
13840
|
+
* Games.getReleaseStats({ precision: 'day', start_date: '2025-06-01' })
|
|
13841
|
+
* .then(res => console.log(res.data.data));
|
|
13842
|
+
*/
|
|
13843
|
+
Games.getReleaseStats = function (params) {
|
|
13844
|
+
// Defensive check: ensure precision is valid if provided
|
|
13845
|
+
if ((params === null || params === void 0 ? void 0 : params.precision) && !['day', 'month', 'year'].includes(params.precision)) {
|
|
13846
|
+
console.warn("Invalid precision '".concat(params.precision, "' passed to getReleaseStats. Defaulting to 'day'."));
|
|
13847
|
+
}
|
|
13848
|
+
return Requests.processRoute(GamesRoutes.routes.releaseStats, undefined, undefined, params);
|
|
13849
|
+
};
|
|
13823
13850
|
return Games;
|
|
13824
13851
|
}());
|
|
13825
13852
|
|