glitch-javascript-sdk 2.0.3 → 2.0.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.
@@ -0,0 +1,39 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class AccessKeys {
4
+ /**
5
+ * List all access keys for a given title.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
8
+ *
9
+ * @param title_id The UUID of the title.
10
+ * @param params Optional query parameters for pagination.
11
+ * @returns promise
12
+ */
13
+ static list<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
14
+ /**
15
+ * Bulk create access keys from a string of codes.
16
+ *
17
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
18
+ *
19
+ * @param title_id The UUID of the title.
20
+ * @param data The platform and codes to upload.
21
+ * @param data.platform The platform for the keys (e.g., 'steam').
22
+ * @param data.codes A string of codes separated by newlines, commas, or spaces.
23
+ * @returns Promise
24
+ */
25
+ static store<T>(title_id: string, data: {
26
+ platform: string;
27
+ codes: string;
28
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
29
+ /**
30
+ * Deletes an unassigned access key.
31
+ *
32
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
33
+ *
34
+ * @param key_id The UUID of the access key to delete.
35
+ * @returns promise
36
+ */
37
+ static delete<T>(key_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
38
+ }
39
+ export default AccessKeys;
@@ -595,5 +595,20 @@ declare class Campaigns {
595
595
  * @returns promise
596
596
  */
597
597
  static updateSourcedCreator<T>(campaign_id: string, sourced_creator_id: string, data: object): AxiosPromise<Response<T>>;
598
+ /**
599
+ * Assigns an available access key to an influencer for a specific campaign.
600
+ * This will find the next available key for the given platform and assign it.
601
+ *
602
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
603
+ *
604
+ * @param campaign_id The ID of the campaign.
605
+ * @param user_id The ID of the user (influencer).
606
+ * @param data The platform for which to assign a key.
607
+ * @param data.platform The platform of the key to assign (e.g., 'steam').
608
+ * @returns promise
609
+ */
610
+ static assignKeyToInfluencer<T>(campaign_id: string, user_id: string, data: {
611
+ platform: string;
612
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
598
613
  }
599
614
  export default Campaigns;
@@ -17,5 +17,25 @@ declare class ShortLinks {
17
17
  * Update a short link
18
18
  */
19
19
  static update<T>(id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
20
+ /**
21
+ * Get click-summary report
22
+ * - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
23
+ */
24
+ static clickSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
25
+ /**
26
+ * Get geo & device breakdown report
27
+ * - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
28
+ */
29
+ static geoDeviceBreakdown<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
30
+ /**
31
+ * Get time-series report
32
+ * - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
33
+ */
34
+ static timeSeries<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
35
+ /**
36
+ * Get referrer & UTM report
37
+ * - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
38
+ */
39
+ static referrerReport<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
20
40
  }
21
41
  export default ShortLinks;
@@ -289,5 +289,63 @@ declare class Titles {
289
289
  * Update a specific chat message.
290
290
  */
291
291
  static chatUpdateMessage<T>(title_id: string, message_id: string, data: object): AxiosPromise<Response<T>>;
292
+ /**
293
+ * List all purchase events for a specific title.
294
+ * Matches GET /titles/{title_id}/purchases
295
+ */
296
+ static listPurchases<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
297
+ /**
298
+ * Retrieve a single purchase record by ID.
299
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
300
+ */
301
+ static viewPurchase<T>(title_id: string, purchase_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
302
+ /**
303
+ * Create a new purchase record.
304
+ * Matches POST /titles/{title_id}/purchases
305
+ */
306
+ static createPurchase<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
307
+ /**
308
+ * Get a summary of total revenue, grouped by day or purchase_type.
309
+ * Matches GET /titles/{title_id}/purchases/summary
310
+ */
311
+ static purchaseSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
312
+ /**
313
+ * Revenue by time (daily, weekly, or monthly).
314
+ * Matches GET /titles/{title_id}/purchases/reports/time
315
+ */
316
+ static purchaseRevenueByTime<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
317
+ /**
318
+ * 30-day LTV (Lifetime Value) per install.
319
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
320
+ */
321
+ static purchaseLtv30<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
322
+ /**
323
+ * Show breakdown of revenue per currency, with optional USD conversion.
324
+ * Matches GET /titles/{title_id}/purchases/reports/currency
325
+ */
326
+ static purchaseCurrencyBreakdown<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
327
+ /**
328
+ * Distribution of installs by total revenue, plus a histogram array.
329
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
330
+ */
331
+ static installRevenueDistribution<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
332
+ /**
333
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
334
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
335
+ */
336
+ static itemAndPurchaseTypeStats<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
337
+ /**
338
+ * Bulk import access keys for a title from a CSV or Excel file.
339
+ * The file must contain 'platform' and 'code' columns.
340
+ *
341
+ * @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
342
+ *
343
+ * @param title_id The UUID of the title.
344
+ * @param file The CSV or Excel file to upload.
345
+ * @param data Optional additional form data.
346
+ * @param params Optional query parameters.
347
+ * @returns AxiosPromise
348
+ */
349
+ static importKeys<T>(title_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>): AxiosPromise<Response<T>>;
292
350
  }
293
351
  export default Titles;
@@ -1,5 +1,6 @@
1
1
  import Auth from "./Auth";
2
2
  import Ads from "./Ads";
3
+ import AccessKeys from "./AccessKeys";
3
4
  import Competitions from "./Competitions";
4
5
  import Communities from "./Communities";
5
6
  import Users from "./Users";
@@ -37,6 +38,7 @@ import ShortLinks from "./ShortLinks";
37
38
  import AIUsage from "./AIUsage";
38
39
  import MarketingAgencies from "./MarketingAgencies";
39
40
  export { Ads };
41
+ export { AccessKeys };
40
42
  export { Auth };
41
43
  export { Competitions };
42
44
  export { Communities };
@@ -1,5 +1,6 @@
1
1
  import { Config } from "./config";
2
2
  import Auth from "./api/Auth";
3
+ import AccessKeys from "./api/AccessKeys";
3
4
  import Competitions from "./api/Competitions";
4
5
  import { Communities, Social } from "./api";
5
6
  import { Ads } from "./api";
@@ -56,6 +57,7 @@ declare class Glitch {
56
57
  };
57
58
  static api: {
58
59
  Ads: typeof Ads;
60
+ AccessKeys: typeof AccessKeys;
59
61
  Auth: typeof Auth;
60
62
  Campaigns: typeof Campaigns;
61
63
  Competitions: typeof Competitions;
package/dist/esm/index.js CHANGED
@@ -5895,6 +5895,60 @@ var Auth = /** @class */ (function () {
5895
5895
  return Auth;
5896
5896
  }());
5897
5897
 
5898
+ var AccessKeysRoute = /** @class */ (function () {
5899
+ function AccessKeysRoute() {
5900
+ }
5901
+ AccessKeysRoute.routes = {
5902
+ list: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.GET },
5903
+ store: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.POST },
5904
+ delete: { url: '/keys/{key_id}', method: HTTP_METHODS.DELETE },
5905
+ };
5906
+ return AccessKeysRoute;
5907
+ }());
5908
+
5909
+ var AccessKeys = /** @class */ (function () {
5910
+ function AccessKeys() {
5911
+ }
5912
+ /**
5913
+ * List all access keys for a given title.
5914
+ *
5915
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
5916
+ *
5917
+ * @param title_id The UUID of the title.
5918
+ * @param params Optional query parameters for pagination.
5919
+ * @returns promise
5920
+ */
5921
+ AccessKeys.list = function (title_id, params) {
5922
+ return Requests.processRoute(AccessKeysRoute.routes.list, undefined, { title_id: title_id }, params);
5923
+ };
5924
+ /**
5925
+ * Bulk create access keys from a string of codes.
5926
+ *
5927
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
5928
+ *
5929
+ * @param title_id The UUID of the title.
5930
+ * @param data The platform and codes to upload.
5931
+ * @param data.platform The platform for the keys (e.g., 'steam').
5932
+ * @param data.codes A string of codes separated by newlines, commas, or spaces.
5933
+ * @returns Promise
5934
+ */
5935
+ AccessKeys.store = function (title_id, data, params) {
5936
+ return Requests.processRoute(AccessKeysRoute.routes.store, data, { title_id: title_id }, params);
5937
+ };
5938
+ /**
5939
+ * Deletes an unassigned access key.
5940
+ *
5941
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
5942
+ *
5943
+ * @param key_id The UUID of the access key to delete.
5944
+ * @returns promise
5945
+ */
5946
+ AccessKeys.delete = function (key_id, params) {
5947
+ return Requests.processRoute(AccessKeysRoute.routes.delete, {}, { key_id: key_id }, params);
5948
+ };
5949
+ return AccessKeys;
5950
+ }());
5951
+
5898
5952
  var CompetitionRoutes = /** @class */ (function () {
5899
5953
  function CompetitionRoutes() {
5900
5954
  }
@@ -11091,6 +11145,47 @@ var TitlesRoute = /** @class */ (function () {
11091
11145
  url: '/titles/{title_id}/chat/messages/{message_id}',
11092
11146
  method: HTTP_METHODS.PUT
11093
11147
  },
11148
+ importKeys: { url: '/titles/{title_id}/import-keys', method: HTTP_METHODS.POST },
11149
+ // ─────────────────────────────────────────────────────────────────
11150
+ // Purchase/Revenue Endpoints
11151
+ // ─────────────────────────────────────────────────────────────────
11152
+ purchasesList: {
11153
+ url: "/titles/{title_id}/purchases",
11154
+ method: HTTP_METHODS.GET,
11155
+ },
11156
+ purchasesShow: {
11157
+ url: "/titles/{title_id}/purchases/{purchase_id}",
11158
+ method: HTTP_METHODS.GET,
11159
+ },
11160
+ purchasesCreate: {
11161
+ url: "/titles/{title_id}/purchases",
11162
+ method: HTTP_METHODS.POST,
11163
+ },
11164
+ purchasesSummary: {
11165
+ url: "/titles/{title_id}/purchases/summary",
11166
+ method: HTTP_METHODS.GET,
11167
+ },
11168
+ // Advanced analytics sub-routes
11169
+ purchasesTimeReport: {
11170
+ url: "/titles/{title_id}/purchases/reports/time",
11171
+ method: HTTP_METHODS.GET,
11172
+ },
11173
+ purchasesLtv30Report: {
11174
+ url: "/titles/{title_id}/purchases/reports/ltv30",
11175
+ method: HTTP_METHODS.GET,
11176
+ },
11177
+ purchasesCurrencyBreakdown: {
11178
+ url: "/titles/{title_id}/purchases/reports/currency",
11179
+ method: HTTP_METHODS.GET,
11180
+ },
11181
+ purchasesInstallDistribution: {
11182
+ url: "/titles/{title_id}/purchases/reports/install-distribution",
11183
+ method: HTTP_METHODS.GET,
11184
+ },
11185
+ purchasesItemTypeStats: {
11186
+ url: "/titles/{title_id}/purchases/reports/item-type-stats",
11187
+ method: HTTP_METHODS.GET,
11188
+ },
11094
11189
  };
11095
11190
  return TitlesRoute;
11096
11191
  }());
@@ -11470,6 +11565,85 @@ var Titles = /** @class */ (function () {
11470
11565
  Titles.chatUpdateMessage = function (title_id, message_id, data) {
11471
11566
  return Requests.processRoute(TitlesRoute.routes.chatUpdateMessage, data, { title_id: title_id, message_id: message_id });
11472
11567
  };
11568
+ /**
11569
+ * List all purchase events for a specific title.
11570
+ * Matches GET /titles/{title_id}/purchases
11571
+ */
11572
+ Titles.listPurchases = function (title_id, params) {
11573
+ return Requests.processRoute(TitlesRoute.routes.purchasesList, {}, { title_id: title_id }, params);
11574
+ };
11575
+ /**
11576
+ * Retrieve a single purchase record by ID.
11577
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
11578
+ */
11579
+ Titles.viewPurchase = function (title_id, purchase_id, params) {
11580
+ return Requests.processRoute(TitlesRoute.routes.purchasesShow, {}, { title_id: title_id, purchase_id: purchase_id }, params);
11581
+ };
11582
+ /**
11583
+ * Create a new purchase record.
11584
+ * Matches POST /titles/{title_id}/purchases
11585
+ */
11586
+ Titles.createPurchase = function (title_id, data, params) {
11587
+ return Requests.processRoute(TitlesRoute.routes.purchasesCreate, data, { title_id: title_id }, params);
11588
+ };
11589
+ /**
11590
+ * Get a summary of total revenue, grouped by day or purchase_type.
11591
+ * Matches GET /titles/{title_id}/purchases/summary
11592
+ */
11593
+ Titles.purchaseSummary = function (title_id, params) {
11594
+ return Requests.processRoute(TitlesRoute.routes.purchasesSummary, {}, { title_id: title_id }, params);
11595
+ };
11596
+ /**
11597
+ * Revenue by time (daily, weekly, or monthly).
11598
+ * Matches GET /titles/{title_id}/purchases/reports/time
11599
+ */
11600
+ Titles.purchaseRevenueByTime = function (title_id, params) {
11601
+ return Requests.processRoute(TitlesRoute.routes.purchasesTimeReport, {}, { title_id: title_id }, params);
11602
+ };
11603
+ /**
11604
+ * 30-day LTV (Lifetime Value) per install.
11605
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
11606
+ */
11607
+ Titles.purchaseLtv30 = function (title_id, params) {
11608
+ return Requests.processRoute(TitlesRoute.routes.purchasesLtv30Report, {}, { title_id: title_id }, params);
11609
+ };
11610
+ /**
11611
+ * Show breakdown of revenue per currency, with optional USD conversion.
11612
+ * Matches GET /titles/{title_id}/purchases/reports/currency
11613
+ */
11614
+ Titles.purchaseCurrencyBreakdown = function (title_id, params) {
11615
+ return Requests.processRoute(TitlesRoute.routes.purchasesCurrencyBreakdown, {}, { title_id: title_id }, params);
11616
+ };
11617
+ /**
11618
+ * Distribution of installs by total revenue, plus a histogram array.
11619
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
11620
+ */
11621
+ Titles.installRevenueDistribution = function (title_id, params) {
11622
+ return Requests.processRoute(TitlesRoute.routes.purchasesInstallDistribution, {}, { title_id: title_id }, params);
11623
+ };
11624
+ /**
11625
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
11626
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
11627
+ */
11628
+ Titles.itemAndPurchaseTypeStats = function (title_id, params) {
11629
+ return Requests.processRoute(TitlesRoute.routes.purchasesItemTypeStats, {}, { title_id: title_id }, params);
11630
+ };
11631
+ /**
11632
+ * Bulk import access keys for a title from a CSV or Excel file.
11633
+ * The file must contain 'platform' and 'code' columns.
11634
+ *
11635
+ * @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
11636
+ *
11637
+ * @param title_id The UUID of the title.
11638
+ * @param file The CSV or Excel file to upload.
11639
+ * @param data Optional additional form data.
11640
+ * @param params Optional query parameters.
11641
+ * @returns AxiosPromise
11642
+ */
11643
+ Titles.importKeys = function (title_id, file, data, params) {
11644
+ var url = TitlesRoute.routes.importKeys.url.replace("{title_id}", title_id);
11645
+ return Requests.uploadFile(url, "file", file, data, params);
11646
+ };
11473
11647
  return Titles;
11474
11648
  }());
11475
11649
 
@@ -11542,6 +11716,7 @@ var CampaignsRoute = /** @class */ (function () {
11542
11716
  getSourcedCreators: { url: '/campaigns/{campaign_id}/sourcing/creators', method: HTTP_METHODS.GET },
11543
11717
  getSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.GET },
11544
11718
  updateSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.PUT },
11719
+ assignKeyToInfluencer: { url: '/campaigns/{campaign_id}/influencers/{user_id}/assign-key', method: HTTP_METHODS.POST },
11545
11720
  };
11546
11721
  return CampaignsRoute;
11547
11722
  }());
@@ -12273,6 +12448,21 @@ var Campaigns = /** @class */ (function () {
12273
12448
  Campaigns.updateSourcedCreator = function (campaign_id, sourced_creator_id, data) {
12274
12449
  return Requests.processRoute(CampaignsRoute.routes.updateSourcedCreator, data, { campaign_id: campaign_id, sourced_creator_id: sourced_creator_id });
12275
12450
  };
12451
+ /**
12452
+ * Assigns an available access key to an influencer for a specific campaign.
12453
+ * This will find the next available key for the given platform and assign it.
12454
+ *
12455
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
12456
+ *
12457
+ * @param campaign_id The ID of the campaign.
12458
+ * @param user_id The ID of the user (influencer).
12459
+ * @param data The platform for which to assign a key.
12460
+ * @param data.platform The platform of the key to assign (e.g., 'steam').
12461
+ * @returns promise
12462
+ */
12463
+ Campaigns.assignKeyToInfluencer = function (campaign_id, user_id, data, params) {
12464
+ return Requests.processRoute(CampaignsRoute.routes.assignKeyToInfluencer, data, { campaign_id: campaign_id, user_id: user_id }, params);
12465
+ };
12276
12466
  return Campaigns;
12277
12467
  }());
12278
12468
 
@@ -14462,6 +14652,10 @@ var ShortLinksRoute = /** @class */ (function () {
14462
14652
  updateShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.PUT },
14463
14653
  // Delete can be added if supported
14464
14654
  // deleteShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.DELETE }
14655
+ clickSummary: { url: '/shortlinks/reports/click-summary', method: HTTP_METHODS.GET },
14656
+ geoDeviceBreakdown: { url: '/shortlinks/reports/geo-device', method: HTTP_METHODS.GET },
14657
+ timeSeries: { url: '/shortlinks/reports/time-series', method: HTTP_METHODS.GET },
14658
+ referrerReport: { url: '/shortlinks/reports/referrer', method: HTTP_METHODS.GET },
14465
14659
  };
14466
14660
  return ShortLinksRoute;
14467
14661
  }());
@@ -14493,6 +14687,38 @@ var ShortLinks = /** @class */ (function () {
14493
14687
  ShortLinks.update = function (id, data, params) {
14494
14688
  return Requests.processRoute(ShortLinksRoute.routes.updateShortLink, data, { id: id }, params);
14495
14689
  };
14690
+ // Uncomment when delete is supported
14691
+ // public static delete<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
14692
+ // return Requests.processRoute(ShortLinksRoute.routes.deleteShortLink, {}, { id }, params);
14693
+ // }
14694
+ /**
14695
+ * Get click-summary report
14696
+ * - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
14697
+ */
14698
+ ShortLinks.clickSummary = function (params) {
14699
+ return Requests.processRoute(ShortLinksRoute.routes.clickSummary, undefined, undefined, params);
14700
+ };
14701
+ /**
14702
+ * Get geo & device breakdown report
14703
+ * - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
14704
+ */
14705
+ ShortLinks.geoDeviceBreakdown = function (params) {
14706
+ return Requests.processRoute(ShortLinksRoute.routes.geoDeviceBreakdown, undefined, undefined, params);
14707
+ };
14708
+ /**
14709
+ * Get time-series report
14710
+ * - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
14711
+ */
14712
+ ShortLinks.timeSeries = function (params) {
14713
+ return Requests.processRoute(ShortLinksRoute.routes.timeSeries, undefined, undefined, params);
14714
+ };
14715
+ /**
14716
+ * Get referrer & UTM report
14717
+ * - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
14718
+ */
14719
+ ShortLinks.referrerReport = function (params) {
14720
+ return Requests.processRoute(ShortLinksRoute.routes.referrerReport, undefined, undefined, params);
14721
+ };
14496
14722
  return ShortLinks;
14497
14723
  }());
14498
14724
 
@@ -15243,6 +15469,7 @@ var Glitch = /** @class */ (function () {
15243
15469
  };
15244
15470
  Glitch.api = {
15245
15471
  Ads: Ads,
15472
+ AccessKeys: AccessKeys,
15246
15473
  Auth: Auth,
15247
15474
  Campaigns: Campaigns,
15248
15475
  Competitions: Competitions,