glitch-javascript-sdk 4.1.0 → 4.2.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.
package/src/api/Titles.ts CHANGED
@@ -3,6 +3,44 @@ import Requests from "../util/Requests";
3
3
  import Response from "../util/Response";
4
4
  import { AxiosPromise } from "axios";
5
5
 
6
+ export type AegisLicenseType = 'premium' | 'rental' | 'subscription' | 'sponsored' | 'admin' | 'trial' | 'free' | 'demo' | 'playtest' | 'none';
7
+ export interface AegisLicenseDetail {
8
+ id: string | null;
9
+ type: AegisLicenseType;
10
+ source: string | null;
11
+ status: string;
12
+ acquired_at: string | null;
13
+ purchased_at: string | null;
14
+ expires_at: string | null;
15
+ is_permanent: boolean;
16
+ price_paid: { amount: string; currency: string } | null;
17
+ }
18
+ export interface AegisInstallValidation {
19
+ valid: boolean;
20
+ reason?: string;
21
+ code?: string;
22
+ user_id?: string | null;
23
+ user_name?: string;
24
+ /** Kept for backward compatibility; inspect license.type for the exact category. */
25
+ license_type?: string;
26
+ license?: AegisLicenseDetail;
27
+ access?: { premium_purchase_required: boolean; subscription_alone_sufficient: boolean };
28
+ build_type?: 'production' | 'demo' | 'playtest';
29
+ has_full_access?: boolean;
30
+ non_revenue_build?: boolean;
31
+ trial_time_remaining?: number | null;
32
+ rental_time_remaining?: number | null;
33
+ server_time?: string;
34
+ }
35
+ export interface GameMonetizationSettings {
36
+ is_premium: boolean;
37
+ premium_price: string | number | null;
38
+ is_rental: boolean;
39
+ rental_price: string | number | null;
40
+ rental_duration_hours: number;
41
+ is_subscription_eligible: boolean;
42
+ premium_purchase_required_for_full_game: boolean;
43
+ }
6
44
  export type GameReviewRecommendation = 'recommended' | 'not_recommended' | 'neutral';
7
45
  export type GameReviewSentiment = 'positive' | 'mixed' | 'negative';
8
46
  export type GameReviewVoteType = 'helpful' | 'funny' | 'detailed' | 'not_helpful';
@@ -83,9 +121,9 @@ class Titles {
83
121
 
84
122
  /**
85
123
  * List all the Titles.
86
- *
124
+ *
87
125
  * @see https://api.glitch.fun/api/documentation#/Titles/edab2e3b061347b06c82258622d239e2
88
- *
126
+ *
89
127
  * @returns promise
90
128
  */
91
129
  public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -94,11 +132,11 @@ class Titles {
94
132
 
95
133
  /**
96
134
  * Create a new title.
97
- *
135
+ *
98
136
  * @see https://api.glitch.fun/api/documentation#/Titles/storeTitle
99
- *
137
+ *
100
138
  * @param data The data to be passed when creating a title.
101
- *
139
+ *
102
140
  * @returns Promise
103
141
  */
104
142
  public static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -108,12 +146,12 @@ class Titles {
108
146
 
109
147
  /**
110
148
  * Update a title.
111
- *
149
+ *
112
150
  * @see https://api.glitch.fun/api/documentation#/Titles/updateTitle
113
- *
151
+ *
114
152
  * @param title_id The id of the title to update.
115
153
  * @param data The data to update.
116
- *
154
+ *
117
155
  * @returns promise
118
156
  */
119
157
  public static update<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -121,13 +159,29 @@ class Titles {
121
159
  return Requests.processRoute(TitlesRoute.routes.update, data, { title_id: title_id }, params);
122
160
  }
123
161
 
162
+ /** View public title monetization settings. For mutation use authenticated title admin. */
163
+ public static getGameMonetization<T = GameMonetizationSettings>(title_id: string): AxiosPromise<Response<T>> {
164
+ return Titles.view<T>(title_id);
165
+ }
166
+
167
+ /**
168
+ * Update publisher monetization including premium_purchase_required_for_full_game.
169
+ * Requires a title administrator JWT; backend validates premium/subscription/rental compatibility.
170
+ */
171
+ public static updateGameMonetization<T = GameMonetizationSettings>(
172
+ title_id: string,
173
+ settings: Partial<GameMonetizationSettings>
174
+ ): AxiosPromise<Response<T>> {
175
+ return Titles.update<T>(title_id, settings);
176
+ }
177
+
124
178
  /**
125
179
  * Retrieve the information for a single title.
126
- *
180
+ *
127
181
  * @see https://api.glitch.fun/api/documentation#/Titles/getTitleByUUID
128
- *
182
+ *
129
183
  * @param title_id The id fo the title to retrieve.
130
- *
184
+ *
131
185
  * @returns promise
132
186
  */
133
187
  public static view<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -137,9 +191,9 @@ class Titles {
137
191
 
138
192
  /**
139
193
  * Deletes a title.
140
- *
194
+ *
141
195
  * @see https://api.glitch.fun/api/documentation#/Titles/deleteTitle
142
- *
196
+ *
143
197
  * @param title_id The id of the title to delete.
144
198
  * @returns promise
145
199
  */
@@ -150,11 +204,11 @@ class Titles {
150
204
 
151
205
  /**
152
206
  * Approve a title
153
- *
207
+ *
154
208
  * @see https://api.glitch.fun/api/documentation#/Titles/approveTitle
155
- *
209
+ *
156
210
  * @param data The data to be passed when creating a title.
157
- *
211
+ *
158
212
  * @returns Promise
159
213
  */
160
214
  public static approve<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -164,11 +218,11 @@ class Titles {
164
218
 
165
219
  /**
166
220
  * Reject a title
167
- *
221
+ *
168
222
  * @see https://api.glitch.fun/api/documentation#/Titles/rejectTitle
169
- *
223
+ *
170
224
  * @param data The data to be passed when creating a title.
171
- *
225
+ *
172
226
  * @returns Promise
173
227
  */
174
228
  public static reject<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -178,11 +232,11 @@ class Titles {
178
232
 
179
233
  /**
180
234
  * Add a user as an administrator to a title
181
- *
235
+ *
182
236
  * @see https://api.glitch.fun/api/documentation#/Titles/addTitleAdministrator
183
- *
237
+ *
184
238
  * @param data The data to be passed when creating a title.
185
- *
239
+ *
186
240
  * @returns Promise
187
241
  */
188
242
  public static addAdministrator<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -192,11 +246,11 @@ class Titles {
192
246
 
193
247
  /**
194
248
  * Remove a user as an administrator toa tile
195
- *
249
+ *
196
250
  * @see https://api.glitch.fun/api/documentation#/Titles/removeTitleAdministrator
197
- *
251
+ *
198
252
  * @param data The data to be passed when creating a title.
199
- *
253
+ *
200
254
  * @returns Promise
201
255
  */
202
256
  public static removeAdministrator<T>(title_id: string, user_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -206,12 +260,12 @@ class Titles {
206
260
 
207
261
  /**
208
262
  * Updates the main image for the title using a File object.
209
- *
263
+ *
210
264
  * @see https://api.glitch.fun/api/documentation#/Titles/uploadTitleMainImage
211
- *
265
+ *
212
266
  * @param file The file object to upload.
213
267
  * @param data Any additional data to pass along to the upload.
214
- *
268
+ *
215
269
  * @returns promise
216
270
  */
217
271
  public static uploadMainImageFile<T>(title_id: string, file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -223,12 +277,12 @@ class Titles {
223
277
 
224
278
  /**
225
279
  * Updates the main image for the title using a Blob.
226
- *
280
+ *
227
281
  * @see https://api.glitch.fun/api/documentation#/Titles/uploadTitleMainImage
228
- *
282
+ *
229
283
  * @param blob The blob to upload.
230
284
  * @param data Any additional data to pass along to the upload
231
- *
285
+ *
232
286
  * @returns promise
233
287
  */
234
288
  public static uploadMainImageBlob<T>(title_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -240,12 +294,12 @@ class Titles {
240
294
 
241
295
  /**
242
296
  * Updates the banner image for the title using a File object.
243
- *
297
+ *
244
298
  * @see https://api.glitch.fun/api/documentation#/Titles/uploadTitleBannerImage
245
- *
299
+ *
246
300
  * @param file The file object to upload.
247
301
  * @param data Any additional data to pass along to the upload.
248
- *
302
+ *
249
303
  * @returns promise
250
304
  */
251
305
  public static uploadBannerImageFile<T>(title_id: string, file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -257,12 +311,12 @@ class Titles {
257
311
 
258
312
  /**
259
313
  * Updates the banner image for the title using a Blob.
260
- *
314
+ *
261
315
  * @see https://api.glitch.fun/api/documentation#/Titles/uploadTitleBannerImage
262
- *
316
+ *
263
317
  * @param blob The blob to upload.
264
318
  * @param data Any additional data to pass along to the upload
265
- *
319
+ *
266
320
  * @returns promise
267
321
  */
268
322
  public static uploadBannerImageBlob<T>(title_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -307,7 +361,7 @@ class Titles {
307
361
 
308
362
  /**
309
363
  * Upload a CSV/Excel file containing wishlist data for a title.
310
- *
364
+ *
311
365
  * @param title_id The UUID of the title
312
366
  * @param file The CSV or Excel file
313
367
  * @param data Any additional form data, e.g. platform
@@ -325,7 +379,7 @@ class Titles {
325
379
 
326
380
  /**
327
381
  * Retrieve the wishlist data for a specific title.
328
- *
382
+ *
329
383
  * @param title_id The UUID of the title
330
384
  * @param params Optional query params, e.g. { platform: 'steam', start_date: '2025-01-01', end_date: '2025-01-31'}
331
385
  * @returns AxiosPromise
@@ -382,9 +436,9 @@ class Titles {
382
436
 
383
437
  /**
384
438
  * Search for Titles using Meilisearch or fallback based on the query and filters.
385
- *
439
+ *
386
440
  * @see https://api.glitch.fun/api/documentation#/Titles/searchTitles
387
- *
441
+ *
388
442
  * @param params Object of query params:
389
443
  * - q?: string, filters?: string,
390
444
  * - sort_by?: string, sort_order?: 'asc'|'desc',
@@ -499,7 +553,7 @@ class Titles {
499
553
 
500
554
  /**
501
555
  * Upload a CSV/Excel file containing daily UTM analytics for a specific title.
502
- *
556
+ *
503
557
  * @param title_id The UUID of the title
504
558
  * @param file The CSV or Excel file
505
559
  * @param data Optional form fields (if needed)
@@ -518,9 +572,9 @@ class Titles {
518
572
 
519
573
  /**
520
574
  * Retrieve the UTM analytics data for a title (paginated, filterable, sortable).
521
- *
575
+ *
522
576
  * GET /titles/{title_id}/utm
523
- *
577
+ *
524
578
  * @param title_id The UUID of the title
525
579
  * @param params Optional query params: start_date, end_date, source, device_type, sort_by, etc.
526
580
  * @returns AxiosPromise
@@ -539,11 +593,11 @@ class Titles {
539
593
 
540
594
  /**
541
595
  * Get the web tracking token used for websites.
542
- *
596
+ *
543
597
  * GET /titles/{title_id}/webTrackingToken
544
- *
598
+ *
545
599
  * @param title_id The UUID of the title
546
- * @param params Optional query params:
600
+ * @param params Optional query params:
547
601
  * @returns AxiosPromise
548
602
  */
549
603
  public static getWebTrackingToken<T>(
@@ -560,9 +614,9 @@ class Titles {
560
614
 
561
615
  /**
562
616
  * Analyze UTM data with optional group_by (source, campaign, medium, device_type, etc.)
563
- *
617
+ *
564
618
  * GET /titles/{title_id}/utm/analysis
565
- *
619
+ *
566
620
  * @param title_id The UUID of the title
567
621
  * @param params e.g. ?group_by=source&start_date=YYYY-MM-DD
568
622
  * @returns AxiosPromise
@@ -640,9 +694,9 @@ class Titles {
640
694
  );
641
695
  }
642
696
 
643
- /**
644
- * List all purchase events for a specific title.
645
- * Matches GET /titles/{title_id}/purchases
697
+ /**
698
+ * List all purchase events for a specific title.
699
+ * Matches GET /titles/{title_id}/purchases
646
700
  */
647
701
  public static listPurchases<T>(
648
702
  title_id: string,
@@ -656,9 +710,9 @@ class Titles {
656
710
  );
657
711
  }
658
712
 
659
- /**
660
- * Retrieve a single purchase record by ID.
661
- * Matches GET /titles/{title_id}/purchases/{purchase_id}
713
+ /**
714
+ * Retrieve a single purchase record by ID.
715
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
662
716
  */
663
717
  public static viewPurchase<T>(
664
718
  title_id: string,
@@ -673,9 +727,9 @@ class Titles {
673
727
  );
674
728
  }
675
729
 
676
- /**
677
- * Create a new purchase record.
678
- * Matches POST /titles/{title_id}/purchases
730
+ /**
731
+ * Create a new purchase record.
732
+ * Matches POST /titles/{title_id}/purchases
679
733
  */
680
734
  public static createPurchase<T>(
681
735
  title_id: string,
@@ -690,9 +744,9 @@ class Titles {
690
744
  );
691
745
  }
692
746
 
693
- /**
694
- * Get a summary of total revenue, grouped by day or purchase_type.
695
- * Matches GET /titles/{title_id}/purchases/summary
747
+ /**
748
+ * Get a summary of total revenue, grouped by day or purchase_type.
749
+ * Matches GET /titles/{title_id}/purchases/summary
696
750
  */
697
751
  public static purchaseSummary<T>(
698
752
  title_id: string,
@@ -706,9 +760,9 @@ class Titles {
706
760
  );
707
761
  }
708
762
 
709
- /**
710
- * Revenue by time (daily, weekly, or monthly).
711
- * Matches GET /titles/{title_id}/purchases/reports/time
763
+ /**
764
+ * Revenue by time (daily, weekly, or monthly).
765
+ * Matches GET /titles/{title_id}/purchases/reports/time
712
766
  */
713
767
  public static purchaseRevenueByTime<T>(
714
768
  title_id: string,
@@ -722,9 +776,9 @@ class Titles {
722
776
  );
723
777
  }
724
778
 
725
- /**
726
- * 30-day LTV (Lifetime Value) per install.
727
- * Matches GET /titles/{title_id}/purchases/reports/ltv30
779
+ /**
780
+ * 30-day LTV (Lifetime Value) per install.
781
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
728
782
  */
729
783
  public static purchaseLtv30<T>(
730
784
  title_id: string,
@@ -738,9 +792,9 @@ class Titles {
738
792
  );
739
793
  }
740
794
 
741
- /**
742
- * Show breakdown of revenue per currency, with optional USD conversion.
743
- * Matches GET /titles/{title_id}/purchases/reports/currency
795
+ /**
796
+ * Show breakdown of revenue per currency, with optional USD conversion.
797
+ * Matches GET /titles/{title_id}/purchases/reports/currency
744
798
  */
745
799
  public static purchaseCurrencyBreakdown<T>(
746
800
  title_id: string,
@@ -754,9 +808,9 @@ class Titles {
754
808
  );
755
809
  }
756
810
 
757
- /**
758
- * Distribution of installs by total revenue, plus a histogram array.
759
- * Matches GET /titles/{title_id}/purchases/reports/install-distribution
811
+ /**
812
+ * Distribution of installs by total revenue, plus a histogram array.
813
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
760
814
  */
761
815
  public static installRevenueDistribution<T>(
762
816
  title_id: string,
@@ -770,9 +824,9 @@ class Titles {
770
824
  );
771
825
  }
772
826
 
773
- /**
774
- * Stats by item SKU, purchase type, and repeat purchase analysis.
775
- * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
827
+ /**
828
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
829
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
776
830
  */
777
831
  public static itemAndPurchaseTypeStats<T>(
778
832
  title_id: string,
@@ -811,13 +865,13 @@ class Titles {
811
865
 
812
866
  /**
813
867
  * Update administrator email preferences for a title.
814
- *
868
+ *
815
869
  * @see https://api.glitch.fun/api/documentation#/Titles/updateTitleAdministrator
816
- *
870
+ *
817
871
  * @param title_id The id of the title.
818
872
  * @param user_id The id of the user/administrator.
819
873
  * @param data The preference data to update (notify_promotion_schedule_reminder_email, notify_weekly_promotion_performance_email).
820
- *
874
+ *
821
875
  * @returns Promise
822
876
  */
823
877
  public static updateAdministrator<T>(title_id: string, user_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -1071,17 +1125,21 @@ class Titles {
1071
1125
 
1072
1126
  /**
1073
1127
  * The Aegis Handshake: Verify if a player is allowed to play.
1074
- *
1075
- * This is used by the game engine (Unity/Unreal) to confirm that the
1128
+ *
1129
+ * This is used by the game engine (Unity/Unreal) to confirm that the
1076
1130
  * current session is valid and the user has a proper license.
1077
- *
1131
+ *
1078
1132
  * @see https://api.glitch.fun/api/documentation#/Aegis%20Security/validateGameSession
1079
- *
1133
+ *
1080
1134
  * @param title_id The UUID of the game title.
1081
1135
  * @param install_id The UUID of the specific install/session.
1082
- * @returns AxiosPromise containing { valid: boolean, user_name: string, license_type: string }
1136
+ * @returns Access result with a backward-compatible license_type and exact license
1137
+ * metadata: type, status, source, acquired_at, purchased_at, expires_at and
1138
+ * verified price_paid (null when no authoritative historical price exists).
1139
+ * Production requests may return PREMIUM_PURCHASE_REQUIRED (403).
1140
+ * The caller must block gameplay when valid is false.
1083
1141
  */
1084
- public static validateInstall<T>(title_id: string, install_id: string): AxiosPromise<Response<T>> {
1142
+ public static validateInstall<T = AegisInstallValidation>(title_id: string, install_id: string): AxiosPromise<Response<T>> {
1085
1143
  return Requests.processRoute(
1086
1144
  TitlesRoute.routes.validateInstall,
1087
1145
  {},
@@ -1121,7 +1179,7 @@ class Titles {
1121
1179
  /**
1122
1180
  * Toggle a game on the current user's wishlist.
1123
1181
  * If the game is not wishlisted, it will be added. If it is, it will be removed.
1124
- *
1182
+ *
1125
1183
  * @param title_id The UUID of the title.
1126
1184
  * @param data Optional context: { fingerprint_id?: string, short_link_click_id?: string }
1127
1185
  */
@@ -1131,7 +1189,7 @@ class Titles {
1131
1189
 
1132
1190
  /**
1133
1191
  * Record a self-assigned excitement score (1-5) for a wishlisted game.
1134
- *
1192
+ *
1135
1193
  * @param title_id The UUID of the title.
1136
1194
  * @param data { score: number } - Must be between 1 and 5.
1137
1195
  */
@@ -1141,7 +1199,7 @@ class Titles {
1141
1199
 
1142
1200
  /**
1143
1201
  * Retrieve the current user's personal wishlist collection.
1144
- *
1202
+ *
1145
1203
  * @param params Optional pagination parameters (?page=1&per_page=25)
1146
1204
  */
1147
1205
  public static myWishlists<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
@@ -1157,7 +1215,7 @@ class Titles {
1157
1215
  * Get Wishlist Intelligence statistics for a title.
1158
1216
  * Includes funnel data and predictive revenue forecasting.
1159
1217
  * Note: Requires Title Administrator permissions.
1160
- *
1218
+ *
1161
1219
  * @param title_id The UUID of the title.
1162
1220
  */
1163
1221
  public static wishlistStats<T>(title_id: string): AxiosPromise<Response<T>> {
@@ -1193,7 +1251,7 @@ class Titles {
1193
1251
  /**
1194
1252
  * Proxies a request through the backend to the matchmaker.
1195
1253
  * This avoids HTTPS -> HTTP mixed content blocks.
1196
- *
1254
+ *
1197
1255
  * @param title_id The UUID of the game title.
1198
1256
  * @returns AxiosPromise containing { signallingServer: string }
1199
1257
  */
@@ -1324,8 +1382,8 @@ class Titles {
1324
1382
 
1325
1383
  /**
1326
1384
  * Get games ranked by community activity (active players).
1327
- *
1328
- * @param params
1385
+ *
1386
+ * @param params
1329
1387
  * - window: number (hours, default 24)
1330
1388
  * - limit: number (default 10)
1331
1389
  * - is_nsfw: 1 for adult titles only, 0 for safe titles only
@@ -1336,8 +1394,8 @@ class Titles {
1336
1394
 
1337
1395
  /**
1338
1396
  * Get games trending on social media.
1339
- *
1340
- * @param params
1397
+ *
1398
+ * @param params
1341
1399
  * - type: 'influencer' (campaigns) or 'organic' (non-paid)
1342
1400
  * - window: number (hours, default 168)
1343
1401
  * - limit: number (default 10)
@@ -1349,8 +1407,8 @@ class Titles {
1349
1407
 
1350
1408
  /**
1351
1409
  * Get a personalized discovery queue of games.
1352
- *
1353
- * @param params
1410
+ *
1411
+ * @param params
1354
1412
  * - limit: number (default 12)
1355
1413
  * - device_id: string (highly recommended for guest tracking)
1356
1414
  * - is_nsfw: 1 for adult titles only, 0 for safe titles only
@@ -1362,9 +1420,9 @@ class Titles {
1362
1420
  /**
1363
1421
  * Get a curated, playable feed for the Swipe interface.
1364
1422
  * This route ensures games have builds and images, and supports seeded randomization.
1365
- *
1423
+ *
1366
1424
  * @see https://api.glitch.fun/api/documentation#/Discovery/getSwipeFeed
1367
- *
1425
+ *
1368
1426
  * @param params Object of query params:
1369
1427
  * - seed?: number (For consistent randomization)
1370
1428
  * - genres?: string[] (Filter by genre names)
@@ -1381,7 +1439,7 @@ class Titles {
1381
1439
  /**
1382
1440
  * Get a consolidated report of all earnings for a title, including
1383
1441
  * playtime payouts, direct premium purchases, and rentals (minus refunds).
1384
- *
1442
+ *
1385
1443
  * @param title_id The UUID of the title.
1386
1444
  * @returns AxiosPromise containing the consolidated financial data.
1387
1445
  */
@@ -1490,6 +1548,95 @@ class Titles {
1490
1548
  ): AxiosPromise<Response<T>> {
1491
1549
  return Requests.processRoute(TitlesRoute.routes.reviewsDeveloperResponse, data, { review_id });
1492
1550
  }
1551
+
1552
+ // ----- Steamworks Financial API -----------------------------------------------------
1553
+
1554
+ /**
1555
+ * Steam Financial API connection and sync status for a title: masked key, partner,
1556
+ * last sync times, stored sales/wishlist date ranges and pending dates.
1557
+ */
1558
+ public static steamFinancialsStatus<T>(title_id: string): AxiosPromise<Response<T>> {
1559
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsStatus, undefined, { title_id });
1560
+ }
1561
+
1562
+ /**
1563
+ * Verify a Steamworks Financial API Group key with Steam and store it (encrypted) on the title.
1564
+ * Queues a full sync unless `sync: false` is passed.
1565
+ *
1566
+ * @param data { api_key: string, sync?: boolean }
1567
+ */
1568
+ public static steamFinancialsConnect<T>(title_id: string, data: { api_key: string; sync?: boolean }): AxiosPromise<Response<T>> {
1569
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsConnect, data, { title_id });
1570
+ }
1571
+
1572
+ /** Check a key (or the stored key when api_key is omitted) with Steam without saving anything. */
1573
+ public static steamFinancialsTestKey<T>(title_id: string, data?: { api_key?: string }): AxiosPromise<Response<T>> {
1574
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsTestKey, data || {}, { title_id });
1575
+ }
1576
+
1577
+ /** Remove the stored key. Pass { purge_data: true } to also delete synced Steam financial data. */
1578
+ public static steamFinancialsDisconnect<T>(title_id: string, params?: { purge_data?: boolean }): AxiosPromise<Response<T>> {
1579
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsDisconnect, undefined, { title_id }, params);
1580
+ }
1581
+
1582
+ /**
1583
+ * Sync sales and/or wishlists from Steam. Queued by default; pass `wait: true` for a short inline run.
1584
+ *
1585
+ * @param data { datasets?: ('sales'|'wishlists')[], full?: boolean, wait?: boolean, max_dates?: number, max_days?: number, from?: string, to?: string, include_view_grants?: boolean }
1586
+ */
1587
+ public static steamFinancialsSync<T>(title_id: string, data?: Record<string, any>): AxiosPromise<Response<T>> {
1588
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsSync, data || {}, { title_id });
1589
+ }
1590
+
1591
+ /**
1592
+ * Report bundle built from synced Steam data: summary, sales over time and by country, region,
1593
+ * product, platform, sale type, discount and price point, key activations, revenue-share tiers,
1594
+ * wishlists over time and by country, region, language and platform, and the wishlist-to-sales funnel.
1595
+ *
1596
+ * @param params { from?: 'YYYY-MM-DD', to?: 'YYYY-MM-DD', report_keys?: string (comma separated), app_scope?: 'title'|'partner', app_id?: number, limit?: number }
1597
+ */
1598
+ public static steamFinancialsReports<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
1599
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsReports, undefined, { title_id }, params);
1600
+ }
1601
+
1602
+ /**
1603
+ * Paginated Steam sales line items (every GetDetailedSales field) with product, country,
1604
+ * discount and key-request names attached.
1605
+ *
1606
+ * @param params { from?, to?, app_scope?, app_id?, page?, per_page?, country_code?, platform?, line_item_type?, package_sale_type?, currency?, packageid?, bundleid?, key_request_id?, combined_discount_id? }
1607
+ */
1608
+ public static steamFinancialsSales<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
1609
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsSales, undefined, { title_id }, params);
1610
+ }
1611
+
1612
+ /**
1613
+ * Daily Steam wishlist rows; pass dimension 'country' or 'language' for the breakdown rows.
1614
+ *
1615
+ * @param params { from?, to?, app_id?, dimension?: 'country'|'language' }
1616
+ */
1617
+ public static steamFinancialsWishlists<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
1618
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsWishlists, undefined, { title_id }, params);
1619
+ }
1620
+
1621
+ /** Names Steam returned with sales: package, app, bundle, discount, combined_discount, key_request, game_item, country, partner. */
1622
+ public static steamFinancialsLookups<T>(title_id: string, params?: { kind?: string }): AxiosPromise<Response<T>> {
1623
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsLookups, undefined, { title_id }, params);
1624
+ }
1625
+
1626
+ /** Live GetChangedDatesForPartner (nothing stored). */
1627
+ public static steamFinancialsLiveChangedDates<T>(title_id: string, params?: { highwatermark?: string; include_view_grants?: boolean }): AxiosPromise<Response<T>> {
1628
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsLiveChangedDates, undefined, { title_id }, params);
1629
+ }
1630
+
1631
+ /** Live GetDetailedSales for one date and page (nothing stored). */
1632
+ public static steamFinancialsLiveDetailedSales<T>(title_id: string, params: { date: string; highwatermark_id?: string; include_view_grants?: boolean }): AxiosPromise<Response<T>> {
1633
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsLiveDetailedSales, undefined, { title_id }, params);
1634
+ }
1635
+
1636
+ /** Live GetAppWishlistReporting for one date (nothing stored). */
1637
+ public static steamFinancialsLiveWishlist<T>(title_id: string, params: { date: string; app_id?: number }): AxiosPromise<Response<T>> {
1638
+ return Requests.processRoute(TitlesRoute.routes.steamFinancialsLiveWishlist, undefined, { title_id }, params);
1639
+ }
1493
1640
  }
1494
1641
 
1495
1642
  export default Titles;