glitch-javascript-sdk 2.7.7 → 2.8.0

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.
@@ -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;
@@ -81,5 +81,11 @@ declare class Subscriptions {
81
81
  * @param data { priceId, paymentMethod, custom_name, limits: { posts, enrichments, invites, ads }, metered_prices: [] }
82
82
  */
83
83
  static createCustomCommunitySubscription<T>(community_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
84
+ /**
85
+ * Purchase a permanent license or rent a game title.
86
+ * If a rental was active in the last 7 days, the fee is automatically deducted from the premium price.
87
+ * @param data { purchase_type: 'premium' | 'rental', payment_method_id: string }
88
+ */
89
+ static purchaseLicense<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
84
90
  }
85
91
  export default Subscriptions;
@@ -475,5 +475,31 @@ declare class Titles {
475
475
  * Delete a saved behavioral funnel definition.
476
476
  */
477
477
  static deleteBehavioralFunnel<T>(title_id: string, funnel_id: string): AxiosPromise<Response<T>>;
478
+ /**
479
+ * Generates a presigned S3 URL for uploading a game build ZIP.
480
+ */
481
+ static getDeploymentUploadUrl<T>(title_id: string): AxiosPromise<Response<T>>;
482
+ /**
483
+ * Confirms the upload and starts the automated deployment/extraction process.
484
+ * @param data { file_path: string, version_string: string, entry_point?: string }
485
+ */
486
+ static confirmDeployment<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
487
+ /**
488
+ * Initializes a play session. Handles age-gating and license verification.
489
+ * Returns the CDN URL for WASM/iFrame or Signaling URL for Pixel Streaming.
490
+ */
491
+ static getPlaySession<T>(title_id: string): AxiosPromise<Response<T>>;
492
+ /**
493
+ * List all developer payouts for a title.
494
+ */
495
+ static listDeveloperPayouts<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
496
+ /**
497
+ * View a specific payout record.
498
+ */
499
+ static viewDeveloperPayout<T>(title_id: string, payout_id: string): AxiosPromise<Response<T>>;
500
+ /**
501
+ * Get the total earnings and playtime summary for a title.
502
+ */
503
+ static getDeveloperPayoutSummary<T>(title_id: string): AxiosPromise<Response<T>>;
478
504
  }
479
505
  export default Titles;
package/dist/esm/index.js CHANGED
@@ -11693,6 +11693,14 @@ var TitlesRoute = /** @class */ (function () {
11693
11693
  createBehavioralFunnel: { url: '/titles/{title_id}/behavioral-funnels', method: HTTP_METHODS.POST },
11694
11694
  behavioralFunnelReport: { url: '/titles/{title_id}/behavioral-funnels/{funnel_id}/report', method: HTTP_METHODS.GET },
11695
11695
  deleteBehavioralFunnel: { url: '/titles/{title_id}/behavioral-funnels/{funnel_id}', method: HTTP_METHODS.DELETE },
11696
+ // Aegis Deployment
11697
+ getDeploymentUploadUrl: { url: '/titles/{title_id}/deployments/presigned-url', method: HTTP_METHODS.POST },
11698
+ confirmDeployment: { url: '/titles/{title_id}/deployments/confirm', method: HTTP_METHODS.POST },
11699
+ getPlaySession: { url: '/titles/{title_id}/play', method: HTTP_METHODS.GET },
11700
+ // Aegis Payouts
11701
+ listDeveloperPayouts: { url: '/titles/{title_id}/payouts', method: HTTP_METHODS.GET },
11702
+ viewDeveloperPayout: { url: '/titles/{title_id}/payouts/{payout_id}', method: HTTP_METHODS.GET },
11703
+ developerPayoutSummary: { url: '/titles/{title_id}/payouts/summary', method: HTTP_METHODS.GET },
11696
11704
  };
11697
11705
  return TitlesRoute;
11698
11706
  }());
@@ -12312,6 +12320,44 @@ var Titles = /** @class */ (function () {
12312
12320
  Titles.deleteBehavioralFunnel = function (title_id, funnel_id) {
12313
12321
  return Requests.processRoute(TitlesRoute.routes.deleteBehavioralFunnel, {}, { title_id: title_id, funnel_id: funnel_id });
12314
12322
  };
12323
+ /**
12324
+ * Generates a presigned S3 URL for uploading a game build ZIP.
12325
+ */
12326
+ Titles.getDeploymentUploadUrl = function (title_id) {
12327
+ return Requests.processRoute(TitlesRoute.routes.getDeploymentUploadUrl, {}, { title_id: title_id });
12328
+ };
12329
+ /**
12330
+ * Confirms the upload and starts the automated deployment/extraction process.
12331
+ * @param data { file_path: string, version_string: string, entry_point?: string }
12332
+ */
12333
+ Titles.confirmDeployment = function (title_id, data) {
12334
+ return Requests.processRoute(TitlesRoute.routes.confirmDeployment, data, { title_id: title_id });
12335
+ };
12336
+ /**
12337
+ * Initializes a play session. Handles age-gating and license verification.
12338
+ * Returns the CDN URL for WASM/iFrame or Signaling URL for Pixel Streaming.
12339
+ */
12340
+ Titles.getPlaySession = function (title_id) {
12341
+ return Requests.processRoute(TitlesRoute.routes.getPlaySession, {}, { title_id: title_id });
12342
+ };
12343
+ /**
12344
+ * List all developer payouts for a title.
12345
+ */
12346
+ Titles.listDeveloperPayouts = function (title_id, params) {
12347
+ return Requests.processRoute(TitlesRoute.routes.listDeveloperPayouts, undefined, { title_id: title_id }, params);
12348
+ };
12349
+ /**
12350
+ * View a specific payout record.
12351
+ */
12352
+ Titles.viewDeveloperPayout = function (title_id, payout_id) {
12353
+ return Requests.processRoute(TitlesRoute.routes.viewDeveloperPayout, {}, { title_id: title_id, payout_id: payout_id });
12354
+ };
12355
+ /**
12356
+ * Get the total earnings and playtime summary for a title.
12357
+ */
12358
+ Titles.getDeveloperPayoutSummary = function (title_id) {
12359
+ return Requests.processRoute(TitlesRoute.routes.developerPayoutSummary, {}, { title_id: title_id });
12360
+ };
12315
12361
  return Titles;
12316
12362
  }());
12317
12363
 
@@ -13355,6 +13401,7 @@ var SubscriptionsRoute = /** @class */ (function () {
13355
13401
  url: '/subscriptions/communities/custom/{community_id}',
13356
13402
  method: HTTP_METHODS.POST
13357
13403
  },
13404
+ purchaseLicense: { url: '/titles/{title_id}/purchase', method: HTTP_METHODS.POST },
13358
13405
  };
13359
13406
  return SubscriptionsRoute;
13360
13407
  }());
@@ -13462,6 +13509,14 @@ var Subscriptions = /** @class */ (function () {
13462
13509
  Subscriptions.createCustomCommunitySubscription = function (community_id, data, params) {
13463
13510
  return Requests.processRoute(SubscriptionsRoute.routes.createCustomCommunitySubscription, data, { community_id: community_id }, params);
13464
13511
  };
13512
+ /**
13513
+ * Purchase a permanent license or rent a game title.
13514
+ * If a rental was active in the last 7 days, the fee is automatically deducted from the premium price.
13515
+ * @param data { purchase_type: 'premium' | 'rental', payment_method_id: string }
13516
+ */
13517
+ Subscriptions.purchaseLicense = function (title_id, data) {
13518
+ return Requests.processRoute(SubscriptionsRoute.routes.purchaseLicense, data, { title_id: title_id });
13519
+ };
13465
13520
  return Subscriptions;
13466
13521
  }());
13467
13522
 
@@ -13755,6 +13810,7 @@ var GamesRoutes = /** @class */ (function () {
13755
13810
  createCampaignWithTitle: { url: '/games/{game_id}/generateCampaignWithTitle', method: HTTP_METHODS.POST },
13756
13811
  createGameTitle: { url: '/games/{game_id}/generateTitle', method: HTTP_METHODS.POST },
13757
13812
  createGameScheduler: { url: '/games/{game_id}/generateScheduler', method: HTTP_METHODS.POST },
13813
+ releaseStats: { url: '/games/release-stats', method: HTTP_METHODS.GET },
13758
13814
  };
13759
13815
  return GamesRoutes;
13760
13816
  }());
@@ -13820,6 +13876,32 @@ var Games = /** @class */ (function () {
13820
13876
  Games.createGameScheduler = function (game_id, data, params) {
13821
13877
  return Requests.processRoute(GamesRoutes.routes.createGameScheduler, data, { game_id: game_id }, params);
13822
13878
  };
13879
+ /**
13880
+ * Get release competition statistics and Steam danger zones.
13881
+ *
13882
+ * This tool analyzes the 'ExternalGames' database to show how many other games
13883
+ * are releasing around a specific date. It also overlays hard-coded Steam events
13884
+ * like NextFest and Seasonal Sales.
13885
+ *
13886
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getReleaseStats
13887
+ *
13888
+ * @param params Filtering options:
13889
+ * - precision: 'day' | 'month' | 'year' (Default: 'day'). Use 'month' for long-term planning.
13890
+ * - start_date: 'YYYY-MM-DD'. The date to begin the analysis from.
13891
+ *
13892
+ * @returns AxiosPromise<Response<ReleaseStatsResponse>>
13893
+ *
13894
+ * @example
13895
+ * Games.getReleaseStats({ precision: 'day', start_date: '2025-06-01' })
13896
+ * .then(res => console.log(res.data.data));
13897
+ */
13898
+ Games.getReleaseStats = function (params) {
13899
+ // Defensive check: ensure precision is valid if provided
13900
+ if ((params === null || params === void 0 ? void 0 : params.precision) && !['day', 'month', 'year'].includes(params.precision)) {
13901
+ console.warn("Invalid precision '".concat(params.precision, "' passed to getReleaseStats. Defaulting to 'day'."));
13902
+ }
13903
+ return Requests.processRoute(GamesRoutes.routes.releaseStats, undefined, undefined, params);
13904
+ };
13823
13905
  return Games;
13824
13906
  }());
13825
13907