glitch-javascript-sdk 2.0.4 → 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;
@@ -334,5 +334,18 @@ declare class Titles {
334
334
  * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
335
335
  */
336
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>>;
337
350
  }
338
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,7 @@ 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 },
11094
11149
  // ─────────────────────────────────────────────────────────────────
11095
11150
  // Purchase/Revenue Endpoints
11096
11151
  // ─────────────────────────────────────────────────────────────────
@@ -11573,6 +11628,22 @@ var Titles = /** @class */ (function () {
11573
11628
  Titles.itemAndPurchaseTypeStats = function (title_id, params) {
11574
11629
  return Requests.processRoute(TitlesRoute.routes.purchasesItemTypeStats, {}, { title_id: title_id }, params);
11575
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
+ };
11576
11647
  return Titles;
11577
11648
  }());
11578
11649
 
@@ -11645,6 +11716,7 @@ var CampaignsRoute = /** @class */ (function () {
11645
11716
  getSourcedCreators: { url: '/campaigns/{campaign_id}/sourcing/creators', method: HTTP_METHODS.GET },
11646
11717
  getSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.GET },
11647
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 },
11648
11720
  };
11649
11721
  return CampaignsRoute;
11650
11722
  }());
@@ -12376,6 +12448,21 @@ var Campaigns = /** @class */ (function () {
12376
12448
  Campaigns.updateSourcedCreator = function (campaign_id, sourced_creator_id, data) {
12377
12449
  return Requests.processRoute(CampaignsRoute.routes.updateSourcedCreator, data, { campaign_id: campaign_id, sourced_creator_id: sourced_creator_id });
12378
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
+ };
12379
12466
  return Campaigns;
12380
12467
  }());
12381
12468
 
@@ -15382,6 +15469,7 @@ var Glitch = /** @class */ (function () {
15382
15469
  };
15383
15470
  Glitch.api = {
15384
15471
  Ads: Ads,
15472
+ AccessKeys: AccessKeys,
15385
15473
  Auth: Auth,
15386
15474
  Campaigns: Campaigns,
15387
15475
  Competitions: Competitions,