glitch-javascript-sdk 3.2.28 → 3.2.30

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,5 @@
1
1
  import Response from "../util/Response";
2
- import { AxiosPromise } from "axios";
2
+ import { AxiosPromise, AxiosProgressEvent } from "axios";
3
3
  declare class Crm {
4
4
  /**
5
5
  * List and search CRM leads.
@@ -149,6 +149,14 @@ declare class Crm {
149
149
  * Import external prospects into CRM leads and contacts for future campaigns.
150
150
  */
151
151
  static importCampaignProspects<T>(prospects: object[], options?: Record<string, any>): AxiosPromise<Response<T>>;
152
+ /**
153
+ * Preview uploaded festival submission sheets without writing External Game or CRM records.
154
+ */
155
+ static previewFestivalSubmissionImport<T>(files: Array<File | Blob>, options?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
156
+ /**
157
+ * Import uploaded festival submission sheets into External Games and CRM leads/contacts.
158
+ */
159
+ static importFestivalSubmissions<T>(files: Array<File | Blob>, options?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
152
160
  /**
153
161
  * List provider-managed sender and reply-to addresses for CRM campaigns.
154
162
  */
@@ -169,5 +177,6 @@ declare class Crm {
169
177
  * Deactivate a provider address while keeping the audit record.
170
178
  */
171
179
  static deactivateEmailProviderAddress<T>(address_id: string): AxiosPromise<Response<T>>;
180
+ private static festivalSubmissionFormData;
172
181
  }
173
182
  export default Crm;
@@ -42,6 +42,17 @@ declare class TwitchReporting {
42
42
  * @returns promise
43
43
  */
44
44
  static getMostActiveGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
45
+ /**
46
+ * Discover the most active Twitch games with Steam/IGDB genre, category,
47
+ * theme, live snapshot, and trend metrics.
48
+ *
49
+ * @see https://api.glitch.fun/api/documentation#/Twitch%20Reporting/discoverActiveTwitchGames
50
+ *
51
+ * @param params Optional query parameters (e.g., genres, categories, match_mode, trend_days, sort_by, limit).
52
+ *
53
+ * @returns promise
54
+ */
55
+ static discoverActiveGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
45
56
  /**
46
57
  * Get top streamers by performance (average or peak CCV).
47
58
  *
package/dist/esm/index.js CHANGED
@@ -5527,6 +5527,39 @@ var Requests = /** @class */ (function () {
5527
5527
  onUploadProgress: onUploadProgress,
5528
5528
  });
5529
5529
  };
5530
+ Requests.postFormData = function (url, formData, params, onUploadProgress) {
5531
+ if (params && Object.keys(params).length > 0) {
5532
+ var queryString = Object.entries(params)
5533
+ .filter(function (_a) {
5534
+ var value = _a[1];
5535
+ return value !== undefined && value !== null && value !== '';
5536
+ })
5537
+ .map(function (_a) {
5538
+ var key = _a[0], value = _a[1];
5539
+ if (Array.isArray(value)) {
5540
+ return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
5541
+ }
5542
+ return "".concat(key, "=").concat(encodeURIComponent(value));
5543
+ })
5544
+ .filter(Boolean)
5545
+ .join('&');
5546
+ if (queryString) {
5547
+ url = "".concat(url, "?").concat(queryString);
5548
+ }
5549
+ }
5550
+ var headers = {};
5551
+ if (Requests.authToken) {
5552
+ headers['Authorization'] = "Bearer ".concat(Requests.authToken);
5553
+ }
5554
+ var uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
5555
+ return axios$1({
5556
+ method: 'POST',
5557
+ url: uri,
5558
+ data: formData,
5559
+ headers: headers,
5560
+ onUploadProgress: onUploadProgress,
5561
+ });
5562
+ };
5530
5563
  Requests.uploadBlob = function (url, filename, blob, data, params, onUploadProgress) {
5531
5564
  // Process URL and params
5532
5565
  if (params && Object.keys(params).length > 0) {
@@ -17876,6 +17909,10 @@ var TwitchReportingRoute = /** @class */ (function () {
17876
17909
  url: '/reporting/twitch/games/most-active',
17877
17910
  method: HTTP_METHODS.GET
17878
17911
  },
17912
+ discoverActiveGames: {
17913
+ url: '/reporting/twitch/games/discovery',
17914
+ method: HTTP_METHODS.GET
17915
+ },
17879
17916
  getTopStreamers: {
17880
17917
  url: '/reporting/twitch/streamers/top',
17881
17918
  method: HTTP_METHODS.GET
@@ -17948,6 +17985,19 @@ var TwitchReporting = /** @class */ (function () {
17948
17985
  TwitchReporting.getMostActiveGames = function (params) {
17949
17986
  return Requests.processRoute(TwitchReportingRoute.routes.getMostActiveGames, undefined, undefined, params);
17950
17987
  };
17988
+ /**
17989
+ * Discover the most active Twitch games with Steam/IGDB genre, category,
17990
+ * theme, live snapshot, and trend metrics.
17991
+ *
17992
+ * @see https://api.glitch.fun/api/documentation#/Twitch%20Reporting/discoverActiveTwitchGames
17993
+ *
17994
+ * @param params Optional query parameters (e.g., genres, categories, match_mode, trend_days, sort_by, limit).
17995
+ *
17996
+ * @returns promise
17997
+ */
17998
+ TwitchReporting.discoverActiveGames = function (params) {
17999
+ return Requests.processRoute(TwitchReportingRoute.routes.discoverActiveGames, undefined, undefined, params);
18000
+ };
17951
18001
  /**
17952
18002
  * Get top streamers by performance (average or peak CCV).
17953
18003
  *
@@ -18634,6 +18684,8 @@ var CrmRoute = /** @class */ (function () {
18634
18684
  listCampaignRecipients: { url: '/admin/crm/campaigns/{campaign_id}/recipients', method: HTTP_METHODS.GET },
18635
18685
  previewCampaignProspectImport: { url: '/admin/crm/campaigns/import-prospects/preview', method: HTTP_METHODS.POST },
18636
18686
  importCampaignProspects: { url: '/admin/crm/campaigns/import-prospects', method: HTTP_METHODS.POST },
18687
+ previewFestivalSubmissionImport: { url: '/admin/crm/imports/festival-submissions/preview', method: HTTP_METHODS.POST },
18688
+ importFestivalSubmissions: { url: '/admin/crm/imports/festival-submissions', method: HTTP_METHODS.POST },
18637
18689
  listEmailProviderAddresses: { url: '/admin/crm/email-provider-addresses', method: HTTP_METHODS.GET },
18638
18690
  getEmailProviderAddressOptions: { url: '/admin/crm/email-provider-addresses/options', method: HTTP_METHODS.GET },
18639
18691
  createEmailProviderAddress: { url: '/admin/crm/email-provider-addresses', method: HTTP_METHODS.POST },
@@ -18878,6 +18930,20 @@ var Crm = /** @class */ (function () {
18878
18930
  if (options === void 0) { options = {}; }
18879
18931
  return Requests.processRoute(CrmRoute.routes.importCampaignProspects, __assign({ prospects: prospects }, options));
18880
18932
  };
18933
+ /**
18934
+ * Preview uploaded festival submission sheets without writing External Game or CRM records.
18935
+ */
18936
+ Crm.previewFestivalSubmissionImport = function (files, options, onUploadProgress) {
18937
+ if (options === void 0) { options = {}; }
18938
+ return Requests.postFormData(CrmRoute.routes.previewFestivalSubmissionImport.url, Crm.festivalSubmissionFormData(files, options), undefined, onUploadProgress);
18939
+ };
18940
+ /**
18941
+ * Import uploaded festival submission sheets into External Games and CRM leads/contacts.
18942
+ */
18943
+ Crm.importFestivalSubmissions = function (files, options, onUploadProgress) {
18944
+ if (options === void 0) { options = {}; }
18945
+ return Requests.postFormData(CrmRoute.routes.importFestivalSubmissions.url, Crm.festivalSubmissionFormData(files, options), undefined, onUploadProgress);
18946
+ };
18881
18947
  /**
18882
18948
  * List provider-managed sender and reply-to addresses for CRM campaigns.
18883
18949
  */
@@ -18908,6 +18974,25 @@ var Crm = /** @class */ (function () {
18908
18974
  Crm.deactivateEmailProviderAddress = function (address_id) {
18909
18975
  return Requests.processRoute(CrmRoute.routes.deactivateEmailProviderAddress, {}, { address_id: address_id });
18910
18976
  };
18977
+ Crm.festivalSubmissionFormData = function (files, options) {
18978
+ var formData = new FormData();
18979
+ files.forEach(function (file, index) {
18980
+ var candidate = file;
18981
+ formData.append('files[]', file, (candidate === null || candidate === void 0 ? void 0 : candidate.name) || "festival-submission-".concat(index + 1));
18982
+ });
18983
+ Object.entries(options || {}).forEach(function (_a) {
18984
+ var key = _a[0], value = _a[1];
18985
+ if (value === undefined || value === null) {
18986
+ return;
18987
+ }
18988
+ if (Array.isArray(value)) {
18989
+ value.forEach(function (item) { return formData.append("".concat(key, "[]"), String(item)); });
18990
+ return;
18991
+ }
18992
+ formData.append(key, typeof value === 'boolean' ? (value ? '1' : '0') : String(value));
18993
+ });
18994
+ return formData;
18995
+ };
18911
18996
  return Crm;
18912
18997
  }());
18913
18998