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.
package/dist/cjs/index.js CHANGED
@@ -19079,6 +19079,60 @@ var Auth = /** @class */ (function () {
19079
19079
  return Auth;
19080
19080
  }());
19081
19081
 
19082
+ var AccessKeysRoute = /** @class */ (function () {
19083
+ function AccessKeysRoute() {
19084
+ }
19085
+ AccessKeysRoute.routes = {
19086
+ list: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.GET },
19087
+ store: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.POST },
19088
+ delete: { url: '/keys/{key_id}', method: HTTP_METHODS.DELETE },
19089
+ };
19090
+ return AccessKeysRoute;
19091
+ }());
19092
+
19093
+ var AccessKeys = /** @class */ (function () {
19094
+ function AccessKeys() {
19095
+ }
19096
+ /**
19097
+ * List all access keys for a given title.
19098
+ *
19099
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
19100
+ *
19101
+ * @param title_id The UUID of the title.
19102
+ * @param params Optional query parameters for pagination.
19103
+ * @returns promise
19104
+ */
19105
+ AccessKeys.list = function (title_id, params) {
19106
+ return Requests.processRoute(AccessKeysRoute.routes.list, undefined, { title_id: title_id }, params);
19107
+ };
19108
+ /**
19109
+ * Bulk create access keys from a string of codes.
19110
+ *
19111
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
19112
+ *
19113
+ * @param title_id The UUID of the title.
19114
+ * @param data The platform and codes to upload.
19115
+ * @param data.platform The platform for the keys (e.g., 'steam').
19116
+ * @param data.codes A string of codes separated by newlines, commas, or spaces.
19117
+ * @returns Promise
19118
+ */
19119
+ AccessKeys.store = function (title_id, data, params) {
19120
+ return Requests.processRoute(AccessKeysRoute.routes.store, data, { title_id: title_id }, params);
19121
+ };
19122
+ /**
19123
+ * Deletes an unassigned access key.
19124
+ *
19125
+ * @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
19126
+ *
19127
+ * @param key_id The UUID of the access key to delete.
19128
+ * @returns promise
19129
+ */
19130
+ AccessKeys.delete = function (key_id, params) {
19131
+ return Requests.processRoute(AccessKeysRoute.routes.delete, {}, { key_id: key_id }, params);
19132
+ };
19133
+ return AccessKeys;
19134
+ }());
19135
+
19082
19136
  var CompetitionRoutes = /** @class */ (function () {
19083
19137
  function CompetitionRoutes() {
19084
19138
  }
@@ -24275,6 +24329,47 @@ var TitlesRoute = /** @class */ (function () {
24275
24329
  url: '/titles/{title_id}/chat/messages/{message_id}',
24276
24330
  method: HTTP_METHODS.PUT
24277
24331
  },
24332
+ importKeys: { url: '/titles/{title_id}/import-keys', method: HTTP_METHODS.POST },
24333
+ // ─────────────────────────────────────────────────────────────────
24334
+ // Purchase/Revenue Endpoints
24335
+ // ─────────────────────────────────────────────────────────────────
24336
+ purchasesList: {
24337
+ url: "/titles/{title_id}/purchases",
24338
+ method: HTTP_METHODS.GET,
24339
+ },
24340
+ purchasesShow: {
24341
+ url: "/titles/{title_id}/purchases/{purchase_id}",
24342
+ method: HTTP_METHODS.GET,
24343
+ },
24344
+ purchasesCreate: {
24345
+ url: "/titles/{title_id}/purchases",
24346
+ method: HTTP_METHODS.POST,
24347
+ },
24348
+ purchasesSummary: {
24349
+ url: "/titles/{title_id}/purchases/summary",
24350
+ method: HTTP_METHODS.GET,
24351
+ },
24352
+ // Advanced analytics sub-routes
24353
+ purchasesTimeReport: {
24354
+ url: "/titles/{title_id}/purchases/reports/time",
24355
+ method: HTTP_METHODS.GET,
24356
+ },
24357
+ purchasesLtv30Report: {
24358
+ url: "/titles/{title_id}/purchases/reports/ltv30",
24359
+ method: HTTP_METHODS.GET,
24360
+ },
24361
+ purchasesCurrencyBreakdown: {
24362
+ url: "/titles/{title_id}/purchases/reports/currency",
24363
+ method: HTTP_METHODS.GET,
24364
+ },
24365
+ purchasesInstallDistribution: {
24366
+ url: "/titles/{title_id}/purchases/reports/install-distribution",
24367
+ method: HTTP_METHODS.GET,
24368
+ },
24369
+ purchasesItemTypeStats: {
24370
+ url: "/titles/{title_id}/purchases/reports/item-type-stats",
24371
+ method: HTTP_METHODS.GET,
24372
+ },
24278
24373
  };
24279
24374
  return TitlesRoute;
24280
24375
  }());
@@ -24654,6 +24749,85 @@ var Titles = /** @class */ (function () {
24654
24749
  Titles.chatUpdateMessage = function (title_id, message_id, data) {
24655
24750
  return Requests.processRoute(TitlesRoute.routes.chatUpdateMessage, data, { title_id: title_id, message_id: message_id });
24656
24751
  };
24752
+ /**
24753
+ * List all purchase events for a specific title.
24754
+ * Matches GET /titles/{title_id}/purchases
24755
+ */
24756
+ Titles.listPurchases = function (title_id, params) {
24757
+ return Requests.processRoute(TitlesRoute.routes.purchasesList, {}, { title_id: title_id }, params);
24758
+ };
24759
+ /**
24760
+ * Retrieve a single purchase record by ID.
24761
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
24762
+ */
24763
+ Titles.viewPurchase = function (title_id, purchase_id, params) {
24764
+ return Requests.processRoute(TitlesRoute.routes.purchasesShow, {}, { title_id: title_id, purchase_id: purchase_id }, params);
24765
+ };
24766
+ /**
24767
+ * Create a new purchase record.
24768
+ * Matches POST /titles/{title_id}/purchases
24769
+ */
24770
+ Titles.createPurchase = function (title_id, data, params) {
24771
+ return Requests.processRoute(TitlesRoute.routes.purchasesCreate, data, { title_id: title_id }, params);
24772
+ };
24773
+ /**
24774
+ * Get a summary of total revenue, grouped by day or purchase_type.
24775
+ * Matches GET /titles/{title_id}/purchases/summary
24776
+ */
24777
+ Titles.purchaseSummary = function (title_id, params) {
24778
+ return Requests.processRoute(TitlesRoute.routes.purchasesSummary, {}, { title_id: title_id }, params);
24779
+ };
24780
+ /**
24781
+ * Revenue by time (daily, weekly, or monthly).
24782
+ * Matches GET /titles/{title_id}/purchases/reports/time
24783
+ */
24784
+ Titles.purchaseRevenueByTime = function (title_id, params) {
24785
+ return Requests.processRoute(TitlesRoute.routes.purchasesTimeReport, {}, { title_id: title_id }, params);
24786
+ };
24787
+ /**
24788
+ * 30-day LTV (Lifetime Value) per install.
24789
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
24790
+ */
24791
+ Titles.purchaseLtv30 = function (title_id, params) {
24792
+ return Requests.processRoute(TitlesRoute.routes.purchasesLtv30Report, {}, { title_id: title_id }, params);
24793
+ };
24794
+ /**
24795
+ * Show breakdown of revenue per currency, with optional USD conversion.
24796
+ * Matches GET /titles/{title_id}/purchases/reports/currency
24797
+ */
24798
+ Titles.purchaseCurrencyBreakdown = function (title_id, params) {
24799
+ return Requests.processRoute(TitlesRoute.routes.purchasesCurrencyBreakdown, {}, { title_id: title_id }, params);
24800
+ };
24801
+ /**
24802
+ * Distribution of installs by total revenue, plus a histogram array.
24803
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
24804
+ */
24805
+ Titles.installRevenueDistribution = function (title_id, params) {
24806
+ return Requests.processRoute(TitlesRoute.routes.purchasesInstallDistribution, {}, { title_id: title_id }, params);
24807
+ };
24808
+ /**
24809
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
24810
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
24811
+ */
24812
+ Titles.itemAndPurchaseTypeStats = function (title_id, params) {
24813
+ return Requests.processRoute(TitlesRoute.routes.purchasesItemTypeStats, {}, { title_id: title_id }, params);
24814
+ };
24815
+ /**
24816
+ * Bulk import access keys for a title from a CSV or Excel file.
24817
+ * The file must contain 'platform' and 'code' columns.
24818
+ *
24819
+ * @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
24820
+ *
24821
+ * @param title_id The UUID of the title.
24822
+ * @param file The CSV or Excel file to upload.
24823
+ * @param data Optional additional form data.
24824
+ * @param params Optional query parameters.
24825
+ * @returns AxiosPromise
24826
+ */
24827
+ Titles.importKeys = function (title_id, file, data, params) {
24828
+ var url = TitlesRoute.routes.importKeys.url.replace("{title_id}", title_id);
24829
+ return Requests.uploadFile(url, "file", file, data, params);
24830
+ };
24657
24831
  return Titles;
24658
24832
  }());
24659
24833
 
@@ -24726,6 +24900,7 @@ var CampaignsRoute = /** @class */ (function () {
24726
24900
  getSourcedCreators: { url: '/campaigns/{campaign_id}/sourcing/creators', method: HTTP_METHODS.GET },
24727
24901
  getSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.GET },
24728
24902
  updateSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.PUT },
24903
+ assignKeyToInfluencer: { url: '/campaigns/{campaign_id}/influencers/{user_id}/assign-key', method: HTTP_METHODS.POST },
24729
24904
  };
24730
24905
  return CampaignsRoute;
24731
24906
  }());
@@ -25457,6 +25632,21 @@ var Campaigns = /** @class */ (function () {
25457
25632
  Campaigns.updateSourcedCreator = function (campaign_id, sourced_creator_id, data) {
25458
25633
  return Requests.processRoute(CampaignsRoute.routes.updateSourcedCreator, data, { campaign_id: campaign_id, sourced_creator_id: sourced_creator_id });
25459
25634
  };
25635
+ /**
25636
+ * Assigns an available access key to an influencer for a specific campaign.
25637
+ * This will find the next available key for the given platform and assign it.
25638
+ *
25639
+ * @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
25640
+ *
25641
+ * @param campaign_id The ID of the campaign.
25642
+ * @param user_id The ID of the user (influencer).
25643
+ * @param data The platform for which to assign a key.
25644
+ * @param data.platform The platform of the key to assign (e.g., 'steam').
25645
+ * @returns promise
25646
+ */
25647
+ Campaigns.assignKeyToInfluencer = function (campaign_id, user_id, data, params) {
25648
+ return Requests.processRoute(CampaignsRoute.routes.assignKeyToInfluencer, data, { campaign_id: campaign_id, user_id: user_id }, params);
25649
+ };
25460
25650
  return Campaigns;
25461
25651
  }());
25462
25652
 
@@ -27646,6 +27836,10 @@ var ShortLinksRoute = /** @class */ (function () {
27646
27836
  updateShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.PUT },
27647
27837
  // Delete can be added if supported
27648
27838
  // deleteShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.DELETE }
27839
+ clickSummary: { url: '/shortlinks/reports/click-summary', method: HTTP_METHODS.GET },
27840
+ geoDeviceBreakdown: { url: '/shortlinks/reports/geo-device', method: HTTP_METHODS.GET },
27841
+ timeSeries: { url: '/shortlinks/reports/time-series', method: HTTP_METHODS.GET },
27842
+ referrerReport: { url: '/shortlinks/reports/referrer', method: HTTP_METHODS.GET },
27649
27843
  };
27650
27844
  return ShortLinksRoute;
27651
27845
  }());
@@ -27677,6 +27871,38 @@ var ShortLinks = /** @class */ (function () {
27677
27871
  ShortLinks.update = function (id, data, params) {
27678
27872
  return Requests.processRoute(ShortLinksRoute.routes.updateShortLink, data, { id: id }, params);
27679
27873
  };
27874
+ // Uncomment when delete is supported
27875
+ // public static delete<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
27876
+ // return Requests.processRoute(ShortLinksRoute.routes.deleteShortLink, {}, { id }, params);
27877
+ // }
27878
+ /**
27879
+ * Get click-summary report
27880
+ * - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
27881
+ */
27882
+ ShortLinks.clickSummary = function (params) {
27883
+ return Requests.processRoute(ShortLinksRoute.routes.clickSummary, undefined, undefined, params);
27884
+ };
27885
+ /**
27886
+ * Get geo & device breakdown report
27887
+ * - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
27888
+ */
27889
+ ShortLinks.geoDeviceBreakdown = function (params) {
27890
+ return Requests.processRoute(ShortLinksRoute.routes.geoDeviceBreakdown, undefined, undefined, params);
27891
+ };
27892
+ /**
27893
+ * Get time-series report
27894
+ * - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
27895
+ */
27896
+ ShortLinks.timeSeries = function (params) {
27897
+ return Requests.processRoute(ShortLinksRoute.routes.timeSeries, undefined, undefined, params);
27898
+ };
27899
+ /**
27900
+ * Get referrer & UTM report
27901
+ * - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
27902
+ */
27903
+ ShortLinks.referrerReport = function (params) {
27904
+ return Requests.processRoute(ShortLinksRoute.routes.referrerReport, undefined, undefined, params);
27905
+ };
27680
27906
  return ShortLinks;
27681
27907
  }());
27682
27908
 
@@ -28427,6 +28653,7 @@ var Glitch = /** @class */ (function () {
28427
28653
  };
28428
28654
  Glitch.api = {
28429
28655
  Ads: Ads,
28656
+ AccessKeys: AccessKeys,
28430
28657
  Auth: Auth,
28431
28658
  Campaigns: Campaigns,
28432
28659
  Competitions: Competitions,